bastibl / gr-ieee802-15-4

IEEE 802.15.4 ZigBee Transceiver
https://www.wime-project.net
GNU General Public License v3.0
270 stars 87 forks source link

TypeError in preamble sfd prefixer - running on E312 hardware #40

Closed dwalexander closed 5 years ago

dwalexander commented 5 years ago

I have been running the gr-ieee802-15-4 CSS transceiver on Ettus B205-minis with great success so far, however I am now trying to use E312 radios instead. When I try to run the transceiver example file the following error occurs:

root@e312:~# python transceiver_CSS_USRP.py
Using Volk machine: neon_hardfp
sender started
Traceback (most recent call last):
  File "transceiver_CSS_USRP.py", line 315, in <module>
    main()
  File "transceiver_CSS_USRP.py", line 303, in main
    tb = top_block_cls()
  File "transceiver_CSS_USRP.py", line 186, in __init__
    time_gap_2=c.time_gap_2,
  File "/home/root/.grc_gnuradio/ieee802_15_4_css_phy.py", line 57, in __init__
    self.ieee802_15_4_preamble_sfd_prefixer_ii_0_0 = ieee802_15_4.preamble_sfd_prefixer_ii((preamble), (sfd), sym_per_frame)
  File "/usr/local/lib/python2.7/site-packages/ieee802_15_4/ieee802_15_4_swig.py", line 5451, in make
    return _ieee802_15_4_swig.preamble_sfd_prefixer_ii_make(*args, **kwargs)
TypeError: in method 'preamble_sfd_prefixer_ii_make', argument 1 of type 'std::vector< int,std::allocator< int > >'

This happens regardless of if I am attempting to use the radio hardware to transmit or just doing a loop-back test within gnuradio itself. I have tried a few things to fix the problem but I have no idea where to start as this issue is very specific to running the code on the E312 hardware - it works fine on my computer. Any guidance here would be much appreciated.

bastibl commented 5 years ago

Hmm, unfortunately, I don't have an ARM setup. And I don't have a really good idea.

You could try setting the Preamble and SFD parameters of the CCS PHY block in the loopback flow graph manually to Preamble: [1] *32 SFD: [-1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1]

dwalexander commented 5 years ago

That changes where the error occurs - which seems promising

Traceback (most recent call last):
  File "transceiver_CSS_USRP.py", line 313, in <module>
    main()
  File "transceiver_CSS_USRP.py", line 301, in main
    tb = top_block_cls()
  File "transceiver_CSS_USRP.py", line 186, in __init__
    time_gap_2=c.time_gap_2,
  File "/home/root/.grc_gnuradio/ieee802_15_4_css_phy.py", line 59, in __init__
    self.ieee802_15_4_phr_removal_0_0 = ieee802_15_4.phr_removal(phr)
  File "/usr/local/lib/python2.7/site-packages/ieee802_15_4/ieee802_15_4_swig.py", line 5154, in make
    return _ieee802_15_4_swig.phr_removal_make(*args, **kwargs)
TypeError: in method 'phr_removal_make', argument 1 of type 'std::vector< unsigned char,std::allocator< unsigned char > >'

This brings me to two ideas of things to try:

  1. Keep hardcoding all variables in the block to avoid using the ieee802_15_4.css_phy entirely - a bit of a hacky solution, but I think it will at least get things running for this specific case and will not take long.
  2. There may be an issue with the compiler options not being suitable for ARM devices - I will keep digging through the errors and see if there is anywhere that this can be fixed.
bastibl commented 5 years ago

I think the issue is using int, which is different on different platforms. I assume the proper solution would be to switch to something like uint16_t in C++ and the numpy array in the PHY.

bastibl commented 5 years ago

Any updates with that? I bought a RPi3, so I could try test it on ARM if there's sill an issue.

dwalexander commented 5 years ago

I tried hardcoding all variables and this did not change the error at all. Since then I have not had time to work on the project so it has been on hold, so no updates since then. Part of my thinking is that it's to do with an incorrect cross-compilation occurring - although I'm not sure.

bastibl commented 5 years ago

I compiled GNU Radio from source on the RPI3 but was not able to reproduce the problem. Might be due to different compile options (RPI3 is 32bit, don't know about the E312) :-/ My current best guess is that the underlying problem is that the PHY uses Numpy arrays as parameters that have to be converted to std::vectors in C++ domain. For example PHR in the constructor of the PHY is not a list but a Numpy array. Maybe you could try replacing things like c.PHR with c.PHR.tolist(). Hope it helps