NUCLEO-L476RG: Write ADC values into SD_CARD using SPI
- July 16, 2020
- 16 replies
- 3581 views
Good Morning.
For my thesis work, I have to develop a sensor for seismocardiography based on sensortile.
Being unfamiliar with microcontrollers, I'm running some tests using an L476RG nucleo board.
I created a project that foresees continuous analog-digital conversion; I can save the data thus obtained in a circular buffer using dma but I cannot save the data obtained on sd.
When the HAL_ADC_ConvHalfCpltCallback interrupt occurs, I send the data contained in the first half of the buffer containing the readings of the adc to an auxiliary buffer using dma. At this point, when the memory to memory transfer is complete, I need a for loop to convert the data contained in the "TxBuffer" buffer into a string and concatenate these strings to create a single string to be saved on the SD (to reduce the time of writing).
The same should happen when the HAL_ADC_ConvCpltCallback interrupt occurs so that no reading of the ADC is lost.
However, a hard fault occurs when the first for loop is executed.
Where am I wrong?
Sorry for the banality of the question but, as mentioned, it is the first time that I work on microcontrollers
