Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with device tree overlay at86rf233 #1294

Closed
smlng opened this issue Feb 17, 2016 · 10 comments
Closed

problem with device tree overlay at86rf233 #1294

smlng opened this issue Feb 17, 2016 · 10 comments

Comments

@smlng
Copy link

smlng commented Feb 17, 2016

Hi,

I use the openlabs IEEE 802.15.4 transceiver, which actually is an Atmel at86rf233 connected via SPI. There is a device tree overlay in /boot/overlays/ and if I enable it in /boot/config.txt the kernel correctly identifies the atmel transceiver, using wpan-tools I am able to setup a 6LoWPAN device or monitor. However, all frames are somehow garbled and discarded by the network stack or kernel.

If I configure a monitoring device and use tshark or something similar on it to observer 6LoWPAN traffic between 2 other nodes. I see IEEE 802.15.4 packets but their content is garbled, i.e., src and dst addresses are incorrect and so on. However the observed 2 nodes communicated successfully, its just the monitoring node with the at82rf233 that is unable to receive correct packages. Moreover in dmesg I see lots of message like this:

[   77.614344] ieee802154: bad frame received (type = 0)
[   78.608092] ieee802154: bad frame received (type = 6)
[   79.607217] ieee802154: bad frame received (type = 0)
[   80.625539] ieee802154: bad frame received (type = 0)
[   81.617464] ieee802154: bad frame received (type = 0)
[   82.617518] ieee802154: bad frame received (type = 6)

This only happens when I use Raspbian with default Kernel and the at86rf233 overlay. A self compiled kernel using this guide does work. The major difference is, that it uses bcm2835 configs and not bcm2708 configs for Pi b or b+ and it recompiles device trees, so no overlays involved here.

Has somebody else problems with the at86rf2xy transceivers. I think something is wrong with device tree definition for bcm2708 and the params for SPI.

@pelwell
Copy link
Contributor

pelwell commented Feb 17, 2016

Can you save out the device trees from both configurations and then upload them somewhere, e.g. a gist?

Install the dtc package if you don't have it, then use dtc -I fs /proc/device-tree > name.dts.

@smlng
Copy link
Author

smlng commented Feb 17, 2016

Hi I recorded the dts as suggested for both configs see here the first one (bcm2835-rpi-b-plus) is working, it uses a self compiled kernel with modified dts file, no overlay here. The other one (bcm2708-rpi-b-plus) uses latest Raspbian image and kernel with dtoverlay for at86rf233, is not working -> content of IEEE 80215.4. frames is garbled.

@smlng
Copy link
Author

smlng commented Feb 17, 2016

oh sorry files are in reverse order, so check the names not first second ...

@pelwell
Copy link
Contributor

pelwell commented Feb 17, 2016

Hmm. There are a lot of differences between the two, but the at86rf233@0 node is the same in both. The clocks, although named differently, also seem to be the same. Somebody on the original issue (#1151) might be able to help.

@smlng
Copy link
Author

smlng commented Feb 17, 2016

Ah, thanks for the pointer, I'll try some different frequencies with the overlay. However, even if this might work, it's weird that there is no problem with high frequencies and a self compiled kernel + device tree using no overlay ... But first I've to check and verify that, I'll report soon

@smlng
Copy link
Author

smlng commented Feb 18, 2016

Hi again,

so I tested some different frequencies for SPI. I first dropped from 6MHz to 2MHz and everything worked liked charm, which was kind of relief. Afterwards I raised it to 4MHz and it didn't work as good: some frames were accepted (so a few pings went through) but for most packets the payload was mixed up again. However, with 6MHz the whole frame was a mess including src and dst address, with 4 MHz the IEEE 802.15.4. and 6LoWPAN part/headers seemed okay only the payload (ICMPv6 for pings) had incorrect checksum and was garbled.

Finally I settled for 3MHz, which allowed for stable pings over a long period, no packet loss or messed up frames any more. So I would suggest to lower SPI frequency to 3MHz in the at86rf233-overlay, at least for now. I only tested with a Pi 1 B+, but I also have some Pi 2 Bs floating around here - maybe they support higher SPI freqs. Btw. is it possible to write the overlay in such a way to support Pi 1 and 2 but with different freqs?

Cheers, and thanks for the help. IMHO this issue is resolved for the time being ...

@smlng
Copy link
Author

smlng commented Feb 18, 2016

Oh one thing, just to let you know: I also tested another transceiver namely a microship mrf24j40ma, and copied an overlay from this blog here. This transceiver works stable with SPI frequency of 5MHz, also running latest Raspbian release with kernel version 4.1.17+ and dt overlay. So maybe this is not totally SPI related but also driver dependent - but that's just guessing around, I have not enough experience with kernel device trees or the drivers of the transceivers.

@pelwell
Copy link
Contributor

pelwell commented Feb 18, 2016

You already have the ability to set the speed on a per-Pi basis using the "speed" parameter:

dtoverlay=at86rf233,speed=3000000

If you had a card that was shared between Pis then you could put multiple dtoverlay directives into [pi1] and [pi2] sections, but the existing overlay mechanism doesn't have a way to include machine-specific sections - that's an interesting idea.

SInce you are up for building your own kernel, it would be interesting to see if reverting 853eff4 helps the bcm2708 build at all.

pelwell pushed a commit that referenced this issue Feb 18, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
pelwell pushed a commit that referenced this issue Feb 18, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
pelwell pushed a commit that referenced this issue Feb 18, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
pelwell pushed a commit that referenced this issue Feb 18, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
@pelwell
Copy link
Contributor

pelwell commented Feb 19, 2016

OK to close?

@smlng
Copy link
Author

smlng commented Feb 19, 2016

Fine with me, thanks again!

@smlng smlng closed this as completed Feb 19, 2016
popcornmix pushed a commit that referenced this issue Feb 20, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Feb 26, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix added a commit to raspberrypi/firmware that referenced this issue Feb 29, 2016
See: raspberrypi/linux#1294

kernel: config: Enable HCI over UARTs

kernel: Add 1-bit SDIO with the minimum pins required for that mode: GPIOs 22-25
See: raspberrypi/linux#1301

kernel: ASoC: bcm: add missing .owner fields in sound card drivers
See: raspberrypi/linux#1300

kernel: Add overlay and enable support for QCA7000 board
See: raspberrypi/linux#1308

kernel: bcm2835-virtgpio: Virtual GPIO driver

kernel: BCM270X_DT: Add Pi3 support

firmware: arm_ldconfig: Use arm_loader API for determining clock frequencies
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Feb 29, 2016
See: raspberrypi/linux#1294

kernel: config: Enable HCI over UARTs

kernel: Add 1-bit SDIO with the minimum pins required for that mode: GPIOs 22-25
See: raspberrypi/linux#1301

kernel: ASoC: bcm: add missing .owner fields in sound card drivers
See: raspberrypi/linux#1300

kernel: Add overlay and enable support for QCA7000 board
See: raspberrypi/linux#1308

kernel: bcm2835-virtgpio: Virtual GPIO driver

kernel: BCM270X_DT: Add Pi3 support

firmware: arm_ldconfig: Use arm_loader API for determining clock frequencies
popcornmix pushed a commit that referenced this issue Mar 4, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
pelwell pushed a commit that referenced this issue Mar 7, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Mar 8, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Mar 10, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Mar 10, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Mar 14, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue Mar 16, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
giraldeau pushed a commit to giraldeau/linux that referenced this issue Apr 12, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi#1294
     raspberrypi#1151
popcornmix pushed a commit that referenced this issue Apr 13, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
popcornmix pushed a commit that referenced this issue May 31, 2016
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: #1294
     #1151
JackieLiu1 pushed a commit to JackieLiu1/kernel that referenced this issue Mar 23, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
woshihuangzhijie pushed a commit to woshihuangzhijie/linuxcode that referenced this issue Sep 20, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
amichelotti pushed a commit to amichelotti/ubuntu-vme-xenial that referenced this issue Oct 19, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
lianhaidong pushed a commit to lianhaidong/ubuntu-xenial that referenced this issue Nov 6, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 14, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 20, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 20, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
liuqun pushed a commit to liuqun/linux-raspi2 that referenced this issue Dec 20, 2017
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
polceanum pushed a commit to polceanum/ubuntu-xenial that referenced this issue Feb 6, 2018
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
APokorny pushed a commit to ubports/ubuntu_kernel_xenial that referenced this issue Oct 11, 2018
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
hisenyiu2015 pushed a commit to hisenyiu2015/msm-4.14 that referenced this issue May 20, 2021
The consensus is that 6MHz is too fast, but that 3MHz is OK.

See: raspberrypi/linux#1294
     raspberrypi/linux#1151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants