Uart 2 always goes back to gpio



  • Hi Community,

    I recently bricked a couple of omegas (was clearly my fault as we used rubish power supplies which just stopped working during firmware Update).....Omega does not like this šŸ˜ž

    However, I loaded a new firmware onto the devices via USB and by fiddling a fancy FTDI serial converter onto the device in order be able to enter some commands.

    Everything is fine now, except that the UART2 output is by default set to GPIO (and I need it to be a serial port). Using omega2-ctrl gpiomux set uart2 uart works, but this will revert at the next reboot....

    Before the manual firmware Update, UART2 was set by default to UART, now it is set by default to GPIO.

    How can I set the default back to UART?

    Thanks,

    MK



  • @MK The most common solution people use if to add the omega2-ctrl command in your /etc/rc.local so it will execute at boot. If you need it set earlier in the boot process then you can modify the DTS to default it to uart, or if you're using the new beta 23.x firmware you can create a DTS overlay to override the DTS setting. Earlier than that you can modify u-boot to set the default.



  • @crispyoz : Thanks for this. Didn't really want to change rc.local as this is for me a "production file". Changing something in production isn't really easy from a process point of view šŸ˜ž

    However, I guess DTS are compiled somewhere in the Firmware....so making a change here won't be easy either.... I'll probably then go for the change in rc.local and hope it won't mess up things in production šŸ™‚ šŸ™‚



  • @MK rc.local is the lowest impact file, changing the DTS requires building new firmware, a DTS overlay requires deployment to your production system, if in fact you are using the 23.x Beta in production, otherwise you need to build new firmware.

    By default the rc.local is empty, it simply executes commands as if you were typing them at the command line.

    Of all the options, changing rc.local would be the easiest and the least risk, the other options I provided are more technically complex and easier to break things, but I provided them as they can set the muxing option at an earlier stage of the boot process, which may be your requirement.


  • administrators

    @MK I agree with @crispyoz that rc.local is the lowest impact file.

    To make it even more low impact, I would suggest adding a uci defaults file that changes rc.local instead of overwriting the default rc.local.

    UCI defaults are generally used to pre-configure the UCI configuration (/etc/config) in your images. But we also use this mechanism to pre-configure other things, like the login banner for example: https://github.com/OnionIoT/OpenWRT-Packages/blob/openwrt-23.05/omega2-base/files/etc/uci-defaults/14_banner

    More info on uci defaults here: https://openwrt.org/docs/guide-developer/uci-defaults



Looks like your connection to Community was lost, please wait while we try to reconnect.