Hello everyone,
I tried to using SPI of UNO R4 WiFi.e.g.:
#include "SPI.h"
#define CS_PIN 10
#define SPI_CLOCK 100000
void send(void) {
uint8_t ret;
SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0));
digitalWrite(CS_PIN, LOW);
ret = SPI.transfer(0x78);
digitalWrite(CS_PIN, HIGH);
SPI.endTransaction();
}
void setup() {
Serial.begin(9600);
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
SPI.begin();
send();
}
void loop() {
}
The SPI is in master and mode0,here is a screencam of the oscilloscope:
C1 is SPI_CS;
C2 is SPI_CK;
C3 is SPI_DATA;
why the cs pin is polled high before the data is sent over?