Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: UNI/O EEPROM Driver Post ReplyPost New Topic
Page of 5 Next >>
Author
Message << Prev Topic | Next Topic >>
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 16 July 2017 at 2:11am | IP Logged Quote Geoffg

Attached is a CFunction for the UNI/O protocol.

This protocol is used by Microchip for their 11XX series of EEPROMs. These are great little devices:
- Only one I/O pin is required to communicate with them
- Simple TO-92 or SOT-23 packages (they look like a transistor)
- Capacity up to 2 KBytes
- Cost just 28 cents in single quantities from Microchip
- And best of all, up to a million writes per cell.

The main downside with the UNI/O protocol is that it is very hard to implement in a microcontroller. It is complicated and the timing is extremely critical so this is why a CFunction is required.

Using the CFunction is reasonably straight forward: status = UNIO(pin, cmd, addr, nbr, data)
where pin is the I/O pin to use, cmd is the operation (eg, read/write/erase), addr is the location in the EEPROM, nbr is the number of bytes to read/write and data is the data (eg, variable or array). The function returns true for success or false for failure.

The code for the CFunction and full description is in the attached pdf file:
2017-07-16_014800_UNIO.pdf

With the one million writes per cell you can use this little device to frequently log readings like temperature and pressure without requiring an SD card or battery backed memory. At 28 cents it is a good solution.

Geoff


__________________
Geoff Graham - http://geoffg.net


Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 16 July 2017 at 3:38am | IP Logged Quote TassyJim

You make it look easy to talk to those chips.
Thanks, I will have to get a few to play with.

Jim

Edited by TassyJim on 16 July 2017 at 3:51am


__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
astro1
Newbie
Newbie


Joined: 26 June 2016
Location: Australia
Online Status: Offline
Posts: 22
Posted: 18 July 2017 at 9:53am | IP Logged Quote astro1

Works great on a mm+100.
Back to Top View astro1's Profile Search for other posts by astro1
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 18 July 2017 at 11:23am | IP Logged Quote Grogster

Very clever!

I will have to get some of these with my next Microchip Direct order.

EDIT: As with just about all EEPROM, these ones also have page boundaries, which in this device's case, is 16-bytes. Therefore, you should not attempt to write more then 16 bytes to this device in any one operation, assuming you start at the beginning of any one page.

As with standard EEPROM chips, you can read as much as you like, you just need to be careful not to create page errors by writing across a page boundary.

See the PDF for this device, page 12 - gray box on right.

Cfunction PDF for this talks about writing 21 bytes - this would fail, as it would cross a page boundary even if you start writing from the first byte on any one page(because 21 bytes is bigger then the 16-byte page buffer).

Something to be aware of, is all.

EDIT: Unless the Cfunction takes care of that for us? Geoff?


Edited by Grogster on 18 July 2017 at 11:39am


__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 18 July 2017 at 12:39pm | IP Logged Quote Geoffg

This is MMBasic Graeme, everything is taken care of. I would not make a dumb mistake like that

Page boundaries are automatically handled by the driver, you can write hundreds of bytes in one go without worrying about pages, write wait times, wakeup from sleep, ACKs, NACKs and all the other hassles of dealing with the chip. The driver will even automatically retry operations if they are disrupted by noise or timing errors

Geoff
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 5061
Posted: 18 July 2017 at 1:14pm | IP Logged Quote Grogster

That's REALLY awesome. The standard I2C EEPROM's you still have to beware those boundaries - even in MMBASIC, but the fact you handle that inside the Cfunction makes this and those EEPROM's even more attractive.

Quite keen to play with one or two of these now...

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 340
Posted: 18 July 2017 at 2:39pm | IP Logged Quote CaptainBoing

Grogster wrote:
That's REALLY awesome.


+1

I have 50 arriving tomoz with any luck

__________________

all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
drkl
Regular Member
Regular Member
Avatar

Joined: 18 October 2015
Location: Hungary
Online Status: Offline
Posts: 97
Posted: 19 July 2017 at 2:07pm | IP Logged Quote drkl

Helo, help me...

where is my mistake, unio doesn't operate.
MM44, MMBasic 5.4.04
UNIO C function is in the library
chip: 11LC160 with filter resistor


'TEST
'WRITING THE STRING NAME$ WHICH WILL HAVE A MAXIMUM OF 30 CHARACTERS.
DIM NAME$ AS STRING, STATUS AS INTEGER
NAME$="THIS IS A STRING"
STATUS=0
DO WHILE STATUS=0
STATUS = UNIO(23,03)
LOOP
? STATUS
STATUS = UNIO(23,02,0,31,NAME$)
? NAME$,"S=",STATUS
NAME$="33"
STATUS = UNIO(23,01,0,31,NAME$)
? NAME$,"S=",STATUS
END


endless loop....

drkl
Back to Top View drkl's Profile Search for other posts by drkl Visit drkl's Homepage
 
drkl
Regular Member
Regular Member
Avatar

Joined: 18 October 2015
Location: Hungary
Online Status: Offline
Posts: 97
Posted: 19 July 2017 at 7:21pm | IP Logged Quote drkl

Hello,
For further work:
Uploading memory with 0 or 1 and the reading is working, but not writing data.
Where is the problem?
drkl
Back to Top View drkl's Profile Search for other posts by drkl Visit drkl's Homepage
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 20 July 2017 at 2:07am | IP Logged Quote Geoffg

Your test program worked fine for me. This is the result I got:

> RUN
 1
THIS IS A STRING        S=       1
THIS IS A STRING        S=       1
>

So this is NOT a bug in the UNIO CFunction.

Have you got the right chip (a 11AA160 not a 11AA161)?
Is it connected correctly?

I noticed that the PDF mangled the hex codes by inserting random newlines when I copied and pasted the text. In the future I will distribute CFunctions as a text file (ah well, it seemed like a good idea at the time).

This is the UNIO CFunction as a text file: 2017-07-20_020429_UNIO.zip

Try using this instead.

Geoff
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 20 July 2017 at 6:13am | IP Logged Quote TassyJim

I can't see any difference between the file in the ZIP and copy and paste from the PDF.

It will be a week or so before I have any chips to test with.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
drkl
Regular Member
Regular Member
Avatar

Joined: 18 October 2015
Location: Hungary
Online Status: Offline
Posts: 97
Posted: 20 July 2017 at 5:24pm | IP Logged Quote drkl

Hi Geoffg,
Using the new contents of the zip file,
the problem remained. (erase/fill and read OK, writting is NOT!
But: I use
chip: 11LC160 with filter resistor (as you suggested)
instead of 11AA160!

It can be any difference between two chips?
Studying the datasheet I can't see any difference.

drkl
Back to Top View drkl's Profile Search for other posts by drkl Visit drkl's Homepage
 


Page of 5 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1094 seconds.
Privacy Policy     Process times : 0, 0.02, 0, 0.09