drivers/sx127x, sys: configure auto_init and improve netif adaption#7356
drivers/sx127x, sys: configure auto_init and improve netif adaption#7356aabadie wants to merge 5 commits intoRIOT-OS:masterfrom
Conversation
jia200x
left a comment
There was a problem hiding this comment.
I just did a quick review and added some comments. As soon as I have time I will continue with the review ;).
Cheers
| @@ -302,10 +305,10 @@ static void _event_cb(netdev_t *dev, netdev_event_t event) | |||
| case NETDEV_EVENT_RX_COMPLETE: | |||
There was a problem hiding this comment.
If a packet is received here, where is it hooked to gnrc_netdev?
There was a problem hiding this comment.
Also, one might reuse the default gnrc_netdev _event_cb and the gnrc_netdev thread since gnrc_netdev->recv is pointing to sx127x_adpt_recv. We would need to find a way to handle LoRa specific NETDEV events though...
There was a problem hiding this comment.
(we could tag the pkt->type to a LoRaWAN packet, and automatically pass the packet to application with this line ). Any comments? :)
There was a problem hiding this comment.
This application is not part of gnrc_netdev. It's just here to show how the underlying thread communicate with the driver netdev interface.
gnrc_netdev has it's own thread here and the gnrc_netdev adaption of sx127x uses this one now, via the auto_init stuff.
|
Also notice the WIP label, since the lora send/listen command doesn't work yet (help appreciated here). I wanted to propose this before being on vacations to not block other interested people. |
actually it does work ;) I could exchange packet snips between 2 boards. |
0ef04db to
a6be0f2
Compare
|
@aabadie great :). I will do some tests today. |
I'm ok with the LoRaWAN packet type but I'm not sure with application. Do you mean application layer ? |
There's still an issue when changing channel, I'm investigating. Otherwise it works well when one plays with bandwidth, SF and CR. |
d61c502 to
de1bc1d
Compare
I think I fixed it: I can exchange packet after switching channels. My change is to switch to op_mode sleep before switching channel. Not sure it's the best solution. |
3a7b931 to
d6b2c9b
Compare
I will check the regs to see why this is happening. |
|
After a node receives a big payload, the Node 1: Node 2: |
|
I'm having some problems with the sx1276 driver + samr21. With the master driver, I'm randomly having this kind of issues: I'm investigating the problem |
With what payload size ? I had this at one point when working on the driver integration but thought I fixed it. |
This is not an issue but a feature ;) One cannot send packet while the radio is in TX state. This is because with big payload and SF 12 the transmission can take several seconds. So there's a check on the device state. If it's TX, the transmission is skipped with the message: Maybe we can bufferize this but this is not the case now. |
| @@ -0,0 +1,101 @@ | |||
| /* | |||
There was a problem hiding this comment.
I don't get this. It's done the same way in a lot of other places.
There was a problem hiding this comment.
I was referring to #7356 (comment) here (to make this gnrc_netdev_lora.c instead)
sys/shell/commands/sc_sx127x.c
Outdated
| @@ -0,0 +1,586 @@ | |||
| /* | |||
There was a problem hiding this comment.
Why not extend sc_netif.c instead?
There was a problem hiding this comment.
I tried but it was becoming a mess with other #ifdef in this file. I thought splitting the 2 would make the code more readable. Maybe we can factorize the interface list and config commands.
There was a problem hiding this comment.
#7370 will cause a vast simplification of sc_netif.c anyway. Let's see if we can fix it then.
There was a problem hiding this comment.
out of topic: do you know a way to access the device handler (pointer to netdev_t or sx127x_t) from sc_sx127x.c or other shell commands ? I wanted to provide more CLI features such as access time on air of a packet or device internal temperature which require direct access to driver API whereas I only have access to thread pid there.
f709380 to
258abc6
Compare
Not sure if solved, but you can use gnrc_netapi_get for this purpose (and declare new NETOPTs if needed). |
| @@ -0,0 +1,42 @@ | |||
| /* | |||
There was a problem hiding this comment.
Please call this file sys/include/net/gnrc/netdev/lora.h to be more in line with gnrc/netdev/ieee802154.h and gnrc/netdev/eth.h. xbee_adpt.h is a special case, since it is IEEE 802.15.4 but uses its own communication protocol to interact with the device.
dd59b95 to
6cbdb58
Compare
6cbdb58 to
b4fc07a
Compare
b4fc07a to
dfa160f
Compare
dfa160f to
3ddb076
Compare
3ddb076 to
5d1cb08
Compare
5d1cb08 to
a956365
Compare
a956365 to
236b2d7
Compare
Another step toward better integration of LoRa into RIOT.
This PR provides adaption of Semtech SX1272/76 devices to
gnrc_netdev, and gives the possibility to auto-initialize them and use shell commands (e.g ifconfig).With this PR, the code should be ready to be used with LoRaWAN stacks (I guess).
There are obviously things that I made wrong because of my poor knowledge of the way gnrc and netapi works, so comments are welcome (especially the way packet snips are handled).
There are 2 shell commands provided when
netdev_defaultandsx127xmodules are loaded:Examples:
The
ifconfigcommand here is a pale adaption of the initialifconfigcommand. I think there's room for improvement (and factorization), but since the_sc_netif.cis already huge, I didn't want to put more mess on it.I applied the auto configuration for the b-l072z-lrwan1 board: this way, the
examples/defaultcan be used to interact with the radio on it without having to tweak anything.