sandeepmistry / arduino-LoRa

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

Feature Request LoraVisionShield #441

Closed hpssjellis closed 3 years ago

hpssjellis commented 3 years ago

Could the definitions for the Lora Vision Shield that connects to the Arduino Portenta be added to the LoRa.h file.

The following is already there

#if defined(ARDUINO_SAMD_MKRWAN1300)
#define LORA_DEFAULT_SPI           SPI1
#define LORA_DEFAULT_SPI_FREQUENCY 200000
#define LORA_DEFAULT_SS_PIN        LORA_IRQ_DUMB
#define LORA_DEFAULT_RESET_PIN     -1
#define LORA_DEFAULT_DIO0_PIN      -1

Curious about the SPI frequency should it be the same.

Also here is the pins info for the PortentaH7

#define SerialLoRa      Serial3
#define LORA_BOOT0      (PG_7)
#define LORA_RESET      (PC_7)
#define LORA_IRQ_DUMB   (PJ_11)
IoTThinks commented 3 years ago

Can just use this instead? https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md#set-pins

LoRa.setPins(ss, reset, dio0);

hpssjellis commented 3 years ago

@IoTThinks I have been messing around with that. I think since the Portenta uses Serial3 that the commands

LoRa.setSPI(spi);

LoRa.setSPIFrequency(frequency);

need to be working, but they don't for me and I can't even see the code for those functions in either the .h or .cpp file. I think they don't work anymore. Another weird issue is I can't even get the LoraVisionShields working on TTN, so either I am doing something wrong (most likely) or my vision shields have issues (not likely). I know people have tested the Vision Shields in Europe, but have not heard from anyone in North America yet.

Thanks for the suggestion?

IoTThinks commented 3 years ago

This library is for SPI LoRa. Serial3 is not relevant here.

It is LoRa library. For TTN, you need LoRaWAN library.

hpssjellis commented 3 years ago

@IoTThinks Thank you so much, that makes so much sense. I will try again and see if I can get it working as if it is the same as the MKRWAN boards.

hpssjellis commented 3 years ago

Back to the lab again. Things still are not working for the Portenta LoRa Vision Shield. Any suggestions would be appreciated. I would really like to get this Library working on the shields.

IoTThinks commented 3 years ago

I believe this board has its own MCU with LoRa firmware. The SPI interface of LoRa (MISO, MOSI, SS, SCK...) is not exposed. Hence, you can not use this library. You must use the UART interface provided with the board. Check the documentation of the board.

https://content.arduino.cc/assets/SL-ASX00026.PDF

image

hpssjellis commented 3 years ago

@IoTThinks Thank you, nice to finally understand why it isn't working. I was really hoping to get point-to-point LoRa working on these shields. I am looking into mbed versions, do you have a suggestions?

IoTThinks commented 3 years ago

You have two choices:

  1. Simple: To use UART LoRa and use the vendor's API. E.g UART E32 LoRa.
  2. Flexible: To use this library and choose SPI LoRa. E.g HopeRF RFM85/96 or Ai-Thinker Ra01, 02...
hpssjellis commented 3 years ago

I posted a similar issue on the MKRWAN library github

That library has code from this library but it does not work.

@IoTThinks I am trying to understand your 2 solutions. The Portenta has a possible 160 pins so accessing anything low level is a bit confusing at the moment.