cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 HAL_SPI_Transmit/Receive limitation

alsaleem
Associate II
Posted on July 07, 2016 at 23:41

version F4, 1.12

I am interfacing SPI to flash.

calling HAL_SPI_Transmit or Receive alone disables SPI_DIRECTION_2LINES. I have to re-initialize it after each call.

When using HAL_SPI_TransmitReceive. I have to specify ONE SIZE for both tx&rx. Thus, I have to provide two equal tx & rx buffers (wasting memory).

Suggestion :

(1) HAL_SPI_Transmit/Receive restores original init.Direction when done. OR

(2) allow HAL_SPI_TransmitReceive to accept separate tx & rx  sizes.

Note : RXNE/TXE can be served (dummy) data to prevent error.

This scenario when sending command and receiving data.

Thanks.

#!stm32 #bug #hal
2 REPLIES 2
Posted on July 08, 2016 at 02:27

(2) allow HAL_SPI_TransmitReceive to accept separate tx & rx  sizes.

Given the symmetrical nature of the bus/transfer isn't that going to be a bit challenging? Perhaps a scatter-gather list would be more appropriate for commands vs data vs pad

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
alsaleem
Associate II
Posted on July 08, 2016 at 03:09

Yes it is symmetric. but my buffers are not.

The idea is to avoid having two equal buffers.

e.g. to read 4K bytes. I need to send only 4 bytes and receive 4K.