Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Witty Pi4 L3V7 charger status via i2c

6 Posts
2 Users
0 Likes
348 Views
(@mastalee)
Posts: 3
Active Member
Topic starter
 

Hello,

i'm using the Witty Pi4 l3v7 with a different board and was wondering if it is possible to eliminate the need to the GPIO connections except the I2C.

Is it possible to read the charger state (GPIO-5, GPIO-6) via an i2c register of the ATtiny?

I could also Implement this myself however i'm missing the schematic to see how the pins of the Attiny are connected to the other wittypi internals. Is it possible to get a simplified schematic of the board?

Cheers

 
Posted : 30/04/2024 6:12 pm
(@admin)
Posts: 478
Member Admin
 

I would suggest to make use of the I2C_CONF_RFU_3 register (with index 49). It has 8 bits and you actually only need 2 of them to keep the state. This register is currently not used by anyone else, so it is pretty suitable for such use case.

You will need to modify the current software or implement your own software to read the state of GPIO-5 and GPIO-6, and save the result to I2C register #49.

 
Posted : 30/04/2024 6:24 pm
(@mastalee)
Posts: 3
Active Member
Topic starter
 

Thanks for pointing me to the I2C_CONF_RFU_3 register. I had a similar idea of using one of the RFU registers, however is there documentation available how to read the GPIO-5 or GPIO-6 state from within the ATtiny? 

 
Posted : 30/04/2024 9:38 pm
(@admin)
Posts: 478
Member Admin
 

@mastalee That is not a correct direction. The MCU (ATtiny841) doesn't have physical access to other GPIOs on Raspberry Pi. There is no way it can read the GPIO-5 or GPIO-6 state directly.

If you want to tell the MCU to remember the state of GPIO-5 and GPIO-6, this job needs to be done by a software running on Raspberry Pi, who can read all GPIOs in the PI and can write the I2C registers in Witty Pi's MCU.

 
Posted : 01/05/2024 10:29 am
(@mastalee)
Posts: 3
Active Member
Topic starter
 

thanks for clarification.

Are all the gpio pins on the attiny used or are there some free ones?

 
Posted : 01/05/2024 10:48 am
(@admin)
Posts: 478
Member Admin
 

@mastalee Yes, they are all used.

See here: https://github.com/uugear/Witty-Pi-4/blob/main/Firmware/WittyPi4_L3V7/WittyPi4_L3V7.ino#L18-L34

ATtiny841 has 11 usable GPIO pins and they are all assigned already.

 
Posted : 01/05/2024 11:35 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.