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.

Packet TX error with LED

Other Parts Discussed in Thread: CC1310

Hi, I'm working with the TX-RX examples located inside the CC1310 SDK. I have implemented communication via UART and it works very well. Now I am implementing a new topic: I have two boards that speak and work, if I do not feed one board and with the other I send the command .... can I turn on an LED if it is not received?

Thanks!

  • Yes, as long as you use ack as covered in https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/813092?RTOS-Blink-led-with-RFexample-and-UART

    If you don't receive an ACK, turn on the LED. 

  • Should this ACK only be placed inside the TX code?

  • In the previous thread you were shown an example on how to do ack. Is something unclear with the example? 

  • I implemented TXecho callbacks within my TX code and RXecho callbacks within my RX code. If I have the receiver off and I send a command my LEDs are always off. Am I wrong?

    TX:

    void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
    
    
    	if (e & RF_EventRxEntryDone)
        {
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            rssiDataPointer = (uint8_t*)(&currentDataEntry->data + packetLength + 1);
            rssi = (int8_t) *rssiDataPointer;
    
            rssi = rxStatistics.lastRssi;
    
    /* Copy the payload + the status byte to the packet variable */
            memcpy(packet_rx, packetDataPointer, (packetLength));
    
            int16_t status = memcmp(packet_tx,packet_rx,packetLength);
    
            if(status == 0)
                    {
                        /* Toggle LED1, clear LED2 to indicate RX */
                        PIN_setOutputValue(pinHandle, LED1,
                                           !PIN_getOutputValue(LED1));
                        PIN_setOutputValue(pinHandle, LED2, 0);
                    }
                    else
                    {
                        /* Error Condition: set both LEDs */
                        PIN_setOutputValue(pinHandle, LED1, 1);
                        PIN_setOutputValue(pinHandle, LED2, 1);
                    }
    
            RFQueue_nextEntry();
        } else if((e & RF_EventLastCmdDone) && !(e & RF_EventRxEntryDone))
        {
            if(bRxSuccess == true)
            {
                /* Received packet successfully but RX command didn't complete at
                 * the same time RX_ENTRY_DONE event was raised. Reset the flag
                 */
                bRxSuccess = false;
            }
            else
            {
                /* RX timed out */
                /* Set LED2, clear LED1 to indicate TX */
                PIN_setOutputValue(pinHandle, LED1, 0);
               // PIN_setOutputValue(pinHandle, LED2, 1);
            }
        }
        else
           {
               /* Error Condition: set both LEDs */
               PIN_setOutputValue(pinHandle, LED1, 1);
               PIN_setOutputValue(pinHandle, LED2, 1);
           }
    }

    RX: 

    void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
    
    	if (e & RF_EventRxEntryDone)
        {
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            rssiDataPointer = (uint8_t*)(&currentDataEntry->data + packetLength + 1);
            rssi = (int8_t) *rssiDataPointer;
    
            rssi = rxStatistics.lastRssi;
    
    /* Copy the payload + the status byte to the packet variable */
            memcpy(packet_rx, packetDataPointer, (packetLength));
    
            RFQueue_nextEntry();
    
            Semaphore_post(semHandle);
        } else if (e & RF_EventLastCmdDone)
        {
            /* Successful Echo (TX)*/
            /* Toggle LED2, clear LED1 to indicate RX */
            PIN_setOutputValue(pinHandle, LED1, 0);
            PIN_setOutputValue(pinHandle, LED2,
                               !PIN_getOutputValue(LED1));
    
        }
        else // any uncaught event
        {
            /* Error Condition: set LED1, clear LED2 */
            PIN_setOutputValue(pinHandle, LED1, 1);
            PIN_setOutputValue(pinHandle, LED2, 0);
        }
    }

  • Yes. As I understand your requirement, you want to alter the state of a LED if you don't receive an ACK. Meaning that setting the LEDs in a RX callback will not give the wanted functionality. 

    I would assume you have seen this when you place a break point in your code and observed if you reach this part of the code. 

  • Debugging, I arrive at that point of code. But can't I verify the arrival of the package through an RSSI value?

  • Please elaborate what you mean here. Either you receive a packet with correct CRC (and you enter the callback) or you don't receive a packet.

    Also, please elaborate what you mean by "if I do not feed one board and with the other I send the command .... can I turn on an LED if it is not received?", please provide a flow diagram that show what you want to implement. 

  • DEVICE 1 SEND HELLO TO DEVICE 2

    IF DEVICE 2 NOT RECEIVE THE PACKET 

    LED ON DEVICE1 , IF RECEIVE THE PACKET LED OFF

  • Then this is still true: Yes. As I understand your requirement, you want to alter the state of a LED if you don't receive an ACK. Meaning that setting the LEDs in a RX callback will not give the wanted functionality. 

    You have to draw a flowchart that represent the above and implement the code accordingly. 

  • RX callback is the same of RXEcho example. 

  • Meaning what? Please write more than one line since I'm not able to follow you when write just one liners.