Hello,
I use the CC2541 to make a transmitter and a receiver.
I use the kit with the CC-Debugger.
When i send (RFST CMD_TX) my data the PRF_ENDCAUSE is TASK_ENDOK so is suppose my package is sended correctly.
When i want to receive this package with the other CC2541 (RFST CMD_RX) the PRF_ENDCAUSE is TASKERR_PAR. I don't realy find the reason.
This are the settings i programmed to make the receiver.
Does anybody see something wrong ?
Thanks in advance,
============================================================
============================================================
int send_data_length;
//Transmitter only
int data_to_send[8] = {0x40,0x45,0x55,0x60,0x65,0x70,0x75,0x80};
int received_data[16];
int i;
void halSetFrequency(uint16 frequency)
{
PRF.CHAN.FREQ = frequency-2379;
}
void halRfLoadBLEBroadcastPacketPayload(void)
{
//Number of bytes effective data
send_data_length = (sizeof(data_to_send)/sizeof(int));
//Read data from FIFO
for(i=0;i<send_data_length+8;i++){
received_data[i] = RFD;
}
return;
}
============================================================
============================================================
void halRfInitBleBroadcastMode(unsigned short broadcast_channel)
{
// Clear radio memory (The RAM registers don't have a default value set, must be set manually).
memset((void*)RFCORE_RAM_PAGE, 0, RFCORE_RAM_PAGE_SZ);
// No timer 2 events sent to LLE
T2EVTCFG = 0x77;
PRF.TASK_CONF.MODE = 0; // Basic mode, fixed length.
PRF.TASK_CONF.REPEAT = 0; // no repeat
PRF.TASK_CONF.START_CONF = 0; // Start each receive/transmit immediately
PRF.TASK_CONF.STOP_CONF = 0; // Don't stop on timer 2 event 2.
PRF.FIFO_CONF.AUTOFLUSH_IGN = 0; // Flush duplicate packets
PRF.FIFO_CONF.AUTOFLUSH_CRC = 0; // Flush packets with CRC error
PRF.FIFO_CONF.AUTOFLUSH_EMPTY = 0; // Flush packets with no payload
PRF.FIFO_CONF.RX_STATUS_CONF = 0; // Don't append status information in FIFO
PRF.FIFO_CONF.RX_ADDR_CONF = 1; // Address byte in Rx FIFO
PRF.FIFO_CONF.TX_ADDR_CONF = 0; // Read address from PRF.ADDR_ENTRY[0].ADDRESS
PRF.PKT_CONF.ADDR_LEN = 1; // Address byte.
PRF.PKT_CONF.AGC_EN = 0; // AGC disabled.
PRF.PKT_CONF.START_TONE = 0; // No tone in front of packet.
PRF.ADDR_ENTRY[0].CONF.REUSE = 0; // Don't reuse packet.
TXCTRL = 0x19;
TXPOWER = TXPOWER_0_DBM; // Set default output power: 0dBm.
TXFILTCFG = 0x03; // Set Tx filter bandwidth
IVCTRL = 0x1B;
FRMCTRL0 = 0x40; // Data goes LSB over the air.
ADCTEST0 = 0x10; // Adjust ADC gain.
MDMCTRL0 = 0x04; // Set 1 Mbps at 250 kHz deviation.
MDMCTRL1 = 0x48; // Correlation threshold
MDMCTRL2 = 0x00; // Syncword transmitted LSB to MSB, 1 leading preamble byte,
MDMCTRL3 = 0x63; // Set RSSI mode to peak detect after sync.
MDMTEST0 = 0x01;
//Address configuration
PRF.FIFO_CONF.TX_ADDR_CONF = 0; //Read address from PRF.ADDR_ENTRY[0]
PRF.ADDR_ENTRY[0].ADDRESS = 0x44; //Address
PRF.ADDR_ENTRY[0].CONF.ENA0 = 1; //Enable address primary sync word
// Set 32 bit sync word:
SW_CONF = 0x00;
SW0 = 0xD6;
SW1 = 0xBE;
SW2 = 0x89;
SW3 = 0x8E;
// Set 3 byte CRC
PRF_CRC_LEN = 0x03;
PRF_CRC_INIT[0] = 0x00;
PRF_CRC_INIT[1] = 0x55;
PRF_CRC_INIT[2] = 0x55;
PRF_CRC_INIT[3] = 0x55;
// Set BLE broadcast channel (2402, 2426 or 2480)
halSetFrequency(broadcast_channel);
// Enable PN7 whitener.
BSP_P0 = 0x00;
BSP_P1 = 0x5B;
BSP_P2 = 0x06;
BSP_P3 = 0x00;
BSP_MODE = 0x01;
// Initialization of PN7 whitener in accordance with advertising channel. PRF_W_INIT should be set to 37, 38, or 39 (0x25, 0x26, or 0x27).
if(broadcast_channel == BLE_BROADCAST_CHANNEL_37)
{
PRF_W_INIT = 0x25; // Init according to BLE channel 37.
}
else if(broadcast_channel == BLE_BROADCAST_CHANNEL_37)
{
PRF_W_INIT = 0x26; // Init according to BLE channel 37.
}
else if(broadcast_channel == BLE_BROADCAST_CHANNEL_37)
{
PRF_W_INIT = 0x27; // Init according to BLE channel 37.
}
}
============================================================
============================================================
unsigned char BleBroadcast(void)
{
// Clear and update LCD display.
halLcdClear();
halLcdWriteLine(1, "BLE BroadCast");
// Reset LLE.
LLECTRL = 0x00;
// Config radio in BLE broadcast mode.
halRfInitBleBroadcastMode(BLE_BROADCAST_CHANNEL_37);
// Enable the radio.
LLECTRL = 0x01;
while(1)
{
// Start receive
while(RFST != 0);
RFST = 0x08;
// Wait for TASKDONE
while ((RFIRQF1 & RFIRQF1_TASKDONE) != RFIRQF1_TASKDONE);
// If data received read FIFO
if(PRF.ENDCAUSE == TASK_ENDOK)
{
//Get packet data.
halRfLoadBLEBroadcastPacketPayload();
}
}