matthijskooijman / arduino-lmic

:warning: This library is deprecated, see the README for alternatives.
705 stars 651 forks source link

Issues with changed pinout #230

Closed sribence closed 4 years ago

sribence commented 5 years ago

Hi, we have designed a LoRa board, which contains an ESP32 and an RFM95W. The problem is, that our pinout is different compared to the board we used before (Heltec).

This is the changed pinout we are using.

#define SS 16 // ESP32 GPIO18 (Pin18) – SX1276 NSS (Pin19) SPI Chip Select Input
#define MOSI 13 // ESP32 GPIO27 (Pin27) – SX1276 MOSI (Pin18) SPI Data Input
#define MISO 12 // ESP32 GPIO19 (Pin19) – SX1276 MISO (Pin17) SPI Data Output
#define SCK 14 // ESP32 GPIO5 (Pin5) – SX1276 SCK (Pin16) SPI Clock Input
#define RST 27 // ESP32 GPIO14 (Pin14) – SX1276 NRESET (Pin7) Reset Trigger Input
#define DIO0 26 // ESP32 GPIO26 (Pin15) – SX1276 DIO0 (Pin8) used by LMIC for IRQ RX_Done & TX_Done
#define DIO1 33 // ESP32 GPIO33 (Pin13) – SX1276 DIO1 (Pin9) used by LMIC for IRQ RX_Timeout
#define DIO2 32 // ESP32 GPIO32 (Pin12) – SX1276 DIO2 (Pin10) not used by LMIC
#define Vext 21

const lmic_pinmap lmic_pins = {
  .nss = SS,
  .rxtx = LMIC_UNUSED_PIN,
  .rst = RST,
  .dio = {DIO0, DIO1, DIO2},
};

But when we load this code on the device, it stops immediately with a Failure message.

Mac: 84:0D:8E:16:8D:E4
FAILURE 
C:\Users\Lab\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53

(This is the full response.)

It's clear, that the problem is new the pinout, but I'm not sure, that:

Thank you for your help.

trlafleur commented 5 years ago

You may have pin 12 and 13 swapped.....

~~ /) ~~~~ /) ~~ _/) ~~ _/) ~~

Tom Lafleur

On Thu, Jun 13, 2019 at 6:44 AM sribence notifications@github.com wrote:

Hi, we have designed a LoRa board, which contains an ESP32 and an RFM95W. The problem is, that our pinout is different compared to the board we used before (Heltec).

This is the changed pinout we are using. `// Pin mapping

define SS 16 // ESP32 GPIO18 (Pin18) – SX1276 NSS (Pin19) SPI Chip Select

Input

define MOSI 13 // ESP32 GPIO27 (Pin27) – SX1276 MOSI (Pin18) SPI Data

Input

define MISO 12 // ESP32 GPIO19 (Pin19) – SX1276 MISO (Pin17) SPI Data

Output

define SCK 14 // ESP32 GPIO5 (Pin5) – SX1276 SCK (Pin16) SPI Clock Input

define RST 27 // ESP32 GPIO14 (Pin14) – SX1276 NRESET (Pin7) Reset

Trigger Input

define DIO0 26 // ESP32 GPIO26 (Pin15) – SX1276 DIO0 (Pin8) used by LMIC

for IRQ RX_Done & TX_Done

define DIO1 33 // ESP32 GPIO33 (Pin13) – SX1276 DIO1 (Pin9) used by LMIC

for IRQ RX_Timeout

define DIO2 32 // ESP32 GPIO32 (Pin12) – SX1276 DIO2 (Pin10) not used by

LMIC

define Vext 21

const lmic_pinmap lmic_pins = { .nss = SS, .rxtx = LMIC_UNUSED_PIN, .rst = RST, .dio = {DIO0, DIO1, DIO2}, };`

But when we load this code on the device, it stops immediately with a Failure message. Starting Mac: 84:0D:8E:16:8D:E4 FAILURE C:\Users\Lab\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53 (This is the full response.)

It's clear, that the problem is new the pinout, but I'm not sure, that:

  • the LMIC didn't get the correct pin reference numbers
  • LMIC can't communicate with the RFM95W module, because of some hardware issue (eg. ESP32 does not support such modes on these pinouts)

Thank you for your help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matthijskooijman/arduino-lmic/issues/230?email_source=notifications&email_token=ABC4EK6GL2KCLHTXXAX7GSLP2JFNHA5CNFSM4HXZYBC2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GZKGWTA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABC4EK4VJKJGV4YXQ7BPIUDP2JFNHANCNFSM4HXZYBCQ .

Akskaypohankar commented 4 years ago

hi i am faceing same problem have you found solution yet?

kevin192291 commented 4 years ago

For some reason I am forced to use GPIO15 on the ESP32. If I don't, I get the same error you are getting. It sucks because it eats up another SPI SS pin that I would have much rather used for an SD card.

matthijskooijman commented 4 years ago

Sounds like there might be some ESP-specific limitations on which pins can be used for what.

Also, it seems you're using https://github.com/mcci-catena/arduino-lmic rather than this version of LMIC, so I suggest you look for support there (that fork is better maintained anyway). So I'm going to close this (but feel free to continue discussion here).