ERROR READ WITH AT24C32
Moderator: Benj
ERROR READ WITH AT24C32
Hello guys
I have a problem with the read macro of the serial eeprom component 24c32.
I am using an at24c32 microchip chip in a 5 pin sot23 package.
As from the "write" pdf the writing is performed correctly at the specified address, write 0x04 to the address 0xA0. When I go to read the address 0xA0 the macro reads correctly the value at the address A0 but does not receive the stop by the master.
Reading the datasheet of the chip, upon receiving the no ack, at the end of the random read of a single byte, the master must send the stop to the eeprom. This does not happen as can be seen in the document "read."
I also tried using i2c hardaware but it does not work by returning a completely wrong address.
I'm using a pic32mx470f512h
Thanks in advance
I have a problem with the read macro of the serial eeprom component 24c32.
I am using an at24c32 microchip chip in a 5 pin sot23 package.
As from the "write" pdf the writing is performed correctly at the specified address, write 0x04 to the address 0xA0. When I go to read the address 0xA0 the macro reads correctly the value at the address A0 but does not receive the stop by the master.
Reading the datasheet of the chip, upon receiving the no ack, at the end of the random read of a single byte, the master must send the stop to the eeprom. This does not happen as can be seen in the document "read."
I also tried using i2c hardaware but it does not work by returning a completely wrong address.
I'm using a pic32mx470f512h
Thanks in advance
- Attachments
-
- EEPROM_READ_MACRO.pdf
- (216.94 KiB) Downloaded 303 times
-
- EEPROM_WRITE_MACRO.pdf
- (197.41 KiB) Downloaded 335 times
-
- AT24C32E+pic32.fcfx
- (10.58 KiB) Downloaded 291 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ERROR READ WITH AT24C32
Hello,
In your project file please can you click on Help -> Check for updates and make sure everything is up to date.
If everything is up to date then tick the "Show up to date files" checkbox
Find the serial_eeprom component and try changing the new revision from 6 to 5.
Click Download, then OK and restart Flowcode.
Try compiling with the v5 component and let us know if this makes any difference, v6 of the component deals with allowing other I2C devices to control the bus and so this may have caused a bug on PIC32 devices.
In your project file please can you click on Help -> Check for updates and make sure everything is up to date.
If everything is up to date then tick the "Show up to date files" checkbox
Find the serial_eeprom component and try changing the new revision from 6 to 5.
Click Download, then OK and restart Flowcode.
Try compiling with the v5 component and let us know if this makes any difference, v6 of the component deals with allowing other I2C devices to control the bus and so this may have caused a bug on PIC32 devices.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ERROR READ WITH AT24C32
Hi Benj
I tried to do as you suggested but it doesn't work.
I noticed through logic analyzer that the clock is correct (100khz) up to "setup read" and then increases up to 125Khz.( RED)
I also tried to perform a read through the blocks of the "i2c master" but also in this case I have the same result.
I tried to do as you suggested but it doesn't work.
I noticed through logic analyzer that the clock is correct (100khz) up to "setup read" and then increases up to 125Khz.( RED)
I also tried to perform a read through the blocks of the "i2c master" but also in this case I have the same result.
- Attachments
-
- EEPROM_READ_MACRO_NEW.pdf
- (218.93 KiB) Downloaded 337 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ERROR READ WITH AT24C32
Hello,
If you add a delay between the Read and the Write then does this help at all? I've looked in the PIC32 CAL I2C code and it looks like we are waiting for events to happen e.g. the stop but maybe this is being skipped if the start is called again in quick succession.
Maybe also try the software channel and see if this helps at all? This will confirm if it's a component problem or a CAL problem.
If you add a delay between the Read and the Write then does this help at all? I've looked in the PIC32 CAL I2C code and it looks like we are waiting for events to happen e.g. the stop but maybe this is being skipped if the start is called again in quick succession.
Maybe also try the software channel and see if this helps at all? This will confirm if it's a component problem or a CAL problem.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ERROR READ WITH AT24C32
Hi benj
I tried to do what you asked but unfortunately did not solve.
I confirm that I am using the i2c software mode.
I am attaching the program with the personal cal eeprom.
I tried to move the delay before and after the rest but nothing changes.
It almost seems like he's trying to do a sequential and not a single read.I can confirm that the value of the data read is correct so the writing is done correctly
I tried to do what you asked but unfortunately did not solve.
I confirm that I am using the i2c software mode.
I am attaching the program with the personal cal eeprom.
I tried to move the delay before and after the rest but nothing changes.
It almost seems like he's trying to do a sequential and not a single read.I can confirm that the value of the data read is correct so the writing is done correctly
- Attachments
-
- EEPROM_READ_MACRO_DELAY.pdf
- (422.28 KiB) Downloaded 316 times
-
- AT24C32E+pic32.fcfx
- (13.92 KiB) Downloaded 307 times
Re: ERROR READ WITH AT24C32
I already tried this combination
I also tried inserting a ReceiveByteTransaction but without success.
The problem, in my opinion, is that when the master receives the NACK, he must stop the clock.
I also tried inserting a ReceiveByteTransaction but without success.
The problem, in my opinion, is that when the master receives the NACK, he must stop the clock.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: ERROR READ WITH AT24C32
Yes, that is true, although it is the master that sends the NACK when reading.when the master receives the NACK, he must stop the clock
In software mode the CAL code generates the clock.
It generates one for the Stop, so why does the clock continue to run after that?
I thought if you added a delay and took another scope trace it might help us deduce where the clock is coming from.
I presume you have nothing else connected to this I2C bus?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: ERROR READ WITH AT24C32
Just as a bit of a long shot, could you try dropping the attached file into
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT
- Attachments
-
- PIC32BIT_CAL_I2C.c
- (15.31 KiB) Downloaded 315 times
Re: ERROR READ WITH AT24C32
I replaced the file with the new one but nothing.
I'm using a mikro6lowpan demoboard.
The memory chip on the demoboard has been physically removed as photos.
doing further testing we think the problem is in the receive byte macro.
From the analysis of the logical states we assume that the ReceiveByte macro is not terminated correctly, it seems that the Nak is correctly sent by the MCU but in our opinion this does not happen .We think that the slave releases the bus, the logic analyzer interprets it as nak while the mcu is lost in some routine.
In fact the stop command not appear after the nak
I'm using a mikro6lowpan demoboard.
The memory chip on the demoboard has been physically removed as photos.
doing further testing we think the problem is in the receive byte macro.
From the analysis of the logical states we assume that the ReceiveByte macro is not terminated correctly, it seems that the Nak is correctly sent by the MCU but in our opinion this does not happen .We think that the slave releases the bus, the logic analyzer interprets it as nak while the mcu is lost in some routine.
In fact the stop command not appear after the nak
- Attachments
-
- EEPROM_READ_MACRO_1.pdf
- (209.94 KiB) Downloaded 328 times
-
- Demo_board.jpg (143.99 KiB) Viewed 7443 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: ERROR READ WITH AT24C32
Hi,
Thanks for the trials.
From your pdf the only conclusion I can come to so far is that the code in Master:RecieveByte is continuously looping creating the clock output.
Can I just check, did you put the CAL file into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT and re-compile?
(ProgramData is normally hidden by Windows)
Did you put a delay at the end of eeprom_read?
Although I don't think it's getting that far, but the delay was intended to prove that.
Thanks
Leigh
Thanks for the trials.
Yes, I agree.We think that the slave releases the bus, the logic analyzer interprets it as nak while the mcu is lost in some routine.
In fact the stop command not appear after the nak
From your pdf the only conclusion I can come to so far is that the code in Master:RecieveByte is continuously looping creating the clock output.
Can I just check, did you put the CAL file into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT and re-compile?
(ProgramData is normally hidden by Windows)
Did you put a delay at the end of eeprom_read?
Although I don't think it's getting that far, but the delay was intended to prove that.
Thanks
Leigh
Re: ERROR READ WITH AT24C32
I have one last question to ask you!
now at startup flowocde asks me to update the file that I replaced.
Can I replace it or not?
now at startup flowocde asks me to update the file that I replaced.
Can I replace it or not?
- Attachments
-
- not_genuine_i2c_flowcode.jpg (43.7 KiB) Viewed 7403 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: ERROR READ WITH AT24C32
Hi,
Sorry, not yet, the system still has the old version.
I'll ask Ben to push the new one
Leigh
Edit: You will be OK to download when the "New Revision" changes from 2 to 3
Sorry, not yet, the system still has the old version.
I'll ask Ben to push the new one
Leigh
Edit: You will be OK to download when the "New Revision" changes from 2 to 3
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ERROR READ WITH AT24C32
Hello,
Sorry for the delay the update should be available now.
Sorry for the delay the update should be available now.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel