problem in LL SPI example code
I have been testing Examples_LL code (SPI_TwoBoards_FullDuplex_DMA_Master_Init ) in STM32Cube_FW_G4_V1.4.0 package.
Here is my problem:
I modified the original code such that I only need one board.
/* Enable the SPI1 peripheral */
Activate_SPI();
/* Wait for the end of the transfer and check received data */
/* LED blinking FAST during waiting time */
//WaitAndCheckEndOfTransfer();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
LL_mDelay(1);
//while (ubTransmissionComplete != 1)
//{
//}
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_3);
/* USER CODE BEGIN 3 */
}In the while loop, I keeps calling LL_DMA_EnableChannel, expecting to see repeated transmitting SPI message.
I used PicoScope to monitor SCLK and MOSI lines signal as showed below (D3 and D4). I expected repeated signals in those two lines, which did not happen. As showed in the picture below SPI transmission only happens once.
Another weird thing is that I define uint8_t aTxBuffer[] = {0x01, 0x02, 0x03, 0x04}; so I expect SPI to transmit 4 bytes out in MOSI line. What I captured is
D3 is clock and D4 is MOSI. Obviously, the signals are far off from what is expected.
In fact, I did something similar with Nucleo-F411RE and example code SPI_TwoBoards_FullDuplex_DMA in package STM32Cube_FW_F4_V1.26.0, for which there is no problem. The only difference I notice is the function call to transmit SPI data: in F4 package it is called LL_DMA_EnableStream, while in G4 LL_DMA_EnableChannel.
I cannot find LL_DMA_EnableStream in STM32G4 HAL and low-layer drivers manual. BTW, the function descriptions in both HAL and low-layer driver manuals are sometimes too simple to be helpful.
