2022-06-06 08:06 AM
uint8_t sdadc_lld_read(SDADCDriver *sdadcp, float* converted_value) {
int16_t data;
uint8_t return_value = SDADC_DATA_NOTVALID;
/* check if valid data is available */
if (sdadcp->sdadc->SFR.B.DFEF == 0U) /* <- Check if the FIFO is not empty */
/* if (sdadcp->sdadc->SFR.B.CDVF == 1U) */ /* <- Check if data is valid */
{
/* read converted data */
data = (int16_t)((uint16_t)sdadcp->sdadc->CDR.R);
Is it right to check the DFEF (which is related with the FIFO) and not the CDVF (valid data)?
Solved! Go to Solution.
2022-06-07 06:49 AM
Hello ,
DFED in the Data Fifo Empty Flag.
This field is asserted when there is no data word in the FIFO.
0 Data FIFO is not empty.
1 Data FIFO is empty.
What is the clock of SDADC ?
for 1ms , maybe it is better to check if the data is vali or invalid.
cf chapter Sigma-Delta Analog-to-Digital Converter (SDADC) Digital Interface
Do not hesitate to add some additional checks in order to put the driver more robust.
Best regards
Erwan
2022-06-07 06:49 AM
Hello ,
DFED in the Data Fifo Empty Flag.
This field is asserted when there is no data word in the FIFO.
0 Data FIFO is not empty.
1 Data FIFO is empty.
What is the clock of SDADC ?
for 1ms , maybe it is better to check if the data is vali or invalid.
cf chapter Sigma-Delta Analog-to-Digital Converter (SDADC) Digital Interface
Do not hesitate to add some additional checks in order to put the driver more robust.
Best regards
Erwan
2022-06-07 07:25 AM
Hi Erwan, thank you for the reply.
I found in this project this solution:
Probably I'm missing something, I will check the suggested chapter - hey the link is not working (if it's a link) :)