We have a specialized application for which the standard BLE stack cannot be used.
I'm trying to set up the CC2541 radio in proprietary mode to receive advertiser packets. I'm using chapter 25 of the CC253x/4x User's Guide (SWRU191C) for guidance.
My RF normal and RF error ISRs are working. Tested with CMD_PING and with an illegal command.
Settings pertinent to a receive only configuration:
However, the device never obtains Rx sync.
Using the Simple BLE Observer in the debugger, I can see that the BLE stack sets up some of the XDATA registers differently for LLE mode. In LLE mode, the RAM register area is used very differently; for example, 0x6000 (PRF_CHAN) contains the channel number, not the FREQ (f - 2379) frequency. I can't find any other clues besides the SWRU191C User's Gude. I've gone through the User's Guide repeatedly and can't figure out what I'm missing.
Any suggestions? Is there any additional documentation or other resources available for proprietary mode?
Thanks
The proprietary mode radio on CC2541 can not be used to receive BLE packets with variable length, as the length field for BLE is located differently compared to proprietary mode. However, you should be able to sync to the BLE packets. If you really need to use proprietary mode to receive BLE packets, you will need to set a fixed length, and then strip off the end of the packet, doing the CRC check in software after receiving the packet. However, if possible, you should try to find another solution to your problem. If you give some more detail on what you want to achieve, we could try to advice you on the best way of doing this.
The reason why you don't sync to the BLE packets could be that you have not set up any of the PRF_ADDR_ENTRYx registers. You must set PRF_ADDR_ENTRY0 even though you don't use an address byte. You need to set PRF_ADDR_ENTRY0.CONF.ENA0 to 1 and PRF_ADDR_ENTRY0.RXLENGTH to the length of the packets when you use fixed length (for variable length, you will need to set the maximum length, but as I said, variable length will not work for receiving BLE packets).
As you said, to receive BLE packets, you will need different values from what is given in Table 25-24: FRMCTRL0 = 0x40; MDMCTRL2 = 0x00; (0x40 will also work). You may use MDMCTRL3 as suggested in Table 25-24, or the reset value, which is 0x60. MDMCTRL0 should be at the reset setting, 0x04, which you probably figured out already.
You should not use AGC; it is only recommended for 2 Mbps.
To make your SWx setting clear (the byte order is not clear from your statement), you need to set SW0 = 0xD6; SW1 = 0xBE; SW2 = 0x89; SW3 = 0x8E;.
Since you need to configure fixed length, the CRC calculation will normally not work. But if you know the length of the advertising packets, you can make it work. In that case, you need to set PRF_CRC_INIT to 0x55555500 (byte 0 to 0x00 and byte 1, 2, and 3 to 0x55), as opposed to what you wrote. THE BSP_Px registers should have their reset values.
That's all it was. I set up PRF_ADDR_ENTRY0 and now it's receiving valid packets. Awesome.
Thanks!