Closed gjt211 closed 3 years ago
You should try the default examples first.
@IoTThinks, yes I did thanks, they don't work either.
It turns out (after spending a lot of time studying how this library works and looking at many ofl the changes over time) that there is an issue with the MKNBR boards that I have worked out also seems to affect the MKRZero as well. I have modified the library and have fixed the problem.
@gjt211 How did you fix the lirary for your board? Thanks.
Hi @IoTThinks
My version of the library has a few small changes to suit our hardware, but basically the following is the library changes I made. Yes it is a hack, but that's what I found and it works. Weird thing is, I have a product from about a year ago that has been working. It is possible that some MKRZero core changes may have introduced the issue I guess.
in LoRa.h I have added (for our hardware - we use SPI1, not SPI)
#elif defined(ARDUINO_SAMD_MKRZERO)
#define LORA_DEFAULT_SPI SPI1
#define LORA_DEFAULT_SPI_FREQUENCY 200000
#define LORA_DEFAULT_SS_PIN 7
#define LORA_DEFAULT_RESET_PIN 6
#define LORA_DEFAULT_DIO0_PIN 10
And in two places in LoRa.cpp int LoRaClass::endPacket(bool async) after
// clear IRQ's
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);
I added
#ifdef ARDUINO_SAMD_MKRZERO
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);
#endif
and in int LoRaClass::parsePacket(int size) after
// clear IRQ's
writeRegister(REG_IRQ_FLAGS, irqFlags);
I added
#ifdef ARDUINO_SAMD_MKRZERO
writeRegister(REG_IRQ_FLAGS, irqFlags);
#endif
Thanks a lot. (y)
Board: MKRZero LoRa Module: NiceRF SX1276-915Mhz
I have a custom board and have the following code that works except that is shows the same packet twice. I have reduced the code to the bare minimum needed for a test.
And here is some data that is being received, it clearly shows the same data packet twice. I have now tried for quite some time to identify the cause of the problem but am stuck.
Example output in Arduino serial monitor.
Does anyone have any suggestions about how to identify or fix this problem? Thanks