This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: Some questions about implementing the sending of ADV data on the rfPacketTx routine of the CC2340R5 chip

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

When using the rfPacketTx routine, I discovered an issue. I set a wake-up time of 1 second, and after waking up, data will be automatically sent. However, there is a possibility that this data may not be sent.

Below is my code for this part, along with a picture of the issue.

//
void tx_cfg(void)
{
    /* Initialize and open RCL */
    RCL_init();
    Display_init();
    display = Display_open(Display_Type_UART, NULL);

    rclHandle = RCL_open(&rclClient, &LRF_config);
    /* Set RF frequency */
    rclPacketTxCmdGenericTx.rfFrequency = FREQUENCY_chl37;

    /* Start command as soon as possible */
    rclPacketTxCmdGenericTx.common.scheduling = RCL_Schedule_Now;
    rclPacketTxCmdGenericTx.common.status = RCL_CommandStatus_Idle;

    rclPacketTxCmdGenericTx.config.fsOff = FS_OFF; // Turn off FS

    /* Callback triggers on last command done */
    rclPacketTxCmdGenericTx.common.runtime.callback = txCallback;
    rclPacketTxCmdGenericTx.common.runtime.rclCallbackMask.value = RCL_EventLastCmdDone.value;
}


void tx_service(void)
{
 
        uint8_t *txData;
        
        RCL_Buffer_TxBuffer *txPacket = (RCL_Buffer_TxBuffer *)&packet_t;
        txData = RCL_TxBuffer_init(txPacket, 0, 0, 25);
        
        sendbuf_debug[24] = packet_cnt;
        /* Generate a random payload */
        memcpy(txData,sendbuf_debug,25);

        /* Set packet to transmit */
        RCL_TxBuffer_put(&rclPacketTxCmdGenericTx.txBuffers, txPacket);

        rclPacketTxCmdGenericTx.common.status = RCL_CommandStatus_Idle;

        /* Submit command */
        RCL_Command_submit(rclHandle, &rclPacketTxCmdGenericTx);
    
         /* Pend on command completion */
        RCL_Command_pend(&rclPacketTxCmdGenericTx); 
    
        if(send_cnt>=3)
        {
            send_cnt = 0;
            packet_cnt++;
            usleep(PACKET_INTERVAL);
        }
    
}



  • 您好

    已经收到了您的案例,调查需要些时间,感谢您的耐心等待

  • thank you so much

  • Hi !

    The first step of debugging would be to know if the issue is coming from the wakeup routine or from the radio. Could you try to print through UART in your tx_service function and see if this function is correctly executed every second ?

    Another good debugging step would be to see if the radio is actually transmitting any data or not. You can see this by enabling the PA and LNA pins in SysConfig, and checking with a logic analyser when those pins are high or low. If the radio is transmitting every second, then your PA pin should be high every second. You can read about how to enable the PA and LNA pins in the User Guide for the F3 SDK.

  • Hello, I have used the DEBUG to confirm that the program is fine. Next, I will follow the method you provided to confirm whether the PA pin is at a high level when sending RF data.

    Thanks.

  • well,I added this function according to your instructions, and the oscilloscope showed that some of the RF data was indeed not sent. I guess it is a problem with the configuration struct. Can you provide a detailed configuration process for me to refer to?thank you.

  • I think the issue probably may come from the format of your packet. In your code you set the last byte (25th byte) of txData to packet_cnt, while the original project sets it to the length of the packet (25 in your case). Here is what I would advise you to debug your packet :

    First you should make sure that you are entering your tx_service function every second. You can do this by blinking the LED or printing using your opened UART device.

    Once you are 100% sure that your function tx_service executes every second, the best next debugging step is to check the returning value from the RCL_Command_submit and RCL_Command_pend functions. These functions return a RCL_CommandStatus enum which tells you what happened to the packet. This will give you the error that may have happened when sending the packet. I would advise to use the UART device that you opened in your program to print the return value of the two RCL functions and see if they return an error.