0

I have heard that

  1. The SPI hardware introduces a 9th, HIGH bit between bytes
  2. USART still uses start and stop bits when in synchronous mode

Are both these statements true? Can I modify the built-in SPI library to avoid #1? Or will I have to bit-bang the protocol needed?

  • Page 217&220 of Atmel-42735B-ATmega328/P_Datasheet_Complete-11/2016 do not mention an 9th bit and to me it seems highly unlikely. Have you actually tried if it works for you? – Paul Sep 30 '18 at 7:07
  • @Paul I've tried it, but it didn't work, but it could be a problem with the actual program. Sucks that no datasheet exists for my use case – Alexander M Sep 30 '18 at 7:15
  • #2 is false. It's basically USART in SPI mode. #1 Without using clock signal, it's possible there is some pause as you can't write data in advance. – KIIV Sep 30 '18 at 7:37
  • 1
    BTW: what is the use case? Why do you even need this bitstream? – KIIV Sep 30 '18 at 7:39
  • 1
    @KIIV your question is most relevant here, because the question does not make sense. It is a typical xyproblem.info When it is for the maximum number of bytes per second, then extra bits or bytes can not be the issue. When it is for a communication protocol then there is manchester code. When a byte needs to be transferred without delay, then 8-bit parallel between two arduino boards is possible plus extra interrupt. There are many ways and many solutions if we would know the problem. – Jot Sep 30 '18 at 10:40
0

Are both these statements true?

Neither of those statements are true.

SPI never inserts extra bits. That would break everything if it did. What you are probably seeing (or think you are seeing) is a delay between bytes being sent. That delay is irrelevant, since the data is only ever sampled on an edge of the clock signal (which edge depends on the mode of the SPI communication) and with no clock edge in that delay period there is no data.

USART in synchronous mode is SPI. There are no start or stop bits in synchronous mode, since the clock is used to synchronise the communication rather than needing start or stop bits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.