LPUART issue on S32k148

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

LPUART issue on S32k148

Jump to solution
1,078 Views
Kazarian
Contributor III

Hello, 

im using S32k148 and trying to use the LPUART driver from the sdk.

when i initialise the driver : LPUART_DRV_Init(INST_LPUART1, &lpuart1_State, &lpuart1_InitConfig0); the program stuck and does not return, i found the issue in LPUART_Init(), i dont know why it says bus error ?

 

Kazarian_0-1652111389950.png

Regards.

0 Kudos
Reply
1 Solution
1,043 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Refer to the "53.4.2 Baud rate generation" of S32K1xx MCU Family - Reference Manual

53.4.2 Baud rate generation.png

I can see you select CLK_SRC_SIRC_DIV2 for LPUART ASYNCH Module Clock. The baud rate has nothing to do with your choice of external external 40Mhz clock source. Please send 0x55 or 0xAA and measure the actual baud rate of the TX pin with a logic analyzer or oscilloscope.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
1,053 Views
Kazarian
Contributor III

Hello Robin, 

Thank you for your answer.

the clock gate is enabled in the clockMan1.c file by default

Kazarian_0-1652201195364.png

but i needed to change the OSC clock from 8 MHz to 40Mhz since im using an external 40Mhz clock source.

this seems to solve the issue to a certain extent, when i want to receive data in Putty at a baudrate of 115200 i get random char, which means my clock is not correctly configured.

Kazarian_1-1652204445527.png

 

here is a summury of my clock configuration :

Kazarian_2-1652204536712.png

 

Kazarian_3-1652204563382.png

LPUAR config

Kazarian_4-1652204628070.png

 

Thank you for your support

0 Kudos
Reply
1,044 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Refer to the "53.4.2 Baud rate generation" of S32K1xx MCU Family - Reference Manual

53.4.2 Baud rate generation.png

I can see you select CLK_SRC_SIRC_DIV2 for LPUART ASYNCH Module Clock. The baud rate has nothing to do with your choice of external external 40Mhz clock source. Please send 0x55 or 0xAA and measure the actual baud rate of the TX pin with a logic analyzer or oscilloscope.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,065 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Kazarian,

Please check if the clock gate and the selected clock source are enabled: Table 27-9. Peripheral module clocking

Table 27-9. Peripheral module clocking LPUART.png

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply