cancel
Showing results for 
Search instead for 
Did you mean: 

how to transmit an array with HAL_SPI_Transmit_DMA?

Tommino
Senior

Could you please explain me how to use HAL_SPI_Transmit_DMA with an array?

In this case

uint16_t data1= 1024;

HAL_SPI_Transmit_DMA(&hspi1, &data1, 1)

I get a warning concerning the pointer ("passing argument 2 of 'HAL_SPI_Transmit_DMA' from incompatible pointer type") but at the end everything is fine, i.e. the SPI lines measured with the oscilloscopes are the ones that I expect

But if i try to transmit an array the interface seems to not work

uint16_t data={32, 4096};

HAL_SPI_Transmit_DMA(&hspi1, data, 2);

I receive no warning but the SPI does not output anything.

I am afraid I am not using the pointer to the array in the proper way...can you help me in understanding this issue?

10 REPLIES 10
Tommino
Senior

@TDK​ 

Yes that is exactly what I thought. Do you have any examples to see how to use the SPI interface and the timer to set the DMA off without using the HAL library?

Regards