Hello everyone. I've been struggling to get the FT811 TFT driver to work with my RA6M3 card. I have successfully run this driver with register encoding on the STM32F4 board. But I'm having trouble trying to integrate it into the RA6M3 board. Frankly, renesas register coding is a bit more difficult. Can you help me with this? Below I am sharing the codes I wrote for STM32F4 and the photos of the codes I wrote for RA6M3.
Hello MKocaman,
Thanks for reaching out Renesas Engineering Community!
It is not necessary to write the functions and configure the registers. Why don't you use r_spi module and the given APIs from Renesas in order to perform a Write or a Read operation and instead of having LL_SPI_IsActiveFlag for TX and RX create a callback function where you could set a flag in order to check if data transfer was completed.
static void r_spi_callback (spi_callback_args_t * p_args) { if (SPI_EVENT_TRANSFER_COMPLETE == p_args->event) { g_transfer_complete = true; } }
Take a look please in r_spi documentation shared here:
https://renesas.github.io/fsp/group___s_p_i.html
Best Regards,
IK
Hello. IK_Renesas
Thank you for your answer. I tried the function in the related document, but even though the flag is true, it gets stuck in an infinite loop in while and does not progress. The conditions are correct but interestingly the code does not progress.
Have you tried to see what does WriteRead() API returns to you and what is the value of spi_event_t event variable in the callback function? Also have you checked that your r_spi module settings in FSP Configurator are correct for the specific screen you want to communicate with?
Thank you!
I think I solved the infinite loop problem. I solved the problem by adding a little timeout code. I can read the driver's ID. But now my code gives error "BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(0)".
Most of the times to solve this error you have to increase stack size in BSP Properties. But it is possible to happen because of a mistake in handling pointers on your code.
Could you share with me your code in order to debug it?
I'm sharing right now. IK_Renesas
RA6M3_FT811.zip
Could you please try this version of code? It seemed that the issue was not stack size. On this project I have modified spi_transmit() function. Test it and let me know.
RA6M3_FT811_edited.zip
I'm sorry for being late. I tried the code snippet you suggested, but the code gets stuck.
fsp_err_t err =FSP_SUCCESS; err = R_SPI_WriteRead(&g_spi1_ctrl, &data, &rxByte, 1, SPI_BIT_WIDTH_8_BITS);
if(err != FSP_SUCCESS) { __BKPT(0); }
__BKPT(0); the code is also crashed.
What is the return value of "R_SPI_WriteRead" ?
Yes this is happening because your SPI_Read_Write operation doesn't return FSP_SUCCESS, as my colleague told you could you please provide as the return value of this operation. Also I modified your code in this place in order to fix BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(0).