cancel
Showing results for 
Search instead for 
Did you mean: 

How to send only 8 bits in SPI master mode?

BMart.2
Associate II

I'm using low level commands to send SPI data to a flash part. I'm in master mode and am using the following 3 commands(just testing) and see 16 clock pulses for each of these.

WRITE_ENABLE_CMD = 0x06 and using the 8bit routine I see 0x06 sent on the upper 8 bits, 0 on the lower but still 16 clock pulses.

Using 16 bit command I see 0x06 on the upper 8 bits and 0x06 on the lower 8 bits.

Using spi.Instance->DR = 0x06 it's on the lower 8 bits and if I set it to 0x0600 it's on the upper 8 bits. My part, to send a write enable command, has to have 0x06 in 8 clocks (1 byte) and then CS needs to go high or the part will ignore the command.

LL_SPI_TransmitData8(spi.Instance,WRITE_ENABLE_CMD);

LL_SPI_TransmitData16(spi.Instance,WRITE_ENABLE_CMD);

spi.Instance->DR = WRITE_ENABLE_CMD; 

Is there any way to just send 8 bit bytes one a a time even though the DR register is 16 bits?

Thanks

2 REPLIES 2
AArt.1
Associate II

If you use a 8bit transmit data and SPI configurated to work with 8 bit data, SPI send only 8 bit

BMart.2
Associate II

Great. I set the config in init to 16 bit and forgot it. Thanks a lot.