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: GermanyPosts: 49 |
Hi Geoff, there is a very nice application Note. 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 ZealandPosts: 9083 |
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: AustraliaPosts: 3167 |
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: GermanyPosts: 49 |
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.) Nathan |
||||
Nathan Regular Member Joined: 10/01/2016 Location: GermanyPosts: 49 |
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: HungaryPosts: 102 |
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: AustraliaPosts: 5923 |
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. I also changed the starting addresses a bit. Jim VK7JH MMedit  MMBasic Help |
||||
drkl Senior Member Joined: 18/10/2015 Location: HungaryPosts: 102 |
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 ZealandPosts: 9083 |
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: AustraliaPosts: 5923 |
Are you using the latest CFUNCTION? From page 3. Jim VK7JH MMedit  MMBasic Help |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9083 |
That's a bloody good point - standby..... Ahhhhhhhhhh!!!!!!!!!!!! The experimentation can now continue - Thanks, Jim. Smoke makes things work. When the smoke gets out, it stops! |
||||
Page 3 of 3 |
Print this page |