[SOLVED] SPI trouble

Post here to get support
arnaud
Bitcraze
Posts: 1207
Joined: Tue Feb 06, 2007 12:36 pm

Re: SPI trouble

Post by arnaud » Wed Apr 12, 2017 9:35 am

How are you powering the crazyradio, from the raspberry pi USB? This is what I did when writing the script (https://twitter.com/Bitcraze_se/status/ ... 2839412736)

arashi
Beginner
Posts: 12
Joined: Sun Dec 14, 2014 4:14 pm

Re: SPI trouble

Post by arashi » Wed Apr 12, 2017 3:29 pm

Well, what do you know! This is what I get when I have my Crazyradio actually powered:

Code: Select all

root@raspberrypi:/usr/local/bin# ./fix_bootloader_raspi.py 
./fix_bootloader_raspi.py:63: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup([SCK, MOSI], GPIO.OUT, initial=GPIO.LOW)
./fix_bootloader_raspi.py:65: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(MISO, GPIO.IN)
Erasing page 0...
Writing 'JL 0x7800' instruction...
Flash content:
02
78
00
Fix written to flash. Disconnect the PROG wire, reconnect Crazyradio
and the bootloader should start!
I told you I was an electronics n00b. :oops:

Anyway, I've found that the bootloader springs to life as soon as I yank the PROG wire. Is it safe to leave the Crazyradio permanently plugged into a USB port and then just put in (and yank afterwards) the PROG wire when you need SPI access? This setup would be convenient (enough) for development.

arnaud
Bitcraze
Posts: 1207
Joined: Tue Feb 06, 2007 12:36 pm

Re: SPI trouble

Post by arnaud » Thu Apr 13, 2017 6:50 am

Great! I am glad it is now working.

Yes there should be no problem keeping the other wire connected during, they are all reverted to hi-z (disconnected) state when the python program quits.

This is actually one problem for me: I was thinking of using this setup to run integration test on the crazyradio: the raspi could compile, flash and test each commit automatically and if the commit breaks the bootloader could be automatically recovered. Unfortunately to achieve that the python program would have to run all the time to keep the PROG pin low ... one day if I have time I can make an always-running recovery server out of it.

arashi
Beginner
Posts: 12
Joined: Sun Dec 14, 2014 4:14 pm

Re: SPI trouble

Post by arashi » Thu Apr 13, 2017 3:25 pm

I think I understand what you're saying about having a Raspberry Pi continuously running integration tests. Quite handy if you're doing a lot of development.

Anyway, I will mark this thread as [SOLVED]. Thanks a lot for your AWESOME support. :-)

Post Reply