Rocnetnode on BBB

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 04:51

A few notes for those that want to port Roonetnode to Ubuntu on the BeaglenBone Black.

Enable and use I2C bus #2.

To enable i2c-2 put the following in /etc/rc.local

Code: Select all

echo "BB-I2C1" > /sys/devices/bone_capemgr.*/slots
Change the rocnetnode.c to use i2c-1 and i2c-2 Do not use I2c-0 on the BBB. It is an internal only I2c Bus.

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 21.03.2014, 11:49

Hi Richard,

I added support in Rocnetnode for I2C-2 and in the Options Tab.
Can you check if this is OK for the BBB and add some info to the Wiki?
http://wiki.rocrail.net/doku.php?id=roc ... tup-en#i2c

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 13:46

That is wonderful Rob! Thanks very much.

As long as you are in the mood, there is one thing that is on my wishlist. Whenever a change is made and SET is clicked, what is displayed is the old value. To see the new value, GET has to be clicked. Could a GET be automatically sent after SET is clicked?

I just created a patch file for the BBB which changes /dev/i2c-0 to /dev/i2c-1. It also changes /dev/i2c-1 to /dev/i2c-2.

I will have to revisit it. Anyway the patch attached is for Rocrail versions 6986 through 7025.

What I did mostly was to change the check for the macro __arm__ to __ARM_ARCH_6__

The Rpi has __ARM_ARCH_6__ defined. The BBB has __ARM_ARCH_7A__ defined.

I also added some #ifdef __ARM_ARCH_6__ here and there.

Since the Rpi GPIO connected LEDS don't translate to the BBB hardware very well, I just disabled them for now. The I2C buses require no setup on the BBB. They are either there or they aren't

Instructions:
Download the Rocrail source package.
Download the patch file and save it to Rocrail/rocnetnode/impl/patchfile
cd to Rocrail/rocnetnode/impl/
run the command

Code: Select all

patch -i patchfile
build as normal.

All I checked was the function of the ADC sensors. I assume the rest is OK too.

By default i2c-2 is not enabled on the BBB. To enable it add the line below to rc.local

Code: Select all

echo BB-I2C1 > /sys/devices/bone_capemgr.*/slots
i2c-2 is the preferred bus to use on a BBB. i2c-0 is for internal use only as there are no physical connections for it. I2c-1 has some system devices reserved on it. I2c-2 is completely free.
You do not have the required permissions to view the files attached to this post.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 13:58

Rocview actually runs at an acceptable speed on the BBB. I never considered the speed of Rocrail on the Rpi to be acceptable.

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 21.03.2014, 14:08

Richard-TX wrote:As long as you are in the mood, there is one thing that is on my wishlist. Whenever a change is made and SET is clicked, what is displayed is the old value. To see the new value, GET has to be clicked. Could a GET be automatically sent after SET is clicked?
Which Rocrail revision are you using?
Which Rocnetnode revision are you using?
Which values are not correctly updated?

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 14:22

The values are the threshold value.

version 6978

go to programming -> rocnet -> options.

set threshold value to say 253 and click SET. Value then displayed is the old value or possibly zero if a GET was not performed since starting rocview.


.

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 21.03.2014, 14:55

Just one value...
You guys want them all. ;)

Just update.

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 21.03.2014, 15:26

ifdefs are not the right approach for this issue.

Use an parameter option to disable the LEDs and so on.

if( useGPIO ) {
}

The processor can be updated in the future and your code will stuck again.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 17:55

I could add a flag like that. Since this is processor specific I could not think of a way to have the code do something automatically without involving patching Makefiles, etc. If they change the processor then the base architecture will have changed as well.

Patches only work if the base code does not change significantly.

I will think about it some more.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 21.03.2014, 18:20

In thinking about this issue some more, I think a lot depends if the BBB is going to be supported or not. I went with the assumption that it would not be supported for the near future. So if that is the case I wanted to keep the code modifications to a bare minimum. I also wanted to make the mods fully compatible with the intended Rpi architecture.

I suppose I could do something like this in a header file.

Code: Select all

#ifdef __ARM_ARCH_6__
#define useGPIO 1
#endif
then do the conditional if statement in c instead of relying on the macro processing of cpp.
Would that be acceptable to you Rob?

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 21.03.2014, 22:01

No, that again an ifdef for a processor...
I can offer an Option for using GPIO or not.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 22.03.2014, 02:41

I could add to the makefile.

Maybe something along the lines of "make PLATFORM=BBB all"

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Re: Rocnetnode on BBB

Post by Richard-TX » 22.03.2014, 03:39

Rob.

I modified the makefile. By default it make a binary for use with the Rpi. It is only when PLATFORM=BBB that the BBB version is built.

Does that sound good to you?

I still use #ifdefs in the code. If you want a c construct instead, let me know.

richard

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 22.03.2014, 07:12

Hi Richard,

I don not want both of them.

Lets clarify things first:
You want to disable GPIO for the BBB: LEDs and Button.
If so I would like to add an Rocnetnode Option to disable it which in the code will be implemented with a contruct at low level: io.c

rjversluis
Site Admin
Posts: 42306
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Rocnetnode on BBB

Post by rjversluis » 22.03.2014, 08:26

In fact you only have to change line 31 in io.c:

Code: Select all

#if defined __arm__ &! defined __ARM_ARCH_7A__
The write/read port calls will end in the dummy function; No need to ifdef them.

Post Reply

Return to “DIY Hardware”