Question

I use a Beaglebone black, which runs on Android, in a project I work. I need to use UART1. As I understand I have to configure the MODE of UART1. It must be MODE0. I can do it via adb with these command:

echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd

echo 0 > /sys/kernel/debug/omap_mux/uart1_txd

Everything works fine like that. But real problem is, I have to do this configuration inside the application, I am coding. But I don't have permission to execute these shell command, because I'm not rooted. So:

1) How can I root my beaglebone black to execute these shell commands?

2) Or is there a way to give permission to write these files? I can execute chmod 777 /sys/kernel/debug/omap_mux/uart1_rxd via adb and have write permission inside my app. But of course it isn't a solution, because when beaglebone restarts the permissions are lost.

Simply I want to use UART1 (or any other UART) for serial communication. But all shell commands must be executed inside my app. How can I do that?

Was it helpful?

Solution

I found the solution. I'm posting it for anyone who might need it.

1) Mount SD card, which have Android image, to your PC

2) Open console and mount rootfs partition

3) open init.rc with nano command

nano init.rc

4) There are shell commands, which run in boot section. Add following shell commands to somewhere of your choice:

chmod 0666 /sys/kernel/debug/omap_mux/uart1_rxd
write 20 /sys/kernel/debug/omap_mux/uart1_rxd 20
chmod 0666 /sys/kernel/debug/omap_mux/uart1_txd
write 0 /sys/kernel/debug/omap_mux/uart1_txd 0

5) Save file and boot your Beaglebone with the SD card.

Now you have permision to read/write to /sys/kernel/debug/omap_mux/uart1_txd and /sys/kernel/debug/omap_mux/uart1_rxd. And their modes are set to MODE0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top