atmel starts python bridge process

Greetings,

Because my python skills are worse then rusty, I want to do the same by using Java. I installed jamvm and now Im pulling my hair out on how the Atmel side starts that python bridge process when the brudge is started on the Atmel side ...

Tips or suggestions anyone?

Kind regards,

Jos

ps . Im typing this on a darn tablet.sorry for the typos. Stupid tablets ...

I would start by looking at
void BridgeClass::begin()

in the Bridge.cpp class

Personally I think if it is just because you don't know Python that well, it would be less work to call the couple of Python things from within Java (I assume you can do so).

NewLine:
I would start by looking at
void BridgeClass::begin()

in the Bridge.cpp class

Personally I think if it is just because you don't know Python that well, it would be less work to call the couple of Python things from within Java (I assume you can do so).

Thanks for the tip; and you're right: I haven't programmed in Python for years, that's why I want to do it in Java. That jamvm looks promising. I did some further reading on both sides: the Linux side already has a shell running on that serial line. On the Atmel side it is known as Serial1; all the Bridge object does is make the Linux side start up a run-bridge process (a shell script in /usr/bin); the script starts up Python that reads and writes from/to its stdin/stdout streams. It sets its streams to raw mode (I don't know why yet).

Replacing the entire machinery by java should be easy (I don't need all that functionality because I want to use the Atmel as a 'slave' unit that just does the hardware fiddling, orchestrated by the Linux side).

kind regards,

Jos

JosAH:
It sets its streams to raw mode (I don't know why yet).

Because the 32u4 and linux sides of the Bridge speak a binary protocol, in order to transfer less bytes and make it faster

JosAH:
Replacing the entire machinery by java should be easy (I don't need all that functionality because I want to use the Atmel as a 'slave' unit that just does the hardware fiddling, orchestrated by the Linux side).

It would be very nice to see a java implementation of the Bridge. Remind that some of that machinery is needed because by default that Serial is used by linux to print its debug messages: that adds noise to the communication and the Bridge filters that out.
There are threads where users have disabled those debug messages (search the forum for "inittab") hence removing the noise

While the Atmel processor can send and receive any possible byte values, it is 'ruined' by the Python layer that treats any '\0' value as an end of C string (also see a recent post by user NewLine).

I haven't seen any debug messages passing by at all; I tested the communication layer of my Java attempt of a Bridge and the Linux OS was completely silent. I had to install the 'stty' package to make the terminal line shut up and not echo anything at all (stty -echo raw) and everything works fine now: everything send/received from Serial1 on the Atmel side arrives on the Linux Java side as System.in/System.out. Java can't do any ioctl, that's why I had to install the stty package.

The communication is quite fast: at 250000 baud more than 5000 bytes/second can be send/received correctly (without any CRC calculations)

kind regards,

Jos

JosAH:
I haven't seen any debug messages passing by at all; I tested the communication layer of my Java attempt of a Bridge and the Linux OS was completely silent. I had to install the 'stty' package to make the terminal line shut up and not echo anything at all (stty -echo raw) and everything works fine now: everything send/received from Serial1 on the Atmel side arrives on the Linux Java side as System.in/System.out. Java can't do any ioctl, that's why I had to install the stty package.

Very interesting. What do you exactly mean by "I had to install the 'stty' package"?
Or did you add the applet to busybox?
Have you install coreutils-stty?

Nice one Jos, do you have source code to share?

Not yet really, the mechanism works ie the Atmel can start jamvm with my jar file and my java code can pass a few sample commands back to the Atmel side. My bridge version pushes simple requests to the Atmel side, reads back the reply and sends it back to its TCP connection. The Atmel cant really push messages to the Java bridge (yet). I use the Atmel processor as a dumb device driver ....

Kind regards,

Jos

Ps sorry for the typos, Im typing this on a silly tablet again.

Could you please elaborate on what you meant by "I had to install the 'stty' package"?

mamu:
Could you please elaborate on what you meant by "I had to install the 'stty' package"?

Of course, I'm sorry, but my IE11 refused to display the forum pages after I logged in (stupid IE stuff ...) The serial1 line is treated full duplex, i.e. what one party sends is send back by the other party and the behaviour confused my simple Java bridge; Java doesn't have any ioctl so I had to set the line to -echo and raw mode in a shell script (that starts javmvm afterwards); the script also sets the line back to echo and sane mode afterwards; I had to install (opkg) the coreutils-stty package for it.

kind regards,

Jos

ps. My laptop is running Chrome now; I got sick and tired of that silly little tablet (my IE11 browser completely goofed, and all I had was my old Linux laptop (it's upstairs) and that silly tablet)

Okay, thanks a lot.
Will play with this because right now I have to change inittab and I would like to get rid of this change and get non-interfered Serial1 support from Linino.

BTW: Does anyone know why the BusyBox of Linino does not include the stty applet?

I don't know, but my guess is size. There are a lot of busybox features that aren't in the standard install.

All it takes to get what you want is

opkg update
opkg list |grep coreutils
opkg install ...

Thanks. Would be nice to have a more complete documentation for Yun.

I already made some tests and disabling the tty echo would solve my problem of modifying inittab to shut up Linino site.
Currently I use this line in rc.local

(python myscript.py)&

And I would like it to change to

(stty -echo;python myscript.py)&

But this does not work.
Any hints on what I'm doing wrong?