SPI APP bug on XMC4800

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

cross mob
User16843
Level 2
Level 2
First solution authored
Hi all:
I am facing the old problem of SPI APP(4.3.28) in receiving data from a ADC. The SPI app operate in full duplex mode, I used the SPI APP (SPI_MASTER_Transfer )to transfer data on the SPI bus ,
and can see the data on scope,but in DAVE receive buffer get no data .The receive index also stay zero. I find that this is an old bug of SPI APP
(https://www.infineonforums.com/threads/4257-Possible-Bug-in-SPI_MASTER-app). Have there any way to workaround this bug?
Thanks a lot.
0 Likes
1 Solution
User16843
Level 2
Level 2
First solution authored
Thanks for your answer. I bypassed this issue by read USIC2_CH1 RBUF0 directly, not an elegent way, but it is work.

View solution in original post

0 Likes
4 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Could you share the configuration of the SPI_MASTER APP?
Could you share the code where you invoke the SPI_MASTER_Transfer and you wait for the transfer to finish?

Regards,
Jesus
0 Likes
lock attach
Attachments are accessible only for community members.
User19094
Level 1
Level 1
Hi,

TIME CRITICAL PLEASE HELP!

I am seeing the same issue with SPI Master receive on XMC4800. I am using DIRECT Mode for both transmit and receive, no FIFO enabled, word length set to 8.
I see the data on the logic analyzer and all the receive data is there, but my SPI_MASTER_Receive function reads the received data intermittently and at other times reads either 0x00 or 0xFF.
I have followed various other threads on the same topic and patched bits and pieces but of no use. I need for this to work consistently.
I call a routine called Futek_Init(), right after DAVE_Init, to set custom settings on the SPI and the function definition for Futek_Init() is in futek_driver.c
Currently I am using SPI_MASTER_Receive, but I would also like to make it work with SPI_MASTER_Transfer.
I have written a function Futek_Transfer in futek_driver.c which uses SPI_MASTER_Transfer, but I have not tested it since SPI_MASTER_Receive is not working consistently. Please suggest edits to SPI_MASTER_Transfer as well.

main.c

void FutekDRDYIRQHandler(void)
{
DBG_PRINTF("DRDY Falling edge received, current state: %d\n", futek_state);
if (futek_state == 4)
futek_state = 0;
futek_state++;
}

int main(void) {

dave_status = DAVE_Init(); /* Initialization of DAVE APPs */
Futek_Init(); //defined in futek_driver.c

INTERRUPT_Enable(&INTERRUPT_1);
uint8_t send_command = 0x00;
while (1U) {

// ESC main loop
//DIGITAL_IO_SetOutputHigh(&VP_MOSI);
switch (futek_state)
{
case 1:
//DBG_PRINTF("Edge has fallen, sending command\n");
//Send command using SPI Transmit
DBG_PRINTF("sending command: 0x%02X\n", send_command);
Futek_Send_Command(send_command);
send_command++;
if (send_command == 0x0D)
send_command = 0x00;
futek_state++;
break;

case 2:
//DBG_PRINTF("Command sent\n");
//Do nothing
break;

case 3:
//DBG_PRINTF("Edge has fallen reading data\n");
//Read data using SPI Receive
Futek_Read_Response();
futek_state = 0;
break;

default:
//DBG_PRINTF("Data Read\n");
break;
}
}
0 Likes
User16843
Level 2
Level 2
First solution authored
Thanks for your answer. I bypassed this issue by read USIC2_CH1 RBUF0 directly, not an elegent way, but it is work.
0 Likes
User16843
Level 2
Level 2
First solution authored
Hi,saili_desai;
Do you called the SPI_MASTER_Receive() in your interrupt routine? Thanks & regards.
0 Likes