USART CMSIS driver incompletely implemented (ARM_USART_SignalEvent)?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USART CMSIS driver incompletely implemented (ARM_USART_SignalEvent)?

跳至解决方案
2,567 次查看
danielholala
Senior Contributor II

Hello,

this is related to SDK for LPC5526. I don't know the CMSIS implementation for other MCUs. I assume that it's pretty similar at least for the same MCU family.

TL;DR: SDK does not implement all mandatory "Signal USART Events" but only ARM_USART_EVENT_SEND_COMPLETE and ARM_USART_EVENT_RECEIVE_COMPLETE. For example, search the SDK code base for ARM_USART_EVENT_RX_OVERFLOW. It is defined but not used.

Long story:

Peripheral tool uses CMSIS USART API to initialize serial interface:

 

static void FLEXCOMM0_init(void) {
  /* Interrupt vector FLEXCOMM0_IRQn priority settings in the NVIC. */
  NVIC_SetPriority(FLEXCOMM0_IRQN, FLEXCOMM0_IRQ_PRIORITY);
  /* Initialize CMSIS USART */
  FLEXCOMM0_PERIPHERAL.Initialize(USART0_SignalEvent);

 

The signature of Initialize() is 

int32_t ARM_USART_Initialize ( ARM_USART_SignalEvent_t cb_event )

The callback cb_event is called from the SDK in fsl_usart_cmsis.c:

 

static void KSDK_USART_NonBlockingCallback(USART_Type *base, usart_handle_t *handle, status_t status, void *userData)
{
    uint32_t event = 0U;

    if (kStatus_USART_TxIdle == status)
    {
        event = ARM_USART_EVENT_SEND_COMPLETE;
    }
    if (kStatus_USART_RxIdle == status)
    {
        event = ARM_USART_EVENT_RECEIVE_COMPLETE;
    }

    /* User data is actually CMSIS driver callback. */
    if (userData != NULL)
    {
        ((ARM_USART_SignalEvent_t)userData)(event);
    }
}

 

As you can see, this function supports only the two events I listed above.

Conclusion: This implementation does not support all events that are declared "always supported" in ARM's CMSIS driver documentation. The implementation is thus incomplete.

Or am I missing something?

 

0 项奖励
回复
1 解答
2,077 次查看
danielholala
Senior Contributor II

This issue seems to have been fixed in SDK 2.12.0, see SDK on Github.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
2,078 次查看
danielholala
Senior Contributor II

This issue seems to have been fixed in SDK 2.12.0, see SDK on Github.

0 项奖励
回复
2,540 次查看
danielholala
Senior Contributor II

When an RX fifo overrun occurs, the callback is called as below:

danielholala_0-1643969105213.png

To support this event, I added this code to KSDK_USART_NonBlockingCallback() in fsl_usart_cmsis.c:

 

    if (kStatus_USART_RxError == status)
    {
    	event = ARM_USART_EVENT_RX_OVERFLOW;
    }

 

 

 

0 项奖励
回复
2,518 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Yes,you can add it by yourself, or you can directly refer to SDK demo, write interrupt function by yourself, and check the flag in it.

 

BR

Alice

0 项奖励
回复
2,512 次查看
danielholala
Senior Contributor II

Hello @Alice_Yang ,

I appreciate your response. Of course, we, the NXP customers, have to accept the software that you provide as is, even if the implementation is incomplete. From the customer perspective, however, this is an unsatifactory situation.

I hope you forward this information to the SDK team for review and further improvement of the driver.

0 项奖励
回复