2024-11-26 02:50 AM
Hallo to everybody.
Still working on SPI&Display adapting a code for M4 (see Different data after the 1st transfer using SPI via DMA ).
I need to write only one byte at a time due to control pins of display.
Starting from a NUCLEO-H563ZI and LL example "SPI_OneBoard_HalfDuplex_IT_Init" (it work!) I'trying to do it without interrupt. So, the code is like this:
LL_SPI_SetFIFOThreshold(SPI1, LL_SPI_FIFO_TH_01DATA);
LL_SPI_SetFIFOThreshold(SPI2, LL_SPI_FIFO_TH_01DATA);
LL_SPI_Enable(SPI1);LL_SPI_Enable(SPI2);
while(!LL_SPI_IsActiveFlag_TXP(SPI1)) {}
LL_SPI_TransmitData8 (SPI1, 0x55);
LL_SPI_StartMasterTransfer(SPI1);
//(wait for RXP flag)
val = LL_SPI_ReceiveData8(SPI2); //or below
while (!LL_SPI_IsActiveFlag_TXC(SPI1)) {}
val = LL_SPI_ReceiveData8(SPI2); //other place!
Using step-by-step debugger I read 0x55 in SPI2_RXDR register, but got a 0 if I read it (removing the breackpoint and leave the program running). The RXP flag is cleared immediately after a simple __NOP() instruction and RXDR is immediately set to 0.
Again, I enabled the SPI2 RX interrupt, I reach the ISR, execute the example's routine
aRxBuffer[ubReceiveIndex++] = LL_SPI_ReceiveData8(SPI2);
but aRxBuffer[0] is = 0. (ubReceiveIndex is 1).
Can someone help me?
@MOBEJ have you some solutions?
Solved! Go to Solution.
2024-11-26 03:28 AM
Solved:
Sometime a simple"rebuild all" (cleaning the .launch file too) is enought.
Discovered using the IAR IDE instead the Cube, then test it again...
2024-11-26 03:28 AM
Solved:
Sometime a simple"rebuild all" (cleaning the .launch file too) is enought.
Discovered using the IAR IDE instead the Cube, then test it again...