-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSDK-1008: MAX11261 Driver Implementation #416
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the initial version of MAX11261 ADC driver. Only sequencer mode 1 has been implemented. Input channel, polarity and output format can be configured. Sample rate setting has not been tested yet.
Add platform functions used by MAX11261 in board initialization file.
Conversion results are now stored in max11261_adc_result_t. There are separate fields for data overrun and analog input overrange conditions.
MAX11261 allows input to settle for a specified amount of time before starting conversion. Set DELAY register accordingly if this feature is used.
Multichannel scan in sequencer mode 2 is now supported. At the moment, conversion results are not read until all channels are converted. In register poll mode, STAT:SRDY field is polled instead of STAT:RDY which is only valid in sequencer mode 1.
General-purpose outputs can be directly controlled in sequencer modes 1 and 2 by writing into GPO_DIR:GPO[5:0].
Sequencer mode 3 is now functional with optional GPO bumps. GPOs that are mapped to channels will be activated before conversion. The delay before conversion is determined by DELAY:GPO[7:0]. Other minor changes: * Conversion delay is now calculated in delay_count(). * Fix CHAMP1_CH3_GPOEN and CHMAP0_CH0_GPOEN definitions
Read, write and update calls with error checks are wrapped in MAX11261_READ_REG, MAX11261_WRITE_REG and MAX11261_UPDATE_REG respectively.
Scanning in sequencer mode 4 with autoscan delay is now possible. Distinct values for each channel can be set for Out-Of-Range detection. Cutoff frequency and comparison mode can be set in the HPF register.
clang chech Signed-off-by: Sadik.Ozer <[email protected]>
18ac665
to
5f422bb
Compare
ozersa
reviewed
Feb 21, 2023
MXC_TMR_Start(MXC_TMR0); | ||
|
||
/* Set ADC hardware parameters */ | ||
error = max11261_adc_config_init(ADC_V_AVDD, ADC_V_REF, I2C_FREQ, ADC_SLAVE_ADDR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if you move slave_addr and freq in the board,c file.
I2C is initialized during board initialization. Add missing call to max11261_convert_prepare before entering main loop.
I will review asap. It's a more in-depth PR so it will take me a little time |
Driver does not need to know the slave address of the chip so remove it. Initialize MAX11261 only if ENABLE_MAX11261_ADC macro is explicitly defined.
ozersa
approved these changes
Feb 23, 2023
Jake-Carter
approved these changes
Feb 27, 2023
Jake-Carter
pushed a commit
that referenced
this pull request
Mar 7, 2023
…0FTHR(#416) * Add platform functions used by MAX11261 in board initialization file. * Add MAX11261 ADC example Signed-off-by: Sadik.Ozer <[email protected]> Co-authored-by: Sadik.Ozer <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial MAX11261 ADC driver support and example application.
Remaining work: