Dynamic pin assignment for serial port on Kinetis running MQX 3.8.1

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

Dynamic pin assignment for serial port on Kinetis running MQX 3.8.1

ソリューションへジャンプ
1,261件の閲覧回数
Jeronimo479
Contributor II

In the file, init_gpio.c, there is a function, _bsp_serial_io_init() that is used to initialize the hardware pins used by each UART device. The port&pins are hard-coded to a port and mux assignment via a switch statement with no parameters.

On my rev 1 board I want to use Port XYZ Alt N, but on my Rev 2 board I want to use Port PDQ Alt M. I want my CPU to discover what board type I'm running on and use the correct pins for that board. How can I do this at run-time if the function wants them to be hard-coded in the library?

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 解決策
1,013件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Unfortunately there is no way to do that without modifying the MQX code.

One thing you can do is to add a new option in the ioctl of the driver you want to use.

You have to modify the uint_32 _kuart_polled_ioctl function in the serl_pol_kuart.c and add the command or option to change the pins to be used. Similar way as you modify the baud-rate, parity and other parameters.

Other way is to modify directly to the registers in the application, just like in a bareboard project.

I hope this helps.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,014件の閲覧回数
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Unfortunately there is no way to do that without modifying the MQX code.

One thing you can do is to add a new option in the ioctl of the driver you want to use.

You have to modify the uint_32 _kuart_polled_ioctl function in the serl_pol_kuart.c and add the command or option to change the pins to be used. Similar way as you modify the baud-rate, parity and other parameters.

Other way is to modify directly to the registers in the application, just like in a bareboard project.

I hope this helps.

0 件の賞賛
返信