Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:37 05 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Talking to FRAM chips with I2C....

     Page 3 of 4    
Author Message
Lou

Senior Member

Joined: 01/02/2014
Location: United States
Posts: 229
Posted: 04:59am 03 Oct 2014
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2932
Posted: 06:31am 03 Oct 2014
Copy link to clipboard 
Print this post

@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. Therefore to keep buying new components is not realistic for me just now.

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

Edited by WhiteWizzard 2014-10-04
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:45am 03 Oct 2014
Copy link to clipboard 
Print this post

  Lou said   Hey Guys,
How about MMBasic code for that one ?? Or is it too specialized ??
Lou



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 Kingdom
Posts: 2932
Posted: 10:47am 03 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9588
Posted: 12:01pm 03 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 711
Posted: 12:13pm 03 Oct 2014
Copy link to clipboard 
Print this post

  Grogster said   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.)


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 States
Posts: 229
Posted: 12:15pm 03 Oct 2014
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2932
Posted: 10:29pm 03 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 711
Posted: 11:09am 04 Oct 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 320
Posted: 10:23pm 07 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9588
Posted: 10:53pm 07 Oct 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 320
Posted: 11:39pm 07 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9588
Posted: 12:09am 08 Oct 2014
Copy link to clipboard 
Print this post

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.....
Edited by Grogster 2014-10-09
Smoke makes things work. When the smoke gets out, it stops!
 
Lou

Senior Member

Joined: 01/02/2014
Location: United States
Posts: 229
Posted: 07:50am 08 Oct 2014
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2932
Posted: 07:57am 08 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 711
Posted: 08:12am 08 Oct 2014
Copy link to clipboard 
Print this post

  Lou said   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


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: Australia
Posts: 320
Posted: 09:47pm 08 Oct 2014
Copy link to clipboard 
Print this post

Thanks Grogster
I will give it a try on the weekend.

Cliff
Cliff
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:30pm 08 Oct 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9588
Posted: 10:45pm 08 Oct 2014
Copy link to clipboard 
Print this post

  centrex said   Thanks Grogster
I will give it a try on the weekend.

Cliff


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 Zealand
Posts: 711
Posted: 11:50pm 08 Oct 2014
Copy link to clipboard 
Print this post

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
 
     Page 3 of 4    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025