Skip to main content
SSmit.0
Associate III
Oct 30, 2018 6:41 PM UTC
Question

HAL_SPI_Transmit uint16_t size limit

Hello,

I would like to send a uint32_t size array via HAL_SPI_Transmit / HAL_SPI_Transmit_DMA but both are limited to 16 bit size.

I have tried casting as

HAL_SPI_Transmit(&hspi1,Array,(uint16_t)65537),10000)

but this doesn't work.

I have also tried editing the SPI driver and changing TxXferSize and TxXferCount to uint32_t but this only seems to get rid of the compiler warning and still overflows somewhere, i.e only 1 byte from the array is sent.

Please could anyone advise what else I need to change?

Thanks

    This topic has been closed for replies.

    13 replies

    SSmit.0
    SSmit.0Author
    Associate III
    Nov 8, 2018 11:23 AM UTC
    If 16-bit SPI
     
    HAL_SPI_Transmit(&hspi1,(uint16_t*)&Array[0], 38400,10000);
    HAL_SPI_Transmit(&hspi1,(uint16_t*)&Array[38400], 38400 ,10000);

    This did the trick, many thanks. I didn't realise the array position could act as an offset, I thought those lines would just send element [0] and [38400], 38400 times.

    Thanks