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?
Solved! Go to Solution.
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.
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.