Something strange with I2C and AT24C32

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Something strange with I2C and AT24C32

Post by maharadga »

Hello everybody.
I bought DS3231 module with AT24C32 inside board. With DS3231 and I2C protocol no problem.
With AT24C32 I have problem. If I want write on it - everything is Ok.
But in read mode I found something strange.
When I use Macro called "write" with locals parameters "address_H", "address_L" and "data" I unable read from EEPROM.
When I use Macro called "write1" without locals parameters and write address and data directly - everithing is Ok.
I try sample file called I2CEEPROM from Matrix Help page but it also does not work /see attached picture/.
I attach Flowcode project.
Attachments
I2CEEPROM.JPG
I2CEEPROM.JPG (86.79 KiB) Viewed 5135 times
AT24C32.fcfx
(19.95 KiB) Downloaded 281 times

User avatar
tiny
Posts: 200
Joined: Wed Jul 08, 2009 8:29 am
Has thanked: 51 times
Been thanked: 93 times
Contact:

Re: Something strange with I2C and AT24C32

Post by tiny »

I use the same module, the address of the AT24C32 is at 0xAC and 0xAD (A0-A2 are connected via resistors to VCC). So it runs with me without problems.
Enclosed is a section of an I2C tracer.

Christina
24C32.pdf
(1.99 KiB) Downloaded 348 times

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Something strange with I2C and AT24C32

Post by maharadga »

Hello, Christina.
I not understand what you want to say me. Default 7 bit address of AT24C32 is 0x57.
With write bit is 0xAE, with read - 0xAF. My problem /I think/ is with Flowcode.
If I try use macro like pattern /will be easy use for different addresses/ I have problem.
I don't want manually write every address in many places. I attach circuit of the board but problem isn't there.
I can't explain why this happens and only in reading.
Attachments
DS3231+AT24C32.pdf
(59.5 KiB) Downloaded 295 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Something strange with I2C and AT24C32

Post by LeighM »

Hi,
You have an "easy to do" error in your read macro.
You have a data_Read parameter, but this cannot be used to return the read value.
You need to edit your read macro and give it a return type "byte", and then read the value from the I2c into .Return
(Or read the data byte into a Global variable, i.e. not a Local one that starts with a dot)
Modified Flowchart attached.
Hope that helps.
Leigh
btw. If you have Flowcode V7 then there is a 24C32 component, see Storage menu.
Attachments
AT24C32.fcfx
(19.85 KiB) Downloaded 299 times

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Something strange with I2C and AT24C32

Post by maharadga »

Thank You LeighM, you're absolutely right.
Sometimes I can watch without seeing something that will pulled my eyes. :lol:
Now everything is Ok.

Post Reply