7 years, 1 month ago.

Using STM32F303 in full duplex mode

The SPI write function send the data and then clocks in the response from the slave. Is there a version of the library call that writes and reads at the same time, that is a full duplex mode? I'm trying to use a VFD display and the read component causes the VFD to not function. The VFD thinks that I am trying to write another byte with zero data. Another method would be to let the user to deselect the chip select between writing and reading the bytes.

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F303K8T6 microcontroller.

Which function are you using exactly? Since the spi.write function is full duplex. It will always read and write at the same time.

posted by Erik - 12 Mar 2017

It is not full duplex. Look at the clock on an oscilloscope. First the write appears and the the read appears. In full duplex write and read occur with the same clock.

posted by Dennis Bahr 12 Mar 2017

Spi.write is indeed full duplex. Mosi will shift out a bit while Miso will shift a bit in at the same time on the same clock pulse. The difference is that the spi slave will typicaĺly use the rising edge of the clockpulse to latch the bit from the transmitting master, while the spi master uses the falling edge of the clock to save the bit received from the slave. What is the VFD device type you are trying to communicate with.

posted by Wim Huiskamp 12 Mar 2017

Only for 8 bit operation. Try 16bits. Only for 8 bit operation. Try 16 bits

posted by Dennis Bahr 13 Mar 2017

Then it is bugged. But can you show your code and what is happening on your logic analyzer/scope?

As workaround: If it does work properly for 8-bit operation, just split it in two 8-bit operations.

posted by Erik - 13 Mar 2017

Used two 8 bits packets and works correctly.

posted by Dennis Bahr 13 Mar 2017
Be the first to answer this question.