In trying to compile the (graciously provided) example code for the RF-24G in CC5X I came across the following error:
Error[1] D:\Other\Projects\SensorNetwork\Software\rf-24g-example.c 257 : Unable to generate code
The C syntax is correct. However, CC5X is unable to generate code.
The workaround is often to split the code into simpler statements,
using an extra variable to store temporary results. Sometimes it is
enough to change the sequence of operations.
I made a code change, with the assumption that the error is caused by the CC5X free version not handling higher than uns16 (with the config word for the transceiver being 24-bit. I split it up into an 8-bit and a 16-bit and sent them out one after the other. I’ve attached a ‘prototype’ of this splitting up for two reasons: 1) So those more knowledgable can review it to see if I did it correctly, and 2) So those people with only the free CC5X version can benefit.
The code demonstrating this change is below (although it’s not the actual code that should be put in the rf-24g-example.c:
void main(void)
{
uns8 i;
uns8 config_setup_high;
uns16 config_setup_low;
int RX_DATA;
//Setup configuration word
config_setup_high = 0b.0010.0011;
config_setup_low = 0b.0110.1110.0000.0101; //Look at pages 13-15 for more bit info
for(i = 0 ; i < 8 ; i++)
{
RX_DATA = config_setup_high.7;
config_setup_high <<= 1;
}
for(i = 0 ; i < 16 ; i++)
{
RX_DATA = config_setup_low.15;
config_setup_low <<= 1;
}
}
Thanks,
Jeff