Data acquisition and storage over Analog Digital Converter and XMC4500 Relax kit

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16717
Level 1
Level 1
Dear Infineon community,

I just started working with an Infineon controller and, since I am just a beginner, it is taking me very long time to achieve my task. Therefore, I kindly ask you for a little help.
I want my XMC4500 Relax Kit to read out data from an external Analog Digital Converter (ADC) with a defined sample rate and save it to an Micro SD. I am trying to use the SPI interface to communicate with the ADC. In the following you can find the code I wrote and some details about the hardware and the task.

Details Analog Digital converter:
Model: ADS8684
Channels: 4
Datasheet: http://www.ti.com/lit/ds/symlink/ads8684.pdf

DetailsTask:
Sample rate: 10 kHz
Signals to be measured: 3
ADC Device operation mode: MAN_Ch_n (maybe not the appropriate one, see page 47 Datasheet)

Please help me, i am on the verge of a crisis. Hoping hearing from you soon,

As


Code:

#include //Declarations from DAVE Code Generation (includes SFR declaration)



int main(void)
{
DAVE_STATUS_t status;

// bool Test = 0;
uint16_t MAN_Ch_0 = 1100000000000000;
uint16_t MAN_Ch_1 = 1100010000000000;
uint16_t MAN_Ch_2 = 1100100000000000;
uint8_t ReadData[512];


FATFS fs;
FIL fil;
FRESULT res;
UINT bw;






status = DAVE_Init(); /* Initialization of DAVE APPs */

if(status != DAVE_STATUS_SUCCESS)
{



XMC_DEBUG("DAVE APPs initialization failed\n");

while(1U)
{

}
}


SPI_MASTER_Transmit(&SPI_MASTER_0, &MAN_Ch_0, sizeof(MAN_Ch_0));
SPI_MASTER_Transmit(&SPI_MASTER_0, &MAN_Ch_1, sizeof(MAN_Ch_1));
SPI_MASTER_Transmit(&SPI_MASTER_0, &MAN_Ch_2, sizeof(MAN_Ch_2));


SPI_MASTER_EnableSlaveSelectSignal(&SPI_MASTER_0, SPI_MASTER_SS_SIGNAL_1);
SPI_MASTER_ClearFlag(&SPI_MASTER_0, (uint32_t)XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION);
SPI_MASTER_Receive(&SPI_MASTER_0, ReadData, 512U); //Receives 10 bytes of data from slave

res = f_write(&fil, &ReadData, 512, &bw);
while(1U)
{

}
}


Apps:
3504.attach
0 Likes
0 Replies