Re-map UART pins

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,415件の閲覧回数
amleng
Contributor IV

Hello community,

On my project I use K60 and MQX. I have two peripherals connected to the cpu over uart ( pins PTE8&PTE9 and PTD8&PTD9). I noticed that these pins are connected to the same  UART5 in k60. which is mapped to ttyf in MQX.

So, my question is...is there any way to read from these two serial peripherals at one time? is it possible to re-map one of these pairs to another uart?

Cheers!

タグ(2)
0 件の賞賛
返信
1 解決策
1,821件の閲覧回数
LuisCasado
NXP Employee
NXP Employee

Hello,

You can SHARE the UART5 with the two channels but you can't receive data simultaneously from the two channels. You could poll the two devices. But you need two UARTS to receive simultaneous data from the two serial devices. When I told you switch dynamically I meant using the GPIO mux as multiplexor, pointing to one device or to the other.

Luis

元の投稿で解決策を見る

0 件の賞賛
返信
7 返答(返信)
1,821件の閲覧回数
LuisCasado
NXP Employee
NXP Employee

Hello,

Check the file :  C:\Freescale\Freescale_MQX_4_0\mqx\source\bsp\twrk60n512\init_gpio.c

_bsp_serial_io_init function

You can remap the UARTS there.

Luis

0 件の賞賛
返信
1,821件の閲覧回数
amleng
Contributor IV

Hello Luis,

Thank you for your reply. First I want to make sure we are on the same page. What I need is using those pins ( PTE8&PTE9 and PTD8&PTD9))  to read from two different serial devices AT THE SAME TIME. Based on k60 datasheet both pairs are connected to UART5. so if I change the _bsp_serial_io_init() then can I remap  them to UART4 for example?

0 件の賞賛
返信
1,821件の閲覧回数
LuisCasado
NXP Employee
NXP Employee

Hello,

I have never done that. But you would have to change the GPIO Mux to select two different pins for the same UART RX.  But do that dynamically, in my opinion, to have the UART assigned to GPIO pair like using an external multiplexor. But you can't connect two TX pins (output of your serial devices) to the same RX UART if they are not open collector.

Luis

0 件の賞賛
返信
1,821件の閲覧回数
amleng
Contributor IV

Actually the serial devices are connected to two different pairs but the same UART Figure below shows how they are connected to K60:

uart-multiplex.png

The serial devices send out data continuously (asynchronous). I need to read them simultaneously. So you think if I chnage the GPIO Mux dynamically in run time to scan these to channel then I won't loose any data? what if i read them in interrupt mode?

0 件の賞賛
返信
1,821件の閲覧回数
amleng
Contributor IV

Hi Luis, just want to make sure that your last message is still valid for the above block diagram and covers my concern regarding data lost during the switching between the two UARTs?

Cheers,

Sina

0 件の賞賛
返信
1,822件の閲覧回数
LuisCasado
NXP Employee
NXP Employee

Hello,

You can SHARE the UART5 with the two channels but you can't receive data simultaneously from the two channels. You could poll the two devices. But you need two UARTS to receive simultaneous data from the two serial devices. When I told you switch dynamically I meant using the GPIO mux as multiplexor, pointing to one device or to the other.

Luis

0 件の賞賛
返信
1,821件の閲覧回数
amleng
Contributor IV

Thanks Luis! that's what I was thinking,

0 件の賞賛
返信