![]() |
Forum Index : Microcontroller and PC projects : UNI/O EEPROM Driver
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Damn, there must be something wrong. I will retest but I may have to just give up on the UNI/O chips. They were hard enough to get working in the first place and I spent a lot of time fine tuning the driver to get the best reliability - but it still does not seem good enough. It might explain why these chips have not taken the world by storm. Geoff Geoff Graham - http://geoffg.net |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Due to some brilliant detective work by TassyJim which pointed me in the right direction I believe that I have found (and fixed) the stupid bug which stopped writes from working. Could you guys please give the attached new driver a run: 2017-07-29_121345_UNIO.zip (fingers crossed ![]() Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
Not so fast Geoff! I can see a big improvement but still no joy writing data. I am trying this I can see the command to write followed by the address Then there is a '07' byte (length?)followed by 7 'A1' bytes "AAAAAAA" followed by 8 zero bytes. (Filling the write buffer?) That doesn't agree with my understanding of the datasheet. This is part of my diagnostic. I will do some more prodding the beast later today. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
Write all memory to FF - OK Read 24 bytes - End up with a string 255 byte long 24 FF's followed by zeros Write "AAAAAAA" - gives fail but actual write did occur. Read 24 bytes - End up with a 7 byte string containing the previously written "AAAAAAA" The leading &h07 and trailing zeros have been trimmed. The actual bytes starting at &h10 are: 7 65 65 65 65 65 65 65 0 0 0 0 0 0 0 0 255 Jim VK7JH MMedit |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Thanks Jim, status = UNIO(UNIOpin, 02, &H10, 7, myName$) should be status = UNIO(UNIOpin, 02, &H10, 8, myName$) because you are writing eight bytes (all MMBasic strings have one additional byte for the length - I think that this is mentioned in the doco). However, your trace has uncovered another bug where the number of bytes to be written within a page was incorrectly calculated - this is why you got the extra zeros written. But it does not explain why you got a slave negative ACK at the end. I will be some more exploring also. BTW your logic analyser output is very helpful. My logic analyser has a broken UNI/O function so I have to manually decode the protocol on the oscilloscope - very tedious for manchester encoding. Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
I knew I should have read the manual! I am glad my logic analyser output is of some use. I got sick of trying to hold a bit of paper on the screen to decode the graphics - very difficult with a touch screen, so I wrote the very crude program to decode. The program has problems with long traces. I found that writing numbers works OK but has the same problem of writing too much data. I got a surprise when I did a test and wrote 8 bytes to the first half of a page and read back the full page &h3F is the number I wrote and UNIOpin is the name of the variable I used for the pin number. The FF is the start of the next page. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
I wouldn't put too much faith in my results, especially when it's a long way in, the code is very rough. Now I have the right length for strings I find that it write first go some of the time, other times I takes 3 or 4 attempts. It should be OK with numbers and short strings. This has been an interesting exercise. Jim VK7JH MMedit |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Could you try this one: 2017-07-30_063552_UNIO.zip I have found and fixed the bug that caused too many bytes to be written. Also I hope that I have fixed the issue with writes returning as failed when they have actually succeeded. This last problem is down to Microchip, their specs for the start header setup time (Tss) say 10uS but I have found that 100uS is much more reliable. Lets hope that this version works (fingers crossed - again) Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
This one looks good. I didn't have any fails with about a dozen writes and the logic analyser doesn't show any repeats with a quick look. Jim VK7JH MMedit |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Good news. Is there anyone else who could test this. If I get a few good results I might declare the driver working! Geoff Geoff Graham - http://geoffg.net |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Success.... 'TEST 'WRITING THE STRING NAME$ WHICH WILL HAVE A MAXIMUM OF 16 CHARACTERS. 'CHIP 11LC160 WITH SUGGESTED DIM NAME$,NAME1$ AS STRING, STATUS,LAB as INTEGER NAME$="0123456789ABCDEF" STATUS=0 LAB=19 DO WHILE STATUS=0 STATUS = UNIO(LAB,04) LOOP ? "FILLSTATUS=",STATUS ? NAME$ STATUS = UNIO(LAB,02,0,17,NAME$) ? "WRITESTATUS=",STATUS NAME1$="" STATUS = UNIO(LAB,01,0,17,NAME1$) ? "READSTATUS=",STATUS ? NAME1$ END The result: ? mm.ver 5.0404 > run FILLSTATUS= 1 0123456789ABCDEF WRITESTATUS= 1 READSTATUS= 1 0123456789ABCDEF > I want to make more test, but it seems to be good. Cheers: drkl |
||||
astro1 Regular Member ![]() Joined: 26/06/2016 Location: AustraliaPosts: 52 |
Hi Geoff, New code writing and reading well. Thanks, astro1 |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Thanks, I will declare this working (famous last words) and add it to the Micromite distribution. Thanks to everyone who found that it did and, just as importantly, did not work. It was a great example of many people working to deliver to a good outcome. Three cheers for the beta testers! Geoff Geoff Graham - http://geoffg.net |
||||
SteveA Regular Member ![]() Joined: 10/03/2017 Location: United KingdomPosts: 48 |
Works well on a MM+ I found that at 3V3, a 100K pull up resistor on the data pin and a 100nf decoupling capacitor eliminated the occasional failed read. Just one thing! The pdf says it will work on *any* pin, however, it wouldn't work on pin 50 which is SCLK. I assume this was down to hardware differences between this and normal I/O pins? |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Based on that, I would strongly recommend that the 100k pullup and 100n cap be standard practise with these chips. IMHO, I would be inclined to make the resistor 10k rather then 100k, just to give the I/O pin a reasonably firm pull-up rather then a weak one, which often also helps to prevent jitter confusing the connected device. Only my 2c though. Make of that what you will. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
There is nothing different between that and any other pin (I am assuming here that you are talking about the 64 pin MM+). Are you using SPI1 at the same time, it uses pin 50 for the SPI clock? Geoff Geoff Graham - http://geoffg.net |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
The UNI/O chip seems to have trouble pulling the pin low if the pullup is too strong. This is what TassyJim found: Geoff Geoff Graham - http://geoffg.net |
||||
Nathan Regular Member ![]() Joined: 10/01/2016 Location: GermanyPosts: 49 |
Hi, some small estimations ![]() (not an exact calculation, only to get a feeling) ![]() lets use Ilowmax something between 200 and 300uA, lets take 240um Rmin = (VDD - Vlowmax) / Ilowmax Rmin = ( 3.3V - 0.4V) / 240uA = 12KOhm IhighMax = leakageIo + leakageUnio = lets say a max around 4-8uA Rmax = (VDD - 0.7*VDD) / Ihighmax = 0.3 *VDD / Ihighmax = 0.3 *3.3 / 8uA = 123KOhm Rmax = (VDD - 0.7*VDD) / Ihighmax = 0.3 *VDD / Ihighmax = 0.3 *3.3 / 4uA = 246KOhm So a 10k Resistor is below or at the border (no low margin anymore) Rmax strongly depends on the estimated/expected leakage, which limits the high level during floating bus stage. ![]() If the leakage is to high the signal will no reach a secure high stage in time. So what to use? ![]() In case the device does not work on some pins I would give a ~56k Ohm resistor a chance. The 100k should be fine in low leakage situations. A non 5V tolerant pin is a good choice, too. Max bus cap should not excceed 100pF (pin cap of all devices on the bus and wire cap) A 100nF cap near the supply pins is required, too. No long wires. I would use the same supply than than the CPU to keep the h/l switch levels in an acceptable range, that's the reason, why I used 3.3V for estimation. ![]() ![]() including the pin caps. Nathan |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
I should also mention that the UNI/O driver enables a weak pullup on the I/O pin. Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6268 |
I didn't try any pullup values other than 10k and 100k. The only capacitor I used was a 0.01uF across the power supply pins. Nothing on the data line. Once I saw close to full supply rail swings on the data line, I stopped playing. In my setup I have the UNI/O on a flying lead about 75mm long. There would have been some loading from the CRO/logic analyzer probes. Jim VK7JH MMedit |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |