![]() |
Forum Index : Microcontroller and PC projects : Talking to FRAM chips with I2C....
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Lou![]() Senior Member ![]() Joined: 01/02/2014 Location: United StatesPosts: 229 |
Hey Guys, Have you looked at the chip Zonker has on his new 28 pin board: FM31256-G (12.99 US$) here . It has a Real Time Clock with calibration register (should be very accurate) and 32k of FRAM. It would be nice to get that chip on the LCDuMite processor board. How about MMBasic code for that one ?? Or is it too specialized ?? Lou Microcontrollers - the other white meat |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
@Lou, Even though I've been using FRAM's for some time, I have only started using them for MicroMite projects. Initially for memory only (i.e. data loggers) so other onboard 'features' have not yet been utilised by myself. More and more FRAM's are just starting to appear with additional 'features' - to use these with the MicroMite will be very easy (just a few lines of MMBasic will get results) - just a matter of someone 'having a go' to produce the code. My funds are very low at the moment due to a couple of exciting new MicroMite products I am about to release. ![]() If anyone wants to buy a couple of Zonker's FRAM's and have a go at coding them then I will be more than happy to jointly help write some code to get things working (and I'm sure Grogster will chime in to help too). For anyone interested in FRAMs, a 2kx8 costs from AU$2 + shipping from all major suppliers. Break Out boards are available from Adafruit, but I would strongly recommend you consider Zonker's module as the FRAM is just one small part of a very useful Module . . . WW |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi Lou I have some chips on order when they arrive I will put together some code to drive them and post it. BTW Cypress ship via FedEx at no charge Regards Jman |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
Jman - Thanks for letting us know that Cypress (owners of Ramtron) ship free of charge. You persuaded me to spend more money that I don't have ![]() The only downside to their them is that it has just taken me over one hour in trying to place an order for a 31256 (Zonkers chip @ $12.05). Their website is a total pain in the a**e - otherwise a good purchase! Lets see how long it takes to arrive . . . . |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Would I be correct in assuming that those FRAM chips with embedded RTC etc, are addressed as two separate devices on the I2C bus? IE: It's all in the one package, but you address the FRAM part and the RTC part with different addresses. ....I would ASSUME that is the only logical way to do it with multi-function chips.... (but then, assumptions are the mother of all "Expletive deleted!" - up's.) ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Well your assumption is spot on from the data sheet "The RTC and processor companion functions are accessed via 25 special function registers, which are mapped to a separate I2C device ID." Slave Address (Slave ID = 1010b) that operates the same as a stand-alone memory device. The second device is a real-time clock and processor companion which have a unique Slave Address (Slave ID = 1101b)." Regards Jman |
||||
Lou![]() Senior Member ![]() Joined: 01/02/2014 Location: United StatesPosts: 229 |
Thanks jman, Wizz, I need an accurate RTC for a possible winter project (uMite repeater controller), and other accurate RTC chips seem to be going for near the same price as the Cypress chip. Since I mainly need the RTC, I figure in this case you get the FRAM for free. Great if you guys can share some code jman, Wizz. Maybe we can get a 'standard' going for the uMite RTC and FRAM. Lou Microcontrollers - the other white meat |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
Just read the data sheet for the FM31256-G FRAM; it looks like a real nice chip with some very useful additional features. Had an email regarding my order from The Cypress Store; they are shipping on Monday 6th (not sure from which part of the world though). Selected FedEx Priority so hopefully will be with me by end of business Tuesday. ![]() I will create a test PCB in the meantime and hopefully have code posted here by Wednesday evening (UK time). WW |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi Attached is some sample code to set and read the RTC in the Fram chips Please note this is untested as the chips have not arrived yet. If somebody has one maybe they could test it for me and post the result Regards Jman 2014-10-04_210833_FramRTC.zip |
||||
centrex![]() Guru ![]() Joined: 13/11/2011 Location: AustraliaPosts: 320 |
Hullo Grogster, WhiteWizard and Jman and others interested in FRAM. Has anyone come up with a workable I2C software to use a FRAM chip as a data logger. I have just received an Adafruit Fram breakout board and would like to get it going. I see from previous posts there have been a few problems, hopefully you have been able to sort them. Regards Cliff Cliff |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Hi-de-hi. Reading and writing is no problem at all, so long as you can get the data into the length of a MMBASIC string(256 bytes) for sequential writing, or if you only need to write every now and then with a few bytes, standard writing is no problem at all. How often do you need to write data, and how many bytes in each write? Smoke makes things work. When the smoke gets out, it stops! |
||||
centrex![]() Guru ![]() Joined: 13/11/2011 Location: AustraliaPosts: 320 |
Hi Grogster I want measure two voltages and two current values say 12.8 volts and say 10.5 amps these would be scaled to suit the micromite and read every 10 minutes or so. I will have to go over your previous posts and give the bits of code a try. Thanks for your help. Cliff Cliff |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Hi there. Try this: [code] A=1 'Set A to 1 at start of code [/code] SUBROUTINE: [code] SUB FRAM (V1,V2,I1,I2) I2C open 400,100 D$=chr$(A\256) + chr$(A Mod 256) + chr$(V1) + chr$(V2) + chr$(I1) + chr$(I2) I2C write &B1010000,0,6,D$ A=A+5 'Set A for the next cycle I2C Close End Sub [/code] This sub will build a string in MMBASIC consisting of the data values of V1,V2,I1 and I2, insert the correct FRAM address as the first two bytes of D$, then write all that to the FRAM starting from decimal address 1. The sub will auto-increment the address by five each time the routine is called. You need only reset A to 1 at the start of the code, then every time you call the sub, it will write V1,V2,I1 and I2 to incrementing FRAM addresses. NOT TESTED, but SHOULD work - I will try it tomorrow..... Smoke makes things work. When the smoke gets out, it stops! |
||||
Lou![]() Senior Member ![]() Joined: 01/02/2014 Location: United StatesPosts: 229 |
jman, Wizz, Please keep us up-to-date on the FramRTC code, especially the RTC and calibration code. jman, did you start this code back in May ?? I noticed the date in your code. We are ordering parts while Zonker is finishing up the 170 core 28pin DIP board for a small first time run, I want to test the accuracy of the RTC ASAP. I think I'm going to like this board. Now, if I can find a good voice chip... Thanks, Lou Microcontrollers - the other white meat |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
My 'Zonker spec' FRAM is still en-route to me (currently in Germany). ![]() It is scheduled for delivery tomorrow (UK Thursday) but I am out all day so won't have it until Friday. I will post code as soon as I have a chance to do so (probably by end of Friday). WW |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
My chips arrived yesterday so I will test and post the results This reworked code that I did for the DS3231 back in May Jman |
||||
centrex![]() Guru ![]() Joined: 13/11/2011 Location: AustraliaPosts: 320 |
Thanks Grogster I will give it a try on the weekend. Cliff Cliff |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi The attached code is now tested and working with the Fram RTC I will do the calibration next and post it here Regards Jman 2014-10-09_082917_FramRTC.zip |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Would you like a date and time stamp every time the sub is called? (assuming that an external RTC has been installed and correctly set) Smoke makes things work. When the smoke gets out, it stops! |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Oh dear I made a mistake in the RTC code new code attached that actually does work this time :) Regards Jman 2014-10-09_094947_FramRTC.zip |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |