Developing for the CrazyRadio using Python.

Firmware/software/electronics
Post Reply
StrToLower
Beginner
Posts: 1
Joined: Tue Apr 12, 2016 10:13 am

Developing for the CrazyRadio using Python.

Post by StrToLower »

Hello!

I am currently developing a python program for the CrazyRadio to learn about radios, python and wireless communication. My first program is simply trying to listen on all channels with all rates to see if I get any signal at all. From reading the documentation I noticed I need to use the radio in PRX mode. When trying to enable PRX mode through the python program I get an error I have been unable to find a fix for online.

This is the code I am trying to run.

Code: Select all


import sys

# import crazyradio python API
from crazyradio import Crazyradio

def main():

    cr = Crazyradio()
    cr.__init__
    

    rates = [Crazyradio.DR_250KPS, Crazyradio.DR_1MPS, Crazyradio.DR_2MPS]
    channels = cr.scan_channels
    cr.set_channel(10)
    
    #for channel in channels:
     #   cr.set_channel(channel)
    for rate in rates:
        cr.set_data_rate(rate)
        cr.set_mode(Crazyradio.MODE_PRX)
        for i in range(0,10):
            print cr.receive()
    
    
    cr.close()
    print "this is the end of the listener"
    return 0

if __name__ == '__main__':
    main()

The error I get is the following.

Code: Select all


Traceback (most recent call last):
  File "sniffer004.py", line 38, in <module>
    main()
  File "sniffer004.py", line 29, in main
    cr.set_mode(Crazyradio.MODE_PRX)
  File "/home/bitcraze/projects/crazyradio-firmware/lib/crazyradio.py", line 221, in set_mode
    _send_vendor_setup(self.handle, SET_MODE, mode, 0, ())
  File "/home/bitcraze/projects/crazyradio-firmware/lib/crazyradio.py", line 310, in _send_vendor_setup
    index=index, timeout=1000)
usb.USBError: error sending control message: Broken pipe

What my question boils down to is, do I have to flash the firmware to something different or do any similar action to the CrazyRadio to enable PRX mode?
Post Reply