Skip to content
This repository has been archived by the owner on Dec 20, 2020. It is now read-only.

Radio module sx1276 not detected #1

Closed
ico12345 opened this issue Apr 17, 2017 · 6 comments
Closed

Radio module sx1276 not detected #1

ico12345 opened this issue Apr 17, 2017 · 6 comments
Assignees

Comments

@ico12345
Copy link

Hi,

I'm trying to use your HAL implementation for Dragino LoRa GPS HAT but the radio module was not detected.

I'm trying this on two different HAT and both are not detected with two different unknown radio module version.

# ./build/hello.out
000000000 HAL: Initializing ...
000000001 HAL: Detected unknown radio module: 0x78
000000001 HAL: Set radio RST pin to 0x00
000000001 HAL: Wait until 000000002 ms
000000003 HAL: Set radio RST pin to 0x02
000000003 HAL: Wait until 000000008 ms
000000008 HAL: Failed. Aborting.
# ./build/hello.out
000000000 HAL: Initializing ...
000000001 HAL: Detected unknown radio module: 0x5b
000000001 HAL: Set radio RST pin to 0x00
000000001 HAL: Wait until 000000002 ms
000000003 HAL: Set radio RST pin to 0x02
000000003 HAL: Wait until 000000008 ms
000000008 HAL: Failed. Aborting.

Dragino HAT works fine with other code based on radiohead RF95 libraries.

@wklenk
Copy link
Owner

wklenk commented Apr 19, 2017

Itacos wrote:

Hello,

I have made some tests and now I can get the module version (0x12 for sx1276). I use a single call to the hal_spi function but with a 16 bits buffer, write 0x42 with the first byte and get response from SPI on the second byte. Like in the single_chan_pkt_fwd code as follow :

u1_t hal_spi (u1_t out) {
unsigned char spibuf[2];

spibuf[0] = out & 0x7F;
spibuf[1] = 0x00;
u1_t rc = wiringPiSPIDataRW(0, spibuf, 2);

if (rc < 0) {
fprintf(stderr, "HAL: Cannot send data on SPI: %s\n", strerror(errno));
hal_failed();

}

return spibuf[1];

}

Why did you make two hal_spi call ?
Did the second call with hal_spi(0x00) not always return a null value ?

Unfortunately, this works for radio detection, hal_init, but failed later on radio_init, but I don't know why right now.

Regards,

Ilan

@wklenk wklenk self-assigned this Apr 19, 2017
@wklenk
Copy link
Owner

wklenk commented Apr 19, 2017

@itacos

It is strange, but your observation is telling me that it possible is an issue of how SPI is done in the LMIC and my code. I re-wrote the code to do SPI operations in one step and merged my changes into the master branch.
Would you mind to checkout the updated master branch and try again?

@ico12345
Copy link
Author

Hi @wklenk ,
Thanks for this commit.

First attempt seems to work with your SPI operations in one step.
I don't have any of my gateway around me to test but it seems better working.
I will do more tests tomorrow and give you a feedback quickly.

root@raspberrypi ~/jn/lmic-rpi-lora-gps-hat/examples/hello# ./build/hello.out
000000000 HAL: Initializing ...
000000002 HAL: Detected SX1276 radio module.
000000002 HAL: Set radio RST pin to 0x00
000000003 HAL: Wait until 000000003 ms
000000004 HAL: Set radio RST pin to 0x02
000000004 HAL: Wait until 000000009 ms
000000010 HAL: Receiving ...
000000016 Debug: Initializing
000000016 Debug: Hello World!

000000016 Debug: Label 'cnt = ' value 0x0
000001016 Debug: Hello World!

000001016 Debug: Label 'cnt = ' value 0x1
000002016 Debug: Hello World!

000002016 Debug: Label 'cnt = ' value 0x2
000003016 Debug: Hello World!

000003016 Debug: Label 'cnt = ' value 0x3
000004016 Debug: Hello World!

000004016 Debug: Label 'cnt = ' value 0x4
000005016 Debug: Hello World!

000005016 Debug: Label 'cnt = ' value 0x5
000006016 Debug: Hello World!

000006016 Debug: Label 'cnt = ' value 0x6
000007016 Debug: Hello World!

000007016 Debug: Label 'cnt = ' value 0x7
000008016 Debug: Hello World!

000008016 Debug: Label 'cnt = ' value 0x8
000009016 Debug: Hello World!

000009016 Debug: Label 'cnt = ' value 0x9
000010016 Debug: Hello World!

000010016 Debug: Label 'cnt = ' value 0xa
000011016 Debug: Hello World!

000011016 Debug: Label 'cnt = ' value 0xb

@CodeGlitcher
Copy link

Did it work?

@ico12345
Copy link
Author

Hello,

After some advanced tests, i can say that joining with OTAA and transmit data on my gateways works.

Sometimes, some segmentation faults occurred, randomly at the begin or after some minutes of execution, but I did not identified the root cause yet.

@Hacklog24
Copy link

Hacklog24 commented May 25, 2019

@wklenk @itacos
Hi,
I have your same initial problem, can you tell me how you solved it?

Thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants