Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:38 20 May 2024 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 : UNI/O EEPROM Driver

     Page 3 of 3    
Author Message
Nathan
Regular Member

Joined: 10/01/2016
Location: Germany
Posts: 49
Posted: 01:06pm 04 Aug 2017
Copy link to clipboard 
Print this post

Hi Geoff,

there is a very nice application Note.

  Quote  
AN1194
"Recommended Usage of Microchip UNI/O® "Bus-Compatible Serial EEPROMs"
Page 1,7-8


Hi Jim,
> 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.
0.1uF is recommended

> Nothing on the data line.
That's fine. There should be no cap at the 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.
75mm WOW!

Geoff must have done a rocket solid software implementation

>There would have been some loading from the CRO/logic analyzer probes.
As long as you are not at the timing borders it will still work.

Nathan
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9083
Posted: 03:04pm 04 Aug 2017
Copy link to clipboard 
Print this post

Okey dokey on the 100k vs 10k stuff - I stand corrected.
So therefore, 100k/100n arrangement would seem to be the engineer's choice then, yes?

I don't have any of these yet, but they ARE on my next order from MC Direct when I send it off.
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 06:03pm 04 Aug 2017
Copy link to clipboard 
Print this post

  Nathan said  Geoff must have done a rocket solid software implementation

The secret is that the driver monitors any sort of error and if it occurs it will retry ten times before giving up. In my test setup I have seen two or three errors in a row so ten retries should cover intermittent errors.

BTW, this is digital - it should either work or not. But that is not how UNI/O seems to work.

Geoff
Geoff Graham - http://geoffg.net
 
Nathan
Regular Member

Joined: 10/01/2016
Location: Germany
Posts: 49
Posted: 09:55pm 04 Aug 2017
Copy link to clipboard 
Print this post


  Quote  BTW, this is digital - it should either work or not. But that is not how UNI/O seems to work.


It's all a question of Manchester Code clock recovery and the jitter.
I agree, at the end it is digital.

There is a very good explanation, for all who want to dig into more details.
(It also includes code examples.)
  Quote   Atmel Manchester Coding Basics [APPLICATION NOTE] 9164B–AUTO–07/15


Nathan
 
Nathan
Regular Member

Joined: 10/01/2016
Location: Germany
Posts: 49
Posted: 10:20pm 04 Aug 2017
Copy link to clipboard 
Print this post

  Grogster said   Okey dokey on the 100k vs 10k stuff - I stand corrected.
So therefore, 100k/100n arrangement would seem to be the engineer's choice then, yes?


Hi 100k is a good value, for experimenting you can just put two in parallel to
get 50k.

Nathan


 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 05:27am 20 Aug 2017
Copy link to clipboard 
Print this post

Hello,

I don't know where is my mistake.
Here is the code:
I want to write three continous blocks to unio chip:


OPTION EXPLICIT
OPTION DEFAULT NONE
DIM C$,NAME$,NAME1$ AS STRING
DIM STATUS AS INTEGER,LAB as INTEGER
LAB=19 'I/0 PIN
'UNIO ROUTINE IN LIBRARY
MAIN:

GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(0,50,NAME$)
GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(52,50,NAME$)
PAUSE 10
GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(101,50,NAME$)
PAUSE 10
PRINT "READ"
RD_UNIO(0,150,NAME1$)
PRINT NAME1$
DO
LOOP

'---GENERATING A STRING
SUB GEN_STR (LENH AS INTEGER,NAMES$ AS STRING)
LOCAL INTEGER I
NAMES$=""
FOR I=1 TO LENH
NAMES$=NAMES$+CHR$(I+32)
NEXT I
END SUB
'
'LAB: THE PIN, GLOBAL VARIABLE, STATUS GLOBAL
'---READING A STRING FROM UNIO: BADDR-BEGINADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB RD_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
STATUS = UNIO(LAB,01,BADDR,LENH+1,NAMES$)
END SUB
'
'---WRITING A STRING TO UNIO: BADDR-BEGIN ADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB WR_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
STATUS = UNIO(LAB,02,BADDR,LENH+1,NAMES$)
END SUB
END


The result:

? MM.VER
5.0404
> RUN
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR
READ
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR


Where is the second and third blocks?

drkl
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 01:20pm 20 Aug 2017
Copy link to clipboard 
Print this post

When you read a string, the length is the first character and it is used to limit the length of the returned string. This means that you cannot read more than one string at a time, unless you manipulate the length byte.

I would also test the value of STATUS and use it to retry if needed. The CFUNCTION does retry automatically and seems to be very reliable but, especially with long strings, it is safer to check.

I have added this check to your subs and read the three strings individually.

  Quote   OPTION EXPLICIT
OPTION DEFAULT NONE
DIM C$,NAME$,NAME1$ AS STRING
DIM STATUS AS INTEGER,LAB AS INTEGER
LAB=
19 'I/0 PIN
'UNIO ROUTINE IN LIBRARY
MAIN:

GEN_STR(
50,NAME$)
PRINT NAME$
WR_UNIO(
1,50,NAME$)
GEN_STR(
50,NAME$)
PRINT NAME$
WR_UNIO(
52,50,NAME$)
PAUSE 10
GEN_STR(
50,NAME$)
PRINT NAME$
WR_UNIO(
103,50,NAME$)
PAUSE 10
PRINT "READ"
RD_UNIO(
1,50,NAME1$)
PRINT status,NAME1$
RD_UNIO(
52,50,NAME1$)
PRINT status,NAME1$
RD_UNIO(
103,50,NAME1$)
PRINT status,NAME1$
END
DO
LOOP

'---GENERATING A STRING
SUB GEN_STR (LENH AS INTEGER,NAMES$ AS STRING)
LOCAL INTEGER I
NAMES$=
""
FOR I=1 TO LENH
NAMES$=NAMES$+
CHR$(I+32)
NEXT I
END SUB
'
'LAB: THE PIN, GLOBAL VARIABLE, STATUS GLOBAL
'---READING A STRING FROM UNIO: BADDR-BEGINADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB RD_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL n AS INTEGER
FOR n = 1 TO 10
STATUS = UNIO(LAB,
01,BADDR,LENH+1,NAMES$)
IF status =1 THEN EXIT FOR
NEXT n
END SUB
'
'---WRITING A STRING TO UNIO: BADDR-BEGIN ADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB WR_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL n AS INTEGER
FOR n = 1 TO 10
STATUS = UNIO(LAB,
02,BADDR,LENH+1,NAMES$)
IF status =1 THEN EXIT FOR
NEXT n
END SUB
END



I also changed the starting addresses a bit.

Jim
VK7JH
MMedit   MMBasic Help
 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 12:00am 21 Aug 2017
Copy link to clipboard 
Print this post

Hello,
With the help of TassyJim (thank you), I succesfully tested the UNIO driver with 11AA160 chip. The code:

'UNIIO TESTING WITH BLOCKS
OPTION EXPLICIT
OPTION DEFAULT NONE
DIM C$,NAME$,NAME1$ AS STRING
DIM INTEGER STATUS,K
CONST LAB=19 'I/0 PIN
CONST BL=255 'BLOCK LENGHT
'UNIO ROUTINE IN LIBRARY
MAIN:
'------ERASING...-----------------------
DO WHILE STATUS=0
STATUS = UNIO(LAB,04)
LOOP

GEN_STR(BL,NAME$)
FOR K=0 TO 15
WR_UNIO(BL*K+K+1,BL,NAME$) '1...BL+2...2*BL+3...3*BL+4...BL*K+K+1
PAUSE 10
PRINT STATUS,NAME$
NEXT K
PRINT "READ"
'------BLOCK READING...-----------------
FOR K=0 TO 15
RD_UNIO(BL*K+K+1,BL,NAME1$)
PAUSE 10
PRINT STATUS,NAME1$
NAME1$=""
NEXT K
DO:LOOP
'----------[SUBROUTINES]------------------------------------
'---GENERATING A STRING
SUB GEN_STR (LENH AS INTEGER,NAMES$ AS STRING)
LOCAL INTEGER I,J
NAMES$=""
FOR I=1 TO LENH
J=I+32
IF J>255 THEN J=J-255+32
NAMES$=NAMES$+CHR$(J)
NEXT I
END SUB
'
'LAB: THE PIN, GLOBAL VARIABLE, STATUS GLOBAL
'---READING A STRING FROM UNIO: BADDR-BEGINADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB RD_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL N AS INTEGER
FOR N = 1 TO 10
STATUS = UNIO(LAB,01,BADDR,LENH+1,NAMES$)
IF STATUS=1 THEN EXIT FOR
NEXT N
END SUB
'
'---WRITING A STRING TO UNIO: BADDR-BEGIN ADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB WR_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL N AS INTEGER
FOR N = 1 TO 10
STATUS = UNIO(LAB,02,BADDR,LENH+1,NAMES$)
IF STATUS =1 THEN EXIT FOR
NEXT N
END SUB
END

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9083
Posted: 01:35am 09 Sep 2017
Copy link to clipboard 
Print this post

I have my 11AA160's, but I can't get them to read.
Using Jim's code:

[Code]
Test4:
OPTION EXPLICIT
OPTION DEFAULT NONE
DIM C$,NAME$,NAME1$ AS STRING
DIM STATUS AS INTEGER,LAB AS INTEGER
LAB=14 'I/0 PIN
'UNIO ROUTINE IN LIBRARY
MAIN:

GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(1,50,NAME$)
GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(52,50,NAME$)
PAUSE 10
GEN_STR(50,NAME$)
PRINT NAME$
WR_UNIO(103,50,NAME$)
PAUSE 10
PRINT "READ"
RD_UNIO(1,50,NAME1$)
PRINT status,NAME1$
RD_UNIO(52,50,NAME1$)
PRINT status,NAME1$
RD_UNIO(103,50,NAME1$)
PRINT status,NAME1$
END
DO
LOOP

'---GENERATING A STRING
SUB GEN_STR (LENH AS INTEGER,NAMES$ AS STRING)
LOCAL INTEGER I
NAMES$=""
FOR I=1 TO LENH
NAMES$=NAMES$+CHR$(I+32)
NEXT I
END SUB
'
'LAB: THE PIN, GLOBAL VARIABLE, STATUS GLOBAL
'---READING A STRING FROM UNIO: BADDR-BEGINADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB RD_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL n AS INTEGER
FOR n = 1 TO 10
STATUS = UNIO(LAB,01,BADDR,LENH+1,NAMES$)
IF status =1 THEN EXIT FOR
NEXT n
END SUB
'
'---WRITING A STRING TO UNIO: BADDR-BEGIN ADDR, LENH-GIVEN LENGHT, NAMES$-THE STRING
SUB WR_UNIO(BADDR AS INTEGER,LENH AS INTEGER, NAMES$ AS STRING)
LOCAL n AS INTEGER
FOR n = 1 TO 10
STATUS = UNIO(LAB,02,BADDR,LENH+1,NAMES$)
IF status =1 THEN EXIT FOR
NEXT n
END SUB
[/Code]

The results I get are all success codes(1), but no data:




MMBASIC 5.0405 on 170 chip.

According to Jim's example code, I should be getting the ASCII string back along with the "1" for success, but I am not.

100k pull-up to 3v3 on I/O pin, 100n across device.
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 01:45am 09 Sep 2017
Copy link to clipboard 
Print this post

Are you using the latest CFUNCTION?
From page 3.

Jim
VK7JH
MMedit   MMBasic Help
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9083
Posted: 01:52am 09 Sep 2017
Copy link to clipboard 
Print this post

That's a bloody good point - standby.....

Ahhhhhhhhhh!!!!!!!!!!!!





The experimentation can now continue - Thanks, Jim. Edited by Grogster 2017-09-10
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024