RA2E1 R_SPI Issue.

Hi,

I'm trying to implement SPI communication on RA2E1 but there's a problem on the callback function of SPI.

Here's the code block that I've written.

The issue is that when R_SPI_Write() function is called, inside the r_spi_callback function, after the updation of spi_transfer_complete flag as true through the event of SPI_EVENT_TRANSFER_COMPLETE, the main program does not continue to run after R_SPI_Write() function is called although the spi_transfer_complete flag updated as true.

When I remove the line of "while(false == spi_transfer_complete) {} {}", the program continues to run after R_SPI_Write() function is called, but SPI write operation becomes unsuccesful.

The situation is that after the spi_transfer_complete flag updated as true, the program does not handle the line of  "while(false == spi_transfer_complete) {}" so that the main program can not continue to operate after the line of "while(false == spi_transfer_complete) {}"   is executed: I couldn't underrstand why  "while(false == spi_transfer_complete) {} " this line  is not handled by debugger.

I'll be appreicated if you illuminate me.

Thanks.

Parents Reply
  • Hi,

    I've solved the problem by increasing the PCLKB clock source of SPI block. When I configured the PCLKB as 1MHz, the program stucked on the  "while(false == spi_transfer_complete) {} ".Subsequently, when I configured the PCLKB as 32MHz. SPI communication has succesfully operated and the program didn't stuck on  "while(false == spi_transfer_complete) {} "line.

    Thanks.

Children