Hi
SPI und ich sind gewiss keine Freunde. Ich stelle mir momentan die
Frage, wie der Code grundsätzlich aussehen soll, wenn ich als Master
Datenpakete (z.B. uint8_t txData[] = "Alex" und uint8_t rxData[5])
sowohl Senden (MOSI) als auch Empfangen (MISO) möchte. Es wird kein
Interrupt verwendet, sondern eine Blocking Schleife. Das Datenpaket und
Paketgröße etc. sind gegeben. Es geht mir um den Ablauf, auf was man
warten muss, und was zuerst kommt. Vielen Dank.
So stelle ich es mir vor:
1 | - SPI enable
|
2 | while (index < length):
|
3 | Wait until TX buffer empty
|
4 | Send from txData[index] to TX buffer
|
5 | Wait until RX buffer full
|
6 | Read from TX buffer into rxData[index]
|
7 | index++
|
8 | - Wait until line is not busy
|
9 | - SPI disable
|
Ist dieses Vorgehen richtig oder liege ich komplett falsch?