USART CMSIS driver incompletely implemented (ARM_USART_SignalEvent)?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USART CMSIS driver incompletely implemented (ARM_USART_SignalEvent)?

ソリューションへジャンプ
1,778件の閲覧回数
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 解決策
1,288件の閲覧回数
danielholala
Senior Contributor II

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

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,289件の閲覧回数
danielholala
Senior Contributor II

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

0 件の賞賛
返信
1,751件の閲覧回数
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 件の賞賛
返信
1,729件の閲覧回数
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 件の賞賛
返信
1,723件の閲覧回数
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 件の賞賛
返信