I want to make a barebone BLE scanner without making use of the TI BLE stack, due to memory constraints and other reasons.
Therefore I interface via the so called Radio doorbell interface.
Here I run into the problem that the CMD_BLE_SCANNER is not accepted by this doorbell interface. It is refused with the result: 0x82 (UnknownCommand), although the command is correct.
In the provided documentation and examples from TI, I cannot find an example of barebone usage of the radio.
All examples are based on the provided BLE stack from TI.
My inspiration/example is the open source contiki environment, which also supports this CC2640 radio.
I run similar startup code as used in the rf-ble.c module in this contiki environment. Simplified flow:
/* Request the HF XOSC to source the HF clock. */
oscillators_request_hf_xosc();
/* Boot the CPE */
rf_core_boot();
/* Trigger a switch to the XOSC, so that we can use the FS */
oscillators_switch_to_hf_xosc();
/* Enter BLE mode (CMD_RADIO_SETUP command) */
rf_radio_setup();
This startup code is working fine.
After this radio setup, I want to use the CMD_BLE_SCANNER radio command.
When I create and send that command to the radio, the command is refused with the error result 0x82 in the CMDSTA register.
According the TI documentation (swcu117d.pdf) this means:
0x82 = UnknownCommand = The command ID number in the command structure is unknown.
But the command ID for CMD_BLE_SCANNER is correct: 0x1807
What am I doing wrong here??
Now the strange stuff:
I can get this exact same software flow working as follows:
As development environment, I use CCS with the SmartRF06 Evaluation Board connected to the target board, based on the CC2640.
When I download my program in this board, I get the 0x82 error as described above.
Now I disconnect CCS and connect the SmartRF Studio 7 tool to my board.
With this SmartRF Studio 7, you can send individual commands to this radio interface.
With this tool I send the same CMD_BLE_SCANNER command to the target, which is accepted.
(the contents of this CMD_BLE_SCANNER command is the exactly the same as the CMD_BLE_SCANNER command in my software!)
Now I disconnect SmartRF Studio 7 and download my program again in the target (keeping the power to the target alive!)
When I run my program now, the CMD_BLE_SCANNER is now accepted.
As soon as I remove the target power and start the program again, it is refused again.
What am I missing here??
It seems that there is a volatile setting, which needs to be enabled before making use of the CMD_BLE_SCANNER command.
This setting is most likely done in the SmartRF Studio 7, but from the documentation and discussions in the e2e forums I cannot find this.
What I see in the e2e forums is that there are more people struggling with this barebone usage of the radio.
Can I get help here?
Or can TI provide a simple barebone usage of the radio doorbell interface, without the complete BLE stack?