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/TMS320F28379D: SYSBIOS CPU 2

Part Number: TMS320F28379D
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello. I have the following problem. There is a project with SYSBIOS, it works fine on the CPU1, but when transferring it to the CPU2 there were problems  in code:
            GateMutex_enter(TX_mutex);
            Queue_putHead(queue_tx_frame,&(tx_packet.element));
            Semaphore_post(TSK_TX_semaphor);
            GateMutex_leave(TX_mutex,mutexKey);

event = Event_pend(event_wake_up_TSK_update,Event_Id_NONE,Event_Id_00,BIOS_WAIT_FOREVER);

when a task tries to set the semaphore everything falls apart,in the window ROV on the tab TASK I see:

Target memory read failed at address:0x885f4073,length 34

This read is at an INVALID address according to the application's section map.The application is likely either uninitialized or corrupt.

After that, blocking the task of waiting for the event does not work, and when you call it again Event_pend , I get an error  (ti.sysbios.knl.Event: line 209: assertion failure: A_eventInUse: Event object already in use.
xdc.runtime.Error.raise: terminating execution)   that is natural.tell me what is my mistake.

  • Konstantis,

    Can you please clarify how you transferred the code to CPU 2?  For example, is the TX semaphore you are posting from CPU 2 dedicated to CPU 2 now, or are you trying to share it with CPU 1?   

    Also, have you tried stepping in the debugger into the Semaphore_post() call to see the exact place where CPU crashes?

    And can you clarify how you are calling Event_pend() a second time?  Are you calling it again from the same task, or from a different task?

    Thanks,
    Scott

  • On the CPU1, I don't use SYSBIOS I set up peripheral, clocking and interprocessor communication in it.When I stepping in the debugger into the Semaphore_post() CPU crashes after the call Task_restore(key),value key=0 (it confuses me a little).
    On the CPU2, I set up peripheral, clocking and interprocessor communication,then create 4 tasks:
    printf("create lora_state_machine_TSK:");
    taskparams.stackSize=768;
    lora_state_machine = Task_create(lora_state_machine_TSK, &taskparams, &eb);
    if (lora_state_machine == NULL)
    {
    printf("Task_create() failed!\n");
    BIOS_exit(0);
    }
    printf("ok \n");

    printf("create lora_TX_frame_TSK:");
    taskparams.stackSize=512;
    taskparams.priority = Task_numPriorities-1;
    lora_TX_frame = Task_create(lora_TX_frame_TSK, &taskparams, &eb);
    if (lora_TX_frame == NULL)
    {
    printf("Task_create() failed!\n");
    BIOS_exit(0);
    }
    printf("ok \n");

    printf("create apdate_state_machine_TSK:");
    taskparams.stackSize=768;//768
    taskparams.priority = Task_numPriorities-2;
    lora_apdate_state_machine = Task_create(update_state_machine_TSK, &taskparams, &eb);
    if (lora_apdate_state_machine == NULL)
    {
    printf("Task_create() failed!\n");
    BIOS_exit(0);
    }
    printf("ok \n");
    printf("create apdate_rxFrame_TSK:");
    taskparams.stackSize=512;
    taskparams.priority = Task_numPriorities-1;
    apdate_rxFrame = Task_create(apdate_rxFrame_TSK, &taskparams, &eb);
    if (apdate_rxFrame == NULL)
    {
    printf("Task_create() failed!\n");
    BIOS_exit(0);
    }
    printf("ok \n");

    BIOS_start(); /* does not return */

    and create the necessary tools for interacting tasks.

    OTA_req_clock_params.period=TIME_OTA_REQ;
    OTA_req_clock_params.startFlag=FALSE;
    OTA_req_clock=Clock_create(OTA_req_clock_event,TIME_OTA_REQ,&OTA_req_clock_params,&eb);
    if(OTA_req_clock == 0)
    {
    printf("OTA_req_clock create failed \n");
    }
    notResp_clock_params.period=TIME_NOTRESP;
    notResp_clock_params.startFlag=FALSE;
    notResp_clock=Clock_create(notResp_clock_event,TIME_NOTRESP,&notResp_clock_params,&eb);
    if(notResp_clock == 0)
    {
    printf("notResp_clock create failed \n");
    }

    TX_mutex=GateMutex_create(NULL,NULL);
    if(TX_mutex == 0)
    {
    printf("TX_mutex create failed \n");
    }

    queue_tx_frame=Queue_create(NULL,NULL);
    if(queue_tx_frame == 0)
    {
    printf("queue_tx_frame create failed \n");
    }

    queue_rx_updateFrame = Queue_create(NULL,NULL);
    if(queue_rx_updateFrame == 0)
    {
    printf("queue_rx_updateFrame create failed \n");
    }

    TSK_RX_update_semaphor = Semaphore_create(0,NULL,NULL);
    if(TSK_RX_update_semaphor == 0)
    {
    printf("TSK_RX_update_semaphor create failed \n");
    }

    TSK_TX_semaphor=Semaphore_create(0,NULL,NULL);
    if(TSK_TX_semaphor == 0)
    {
    printf("TSK_TX_semaphor create failed \n");
    }

    event_wake_up_TSK_update = Event_create(NULL,NULL);
    if(event_wake_up_TSK_update == 0)
    {
    printf("event_create_TSK_TX create failed \n");
    }

    event_lora_state_machine = Event_create(NULL,NULL);
    if(event_lora_state_machine == 0)
    {
    printf("event_lora_state_machine create failed \n");
    }

    event_update_state_machine = Event_create(NULL,NULL);
    if(event_update_state_machine == 0)
    {
    printf("event_lora_state_machine create failed \n");
    }
    before the destruction, only one task works(update_state_machine_TSK) all the others are blocked, this task must wake the lora_TX_frame_TSK through a semaphore and block through event = Event_pend(event_wake_up_TSK_update,Event_Id_NONE,Event_Id_00,BIOS_WAIT_FOREVER);

    request_ota.state = state_machine_status.current_state;
    tx_packet.data.Req.Unconfirmed.fBuffer=&request_ota;
    tx_packet.data.Req.Unconfirmed.fBufferSize=OTA_REQ_SIZE;


    GateMutex_enter(TX_mutex);

    Queue_putHead(queue_tx_frame,&(tx_packet.element));

    Semaphore_post(TSK_TX_semaphor);
    GateMutex_leave(TX_mutex,mutexKey);
    I note that this project worked fine on CPU1
  • I figured out my problem, the reason was interprocessor interaction.