PINE64

Full Version: I2C Expansion Board
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Yup...that fixed it. Works fine with debian-mate.
(07-26-2016, 08:51 AM)Artyom Wrote: [ -> ]
As I undestand you switch on pull up resistors? You using pullup register to do that?

Thanks Artyom !

Pullup resistors (internal or external) have the same purpose of holding (either weak or strong) an input GPIO  at logic level 'high' or '1'.   To signal the input, then all the device has to do is provide a 'ground shot'; pulling the input pin low for some period of time.  

Input switches are often used this way. The internal pullup is cool, because it requires less external circuit components. 

marcus
'
(07-26-2016, 10:52 AM)MarkHaysHarris777 Wrote: [ -> ]
(07-26-2016, 08:51 AM)Artyom Wrote: [ -> ]
As I undestand you switch on pull up resistors? You using pullup register to do that?

Thanks Artyom !

Pullup resistors (internal or external) have the same purpose of holding (either weak or strong) an input GPIO  at logic level 'high' or '1'.   To signal the input, then all the device has to do is provide a 'ground shot'; pulling the input pin low for some period of time.  

Input switches are often used this way. The internal pullup is cool, because it requires less external circuit components. 

marcus
'
Can anyone publish code on C++ to test light and humidity sensor. Simple write to console result of measurements. Do any have this? A I'm new in programming on c++. I am learn...
On the second I2c Port (TWI-SDA and TWI-SCL), which is connected to the Pin 28 & 29 of Pi-2 Connector, is on port PL8 and PL9 of the MCU. The base address of the MCU I/O configuration register for this Port L is on 0x01F02C00. To enable the I2c function for this pin, we need to configure the PL Configuration Register 1(by default, the MCU disable the i/O function of this 2 pin during power up). The detail of the setting can be found at the MCU User Manual on page 410 to page 416.

I think (some one please correct me if I am wrong) all this setting has to be done in the linux kernel in order for the user land program to be able to access it. Since I am not very good in linux kernal, may be someone which is good in it can help out. Thanks.

Regards,
KH Goh
(07-26-2016, 09:17 PM)khgoh Wrote: [ -> ]On the second I2c Port (TWI-SDA and TWI-SCL), which is connected to the Pin 28 & 29 of Pi-2 Connector, is on port PL8 and PL9 of the MCU. The base address of the MCU I/O configuration register for this Port L is on 0x01F02C00. To enable the I2c function for this pin, we need to configure the PL Configuration Register 1(by default, the MCU disable the i/O function of this 2 pin during power up). The detail of the setting can be found at the MCU User Manual on page 410 to page 416.

I think (some one please correct me if I am wrong) all this setting has to be done in the linux kernel in order for the user land program to be able to access it. Since I am not very good in linux kernal, may be someone which is good in it can help out. Thanks.

Regards,
KH Goh
Thank you very much.
(07-26-2016, 09:17 PM)khgoh Wrote: [ -> ]On the second I2c Port (TWI-SDA and TWI-SCL), which is connected to the Pin 28 & 29 of Pi-2 Connector, is on port PL8 and PL9 of the MCU. The base address of the MCU I/O configuration register for this Port L  is on 0x01F02C00. To enable the I2c function for this pin, we need to configure the PL Configuration Register 1(by default, the MCU disable the i/O function of this 2 pin during power up). The detail of the setting can be found at the MCU User Manual on page 410 to page 416.

I think (some one please correct me if I am wrong) all this setting has to be done in the linux kernel in order for the user land program to be able to access it. Since I am not very good in linux kernal, may be someone which is good in it can help out. Thanks.

Regards,
KH Goh
hello khgoh,
i also add my thank you for your work on this issue. i appreciate it. i would like to know if it will be possible in the future , once the kernel issue is resolved, to have both banks [ports] of I2C enabled at same time or if it would be a situation of one or the other at any given time?  also, a more general question since this is first time i have had multiple connections to this extent, will these connections be hot-plugable while power on state? what i mean is can i unplug any given connection and plug in something else, like a usb port allows me to do, while the power is on? of course proper care given to handling is understood. thanks again.
(07-27-2016, 12:51 AM)dkryder Wrote: [ -> ]
(07-26-2016, 09:17 PM)khgoh Wrote: [ -> ]On the second I2c Port (TWI-SDA and TWI-SCL), which is connected to the Pin 28 & 29 of Pi-2 Connector, is on port PL8 and PL9 of the MCU. The base address of the MCU I/O configuration register for this Port L  is on 0x01F02C00. To enable the I2c function for this pin, we need to configure the PL Configuration Register 1(by default, the MCU disable the i/O function of this 2 pin during power up). The detail of the setting can be found at the MCU User Manual on page 410 to page 416.

I think (some one please correct me if I am wrong) all this setting has to be done in the linux kernel in order for the user land program to be able to access it. Since I am not very good in linux kernal, may be someone which is good in it can help out. Thanks.

Regards,
KH Goh
hello khgoh,
i also add my thank you for your work on this issue. i appreciate it. i would like to know if it will be possible in the future , once the kernel issue is resolved, to have both banks [ports] of I2C enabled at same time or if it would be a situation of one or the other at any given time?  also, a more general question since this is first time i have had multiple connections to this extent, will these connections be hot-plugable while power on state? what i mean is can i unplug any given connection and plug in something else, like a usb port allows me to do, while the power is on? of course proper care given to handling is understood. thanks again.
Hi,
For the program that enable the internal pull up on the I2c pin, I already enable the pull up for both of the I2c port. Once the kernel part is resolved, running the program will also turn on the internal pull for the 2nd I2c port.

As for hot plugging the I2c device, on the hardware side, all the i2c pin on the POT board and also on the sensor board already build with spike protector to protect the IC during hot plug. So, as far as the hardware concer, It should be no problem for the hardware to connect the device while power on. 

But on the software application side, your application must also support this feature.

Regards,
KH Goh
Testing humidity and temperature sensor with KH GOH patch for I2C POT Board.

[Image: c5fba2b953900e2762361e32b9b8664f.jpg]

[Image: 2b6659f315c0a08aefecba2021045c6e.jpg]

As you see sensor work. Great thanks all who help solve this problem.

If you want repeat this experiment you can download test programm from github.com here:
Https://github.com/ControlEverythingComm...C/SI7021.c

After downloading source file compile them:
gcc SI7021.c -o test
Then run it:
./test
Their (controleverything.com) python code for the STS21 module is what I used for some quick testing initially.

https://www.controleverything.com/conten...t_tabset-2

Of course, one could have saved themselves some time if they had just searched a bit more to see that they had a 7021 module of the same type.. Smile

https://www.controleverything.com/conten...I7021_I2CS
I had a look at the devicetree-file we use for the Linux kernel. Seems the I2C Interface for pin PL8/9 is not mapped. I then checked the usermanual and found out that this particular interface is actually different from TWI0/TWI1/TWI2.... it is named R_TWI and while it is the same hardware block, it does not sit on the APB2 bus like the others, it sits in the secure domain of the SoC on the APBS bus... so you can't just copy the dts entry from the others, fix the addresses/clocks/pins and call it a day... I am not sure what implications this has for adding it to the devicetree-file but I looked at R_UART - which is already configured (the name in the dts is s_uart though....) and found out that the secure devices have their own pin-control section, so that seems to be doable. What I do not know, what clock needs to be assigned to drive devices on the APBS bus? Also what are the correct IRQ definitions, I looked at the GIC IRQ table from the usermanual but couldnt figure out how the IRQ line numbers and vectors translate to the interrupt entries in the dts...
Pages: 1 2 3 4