Closed TJ178 closed 2 years ago
I noticed that the branches are mixed up here The datasheet says: Bit 2 at address 0x0736 must be set to: • “0” when using inverted IQ polarity (see the SetPacketParam(...) command) • “1” when using standard IQ polarity
@TJ178 the begin()
method arguments look fine, the only thing I am slightly unsure of is the ANT connection. The device is returning RADIOLIB_SX126X_STATUS_CMD_FAILED
, and unfortunately the datasheet doesn't go into much details about what does it mean or how to solve it.
I could disable the errata fix for non-inverted IQ, so it would be disabled by default. Again, the datasheet doesn't go into much detail about when exactly is this workaround needed, and what are the consequences.
@homewsn you're right, it seems that is indeed swapped. I'll fix that, however, I don't see how that would break this only for certain setups. Maybe @TJ178 can try it out and see if it helps or not.
Just tried out the fix, changed the function to below. Still not working but at least the status code changed to RADIOLIB_ERR_SPI_CMD_INVALID
int16_t SX126x::fixInvertedIQ(uint8_t iqConfig) {
// fixes IQ configuration for inverted IQ
// see SX1262/SX1268 datasheet, chapter 15 Known Limitations, section 15.4 for details
// read current IQ configuration
uint8_t iqConfigCurrent = 0;
int16_t state = readRegister(RADIOLIB_SX126X_REG_IQ_CONFIG, &iqConfigCurrent, 1);
RADIOLIB_ASSERT(state);
// set correct IQ configuration
if(iqConfig == RADIOLIB_SX126X_LORA_IQ_INVERTED) {
iqConfigCurrent &= 0xFB;
} else {
iqConfigCurrent |= 0x04;
}
// update with the new value
return(writeRegister(RADIOLIB_SX126X_REG_IQ_CONFIG, &iqConfigCurrent, 1));
}
Here's the last few lines of the debug again:
Symbol length: 4.10 ms
CMD 8B
DATW 9 A2 4 A1 1 45 0 45
CMD 11
DATR 0 A2 0 1
CMD D 7 40
DATW 14 45 24 45
CMD 11
DATR 0 A2 0 1
CMD 1D 7 36
DATR 0 80 0 28
CMD D 7 36
DATW 2C 89
failed, code -706
I was reading through the debug output again, and noticed something I missed on the first read:
Symbol length: 4.10 ms
CMD 8B
DATW 9 A2 4 A1 1 45 0 45
The status here changes, from 0xA2 (standby RC mode) to 0x45 (FS mode, data available to host). That's really strange, because it seems to imply the device randomly changed its operation mode. What's even more strange, 0xA2 happens to be 0x45 if you reverse the bits.
Which level shifters are you using?
They are the Sparkfun ones. I figured they wouldn't be the problem since it was communicating at all, but I wouldn't be surprised if they were the issue.
Looks like a BSS138, those are actually decent (one of the few that are actually bi-directional).
One more thought, though it's a bit far-fetched - could you try setting the last argument of the begin()
method to true?
Just tried making that last argument true, no change unfortunately.
@TJ178 I tried replicating this issue with a Dorji DRF1262G, connected to Arduino Uno via a BSS138 level shifter. Unfortunately I was not able to replicate this issue, it seems like something specific to either the shield, or your hardware setup. Beacuse of that, I will close this issue now, though feel free to reopen if you find out some new information.
Just trying to get my SX1262MB2CAS shield working w/ an Arduino Uno. One of the commands is failing during the begin command.
The only thing modified here is the
radio.begin
call, which I believe is setup correctly for my module.Hardware setup Since the Arduino UNO is 5V logic level, there are some logic level shifters in between the transmitter and MCU ANT_SW is permanently connected to 3V3. Otherwise, everything is connected to the correct pins specified in the sketch![image](https://user-images.githubusercontent.com/22756691/166336760-e421e099-db54-4073-8fac-98cd79d58f14.jpg)
Debug mode output
Additional info:
I tried to debug this a bit, looks like it's failing the IQ Polarity fix that's described in chapter 15.4 of the datasheet for the sx1262.
I'm not 100% sure of my
radio.begin
settings, so perhaps I'm doing something wrong? Any help would be appreciated.Thank you!