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

Guru**** 2419730 points
Other Parts Discussed in Thread: HALCOGEN

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1103321/tms570lc4357-tms570lc4357

部件号:TMS570LC4357
主题中讨论的其他部件:HALCOGEN

大家好,

我正在使用开发板Launchxk2-570lc43。 将HalCoGen配置为与FreeRTOS配合使用。 然后,在主代码中,我创建了两个任务,一个是读取ADC,另一个是读取sci。 在配置中,启用SCI3读取中断,并在VIM中启用相应的中断。 问题是中断不工作。 即,在对sci3HighLevelInterrupt的调用中,我在调试它时放置了一个断点,但它从未进入。

因此,它永远不会进入我在代码中实现的sciNotification函数:

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;
}

函数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();
}

和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;
}

下面是HalCoGen的屏幕截图 

请告诉我我我做错了什么?

提前感谢。

此致,

Pablo Llull

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,Pablo:

    VIM表是否已在项目中初始化?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,王先生,

    我认为在启动过程中(从halcogen生成的代码),vim正在初始化。 这是正确的还是有其他初始化方法?

    此致,

    Pablo

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,王先生,

    设置串行终端时出现问题。 现在它开始工作了。 谢谢! 但是,在启用中断之前,您是否总是必须调用sciRecieve()?

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

    如果不调用sciReceive(),则不要在 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;

    因为g_sciTransfer_t[2U].rx_length为0。

    此致,

    Pablo

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 ,Pablo:

    感谢您分享信息。 是的,应在启用RX INT后调用Receive()。