sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.6k stars 621 forks source link

SAMD - Seeedstudio XIAO SPI issue #633

Open i-g-g-y opened 1 year ago

i-g-g-y commented 1 year ago

Hello,

was this tested with SAMD device?

I am seeing extra two clocks on SPI bus?

image

i-g-g-y commented 1 year ago

I have been screwing around the SPI and decided to do my own code for RFM95 version check. When I move the slave select pin code after SPI.begin(), correct data is sent and RFM95 responds with 0x12. Two pulses are still there, but are now not part of comm.

image

After that, normal LoRa.cpp code begins, but this time only 1 error pulse: image

As the loop for init is repeated two error pulses for every transaction: image

` SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV8); pinMode(NSS_RFM95, OUTPUT); digitalWrite(NSS_RFM95, LOW); SPI.transfer(0x42); SPI.transfer(0x00); SPI.end(); pinMode(NSS_RFM95, OUTPUT); digitalWrite(NSS_RFM95, HIGH);

LoRa.setSPIFrequency(400000); LoRa.setPins(ss, rst, -1);

//replace the LoRa.begin(---E-) argument with your location's frequency //433E6 for Asia //866E6 for Europe //915E6 for North America while (!LoRa.begin(866E6)) {

Serial.print("*");
manualRESET();
delay(100);

}

`

i-g-g-y commented 1 year ago

I have modified the library to add nCS after SPI.begin, it works, but does not send packet out of RFM95. So I config correctly, I sent packet correctly, but it never leaves my transciever. What could be wrong?

` uint8_t LoRaClass::singleTransfer(uint8_t address, uint8_t value) { uint8_t response;

//digitalWrite(_ss, LOW);

_spi->beginTransaction(_spiSettings);

digitalWrite(_ss, LOW);

_spi->transfer(address); response = _spi->transfer(value); _spi->endTransaction();

digitalWrite(_ss, HIGH);

return response; } `

image