Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: UNI/O EEPROM Driver Post ReplyPost New Topic
<< Prev 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: 30 July 2017 at 3:11am | IP Logged Quote Geoffg

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


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: 30 July 2017 at 4:26am | IP Logged Quote TassyJim

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
Quote:
0000003F ?
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000055 U
0000004E N
00000049 I
0000004F O
00000050 P
00000049 I
0000004E N
00000000
000000FF


&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


__________________
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
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 30 July 2017 at 4:35am | IP Logged Quote TassyJim

Geoffg wrote:

But it does not explain why you got a slave negative ACK at the end. I will be some more exploring also.

Geoff

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

__________________
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
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 30 July 2017 at 6:42am | IP Logged Quote Geoffg

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
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: 30 July 2017 at 7:28am | IP Logged Quote TassyJim

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

__________________
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
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 30 July 2017 at 7:54am | IP Logged Quote Geoffg

Good news. Is there anyone else who could test this.

If I get a few good results I might declare the driver working!

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

Joined: 18 October 2015
Location: Hungary
Online Status: Offline
Posts: 97
Posted: 30 July 2017 at 9:57am | IP Logged Quote drkl

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
Back to Top View drkl's Profile Search for other posts by drkl Visit drkl's Homepage
 
astro1
Newbie
Newbie


Joined: 26 June 2016
Location: Australia
Online Status: Offline
Posts: 22
Posted: 03 August 2017 at 10:38am | IP Logged Quote astro1

Hi Geoff,
New code writing and reading well.
Thanks,
astro1
Back to Top View astro1's Profile Search for other posts by astro1
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 03 August 2017 at 1:10pm | IP Logged Quote Geoffg

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
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
SteveA
Newbie
Newbie


Joined: 10 March 2017
Location: United Kingdom
Online Status: Offline
Posts: 14
Posted: 03 August 2017 at 2:00pm | IP Logged Quote SteveA

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?
Back to Top View SteveA's Profile Search for other posts by SteveA
 
Grogster
Guru
Guru
Avatar

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

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!
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: 04 August 2017 at 3:33pm | IP Logged Quote Geoffg

SteveA wrote:
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?

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
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 


<< Prev 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.1055 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11