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!
Solved! Go to Solution.
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
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
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?
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
Actually the serial devices are connected to two different pairs but the same UART Figure below shows how they are connected to K60:
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?
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
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
Thanks Luis! that's what I was thinking,