Use EXTAL0 and XTAL0 pins in UART mode

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

Use EXTAL0 and XTAL0 pins in UART mode

ソリューションへジャンプ
977件の閲覧回数
alex323qp
Contributor III

Hi, I have a custom board with a MKL25Z128 MCU. The MCG is configured in FEI mode (internal clock source) and I'm trying to repurpose the EXTAL0 and XTAL0 pins for serial communication (UART1).

(My project uses mbed libraries, but I'm comfortable manipulating the registers directly if required)

mbed has a DigitalOut library for generic I/O purposes that works fine over the PTA19 pin. The problem is that if I replace it with the serial instance (using the Serial library), the program stops working. My guess is that there is something in that library that conflicts with my configurations.

I tried to set the ALT mode 3 directly thinking that was the problem but no luck whatsoever:

PORTA->PCR[19] = PORT_PCR_MUX(3);

PORTA->PCR[18] = PORT_PCR_MUX(3);

I wonder if there is something else I'm supposed to do in order to free these pins and use the UART module available to them?

Any help would be greatly appreciated.

Regards,

Alex.

ラベル(2)
0 件の賞賛
1 解決策
732件の閲覧回数
alex323qp
Contributor III

I figured out what the problem was:

Mbed's PinMap module did not include the PTA18 and PTA19 pins as part of the UART Peripheral. The fix was just to add both pins and the alt mode to the PinMap_UART_TX structure in the PeripheralPins.c file.

Hope this helps someone else.

Regards,

Alex.

元の投稿で解決策を見る

0 件の賞賛
4 返答(返信)
733件の閲覧回数
alex323qp
Contributor III

I figured out what the problem was:

Mbed's PinMap module did not include the PTA18 and PTA19 pins as part of the UART Peripheral. The fix was just to add both pins and the alt mode to the PinMap_UART_TX structure in the PeripheralPins.c file.

Hope this helps someone else.

Regards,

Alex.

0 件の賞賛
732件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Alex,

Could you show your code about how to configure the UART1 ?

And have you enable the UART1 clock ?

Have you IDE can debug your project , if have , i recommend you first debug it to be sure the code can work well ,

and the project only with UART1 , thus we can locate the problem quickly .

BR

Alice

0 件の賞賛
732件の閲覧回数
alex323qp
Contributor III

Hi Alice,

Thanks for your response.

All the UART setup is done by the mbed libraries, so I'll have to check the source code to see what configurations are being used. Since this is a custom board, I don't yet have debugging capabilities; that is in fact the purpose of getting the UART working to use it as an improvised way of getting debugging statements out of the chip.

Can you point me out to the chapter in the datasheet regarding the UART clock configuration? That would really help me find my way through the mbed libraries and figure out whether it is active or not.

Cheers,

Alex.

0 件の賞賛
732件の閲覧回数
alex323qp
Contributor III

After having a quick look to the mbed's serial_api.c library, it seems that the UART1 clock is being enabled:

SIM->SCGC4 |= SIM_SCGC4_UART1_MASK;

I also tested adding the line to my main() method (just in case), but the problem persists. Any other idea?

Cheers,

A.

0 件の賞賛