more G-Labs products

Author Topic: Raspberry 2 MCP23017 Error  (Read 16632 times)

February 22, 2015, 04:28:17 PM
Reply #15

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Well... I found out that I applied corrections of base address only to the GPIO class but not to the I2C one (didn't notice of duplicated code for Interop.cs).
So I'm attacching the fix. These are changes I just made:

https://github.com/genielabs/raspberry-sharp-io/commit/1d5dce1dadd3f1bb3e5539909669a7495c816ad3

Hope it works!
g.

February 22, 2015, 07:09:15 PM
Reply #16

funworld

  • *
  • Information
  • Newbie
  • Posts: 20
Hi Gene,

Sorry but I get still  errors!
1. when I start inside the editor

Error
×
    Object of type 'HomeGenie.Automation.Scripting.ScriptingInstance' doesn't match target type 'HomeGenie.Automation.Scripting.ScriptingInstance'

2. when starting the modul smartIC mcp23017

CR: Read operation failed with BCM2835_I2C_REASON_ERROR_NACK status

THX
 funworld
« Last Edit: February 22, 2015, 07:38:17 PM by funworld »

February 22, 2015, 07:52:46 PM
Reply #17

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Did you restart HG after copying the new libraries? Try also recompiling the program.
Can you provide output of command
Code: [Select]
cat /proc/cpuinfo
from your RPi 2?

g.

February 22, 2015, 08:46:01 PM
Reply #18

funworld

  • *
  • Information
  • Newbie
  • Posts: 20
Hello,
yes,  I make a restart and can command with putty!
my cpuinfo

processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 1
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 2
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 3
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : BCM2709
Revision        : a01041
Serial          : 000000006e92fXXX

root@raspberrypi:~# i2cset -y 1 0x20 0x00 0x00
root@raspberrypi:~# i2cset -y 1 0x20 0x14 0x01
root@raspberrypi:~# i2cset -y 1 0x20 0x14 0x00
root@raspberrypi:~# i2cget -y 1 0x20 0x14
0x00
root@raspberrypi:~# i2cset -y 1 0x20 0x14 0x01
root@raspberrypi:~# i2cget -y 1 0x20 0x14
0x01
root@raspberrypi:~# i2cset -y 1 0x20 0x14 0x00

regards

« Last Edit: February 22, 2015, 09:00:27 PM by funworld »

February 22, 2015, 09:53:28 PM
Reply #19

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi all,

my CPU info is attached.

Going to investigate your changes Gene.

Where did you get the info about  different base address?

What url for svn should I use if I want to use the same code base as HG?
It's not clear to me where the master is.

Regards,
Wibo.


February 22, 2015, 11:40:09 PM
Reply #20

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi guys,

so the problem might be the wrong Revision I used to detect RPi2:

https://github.com/genielabs/raspberry-sharp-system/blob/master/Raspberry.System/Board.cs#L182

I got it from some forum, can't remember where... the reported revision in that forum was 0x1a01040.
The revision reported in your infos is different --> a01040.

@Wibo, the base address was get from a post on the raspberry forum site:
http://www.raspberrypi.org/forums/viewtopic.php?f=72&t=98400&p=701074&hilit=0x3F000000#p701074

I will change the revision number used for detecting RPi2 later and post the update here.

It would be useful if some of you could verify RPi2 detection directly from source code by running the test program contained here:
https://github.com/genielabs/raspberry-sharp-system

@Wibo raspberry-sharp libraries used in HG are two:
1) one is raspberry-sharp-system that just detect the board type and can be found at the above link
2) the second one is raspberryshar-io that contains all the class for working with gpio/i2c/spi and other components. this can be found here: https://github.com/genielabs/raspberry-sharp-io

g.


February 23, 2015, 12:20:24 AM
Reply #21

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hey guys,

thanks to your cpuinfo I finally made the raspberry-system detect RPi2.
I used Wibo file as input and so fixed to make it work.
Attacched the fixed dll (to be used with the previously attacched raspberry-sharp-io).

https://github.com/genielabs/raspberry-sharp-system/commit/fb2dc2a0d5de0b61b3055cc4b5384aaf357c17de

I'll keep finger crossed  ;)

Cheers,
g.

February 23, 2015, 06:36:29 PM
Reply #22

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
HI gene,

thx for the info, I'm on it.

Regards,
Wibo.


February 23, 2015, 07:26:14 PM
Reply #23

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Output from the Test.Board.exe attached.

Already wandered where the Raspberry.System.dll came from.
High resolution timer was on my wishlist, nice!

Going to check if I can get I2C online.

Regards,
Wibo.

February 23, 2015, 09:07:52 PM
Reply #24

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi Gene,

did a fresh build from https://github.com/genielabs/raspberry-sharp-system r209
Checked Raspberry.System.dll, think nuget copied it into the solution.
It was the same(size: 11264)) as produced by the Test.Board.exe solution.
Copied all 7 dll's into the r480 folder on Pi2 and got same error in HG.

Replaced Raspberry.System.dll from Test.Board and rebuilded.
Copied and tested, error still lives.

Suddenly the Raspberry.System.dll was 11288 bytes, I didn't change anything, just a rebuild.
Is Nuget doing this?
Repeated the whole drill to no avail.

Downloaded your dll which was also 11288 bytes, repeated the whole drill and no results.

Going to do some debugging...

Regards,
Wibo.


February 23, 2015, 11:43:38 PM
Reply #25

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Wibo,

I packed up all the patched raspberry-sharp dll into the new r480 deb and tgz (testing folder).
So you can try to run HG and see if I2C is now working without struggling with source code.

g.


February 24, 2015, 12:22:01 AM
Reply #26

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi Gene,

Going to sleep now, will try that tomorrow...

Is there any easy way to replace Raspberry.System.dll without modifying the raspberry-sharp solution and projects, they are all expecting the dll to be in the bin/debug.?

Your attempts to only use HG will be futile.
I'm a source guy and HG can never give me all I want, but I'm trying to do as much as integration as possible.

I'm a control freak, just like you.

Regards,
Wibo.


February 24, 2015, 01:09:31 AM
Reply #27

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
All right source guy  :)
Yes, all dll are expected to be in the bin/debug.

Cheers,
g.

February 24, 2015, 09:04:08 PM
Reply #28

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Hi Gene,

have the I2C working on RPi2.

Your changes used the wrong base address.
bscBase: 0x20804000
gpioBase: 0x3F200000

I2cDriver.GetBscBase return the wrong address.
It gets a rev 3 from GpioConnectionSettings.BoardConnectorRevision
Your switch case 3 is the only case where you don't replace the base address.

When I change bscBase into 0x3F804000 it works.

Thank God for source code.  8)

Regards,
Wibo.



February 24, 2015, 10:10:19 PM
Reply #29

Wibo

  • ***
  • Information
  • Full Member
  • Posts: 95
Forgot some info...

If you want to cleanup all the experiments...

These are the pins used:
const ConnectorPin sdaPin = ConnectorPin.P1Pin03;
const ConnectorPin sclPin = ConnectorPin.P1Pin05;

After calling ToProcessor() on the ConnectorPin they result in ProcessorPins.
sdaCpuPin: Pin02
sclCpuPin: Pin03

The processor pins go into the I2cDriver and that's what your testing in method GetBscBase()

All this info was gathered on RPi2, but the same testing code works on RPiB+ too (without the 0x3F804000 hack)

Regards,
Wibo.
« Last Edit: February 24, 2015, 10:13:41 PM by Wibo »