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.

TMS570LC4357: TMS570LC4357

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi all,

I am working with the development board Launchxk2-570lc43. Configure HalCoGen for use with freertos. Then, in the main code, I create two tasks, one to read the adc and the other to read the sci. In the configuration enable the SCI3 read interrupt, and its corresponding enablement in the VIM. The problem is that the interrupt is not working. That is, in the call to sci3HighLevelInterrupt I put a breakpoint while debugging it but it never enters.

Therefore, it never enters the sciNotification function that I implement in my code:

int main(void)
{
/* USER CODE BEGIN (3) */
    hardwareInit();
    /* create a queue and semaphore to collect a line and flag the end of it */
    g_uartQ = xQueueCreate(32, sizeof(char));
    vSemaphoreCreateBinary(flagEOL);
    
    /* Create Task 1 */
    if (xTaskCreate(prvTaskADCRead,"TaskADCRead", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, &xTask1Handle) != pdTRUE)
    {
        /* Task could not be created */
        while(1);
    }
    if (xTaskCreate(prvTaskCMD,"TaskCMD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+2, &xTask2Handle) !=  pdTRUE)
    {
        while(1);
    }
    vTaskStartScheduler();
/* USER CODE END */

    return 0;
}

Function hardwareInit:

static void hardwareInit(void)
{
    /* Se inicializan las 4 uart: SCI1, SCI2, SCI3 y SCI4. SCI
       SCI data Format
       Baudarate: 115200
       Stop bit: 2
       Length: 8 */
    _enable_interrupt_();
    sciInit();
}

And sciNotification:

void sciNotification(sciBASE_t *sci, uint32 flags)
{
    static uint8 c;

    /* get the byte out of the interrupt register */
    sciReceive(sci, 1, &c);
 
    /* put the byte in a queue */
    if (xQueueSendFromISR(g_uartQ, &c, 0))
    {
        /* success */
    }
    else
    {
        /* queue send fail: probably full */
    }
 
    /* flag the End of the Line */
    if (c == '\r')
    {
        xSemaphoreGiveFromISR(flagEOL, NULL);
    }
    else
    {
        sciSend(sci, 1, &c);
    }
    return;
}

Below are the screenshots of the HalCoGen :

Please if you can tell me what I'm doing wrong?

Thanks in advance.

Regards,

Pablo Llull

  • Hi Pablo,

    Is the VIM table initialized in your project?

  • Hi Wang,

    I thing that during startup (from halcogen generated code), vim is getting initialized. is this correct or is there another way to initialize?

    Best regards,

    Pablo,

  • Hi Wang,

    I had a problem with the setting serial terminal. Now it's works. Thanks!. But, Do you always have to call the sciRecieve() before enable interrupt?.

        _enable_interrupt_();
        sciInit();
        sciEnableNotification(sciREG3, SCI_RX_INT);
    
        sciReceive(sciREG3,1,&c);
    

    If don't call sciReceive(), never enter in line for callback function in sci3HighLevelInterrupt:

     

        case 11U:
            /* receive */
            byte = (uint8)(sciREG3->RD & 0x000000FFU);
    
                if (g_sciTransfer_t[2U].rx_length > 0U)
                {
                    *g_sciTransfer_t[2U].rx_data = byte;
                    g_sciTransfer_t[2U].rx_data++;
                    g_sciTransfer_t[2U].rx_length--;
                    if (g_sciTransfer_t[2U].rx_length == 0U)
                    {
                        sciNotification(sciREG3, (uint32)SCI_RX_INT);
                    }
                }
            
            break;

    because g_sciTransfer_t[2U].rx_length is 0.

    Best Regards,

    Pablo

  • Hi Pablo,

    Thanks for sharing the information. Yes, the sciReceive() should be called after RX INT is enabled.