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

Grogster wrote:
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

The UNI/O chip seems to have trouble pulling the pin low if the pullup is too strong.

This is what TassyJim found:
TassyJim wrote:
I put the cro on and did some experimenting with different values of pull-up resistor. With no resistor, one direction goes from ~zero to a high of ~2.5V. With a 10k pull-up it goes from ~0.5V to 3.3V. That seems to agree with the data sheet. I tried a 100k resistor and got close to full voltage swing so will stay with that.

Geoff


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


Joined: 10 January 2016
Location: Germany
Online Status: Offline
Posts: 41
Posted: 04 August 2017 at 8:59pm | IP Logged Quote Nathan

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.

for real values a pcb-board simulation would be required,
including the pin caps.

Nathan
Back to Top View Nathan's Profile Search for other posts by Nathan
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2135
Posted: 04 August 2017 at 9:46pm | IP Logged Quote Geoffg

I should also mention that the UNI/O driver enables a weak pullup on the I/O pin.

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: 04 August 2017 at 9:53pm | IP Logged Quote TassyJim

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

__________________
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
 
Nathan
Regular Member
Regular Member


Joined: 10 January 2016
Location: Germany
Online Status: Offline
Posts: 41
Posted: 04 August 2017 at 11:06pm | IP Logged Quote Nathan

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

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

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!
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: 05 August 2017 at 4:03am | IP Logged Quote Geoffg

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


Joined: 10 January 2016
Location: Germany
Online Status: Offline
Posts: 41
Posted: 05 August 2017 at 7:55am | IP Logged Quote Nathan


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
Back to Top View Nathan's Profile Search for other posts by Nathan
 
Nathan
Regular Member
Regular Member


Joined: 10 January 2016
Location: Germany
Online Status: Offline
Posts: 41
Posted: 05 August 2017 at 8:20am | IP Logged Quote Nathan

Grogster wrote:
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


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

Joined: 18 October 2015
Location: Hungary
Online Status: Offline
Posts: 97
Posted: 20 August 2017 at 3:27pm | IP Logged Quote drkl

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


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2257
Posted: 20 August 2017 at 11:20pm | IP Logged Quote TassyJim

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

__________________
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: 21 August 2017 at 10:00am | IP Logged Quote drkl

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

Back to Top View drkl's Profile Search for other posts by drkl Visit drkl'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.1250 seconds.
Privacy Policy     Process times : 0.02, 0, 0, 0.11