radioComInit call locks up Wixel

If I load the app below onto my Wixel, the Wixel stops working–that is, its lights all shut down and the USB no longer responds, such that I have to jump it into bootloader mode in order to put on a new app.

If I comment out the “radioComInit();” line, the Wixel instead runs fine: the green light blinks regularly, the USB stays active and I can refresh the app any time I want.

Here’s the fun part: I’ve got two wixels, and both of them behave exactly the same way. What could I possibly have done wrong here??

#include <wixel.h>
#include <usb.h>
#include <usb_com.h>
#include <stdio.h>
#include <gpio.h>
#include <radio_com.h>

void main()
{
   systemInit();
   usbInit();
   radioComInit();

   for(;;) {
      boardService();
      usbComService();

      LED_GREEN(getMs() >> 8 & 1);           // Blink green while alive
   }
}

Ooo… interesting twist: if I add #include <radio_link.h> at the bottom of the include section there, the radioComInit() method no longer locks up the wixel. Now how’s that for weird?

Hello, Lertulo. For an interrupt to work in SDCC, there must be a line of code to declare the ISR in the source file that contains your main() function. Including radio_link.h in to your app fixed the problem because it includes radio_mac.h which contains the declaration of the radio ISR: “ISR(RF, 1);”.

But a better solution would be to include radio_link.h from radio_com.h. I have done that and pushed the change to the Wixel-SDK on github.

Thank you for letting us know about this problem.

–David

hi,

i just downloaded the sdk yesterday and i do see that change to radio_com.c but i still have this same issue - radio_link must be included in my app or it hangs. maybe it’s not fixed in the sdk after all?

thanks for any info,
rob

Hello, rob.

Are you using the Wixel SDK included with the Wixel Development Bundle or did you download the latest version from Github?
github.com/pololu/wixel-sdk/

–David

I believe I got the SDK from github. Is there a way to tell which version I’ve been using? My lib/src/radio_com/radio_com.c does have an include of radio_link.

Rob

It’s not radio_com.c that is the issue, it is libraries/include/radio_com.h. The latest version of that file on github has “include <radio_link.h>”. If you downloaded the Wixel SDK from github as a zip file, then the name of the zip file has a 7-digit hex code at the end that tells you which version (commit) you downloaded.

If you use git to clone the repository, then you can use the “git log” command to see what commit you are at.

–David