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.

RTOS: Packet Len on my CC1310

Other Parts Discussed in Thread: CC1310

Tool/software: TI-RTOS

Hi everyone, I'm working with an examples rx/tx of TIRTOS for the CC1310. In this moment the my code have this configuration (see the photo) and I send max 30 byte. If I send more than 30 byte, the CC1310 RX receive the 30 byte and detaches the most received bytes. 

How set the Packet Len? I want to add the byte: for examples 50 bytes

#define RX_TASK_STACK_SIZE        1024        //
#define RX_TASK_PRIORITY   2

/* TX Configuration */
#define DATA_ENTRY_HEADER_SIZE    8        // 8  /* Constant header size of a Generic Data Entry */-
#define MAX_LENGTH             125                    //30 /* Max length byte the radio will accept */
#define NUM_DATA_ENTRIES       2                  /* NOTE: Only two data entries supported at the moment */
#define NUM_APPENDED_BYTES     2             /* The Data Entries data field will contain:
                                                                              * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                                                               * Max 30 payload bytes
                                                                              * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */

  • It's not clear from you code extract:

    Do you change the

    /* Packet TX Configuration */
    #define PAYLOAD_LENGTH      30

    In the rfPacketTx example?

  • I used the RFQueue example, for default the payload byte is 30. This number I want to increase to 50.
  • I could not find a link to RFQueue in the SDK, could you link to exactly where I can find this?
  • I write a software for the communication between two cc1310. If I write to first device I receive the message for to second device. In my code, the payload is set to 30 byte for default. I try to change the .pktlen in smartrfsettings.c to 1e in 32..but not working
  • Without seeing your code it's not possible to see how you do things but in our examples we normally have a line like:

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;

    in the code that actually sets the packet length and overwrites whatever set in the smartrfsettings.
  • In my code I have this:

    #define MAX_LENGHT 125
    RF_cmdPropTx.pktLen = MAX_LENGTH;
    RF_cmdPropTx.pPkt = 0;
    RF_cmdPropTx.startTime = 0;

    If I send 20 charcacter then 40 byte, I see the first packet 30 byte and the second packet with 10 byte. Can I read all in one packet?
  • Have you tried to use SmartRF studio on the RX side to see if you have an error in the RX code.

    When you write 20/ 40 bytes, do you mean that you set:
    #define MAX_LENGHT 20?
  • No, I set MAX_LENGHT 125. On the port serial I see this:

    COM1: I send 20 characters(40 byte) =01234567890123456789

    COM2: I receive:

    01234567890123400000(up to the whole package 125) and 567890000000000000000000000000000000000(up to the whole package 125)

    I send 40 byte, but I receive the first packet with 30 byte(15 characters) and the second with 10 byte(5 characters)
  • What you write is that you set the pktLen =125. Is it possible to post the code (simplified as much as possible by still showing the issue)
  • Hi TER, I can't send you the code, because it is of my company. I attached here the capture of my port serial. In this moment the my communication accept 30 byte(15 characters), but if I send 20 byte (20 characters) I see two packet (see photo)

  • I understand that you can't send your full code. But it should be possible to alter the rfPacketRx/Tx examples to give the same functionality as your full code with regards to the issue you want help with and send post that. The seriell interface ump does not give me that much information.
  • 
    

    This is a part of communication: 

    void Read_From_RF(char RFRead[MAX_LENGTH + NUM_APPENDED_BYTES - 4])
    {
        uint8_t i;
    
        if (RFRead != NULL)								
    	{
    		for (i = 0; i < 4; i++) Addr_da_RF[i] = RFRead[i];					
       		for (i = 0; i < 4; i++)
       		{
       			if (Addr_da_RF[i] != MyAddr[i])
       	   		{
       	   			PIN_setOutputValue(pinHandle, S_ON,Out_Low);
       	   			for (i = 0; i < MAX_LENGTH; i++) From_RS232[i] = NULL;			
       	   			PIN_setOutputValue(pinHandle, S_ON,Out_High);
       	   			return;
       	   		}
       		}
    		for (i = 4; i < MAX_LENGTH; i++) Dato_da_RF[i-4] = RFRead[i];	
       		Istruzioni(Dato_da_RF);								
    		if (comando != 0) return;
    		UART_write(uart, &Dato_da_RF, MAX_LENGTH);						
    	}
    }
    
    void TX_To_RF(char To_Send[MAX_LENGTH])
    {
    	uint8_t i;
        rfcmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    	if (PIN_getInputValue(Sel_Mod_Unmod) && To_Send[0] != 0)					
    	{
    		for (i = 0; i <4; i++) packet[i] = RemoteAddr[i];					
    																		   
    		for (i = 0; i <strlen(To_Send); i++) packet[i+4] = To_Send[i];
    		RF_cmdPropTx.pPkt = packet;
    		RF_cmdPropTx.pktLen = strlen(To_Send)+4;
    		RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
    	}
    	if (!PIN_getInputValue(Sel_Mod_Unmod) && To_Send[0] != 0)					
    	{
    		RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);		
    		RF_cmdTxTest.endTime = RF_getCurrentTime();								
    		RF_cmdPropTx.pktLen = strlen(To_Send);
    		RF_cmdTxTest.endTime = RF_getCurrentTime()+5000000;						
    		RF_runCmd(rfHandle, (RF_Op*)&RF_cmdTxTest, RF_PriorityNormal, NULL, 0);	
    	}
    	RF_cancelCmd(rfHandle, rfcmdHandle, 0);
    }
        if( RFQueue_defineQueue(&dataQueue,
                                rxDataEntryBuffer,
                                sizeof(rxDataEntryBuffer),
                                NUM_DATA_ENTRIES,
                                MAX_LENGTH + NUM_APPENDED_BYTES))
        {
            /* Failed to allocate space for all data entries */
            while(1);
        }
    
        /* Modify CMD_PROP_TX command for application needs */
        RF_cmdPropTx.pktLen = MAX_LENGTH;
        RF_cmdPropTx.pPkt = 0;
        RF_cmdPropTx.startTime = 0;
    
    
        /* Modify CMD_PROP_RX command for application needs */
        RF_cmdPropRx.pQueue = &dataQueue;           /* Set the Data Entity queue for received data */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;  /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;   /* Discard packets with CRC error from Rx queue */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
        RF_cmdPropRx.startTrigger.triggerType = TRIG_ABSTIME;
        RF_cmdPropRx.endTrigger.triggerType = TRIG_ABSTIME;

  • In the TX code your packetlength is set as
    RF_cmdPropTx.pktLen = strlen(To_Send)+4;

    When debugging the code, have you checked that the .pktlen is the expected value? On the RX side you first have to read out the packet length which is the first byte in the received data to know have many bytes you should read into the buffer, see the rfpacketrx example.
  • Then, If I deleted the string: RF_cmdPropTx.pktLen = strlen(To_Send)+4; I send all message?
  • Not sure what you mean. From your code it looks like you want to send the content of To_send + an address. Why do you want to send more bytes than strlen(To_Send)+4?
  • In this moment I send 30 byte and not 40 byte because receive two packet. Then, I think that I should to delete the +4 in my code
  • For debugging, use SmartRF Studio to control the receiver side and see what you receive here.
  • If I delete the string RF_cmdPropTx.pktLen = strlen(To_Send)+4; I not receive nothing. But If I not change the code, I send 40 byte and receive two packet the first of 30 byte and the second of 5 byte
  • When you state that you receive two packets, are you here only monitoring the serial output? The reason I ask is: To actually receive two packets over RF you also actually havvew to send two packets. Do you run
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
    two times? If not, you should not receive more than one packet over RF. Please check when you enter the RX callback.

    If you only see two packets over the serial interface, how have you setup the UART?
  • Yes, I receive two packet on the serial output.

    This is the RX packet on my code: 

        		UART_read(uart, &From_RS232, sizeof(From_RS232));			/* Read max 30 byte */
        		if (From_RS232[0] == 0) Read_Button_State();
        		else
        		{
        			PIN_setOutputValue(pinHandle, CTS,Out_High);
    				Analyze_RS232_String(From_RS232);
    				if (RS232_To_Local == 0) TX_To_RF(From_RS232);
    				
    				if (From_RS232[0] != 0)
    				{
    					for (i = 0; i < MAX_LENGTH; i++) From_RS232[i] = NULL;	
    					for (i = 0; i < MAX_LENGTH+4; i++) packet[i] = NULL;	
    					RF_cmdPropTx.pPkt = 0;
    				}


  • In this moment I used RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0); one times, but I continue to see the packet in two different packet. I don't think that need to use 30 bytes default and stop.
  • - Is it possible to run your code on a launchpad?
    - Looking at the code, I could not see any variable equal to 30. Where is the number 30 set?
  • The device not read 00 how value hexadecimal. Why?
  • Hi TER, Can I see with Smart RF Studio the packet that changes the two devices with RFPacket examples? If Yes, how?
  • Hi, nice to meet you. I see that you have a big experience with TIRTOS and CC1310. Can you help me?
  • With regards to .pktlen etc:
    As I understand it this program either takes a string from the UART and send it over RF if the string doesn't contain any command characters. Or it prints a string received over RF out in the UART.
    - UART to RF: The length of all strings should be set to the length of the string received over UART. For RF you have to add the length of an address field if you want to add this. If you type in the string "0123456789" the string length is 10 and all operations should use the length of this string.
    - RF to UART: The length of all strings should be set to the length of the received RF packet.

    I was looking a bit at the flow in your program now and it's not ideal. As far as I can see you have two tasks, RS232 and rx. The rs232 loop is polling if a packet is received either over UART or RF. All UART operations are done in blocking mode. I would have used either pending on semaphores or an event handler to control the flow and use UART in callback mode. See e2e.ti.com/.../636545 for an example I made for UART over RF at one point.
  • Hi, I trying the your example. Why When I should to send the packet with TX I should to write 0D000A in hexadecimal for to start the packet? It's the Semaphore?
  • " Why When I should to send the packet with TX I should to write 0D000A in hexadecimal for to start the packet"

    Not sure what you mean here. Where does 0D000A come from?
  • Sorry TER, I meant that when I try to send 012345678 I have to press Enter (0D000A) to receive the package. But if I want to receive the package without pressing enter?
  • I assume you mean that you have to press enter after you have finished typing in the string. This sounds to be dependent on how your terminal window is setup if a enter is required to send the data or not.
  • In your example of UART is required
  • When you refer to "your example" are you then referring to the examples I linked to in an E2E thread? If yes, do you run this unmodified on a LP?
  • Yes, I refer to your example that linked to in an E2E thread. I not modify nothing
  • I'm busy with some other cases this week so I won't have a chance to do a deep dive to debug this this week. Have you actually done some debugging to try to find out where things fail?
  • Yes, but the problem is that for to send a string I should to press Enter, but I don't want to make this
  • If you type in a string like
    a b c d ...
    and you don't press enter, how would you know when you are done typing and want to actually send the string?
  • On my terminal (Hercules) when I type in a string I click on Send and for send the string I should to press ENTER