user2144480
user2144480

Reputation: 1097

Data with stm32 dma SPI does not flush?

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 >> 8) & 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));


I see there is no data flush needed but not sure if I need to do something to refresh the data.

Upvotes: 0

Views: 259

Answers (1)

user2144480
user2144480

Reputation: 1097

using D! for memory location fixed it.

Upvotes: 0

Related Questions