FRDM-MCXA156, LPUART1 not working

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

FRDM-MCXA156, LPUART1 not working

Jump to solution
2,251 Views
jukka1
Contributor III

Hi,

I am using FRDM-MCXA156 and MCUXpresso IDE v24.12

I cannot get LPUART1 working.
I imported the example frdmmcxa156_lpuart_edma_transfer which uses LPUART0, and I simplified it so that I removed all unnecessary code. I modified only file lpuart_edma_transfer.c. It now initialises LPUART0, writes character 'A' and reads status flags.
Then I changed all LPUART0 related references to LPUART1 related. Both LPUART0 and LPUART1 versions are attached below.

When I run LPUART0 version, 'A' is sent and status flags are: 00c000c0

When I run LPUART1 version, 'A' is not sent and status flags are: 00000040

Perhaps some register initialization is missing from LPUART1 version, but I do not understand what it can be.

 

BR,

jukka

Labels (2)
0 Kudos
Reply
1 Solution
2,184 Views
jukka1
Contributor III

OK, I found the problem. I have to attach the clock to LPUART1.
These lines were missing

 

            CLOCK_SetClockDiv(kCLOCK_DivLPUART1, 1u);
            CLOCK_AttachClk(kFRO12M_to_LPUART1);

 

In the original example they were in BOARD_InitDebugConsole().

View solution in original post

0 Kudos
Reply
2 Replies
2,244 Views
jukka1
Contributor III

The LPUART register dumps when execution is suspended in the while loop
LPUART0

 

0x4009F000  04040003 00000202 00000000 00000000  ................
0x4009F010  19000004 00C00000 000C0000 00001000  ......À.........
0x4009F020  00000000 00000000 00C10099 00000000  ..........Á.....
0x4009F030  00001000 ??????00 ???????? ????????  ....????????????

 

LPUART1

 

0x400A0000  04040003 00000202 00000000 00000000  ................
0x400A0010  19000004 00000000 000C0000 00001000  ................
0x400A0020  00000000 00000000 00410099 00000100  ..........A.....
0x400A0030  00001000 ??????00 ???????? ????????  ....????????????

 

 Perhaps some clock initialization is missing???

0 Kudos
Reply
2,185 Views
jukka1
Contributor III

OK, I found the problem. I have to attach the clock to LPUART1.
These lines were missing

 

            CLOCK_SetClockDiv(kCLOCK_DivLPUART1, 1u);
            CLOCK_AttachClk(kFRO12M_to_LPUART1);

 

In the original example they were in BOARD_InitDebugConsole().

0 Kudos
Reply