Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

[TinyLora] How to change pin configuration
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

[TinyLora] How to change pin configuration

by pierrot10 on Sat Apr 18, 2020 3:06 am

Hello everybody,
I hope all of you are fine.

I setup a Reaspberry Zero W with TinyLora following that procedure
https://learn.adafruit.com/lora-and-lorawan-radio-for-raspberry-pi/usage

It states this pin configuration
RFM G0 to Raspberry Pi GPIO #5
RFM RST to Raspberry Pi GPIO #25
RFM CLK to Raspberry Pi SCK
RFM MISO to Raspberry Pi MISO
RFM MOSI to Raspberry Pi MOSI
RFM CS to Raspberry Pi CE1

However, my LoRaWAN HAT has different pinout as the following

RFM G0 to Raspberry Pi GPIO #25
RFM RST to Raspberry Pi GPIO #5
RFM CLK to Raspberry Pi SCK
RFM MISO to Raspberry Pi MISO
RFM MOSI to Raspberry Pi MOSI
RFM CS to Raspberry Pi CE0

Then I modified the pin configuration in the radio_lorawan.py and I always get this error
[sudo] Mot de passe de pierrot : 
Traceback (most recent call last):
File "aqi.py", line 61, in <module>
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
File "/usr/local/lib/python3.7/dist-packages/adafruit_tinylora/adafruit_tinylora.py", line 161, in __init__
raise TypeError("Can not detect LoRa Module. Please check wiring!")
TypeError: Can not detect LoRa Module. Please check wiring!


I really spend a lot lot of time understanding why.
I was a bit suprised because I could make it working with a previous Rasbian version

Next I try with this https://www.adafruit.com/product/3073, but it was not working has well until I connected exactely as it written in the tuto, as the following
RFM G0 to Raspberry Pi GPIO #5
RFM RST to Raspberry Pi GPIO #25
RFM CLK to Raspberry Pi SCK
RFM MISO to Raspberry Pi MISO
RFM MOSI to Raspberry Pi MOSI
RFM CS to Raspberry Pi CE1

Since it works.

I conclued the above pin connection is mendatory, isn't?
As I would like to keep my HAT, I wonder if I can do something to use this pin configuration

RFM G0 to Raspberry Pi GPIO #25
RFM RST to Raspberry Pi GPIO #5
RFM CLK to Raspberry Pi SCK
RFM MISO to Raspberry Pi MISO
RFM MOSI to Raspberry Pi MOSI
RFM CS to Raspberry Pi CE0

Any idea?
Many thanks and enjoy your week-end

pierrot10
 
Posts: 304
Joined: Tue Nov 17, 2015 4:34 pm

Re: [TinyLora] How to change pin configuration

by jerryn on Sat Apr 18, 2020 6:25 am

See the warnings about the CS pin on this page of the "Blinka" guide https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/spi-sensors-devices
I think you cannot use CE0 as the CS pin. The RST and G0 pins probably don't matter. You can use any other GPIO pin as CS as well just not CE0 so if you need CE1 for something else you can move it.

I know it also says not to use CE1, but it does work... I wish it were clearer as to why ;-)

Edited to add: can you post a link to the LoraWAN Hat you are using? there may be other issues with it.
Just to be clear, I don't represent Adafruit. I have used several RFM9x boards with Raspberry Pis with CS on either CE1 or another GPIO pin. (for example I used GPIO23 at one time)

jerryn
 
Posts: 1251
Joined: Sat Sep 14, 2013 9:05 am

Re: [TinyLora] How to change pin configuration

by pierrot10 on Sat Apr 18, 2020 11:51 am

Dear Jerrin

Thank y lot for your answer.
I am using that HAT https://www.tindie.com/products/electro ... ct-reviews but I do not recommand it. I really spent a lot of time and the documentation is not really clear.
I removed the HAT and I am using Adafruit product, and it work
I will finally do my own HAT PCB and adapt it with my needs.

pierrot10
 
Posts: 304
Joined: Tue Nov 17, 2015 4:34 pm

Please be positive and constructive with your questions and comments.