jgromes / RadioLib

Universal wireless communication library for embedded devices
https://jgromes.github.io/RadioLib/
MIT License
1.47k stars 369 forks source link

LLCC68 Doesn't work #331

Closed RJSDevel closed 3 years ago

RJSDevel commented 3 years ago

I have connected LLCC68(Ra-01sc) module to Arduino UNO, but I have got different errors from SPI

  1. Initializing ... failed, code -707 - if I set BUSY pin
  2. [SX1262] Scanning channel for LoRa transmission ... failed, code -20 - if I remove BUSY in constuctor I modify emaple from master for SX1262 to: LLCC68 radio = new Module(10, 2, 3, 9);

The first 2 module wans't connected thought level-shift, and I thought that I had broken them, but I bought new modules and level-shift YF08E, but I had got the same errors.

I don't know what to do, I did all what I knew

The changes for example RadioLib SX126x Channel Activity Detection Example: // SX1262 has the following connections: // NSS pin: 10 // DIO1 pin: 2 // NRST pin: 3 // BUSY pin: 9 LLCC68 radio = new Module(10, 2, 3, 9);

photo_2021-07-20_11-30-26

Additional info (please complete):

RJSDevel commented 3 years ago

Add log to begin()

int state = radio.begin(); if (state == ERR_NONE) { Serial.println(F("success!")); } else { Serial.print(F("failed, code ")); Serial.println(state); while (true); }

[SX1262] Initializing ... reset 16:37:21.606 -> 0 16:37:21.606 -> standby 16:37:21.606 -> 0 16:37:21.606 -> config 16:37:21.606 -> 0 16:37:21.606 -> setTCXO 16:37:21.653 -> 0 16:37:21.653 -> setSpreadingFactor 16:37:21.653 -> 0 16:37:21.653 -> setBandwidth 16:37:21.700 -> 0 16:37:21.700 -> setCodingRate 16:37:21.700 -> 0 16:37:21.747 -> setSyncWord 16:37:21.747 -> 0 16:37:21.747 -> setPreambleLength 16:37:21.747 -> 0 16:37:21.747 -> setCurrentLimit 16:37:21.747 -> 0 16:37:21.747 -> setDio2AsRfSwitch 16:37:21.795 -> 0 16:37:21.795 -> setRegulatorDCDC 16:37:21.842 -> 0 16:37:21.842 -> failed, code -707

jgromes commented 3 years ago

Depending on the position on the logging prints, it could be that the error is returned from setRegulatorDCDC. If the module is not using a DC/DC converter, but an LDO, that would explain the error. Try to call begin() with useRegulatorLDO set to false (default is true).

EDIT: Also, in reference to your first message, BUSY pin is not optional and must be connected.

RJSDevel commented 3 years ago

16:37:21.795 -> setRegulatorDCDC 16:37:21.842 -> 0 <-- Result of setRegulatorDCDC

RJSDevel commented 3 years ago

setRegulatorLDO image

[SX1262] Initializing ... reset 20:37:21.889 -> 0 20:37:21.889 -> standby 20:37:21.889 -> 0 20:37:21.889 -> config 20:37:21.889 -> 0 20:37:21.889 -> setTCXO 20:37:21.936 -> 0 20:37:21.936 -> setSpreadingFactor 20:37:21.936 -> 0 20:37:21.936 -> setBandwidth 20:37:21.983 -> 0 20:37:21.983 -> setCodingRate 20:37:21.983 -> 0 20:37:21.983 -> setSyncWord 20:37:21.983 -> 0 20:37:21.983 -> setPreambleLength 20:37:22.030 -> 0 20:37:22.030 -> setCurrentLimit 20:37:22.030 -> 0 20:37:22.030 -> setDio2AsRfSwitch 20:37:22.076 -> 0 20:37:22.076 -> setRegulatorLDO 20:37:22.076 -> 0 20:37:22.076 -> failed, code -707 <- int state = radio.begin(434.0, 125.0, 9, 7, SX126X_SYNC_WORD_PRIVATE, 10, 8, 1.6, true);

RJSDevel commented 3 years ago

I don't know how it possible that the last method returned 0, but begin returned -707

RJSDevel commented 3 years ago

I will try to use logical analyzer analyzer to see what happend in SPI

RJSDevel commented 3 years ago

Could you say to me if answers of those functions are 0, that means SPI is ok?

jgromes commented 3 years ago

I will try to use logical analyzer analyzer to see what happend in SPI

Alternatively you could enable the built-in debug mode.

There's more than just a call to SX126x::begin(), there's also a call to SX1268::begin(), it might have failed somewhere in that.

RJSDevel commented 3 years ago

I had changed SX1262 to LLCC68

jgromes commented 3 years ago

I had changed SX1262 to LLCC68

That doesn't matter, since LLCC68 class still inherits from SX1262. So when you call radio.begin() you're actually calling SX1262::begin().

RJSDevel commented 3 years ago

You are right! image

20:58:31.398 -> setRegulatorDCDC 20:58:31.443 -> 0 20:58:31.443 -> state 20:58:31.443 -> 0 20:58:31.443 -> pre setFrequency 20:58:31.443 -> failed, code -707

RJSDevel commented 3 years ago

It overrided in SX1262 but not in LLCC68

RJSDevel commented 3 years ago

I commented it image

RJSDevel commented 3 years ago

I have found what the deal! image Replace: image setFrequency calibarations are wrong

RJSDevel commented 3 years ago

image

RJSDevel commented 3 years ago

But if send packets without interrupt appears timeout error

RJSDevel commented 3 years ago

The setFrequency wasn't the main cause, because I'v changed not right condition, and calibration values the same as SX1262

jgromes commented 3 years ago

I don't understand why you felt the need to add LLCC68::setFrequency(), both setFrequency() and begin() are inherited from SX1262 class, since I wasn't able to find any difference between SX1262 and LLCC68 in that regard.

RJSDevel commented 3 years ago

so do I, I have compared datasheets of those chips, I deleted what I changed, and clone repo again, and the chip doesn't work again! I don't know what happend, I will investigate this when I will have time

RJSDevel commented 3 years ago

I found strange in datasheet: image image

jgromes commented 3 years ago

That sort of inconsistency is fairly common in Semtech documentation, but it's not the root cause here, since we know that frequency configuration works flawlessly on all SX126x devices.

From your (fairly chaotic) posts, I can't determine whether there's an actual problem in the library at the moment, so I'm closing this issue. Feel free to open a new one once you have a reliable way to reproduce any unexpected behavior using unedited library. Also, please follow the issue template.

RJSDevel commented 3 years ago

The same https://github.com/jgromes/RadioLib/issues/89

I will make merge request, we need to modify begin, remove tcxoVoltage from it, or override begin tcxoVoltage have to be 0

RJSDevel commented 3 years ago

if tcxoVoltage != 0, then calibration is failed, I connected analyser to spi and saw answer of LLCC68, it was 0xAA, this means that was calibration error

RJSDevel commented 3 years ago

https://github.com/jgromes/RadioLib/pull/341