We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Use Serial Port for Lora Module

  • Hi Everyone,

    I'm trying to connect my Onion to a LoRa module.
    This module uses Serial Port. I can't find any instruction about how to communicate with Serial Port, I tried to plug to TX & RX on the extension dock (still I don't understand why there is a + and - on it and not on the onion itself) and I tried to send message through /dev/ttyATH0

    Have you ever use serial port to communicate with a module ?
    Thank you for your help,


  • Hi Dorian,

    Yes, I have connected a serial module to the Onion (an EnOcean Pi module), see below. Once you get it working hardware-wise I'd be interested to hear more about LoRa+Onion; that's something I'd like to experiment with myself some time šŸ˜‰

    Now for the serial port:

    First of all, these TX+/- and RX+/- lines are the Ethernet connections, not the serial port.

    The actual serial port is on the Omega's J1 (right side) connector, pins 5 and 6, see wiki. These pins are not available on the expansion dock's connector, but are internally connected to a Silicon Labs CP2102 serial to USB chip, to make the serial console available via the micro USB connector to a connected computer. You can see that in the schematics of the expansion dock. The schematic also shows that fortunately, there are resistors in these connections. This means that altough the Rx signal is driven from a CP2102 output, it can be overridden by a direct connection to the Rx pin on the omega itself, without the risk ruining the CP2102 or the connected module (current is limited by R91 to 3mA max).

    So that's how I connected my module - simply soldered two wires to pins 5 + 6 of the omega J1 connector, and connected these to my module's RX and TX. Of course, the module must be 3.3V powered for that - if it is 5V powered, the level on TX could damage the Omega! In my case, the module has very low power requirements so I just powered it off the 3.3V available on the Expansion Dock.

    Then there's a software side to take care of: the omega uses the serial port for the system console, which means your module will see all kernel messages, and your module's output might be seen as login attempts.

    To get the serial port for myself, I had to do two things:

    a) Prevent the kernel from writing any messages to the console:

    echo "0" >/proc/sys/kernel/printk

    b) prevent openwrt from awaiting a login on the console:
    Comment out the last line in /etc/inittab as follows:

    #::askconsole:/bin/ash --login

    Note these steps do not completely detach the serial port from the kernel (to do that, one probably would need to change the kernel command line in uboot). This means, at startup your module will still see kernel messages. And, if your module emits something at early boot, it might even get interpreted as input to uboot or failsafe mode and prevent proper bootup.

    I could solve this problem because my module has a "reset" pin. So I connected this to a GPIO such that the module is kept reset at startup, until after the kernel is silenced (printk in a custom init.d script). Only then I toggle the GPIO to activate the module, and can talk to it via /dev/ttyATH0 undisturbed.

    Hope this helps!

  • Just a quick update - with the Omega2 this will all get much easier, as the Omega2 has a second serial port on the pins that were labelled GPIO 13 and 14 on the Omega1 (see new pinout). And these pins are available on the dock connector!
    Also the software side will be probably simpler, because the second serial port will not be occupied by the system console.

Log in to reply

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