cancel
Showing results for 
Search instead for 
Did you mean: 

Data with stm32 dma SPI does not flush?

ulao
Associate III
 

I'm using HAL with stm32 (H735) and I use SPI5 and SPI4. Both are set up for DMA transfers. The SPI5 works fine and returns data from peripheral to ram. The data out is static, so all good. SPI 4 has changing data out but its not changing. Seems it is copied to peripheral once. I have a few functions that set the data up and what ever function is used first, is the data that is sent. I verified in the debugger that the SPI completed without errors. I tried a lot of ways to set up my data included using the LinkerScript placing it in D2.

currently I have it as such.

 

 

spi_data :
  {
   . = ALIGN(4);
   *(.dma_buffer)
  } >RAM_D2

typedef struct tagDACoutput {
    uint8_t Dac;
    uint8_t Data[2];
} DACOUTPUT;
__attribute__((__section__(".spi_data"))) static DACOUTPUT ToTheDac;

//during transfer

                ToTheDac.Dac = 0x34;
                ToTheDac.Data[0]= (dac1 >> 😎 & 0xff;
                ToTheDac.Data[1]= dac1 & 0xff;
for ( int t = 0;t < 30; t ++) asm("NOP"); //I needed to add a small wait. Like to not do this.
HAL_SPI_Transmit_DMA(&hspi4,(uint8_t*)&ToTheDac, sizeof(ToTheDac));

 

1 REPLY 1
ulao
Associate III

I had to use D!, this resolved it.