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.

System Hang at RF_runCmd

Other Parts Discussed in Thread: CC1310, CC1200, SYSBIOS

Hi all, I'm a hardware engineer but learning to do some programming on the side so please bear with me as I'm very new to the programming field.  This is also my first experience using any operating system functions.  I have a system that contains a CC1310F64 (SPI master) and another processor (SPI slave) which is the source of data that I need to transmit to the CC1310 to send out over the RF in high speed mode.  This is a custom board.  Previously, on this exact same unit, I've had the CC1310 broadcasting to a CC1200 through smartrf using the rfPacketTx_CC1310_LAUNCHXL_TI example.

The basis of my project is the rfPacketErrorRate example.  I have SPI working well enough for the time being.  Where I'm running into issues is at:

RF_runCmd(rfHandle, (RF_Op*)RF_pCmdFs_preDef, RF_PriorityNormal, NULL, 0);

The system simply hangs at this point.  I've included my tx.c as well as my rfExamples.cfg.  I'm sure I have some logical errors that I can work through later...for now, I just need to get this RF_runCmd working.  

I did also modify smartrf_settings_predefined.c with all instances of .txPower being reduced to 0x24cb as well as the instances of .centerFreq being adjusted to 0x0393 (for 915MHz) as well as instances of .frequency being changed to 0x0393.  However, I did try restoring the defaults which don't work either.

I'm working out of tirtos_cc13xx_cc26xx_2_21_00_06 with CCS6.2 and using the XDS110 debugger on the CC1310 launchpad.

The errors I'm seeing in ROV are:

BIOS:

,ti.sysbios.knl.Clock,Module,N/A,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x200026b4, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

,ti.sysbios.family.arm.m3.Hwi,Module,N/A,exception,An exception has occurred!

,ti.sysbios.knl.Semaphore,Basic,(0x20001f8c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

,ti.sysbios.knl.Semaphore,Basic,(0x2000267c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

Clock: address 0x20000178:

Caught exception in view init code.  Target memory read failed at address: 0x200026b4, length: 32 This read is at an INVALID address according to the application's section map.  The application is likely either uninitialized or corrupt.

8156.rfPacketErrorRate.zip

  • Hi Joseph,

    The errors that you are seeing are usually caused by memory corruption (most likely an overflow, but wrong pointer could also cause this).

    For the overflow:

    Can you make sure the task stacks are large enough?

    Also, check to make sure that your heap size is large enough? (this usually causes problems when creating tasks since the stack space is usually from the heap)

    I don't know how comfortable you are with programming, so I'll assume not very much. As a first step, try increasing the size of the stack. If you use the heap to allocate memory for your stack you might also have to increase the heap size. As an alternative  the heap, you can create an array of bytes (Char) which will be used for the task stack.

    Here is a snippet of code to create your own stack and use it for your task.

    //In the file where you create/construct the task, create your global array of bytes.
    Char myTaskStack[VERY_LARGE_STACK_SIZE]; // you can also make it static
    
    
    // In your main or wherever you create your task
    // Here is how to configure the task to use that stack
    Task_Params_init(&taskParams);
    taskParams.stack = myTaskStack;
    taskParams.stackSize = sizeof(myTaskStack);
    // set other parameters here
    
    // Create you task with Task_create(..) or Task_construct(..) here

    Michel

  • Hi Michel,

    Thanks for your help.  I was running either task (SPI is one and my other task which works with the RF core) with a statically created stack of 1152 but I've since increased the size of my RF manager all the way up to 4096 with no luck.  

    #define master_TASK_STACKSIZE 1024
    #define packetizer_TASK_STACKSIZE 4096
    
    uint8_t taskStack[master_TASK_STACKSIZE];
    
    uint8_t packetizer_taskStack[packetizer_TASK_STACKSIZE];
    
    void master_init(void) {
    Task_Params taskParams;
    Task_Params_init(&taskParams);
    taskParams.instance->name = (xdc_String) master_TASK_NAME;
    taskParams.stackSize = master_TASK_STACKSIZE;
    taskParams.priority = PRIORITY_MASTER_TASK;
    taskParams.stack = taskStack;
    Task_construct(&master_task, (Task_FuncPtr) &master_runTask, &taskParams,
    NULL);
    // Initialize Master SPI transaction structure
    masterTransaction.count = 1;
    
    masterTransaction.txBuf = (Ptr) spiTXbuffer;
    
    masterTransaction.rxBuf = (Ptr) &spiRXbufferInitial;
    
    masterTransaction.arg = (Ptr) callbackArg;
    
    Event_Params eventParams;
    Event_Params_init(&eventParams);
    eventParams.instance->name = (xdc_String) (slave_event_NAME);
    Event_construct(&slave_event, &eventParams);
    }
    
    void PacketizerTask_init(void) {
    Task_Params packetizerTaskParams;
    Task_Params_init(&packetizerTaskParams);
    packetizerTaskParams.instance->name = (xdc_String) packetizer_TASK_NAME;
    packetizerTaskParams.stackSize = packetizer_TASK_STACKSIZE;
    packetizerTaskParams.priority = PRIORITY_PACKETIZER_TASK;
    packetizerTaskParams.stack = packetizer_taskStack;
    Task_construct(&packetizer_task, (Task_FuncPtr) &PacketizerTask_runTask,
    &packetizerTaskParams,
    NULL);
    
    Event_Params PacketizerEventParams;
    Event_Params_init(&PacketizerEventParams);
    PacketizerEventParams.instance->name = (xdc_String) (packetizer_event_NAME);
    Event_construct(&packetizer_event, &PacketizerEventParams);
    
    // spiRXbufferStatus |= PINGREADYTOPACKETIZE; //set status to show that ping is ready to be packetized
    // spiRXPingBufferLength = 32;
    // Event_post(Event_handle(&packetizer_event), packetizerEventAny);
    }

    I ~think~ that the heap size would have no bearing since I'm using static creation of the stacks.  I also am going under the assumption that a statically created stack doesn't eat into the stack that's defined in the *.cfg file but that might be a misunderstanding on my behalf.  I also just tested creating the stacks as char arrays instead of unit8_t but no luck with that either.

    As to the pointer issue, I'm calling the exact same command as what is used in the original rfPacketErrorRate test so I doubt that's the problem.  That said, I am working far outside of my area of expertise so I can't make any guarantees.

    In my *.cfg file, I have BIOS>Runtime>System (HWI and SWI) stack size at 2048 and the Heap size at 1024.  If it matters, I haven't manually run a malloc but I can't speak for any of the drivers that are included so I'm not sure if I even need any heap space.  

    Thanks again Michel!

  • Joseph Hancock38 said:
    I ~think~ that the heap size would have no bearing since I'm using static creation of the stacks.

    You are correct, the heap is not necessary when using static creation.

    Joseph Hancock38 said:
     I also am going under the assumption that a statically created stack doesn't eat into the stack that's defined in the *.cfg file but that might be a misunderstanding on my behalf.

    Also, correct.

    Joseph Hancock38 said:
    I also just tested creating the stacks as char arrays instead of unit8_t but no luck with that either.

    They all end being some variation of char or unsigned char.

    Joseph Hancock38 said:
    In my *.cfg file, I have BIOS>Runtime>System (HWI and SWI) stack size at 2048 and the Heap size at 1024.  If it matters, I haven't manually run a malloc but I can't speak for any of the drivers that are included so I'm not sure if I even need any heap space.  

    I believe the SPI driver uses the heap, but that would have caused problems much earlier. It would most likely get stuck at SPI_open...

    You say that it gets stuck at RF_runCmd, so can you place a breakpoint just before calling the function and inspect the ROV then? (Check the BIOS and Stack tabs)

    Here are a few steps to help you debug this problem:

    • Can you step through the code inside the RF_runCmd function (if RF_runCmd is not hidden in a library) to see what call inside the function is causing the problem.
    • Have you tried running only one task at a time? Simply comment out the Task_construct for either task. This should end up with your remaining task being in a BLOCKED state and the IDLE task should be running. You can see if one which task is causing the problem (if a task is the problem).

    Unfortunately, that's as much as I can help since I don't have access to the CC1310 board right now.

    Michel

  • When initially turning on the system before toggling the GPIO that causes the CC1310 to initiate the SPI transfer, here's my ROV>BIOS>Scan for errors:

    ,ti.sysbios.knl.Clock,Module,N/A,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x20002dc0, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Event,Basic,(0x20002d28),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Event,Basic,(0x20002d3c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Queue,Basic,ti.sysbios.knl.Queue@20002d2c,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Queue,Basic,ti.sysbios.knl.Queue@20002d40,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Semaphore,Basic,(0x2000268c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Semaphore,Basic,(0x20002800),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Semaphore,Basic,(0x20002d88),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Task,Detailed,(0x20002a90),stackPeak,Error: Problem fetching Task stack: Error: fetchArray called with length 0.

    ,ti.sysbios.knl.Task,Detailed,(0x20002ae0),stackPeak,Error: Problem fetching Task stack: Error: fetchArray called with length 0.

    After this point, I give the input to my main processor to toggle a GPIO and trigger the event that calls the SPI transfer at which point I have a breakpoint at result = RF_runCmd(rfHandle, (RF_Op*) RF_pCmdFs_preDef, RF_PriorityNormal, NULL, 0);

    For clarity, the SPI transaction has already successfully occurred prior to executing the RF_runCmd function.  Here's the errors:

    ROV>BIOS>Scan for errors:

    ,ti.sysbios.knl.Clock,Module,N/A,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x20002dc0, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Semaphore,Basic,(0x2000268c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    ,ti.sysbios.knl.Semaphore,Basic,(0x20002d88),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    I don't have a Stack tab however, looking at Task>Detailed:

    ,0x20003294,ti.sysbios.knl.Task.IdleTask,0,Ready,,0x0,0x0,200,512,0x20002400,n/a,n/a,

    ,0x20002d90,,2,Ready,master_runTask,0x0,0x0,360,1024,0x20001520,n/a,n/a,

    ,0x20002de0,,3,Running,PacketizerTask_runTask,0x0,0x0,448,4096,0x20000520,n/a,n/a,

    Stepping into the RF_runcmd function, it looks ch gets assigned a value of 2 and then the failure occurs within RF_pendCmd;

    RF_EventMask RF_runCmd(RF_Handle h, RF_Op* pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent)
    {
        if (pCb == NULL)
        {
            pCb = syncCb;
        }
    
        RF_CmdHandle ch = RF_postCmd(h, pOp, ePri, pCb, bmEvent);
    
        if (ch<0)
        {
            return RF_EventCmdError;
        }
       /* this line occurs */ return RF_pendCmd(h, ch, (RF_EventLastCmdDone | RF_EventCmdAborted | RF_EventCmdStopped | RF_EventCmdCancelled));
    }

    Within RF_pendCmd, if I step into that function, it looks like it runs almost all the way through:

    RF_EventMask RF_pendCmd(RF_Handle h, RF_CmdHandle ch, RF_EventMask bmEvent)
    {
        //Assert
        Assert_isTrue((h != NULL), NULL);
        Assert_isTrue((ch >= 0), NULL);
    
    
        // Check whether command has finished, if not override command callback
        uint32_t key = Swi_disable();
    
        RF_Cmd* pCmd = getCmd(ch);
    
        // check if null
        if (!pCmd)
        {
            Swi_restore(key);
            return RF_EventLastCmdDone;
        }
    
        // check if aborted
        if (pCmd->flags & (RF_CMD_ABORTED_FLAG | RF_CMD_STOPPED_FLAG | RF_CMD_CANCELLED_FLAG))
        {
            Swi_restore(key);
            while(pCmd->flags & (RF_CMD_ABORTED_FLAG | RF_CMD_STOPPED_FLAG | RF_CMD_CANCELLED_FLAG));
            return RF_EventLastCmdDone;
        }
    
        // Command has still not finished, override callback with one that posts to semaphore
        if (pCmd->pCb != syncCb)
        {
            h->state.pCbSync = (void*)pCmd->pCb;
            pCmd->pCb = syncCb;
        }
    
        h->state.eventSync = bmEvent;
        Swi_restore(key);
    
        // Wait for semaphore
       /* this line hangs */Semaphore_pend(Semaphore_handle(&h->state.semSync), BIOS_WAIT_FOREVER); // Return command event return h->state.unpendCause; }

    Once it hits the Semaphore_pend line, nothing else happens.

    Thanks!

  • Joseph Hancock38 said:

    ,ti.sysbios.knl.Task,Detailed,(0x20002a90),stackPeak,Error: Problem fetching Task stack: Error: fetchArray called with length 0.

    ,ti.sysbios.knl.Task,Detailed,(0x20002ae0),stackPeak,Error: Problem fetching Task stack: Error: fetchArray called with length 0.

    This seems to contradict the second Scan below.

    Joseph Hancock38 said:

    I don't have a Stack tab however, looking at Task>Detailed:

    ,0x20003294,ti.sysbios.knl.Task.IdleTask,0,Ready,,0x0,0x0,200,512,0x20002400,n/a,n/a,

    ,0x20002d90,,2,Ready,master_runTask,0x0,0x0,360,1024,0x20001520,n/a,n/a,

    ,0x20002de0,,3,Running,PacketizerTask_runTask,0x0,0x0,448,4096,0x20000520,n/a,n/a,

    I am a little confused because in the first Scan for errors, it shows that it cannot fetch the tasks' data (hence memory corruption). However, in this second one, it can fetch data (no memory corruption for the tasks at least).

    What is the difference between the two scans? Is the first one before BIOS_start()?

    This seems to show that the task stacks are good because the numbers before the n/a show the stack peak, stack size and stack location.

    In any case, you should not be getting errors when your debugger stops at a breakpoint or if you pause the execution manually. Can you confirm by loading the original rfPacketTx example and inserting breakpoints or pausing manually?

    If there are no errors in the original example, try placing breakpoints at the beginning of each task to make sure that your tasks enter properly without errors.

    Also, there are a few debug option that we can add to help us figure out what is going on.

    In the .cfg file: 

    //line 98: enable policyDefault
    Error.policyFxn = Error.policyDefault;
    //Error.policyFxn = Error.policySpin;
    
    //line 115 use Error.print to show errors in the console
    Error.raiseHook = Error.print;
    //Error.raiseHook = null;
    //Error.raiseHook = "&myErrorFxn";
    
    //line 168 enable exceptions for hardware errors
    m3Hwi.enableException = true;
    //m3Hwi.enableException = false;
    //m3Hwi.excHandlerFunc = null;
    
    //line 253: try increasing the heap size (just to make sure it is not a problem)
    BIOS.heapSize = 2048;
    

    Michel

  • Hi Michel,

    The two scans are both performed after BIOS_Start().  It's also hard to run with the breakpoints idea because there are ~always~ errors showing up in ROV and they are extremely confusing.

    For example, here's some error code from my system after BIOS_start() has executed:

    ROV>BIOS>Scan for errors:

    ,ti.sysbios.knl.Clock,Module,N/A,N/A,Caught exception in view init code: "C:/ti/xdctools_3_32_00_06_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0x200029c0, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    The memory address, 0x200029c0 is a variable bStart with a value of 0.

    ,ti.sysbios.knl.Semaphore,Basic,(0x2000228c),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    The memory address, 0x2000228c is a value in the middle of spiCC26XXDMAObjects while 0xbebebebe shows -------- in the memory browser.

    ,ti.sysbios.knl.Semaphore,Basic,(0x20002400),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    The memory address 0x20002400 is a location in rfObject with a value of 0.  0xbebebebe, of course, is the same deal as it was prior.

    ,ti.sysbios.knl.Semaphore,Basic,(0x20002988),pendElems,Error: Problem scanning pend Queue: JavaException: java.lang.Exception: Target memory read failed at address: 0xbebebebe, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    The memory address 0x20002988 is callbackArg and has a value of 0.  0xbebebebe, you know the drill!

    ROV>Clock>Basic:

    Received exception from ROV server: Target memory read failed at address: 0x200029c0, length: 32 This read is at an INVALID address according to the application's section map.  the application is likely either uninitialized or corrupt.

    This is the same error as called out above for the clock module.  

    ROV>Clock>Module:

    ,0x20000178,,,,,,,,

    The above is what is copied out of ROV but mousing over, you get the same message as above.  However, mousing over it gives the ROV>Clock>Basic error message as a toast message.  The address 0x20000178 is the address of ti_sysbios_knl_Clock_Module__state__V.

    ROV>Semaphore>Basic:

    No errors displayed.

    ROV>Task>Detailed

    ,0x200026e0,,3,Blocked,PacketizerTask_runTask,0x0,0x0,212,1024,0x20000d20,n/a,n/a,Event: 0x20002928

    ,0x20002b94,ti.sysbios.knl.Task.IdleTask,0,Running,,0x0,0x0,176,512,0x20001d00,n/a,n/a,

    ,0x20002690,,2,Blocked,master_runTask,0x0,0x0,220,1024,0x20001120,n/a,n/a,Event: 0x2000293c

    The addresses called out in stackBase point to the relevant stacks for each task.

    ROV>Timer>Basic:

    ,0x20002be0,,,0,StartMode_AUTO,42949,ti_sysbios_knl_Clock_doTick__I,0x0,0x20002e18

    No issues displayed here either.  The addresses seem correct.

    I've actually hacked up the rfPacketTx example far too much at this point when I was attempting to get SPI working on that example so I'd have to do a fair bit of work on that to get it running again.

    Anyway, I've spent the majority of today working on my SPI code because, oddly enough, when I remove the SPI init code, as you suggested, the Clock issue goes away while the semaphore problems still occur.  

    When enabling the debugger options, the SPI task fails.

    [Cortex_M3_0]
    Board_initSPI done
    master_init done
    packetizer_init done
    Pins Configured and Pin Interrupts Registered
    About to start BIOS
    GPIO2 high detected
    Using SPI Ping BufferFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x00000001
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

    As a side note, and this issue was discovered ~before~ I posted on this forum.  My program makes it a lot further when I operate with the debugger connected than it does when I'm without.  The SPI fails to initiate the transfer and so my other processor simply waits for it to start the clock.  My Packetizer task is shown below.  Please note the comment after the first System_printf();

    void PacketizerTask_runTask(UArg arg0, UArg arg1) {
    	uint16_t BufferLength;
    	while (true) {
    		Event_pend(Event_handle(&packetizer_event),
    		Event_Id_NONE, (packetizerEventAny),
    		BIOS_WAIT_FOREVER);
    		System_printf("\n We be packetizing!");  /* this line and the next are required to get the program to execute past this point 
    with the debugger connected...otherwise, system hangs without finishing this function */ System_flush(); if (spiRXbufferStatus & PINGREADYTOPACKETIZE) { BufferLength = spiRXPingBufferLength; System_printf( "\n Creating packets from the Ping Buffer using BufferLength = %d", BufferLength); System_flush(); TestResult test_result = tx_test(spiRXbufferPing, BufferLength); spiRXbufferStatus &= ~PINGREADYTOPACKETIZE; spiRXbufferStatus |= (PINGREADYTOTX | PINGAVAILABLEFORRX); } if (spiRXbufferStatus & PONGREADYTOPACKETIZE) { BufferLength = spiRXPongBufferLength; System_printf( "\n Creating packets from the Pong Buffer using BufferLength = %d", BufferLength); System_flush(); TestResult test_result = tx_test(spiRXbufferPong, BufferLength); spiRXbufferStatus &= ~PONGREADYTOPACKETIZE; spiRXbufferStatus |= (PONGREADYTOTX | PINGAVAILABLEFORRX); } } }

    Thanks Michel.  I really appreciate your help!

  • Hi Joseph,

    Sorry for the delay in my response but I've quite busy lately. I'm also starting to run out of ideas.

    In the meantime, I was able get my hands on a CC1310 lauchpad to try to help you with your problem.

    I loaded the RfPacketTx example and the ROV Scan for errors view was not showing me anything (from the first line of main all the way up to running the device freely and pausing it after a minute or so).

    Since we already checked the stack and the heap, which don't seem to be the cause of your issue, I believe that the problem would lie in your initialization sequence (for example: using a semaphore that hasn't been initialized yet).

    Is it possible for you to send the full initialization sequence. I don't need to see the full code, but here is what I need to see:

    1. where you create your tasks
    2. where you create your modules (events, semaphores, mailboxes, etc.
    3. where you initialize and open your drivers
    4. where you have BIOS_start
    5. also where do you use the modules
    6. EDIT: where you declare your TI-RTOS modules and driver variables

    My guess is that the sequence might be wrong somewhere.

    There are a few things that you can try:

    • start from an empty project in CCS and create a single task with your SPI driver. First open the driver without sending any data. You can then feed some random data just to make sure that the SPI driver works.
    • Once the driver and task are running, add your changes to make sure that your packetizer task is properly working.
    • Use a second project with only the rf tx task. Do your modifications to the tx and make sure that they work with random data again.
    • Once you have both tasks working inidividually, you can then merge them together into a single project.

    You can also send me a friend request and send me your project so I can try to reproduce the problem on my board.

    There is one thing that I want to make sure that I understood properly. In your first post, you mentioned that you were able to use SmartRf to broadcast data to another unit. I don't believe that SmartRF uses the firmware on the device but simply controls the register to control the radio. Can you confirm that you had the original RfPacketTx example running on your board?

    Regards,

    Michel

    EDIT: I don't know whether it's still pertinent, but some older documentation (TI-RTOS User Guide version 2.11.01.09) said that you had to add this line in the .cfg file to use the SPI. This needs to be placed anywhere after you declare the TIRTOS variable. The current User Guide says to use the CCS interface to add the different drivers but I don't know whether it just adds that line automatically for you or not.

    TIRTOS.useSPI = true;

    That being said (if it hasn't already been done), I would also recommend that you go through the TI-RTOS User Guide (the one that corresponds to the version that you use) to see how to use the different drivers (in case you missed something)

  • Hi Michel,

    I just wanted to respond really quickly to give you an idea of where I'm at: I think the problem was my use of statically created buffers for my SPI code combined with my use of events and all sorts of poor coding techniques. I was originally using a Ping/Pong system to store my SPI data. Ultimately though, I think the source of all my issues was the rate at which the CPU was retiring functions. I think it was making calls before the SPI transfers were finishing (hence the System_printf and System_flush making things work better) and, as a result, everything was crashing.

    I'm in the process of rewriting all my code to use dynamic memory allocation (from the heap, I think) with storing the pertinent information in a structure. I'm then going to use the mailbox system to queue the structures up for my packetizer task. I think this is a much better way of doing things however, I've had a lot of learning to do as I've never used malloc nor semaphores prior. Before this project, I've never used an OS, events, or threading before either! I'll check in and give you a heads up on how things are going once I make a bit more progress. I'm sure I'll have more questions as well!

    Thanks,
    Joe
  • Hi Joe,


    Yes, an OS can seem daunting at first, but it makes a lot of things much simpler when you think of your tasks as separate entities do work independently from each other (besides the communication/synchronization between them).


    Just a suggestion, I would stay away from dynamic memory allocation if you can (even with an OS). You have limited memory in an embedded system and the memory re-allocation is never as good as it would be on a PC, so there's always a chance of running into problems after some time. When properly organized and protected, ping pong buffers can be very useful to avoid using dynamic memory allocation.


    As you mentioned, mailboxes is another option that can also help you synchronize your tasks. The mailbox module makes a copy of your data, so you just need some temporary buffer to store the data until you push it to the mailbox.


    Another note. Mailboxes are very useful but require overhead memory for each message. I wanted to store 2 bytes at a time to transfer to another task and because of the overhead, the size of the mailbox buffer almost tripled the amount of space that I needed to store my bytes individually. I ended up making my own queue with events to save precious RAM space. Mailboxes are great if the chunk of data that you are copying are larger (10 bytes or more). The overhead doesn't have such a great impact on the total buffer size.


    If you need more help, don't hesitate to ask and the forums already have plenty of answers.


    Regards,
    Michel

    EDIT: An additional note from my software perspective: test as you go. You will avoid a lot of headaches ;)

  • Hi Michel,

    I'm resurrecting this thread in hopes of getting some additional help on this same platform.  I've been able to successfully move data from my other processor over the SPI to the CC1310 and that seems to be working well.  At this stage, I'm stuck on my RF RX portion.  I've verified that my TX code is properly loading the RF data AND that the RF core is broadcasting SOMETHING in the 915MHz band in high speed mode using a cheap RF sniffer.  My "check" on the RF core loading was to view the pPacket and packet variables in the memory browser to see that they matched my input data.

    My task that handles my RF RX seems to be loading fine and entering the loop responsible for sniffing out messages but I can't actually get it to trigger the callback indicating receipt.  I'm hoping that it's a simple fix but I'm pretty clueless as to where to go from here.  I'm including a copy of my RX code as well as my smartRF settings.  If more code is needed to help track down the issue, I can supply that as well.  FYI, my "PAYLOAD_LENGTH" define has been moved to a different file than the typical "TX.c" but is defined at 128.

    Thanks,

    Joe0675.rfPacketErrorRate_CC1310_TI_CC1310F64.zip