-
Notifications
You must be signed in to change notification settings - Fork 1
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
#83 - ADS131M04 Driver #108
Conversation
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.
Looks solid but you should prob add the actual code that does stuff lol
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.
Ngl i'm a lil confused about how a dev might interact with this API. An ideal driver willmake it so that the user doesn't have to read the data sheet at all for how data is formatted in the registers and such. Also the SPI transactions are a bit off, check comment
general/src/ADS131M04.c
Outdated
void ads131m04_send_command(ads131_t *adc, uint16_t cmd) | ||
{ | ||
HAL_GPIO_WritePin(adc->gpio, adc->cs_pin, GPIO_PIN_RESET); | ||
HAL_SPI_Transmit(adc->spi, cmd, 1, HAL_MAX_DELAY); |
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.
So usually you gotta write the register and value in 1 set of transactions (i.e. set pin low, write spi, write spi, ... set pin high)
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.
Made some changes but looks god to me rn, we'll validate it when HV proteus board is assembled
Changes
The basic interface for the driver, setting up some basic SPI, and initializing the ADC into continuous-conversion mode using the RESET command. Mainly trying to figure out whether I need to configure anything to get good readings from the ADC and the best way to read out the values generated by the ADC
Notes
data-ready interrupt signal, DRDY
The end of tPOR is indicated by a transition of DRDY from low to high. The transition of DRDY from low to
high also indicates the SPI interface is ready to accept commands.
Connect the DRDY pin to a digital input on the host to trigger periodic data retrieval in conversion mode.
The conversion status of all channels is available as the DRDY[3:0] bits in the
STATUS register. The STATUS register content is automatically output as the response to the NULL command.
SPI: The device defaults to a 24-bit word size.
Either strobe the SYNC/RESET pin to re-synchronize conversions and clear the
FIFOs, or quickly read two data packets when data are read for the first time or after a gap in reading data.
This process ensures predictable DRDY pin behavior.
Notes for self from data sheet:
Might be important:
Todo
Checklist
It can be helpful to check the
Checks
andFiles changed
tabs.Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
Closes #83