Rocnetnode on BBB

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, 10:14

rjversluis wrote: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
That is most of it. I also need to eliminate any GPIO addressing. There is some GPIO setup that is done.
I am working on the code some more. I will let you know what I find.


Richard

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, 10:19

rjversluis wrote: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.
I will try that and see if that covers everything.


Richard

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, 11:30

Rob,

I changed line 31 in io.c to

Code: Select all

#if defined  __arm__ &! defined __ARM_ARCH_7A__
That took care of all of the GPIO issues.

I also had to change rocnetnode.c as the i2c bus numbers were not right. I could not address i2c-2. I2c0 = I2c1 and i2c1 = i2c0


Here is what lines 2983+ look like.

Code: Select all

  if(data->iotype == IO_I2C_0) {
    /* i2c-0 Rev. 1*/
    data->i2cdevice = "/dev/i2c-0";
    __initI2C(inst, 1);
  }
  if(data->iotype == IO_I2C_1) {
    data->i2cdevice = "/dev/i2c-1";
    __initI2C(inst, 2);
  }
  if (data->iotype == IO_I2C_2) {
    /* default i2c-1 Rev.2 */
    data->i2cdevice = "/dev/i2c-2";
    __initI2C(inst, 3);
  }
I replaced the else statement with an if. I don't like else statements except for error trapping.

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, 11:43

Hi Richard,

I hope I fixed it now. ;)
git pull

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, 12:41

Rob,

Just ran a test. Looks great but....
I2c bus1 and bus0 are swapped. When I select bus0 I am actually using bus1. It is a little confusing. I believe that the bus numbers used when running i2cdetect should match what is in rocrail.

What do you think Rob?

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, 12:46

I think this is what you want,

Code: Select all


 if(data->iotype == IO_I2C_0) {
    /* i2c-0 Rev. 1*/
    data->i2cdevice = "/dev/i2c-0";
    __initI2C(inst, 1);
  }
  if(data->iotype == IO_I2C_1) {
    data->i2cdevice = "/dev/i2c-1";
    __initI2C(inst, 2);
  }
  else {
    /* default i2c-1 Rev.2 */
    data->i2cdevice = "/dev/i2c-2";
    __initI2C(inst, 3);



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, 12:52

Thats historically:

Code: Select all

#define IO_I2C_1 0
#define IO_I2C_0 1
#define IO_I2C_2 2
#define IO_DIRECT 3
Its just mapping.

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, 13:32

I sort of understand why but I suppose it is too late to change it now. It should have never been done. The Raspberry people should have not moved things around between the A and the B versions either. Oh well. BBB users should only use I2C-2 anyway.

We can close this chapter. Now rocnetnode should be completely portable and will automatically make the correct version and that is a wonderful thing!

Good Job Rob and thanks for your valuable assistance.

I have two more BBB ordered and should arrive here in a couple of days. I will put one under the layout with some Rpi07 detectors.

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, 15:33

Richard-TX wrote:The Raspberry people should have not moved things around between the A and the B versions either.
Yes, it very annoying.
I try to keep Rocrail backwards compatible; A plan.xml and rocrail.ini from 10 years ago should load. (Except for the route changes.)

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

Re: Rocnetnode on BBB

Post by Richard-TX » 27.03.2014, 00:17

This reminds me of a bad joke I heard long ago.

Two wrongs don't make a right....but two (w)rights made an airplane. :roll:

Post Reply

Return to “DIY Hardware”