I am trying to use I2C to talk with a FRAM and I am trying to understand how I terminate a read operation with the I2C driver. In the datasheet for the FRAM it lists 4 ways to stop the FRAM from continuing to send data to the bus.
1. bus master issues NOACK on 9th clock cycle and STOP in the 10th clock cycle.
2. bus master issues NOACK on 9th clock cycle and start in the 10th clock cycle.
3. bus master issues STOP in the 9th clock cycle.
4. bus master issues START in the 9th clock cycle.
How exactly would I do this with the driver?
I2C Read termination on a FRAM (FM24V02)
Moderators: RoccoMarco, lbednarz, tfAteba
-
Rick Burnett
- Posts: 150
- Joined: Tue Jan 08, 2013 2:20 pm
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: I2C Read termination on a FRAM (FM24V02)
The driver should automatically give a NACK at the end of the transfer I think.
giovanni
giovanni
-
Rick Burnett
- Posts: 150
- Joined: Tue Jan 08, 2013 2:20 pm
Re: I2C Read termination on a FRAM (FM24V02)
Time to break out the probes.
Okay, I kind of figured that was happening.
Re: I2C Read termination on a FRAM (FM24V02)
I've successfully been accessing FRAM on both 32F0 and 32F4 using just the normal I2C commands. Main 'gotcha' for me has been a failure to set up the I/O pins properly in the first place.
I've attached one of the drivers I'm using - bit overcomplicated as an example, since it writes buffers including a checksum.
I've attached one of the drivers I'm using - bit overcomplicated as an example, since it writes buffers including a checksum.
- Attachments
-
- gconf_fram.zip
- FRAM driver
- (2.7 KiB) Downloaded 392 times
-
Rick Burnett
- Posts: 150
- Joined: Tue Jan 08, 2013 2:20 pm
Re: I2C Read termination on a FRAM (FM24V02)
Discovered my code problem, it wasn't clear to me originally that the address of the I2C shouldn't contain the read/write bit. So, I was making it 8 bits and having 2 different addresses. Now that I fixed that, works perfect.
-
Rick Burnett
- Posts: 150
- Joined: Tue Jan 08, 2013 2:20 pm
Re: I2C Read termination on a FRAM (FM24V02)
Yeah, the board.h file got me awhile ago when doing USART stuff since I started with the 429 discovery board. I should have just created my own version in my code tree, but for now since I am just doing a bringup of subsystems, I'm fixing that file for each system. I had to change it for the USART, USB and I2C stuff.
Slowly experiencing all the systems of the STM32F4
Slowly experiencing all the systems of the STM32F4
Re: I2C Read termination on a FRAM (FM24V02)
Rick Burnett wrote:Discovered my code problem, it wasn't clear to me originally that the address of the I2C shouldn't contain the read/write bit. So, I was making it 8 bits and having 2 different addresses. Now that I fixed that, works perfect.
That's a favourite. Personally I prefer to quote the address as an 8-bit value including the R/W bit (set to zero) - gives a logical correspondence with the hardware level. Some software does it that way; other software does it the Chibi way, with a 7-bit value.
-
Rick Burnett
- Posts: 150
- Joined: Tue Jan 08, 2013 2:20 pm
Re: I2C Read termination on a FRAM (FM24V02)
Yeah, I would probably have preferred using an 8-bit value since that is what made the most sense to me when trying to use it. I guess I just think in terms of general memory mapping hardware and such, I'd rather have complete control over the address name. But, now I know what it is so I can live with that. Haha.