The LP800's usart driver not work for 9bit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The LP800's usart driver not work for 9bit

1,352 Views
Alex_Tsai
Contributor II

Previously, LPC800 used peri_driver, which can be applied to 9bit usart.
But now the driver created by sdk builder can't be applied.

It's too complicated and resource-intensive for small MCUs.
The sdk should keep lower-level drivers, like the STM's LL driver.

0 Kudos
Reply
9 Replies

1,333 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Alex_Tsai 

May I ask which chip from the LP800 series you are using.

Sorry, to use 9-bit USART on LPC800 with the NXP SDK, you’ll need to modify the provided driver or directly manipulate the USART peripheral registers, as the current SDK-generated drivers may not natively support 9-bit mode.

BR

Harry

0 Kudos
Reply

1,330 Views
Alex_Tsai
Contributor II

The chip I'm currently using is LPC824M20JDH20.

 

0 Kudos
Reply

1,294 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Alex_Tsai 

I checked the LPC82x User manual.

The  USARTs support the 9 data bits.

But this demo is not included in the SDK.

You’ll need to modify the provided driver.

You can refer to the lpc55s16 9 bit example.

Harry_Zhang_0-1737022389832.png

 

BR

Harry

0 Kudos
Reply

1,290 Views
Alex_Tsai
Contributor II

The fundamental problem is that the fsl_usart of LPC800 does not suitable.

Many code modifications may be required, such as the following

In USART_TransferHandleIRQ() function 

uint8_t tmpdata = (uint8_t)base->RXDAT;

The data type is limited to 8 bits.

0 Kudos
Reply

1,250 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Alex_Tsai 

You can use the USART_TransferSendNonBlocking function.

Harry_Zhang_0-1737343514430.png

BR

Harry

0 Kudos
Reply

1,241 Views
Alex_Tsai
Contributor II

I'm not sure which version of the SDK you are using.
There is USART_Enable9bitMode() in your posting, but not in the SDK v2.16.

I also cann't see the USART_TransferSendNonBlocking() function in your posting.
USART_TransferSendNonBlocking() function it will start interrupt, but the ISR have bug, the type will be limited to 8bit.
Refer to fsl_usart.c line.896.

0 Kudos
Reply

1,228 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Alex_Tsai 

Sorry, the code is lpc55s16 Usart 9bit interrupt transfer demo.

The lpc824 doesn't support the 9bit usart demo.

So I suggest you can refer to lpc55s16 Usart 9bit interrupt transfer demo and modify the lpc824 usart demo.

BR

Harry

0 Kudos
Reply

1,225 Views
Alex_Tsai
Contributor II

I don't think it's a problem with the demo code, but NXP needs to fix the fsl_uart.c bug.

0 Kudos
Reply

1,180 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @Alex_Tsai 

Thanks for your information.

i will report it to my SDK teams.

BR

Harry

0 Kudos
Reply