Bonescript serial communication ttyO4

I would like to send and receive data from ttyO4 (P9_11, P9_13) using bone script. Unfortunately I didn’t find any projects or examples, how to make it with bonescript.
It should be just a normal serial connection with 9600 baudrate.

Does anybody have some tips, how I can access ttyO4 with bonescript?

Thanks.

I would like that too.

I think that bbb is just a new project and there is not a lot of examples on it.

Is there at least any books that could help on it? (for bbb not bbw)

I am not sure if you are still having issues - but I got this example working :

https://github.com/jadonk/bonescript/blob/master/test/test-serial.js

To get that version working, I had to do a few things:

  1. you have to have python on your bone

opkg update

opkg install python-compiler

  1. you need to shut off the python version check in /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js - I did this by typing

#nano /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js
then searching for semver.lt (^W) and then commenting out these lines (NOTE one does not get commented out):

// if (semver.gte(version, ‘2.7.3’) && semver.lt(version, ‘3.0.0’)) {

getNodeDir()

// } else {

// failPythonVersion(version)

// }

  1. switch paths to cloud9 (and maybe a reboot for good measure) - I am not sure why this is necessary - but it is…

cd /var/lib/cloud9

  1. Then install the latest bonescript version (0.2.3)

npm install -g bonescript

  1. test with

node -pe “require(‘bonescript’).getPlatform().bonescript”

  1. then open cloud9 and run his example code - and all seemed to work

I hope that helps

Thanks Chris!

I need bit more help. Can you tell me how did you set up your device tree? Or it worked without editing the tree?

The only changes I made were on the configure.js file (mentioned below) - nothing to the device tree. Just the steps below did not work or you?

It seems from the docs that in the default device tree, the uart pins are set to bidirectional. In serial communication TX should not be able to receive, and RX should not be able to send. I’m afraid that If I keep it default i.e. bidirectional, it might work weird or worst might fry the ports.

Well, thanks for the info. I’ll try it. I’m a newbie, so still learning how to edit the device tree.