PiInTheSky / lora-gateway

LoRa gateway to Habitat
96 stars 69 forks source link

Support for Dragino Lora/GPS Raspberry Pi HAT #31

Closed Romeo-Golf closed 7 years ago

Romeo-Golf commented 7 years ago

While it looks like there may be some wiring challenges, it would be useful to confirm if the Dragino Lora/GPS Hat will work out of the box with this project?

http://wiki.dragino.com/index.php?title=Lora/GPS_HAT

Romeo-Golf commented 7 years ago

And if it doesn't work out of the box it would be useful to document what additional wiring is required based on the current v1.3 board:

https://github.com/dragino/Lora/tree/master/Lora_GPS%20HAT/v1.3

And with any luck it might be possible to have these added to a future revision to take advantage of the convenience offered by having both GPS and Lots radios on a single HAT :)

daveake commented 7 years ago

It won't work with that, because they've made the mistake of connecting the NSS LoRa pin to a random GPIO pin instead of one of the 2 standard SPI CS pins.

On 23 December 2016 at 02:18, Romeo-Golf notifications@github.com wrote:

And if it doesn't work out of the box it would be useful to document what additional wiring is required based on the current v1.3 board:

https://github.com/dragino/Lora/tree/master/Lora_GPS%20HAT/v1.3

And with any luck it might be possible to have these added to a future revision to take advantage of the convenience offered by having both GPS and Lots radios on a single HAT :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PiInTheSky/lora-gateway/issues/31#issuecomment-268930315, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBodIVZE-q0wjrKnFkaGhvPiZfZww_rks5rKy-NgaJpZM4LUh6A .

Romeo-Golf commented 7 years ago

Dave,

Thanks KS for confirming, I did suspect that based on the GPS chip's PPS pin not being wires to any gpio pins the wiring of this hat hadn't been well thought out...

But as I needed a GPS hat and these GPS+LoRa boards were equivalent cost to GPS only I ordered one anyway :)

So looks like I will be using the Black Hat Hack3r board to test wiring the GPS PPS pin into the Pi GPIO, typically on GPIO 17:

https://shop.pimoroni.com/products/black-hat-hacker

Can you advise on the LoRa chip to gpio pin mapping this code is expecting?

Thanks

daveake commented 7 years ago

You can override the default mapping by using DIO0_0= etc. See the readme

On 24 December 2016 at 17:31, Romeo-Golf notifications@github.com wrote:

Dave,

Thanks KS for confirming, I did suspect that based on the GPS chip's PPS pin not being wires to any gpio pins the wiring of this hat hadn't been well thought out...

But as I needed a GPS hat and these GPS+LoRa boards were equivalent cost to GPS only I ordered one anyway :)

So looks like I will be using the Black Hat Hack3r board to test wiring the GPS PPS pin into the Pi GPIO, typically on GPIO 17:

https://shop.pimoroni.com/products/black-hat-hacker

Can you advise on the LoRa chip to gpio pin mapping this code is expecting?

Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiInTheSky/lora-gateway/issues/31#issuecomment-269093253, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBodPA94iEl7y5gnnLmLti-uUoxkxtxks5rLVcIgaJpZM4LUh6A .

Romeo-Golf commented 7 years ago

Ok so the DIO pins can be specified in the config, is it possible to do the same for the NSS pin to say use GPIO pin 6 / physical pin 22 rather than pins 24 and 26 listed in the Readme?

Thanks

daveake commented 7 years ago

No. The code as it stands can only use standard SPI CS pins. That's not going to change.

On 29/12/2016 01:39, Romeo-Golf wrote:

Ok so the DIO pins can be specified in the config, is it possible to do the same for the NSS pin to say use GPIO pin 6 / physical pin 22 rather than pins 24 and 26 listed in the Readme?

Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PiInTheSky/lora-gateway/issues/31#issuecomment-269568958, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBodMvtoQNZrsVACrpvK0CGKKIN8eZUks5rMw9rgaJpZM4LUh6A.

Romeo-Golf commented 7 years ago

Its a shame that the manufactures of this board didnt follow the 'standard', although to be fair there doesnt seem to be an abundance of documentation beyond this:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/

I will try physically re-mapping the pins with the hack3r board and if successful then perhaps they would consider more sensible pin mapping in the next revision.

Out of interest is ther DIO pin mapping also based on a standard or reference source?

PiInTheSky commented 7 years ago

DIOs can connected to any free I/O pin, unlike SPI pins which are fixed.

pelwell commented 7 years ago

@daveake FYI, with a suitable Device Tree overlay you can ask the SPI driver to use any random GPIOs as chip selects.

daveake commented 7 years ago

Cheers, didn't know that. I'll add some notes to the readme.

On 16 January 2017 at 13:08, Phil Elwell notifications@github.com wrote:

@daveake https://github.com/daveake FYI, with a suitable Device Tree overlay you can ask the SPI driver to use any random GPIOs as chip selects.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiInTheSky/lora-gateway/issues/31#issuecomment-272857844, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBodO0EZb4Aa7hbMFvRG1nfm869aDgGks5rS2u8gaJpZM4LUh6A .

pelwell commented 7 years ago

OK - I'd better write a suitable overlay then. I'll post it here first with instructions, then get it built into standard images.

pelwell commented 7 years ago

The new overlay is called spi0-cs:

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

    fragment@0 {
        target = <&spi0_cs_pins>;
        frag0: __overlay__ {
            brcm,pins = <8 7>;
        };
    };

    fragment@1 {
        target = <&spi0>;
        frag1: __overlay__ {
            cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
            status = "okay";
        };
    };

    __overrides__ {
        cs0_pin  = <&frag0>,"brcm,pins:0",
               <&frag1>,"cs-gpios:4";
        cs1_pin  = <&frag0>,"brcm,pins:4",
               <&frag1>,"cs-gpios:16";
    };
};

Save the above to spi0-cs-overlay.dts, and compile it using:

sudo dtc -@ -I dts -O dtb -o /boot/spi0-cs.dtbo spi0-cs-overlay.dts

Then add the following to config.txt (you can change the 12 and 13 or omit either cs?_pin):

dtoverlay=spi0-cs,cs0_pin=12,cs1_pin=13

The overlay is now in the kernel source tree, and will be included in future builds.

jorgerance commented 6 years ago

Is this already supported? Just got one of those Dragino boards and I was willing to play with some "Pi in the sky" nodes, but I can't get the tracker to work and the following message appears on screen:

Channel 0 power set to FFh
Setting SF=8
Setting Error Coding=5

gateway.txt content:

frequency_0=868.100
mode_0=0
AFC_0=Y
bandwidth_0=125K
implicit_0=0
coding_0=5
sf_0=8
lowopt_0=0
power_0=255
DIO0_0=13
DIO5_0=12
UplinkTime_0=2
UplinkCycle_0=60

config.txt:

pi@raspberrypi:/boot $ tail -1 config.txt
dtoverlay=spi0-cs,cs0_pin=12,cs1_pin=13
pi@raspberrypi:/boot $

Can anyone please advise? Is it possible to use these Dragino boards as tracking stations?

daveake commented 6 years ago

The gateway software uses standard SPI CE0/1 pins and the draguino does not. This is not going to change. It may be possible to remap those pins but this is something you would need to try.

On 11 October 2017 at 02:03, jorgerance notifications@github.com wrote:

Is this already supported? Just got one of those Dragino boards and I was willing to play with some "Pi in the sky" nodes, but I can't get the tracker to work and the following error appears on screen:

Channel 0 power set to FFh Setting SF=8 Setting Error Coding=5

Can anyone please advise? Is it possible to use these Dragino boards as tracking stations?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiInTheSky/lora-gateway/issues/31#issuecomment-335651072, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBodPeYqFvKRSQjnvGAfyehXwQHorLFks5srBP_gaJpZM4LUh6A .

2020rberry commented 6 years ago

Two questions. One, would this board work with it? And two, if yes, my board says I'm using the 915MHz range, but when I put that in as the channel it doesn't work. Any ideas?