Shop OBEX P1 Docs P2 Docs Learn Events
Tachyon NEON V5 (FAT32 and Ethernet Servers in 32kB EEPROM!) - Page 10 — Parallax Forums

Tachyon NEON V5 (FAT32 and Ethernet Servers in 32kB EEPROM!)

17810121325

Comments

  • RS_JimRS_Jim Posts: 1,768
    edited 2018-08-30 23:53
    31.5' C translates to about 86 F current OAT is 102 F. We live in Arizona where daytime temps are high andutility rates are even higher. My project is an Energy management system that never allows more than one AC unit (we have 3) to be on at one time. Oure rates are based upon the max usage during any prime time hour.
    Next time I am on the computer, I will try the $50 0 RTC. Made an interesting discovery today, if prop plug connected to my device and the computer powered off, the prop will not run. With computer on and Tera term not on, prop will not run. Any ideas why?
    Jim
  • This has always been the problem with those boards that have onboard usb serial but no provision for maintaining the signals in their default state when usb power is removed. Probably what's happening is that the rxd is dragged low which is a break condition that Tachyon detects as a request to reset.. over and over. I suppose i could add a float check on the break detection to disregard this undesirable condition that happens with all these usb equipped parallax boards.

    Thanks for the overview of your project. I think even you get over these little good you should be coasting along. I'm thinking of visiting the grand canyon next year.
  • Thanks Peter. I figured there was some kind of an explanation like that. I discovered it when I fired up the prop with the computer shutdown and the cock was not running. I do hope that you have the opportunity to visit the canyon next year. I will look forward to the opportunity to meet you for an eyeball conversation.
    A question regarding parsing the minutes out of the hhmmss from TIME@ ''##'' will that do it?.
    Jim
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-08-31 07:39
    RS_Jim wrote: »
    Thanks Peter. I figured there was some kind of an explanation like that. I discovered it when I fired up the prop with the computer shutdown and the cock was not running. I do hope that you have the opportunity to visit the canyon next year. I will look forward to the opportunity to meet you for an eyeball conversation.
    A question regarding parsing the minutes out of the hhmmss from TIME@ ''##'' will that do it?.
    Jim

    Remember that there is no lexing or parsing in Forth, each word must either be a number or a string or already in the dictionary or being created. Just let Forth do the work for you like this:
    ...  123456 100 / 100 MOD . 34  ok
    
    Apply the same technique to the time to extract the minutes, that is divide it by 100 to get hhmm and then strip the hours by applying a modulus 100 which is effectively the remainder if you divide by 100. If you have a question, try it out first. In fact TIME@ just reads a 32-bit counter that is incremented every millisecond. In fact you could even read this variable directly and extract the minutes like this:
    ...  .TIME 17:36:19 ok
    ...  time @ 60,000 / 60 MOD . 36  ok
    
    So we read the millisecond "time" and divide it by 1000 to get seconds and by 60 to minutes (60,000 total) and then strip the hours with a 60 MOD.
  • Peter,
    I never think of using the MOD function to solve numeriic parsing problem. I can create a Minutes word that uses 60,000 MOD and 60 MOD and use that in my IF statement. I figured out that if I check for <20 Miinutes and >40 what is left is between 20 and 40 with no need for a complicated function to extract that.

    Last night I let the CLOCK run over night. at 2300 hours it was fine. At 0500 this AM it look liked it was stuck trying to reset an 00:00:00. it would show the hours as 00 and the minutes and seconds would increment a little bit and try to reset. I will use that clue and try 235900TIME! and see what happens from there. Will also do the DUMP and see if it gives me any further clues. With getting a Temperature reading that is Reasonably close, I think I am reading the clock chip, just don't know if time function is correct. Will let you know when I get back on the computer.

    As always I thank you for your wisdom and advice.

    Jim
  • RS_JimRS_Jim Posts: 1,768
    edited 2018-08-31 17:14
    Tried TIME@ 60,000 mod . And got mixed results. I assumed you ment TIME@ not TIME @.
    Was trying to create a MINS word.didn't quite work. I realize if I get a 4 digit number begining with 10's of minutes, that is good enough as I can always compare with a 4 number such As <2000 or >4000.
    Jim
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-08-31 20:57
    Jim, I include actual terminal captures including the "..." prompt and the "ok" response so they are exactly what they are and you can always copy and paste that part of the line to be sure. There's nothing complicated about a division and then a mod and if you used it more than once in your code then I would probably make it a function too.
    time   @   60,000    /    60    MOD
    
    I copied and pasted this from the previous post and I've put extra spaces in it ( not a problem normally ) so that you can clearly see the name of the variable "time" being fetched "@" and with 60,000 divide "/" this then with 60 perform a modulus operation "MOD".
    pub MINS@  time   @   60,000   /   60   MOD ;
    
    So "time" and "@" is not the same as "TIME@".

    Just set the time AND date and day anyway then without disturbing it dump the RTC registers. Do they look right as per the datasheet register map? (seconds, minutes, hours, etc). No? Store some values to a register and dump it again. Did it work? These are just sanity checks, you shouldn't have to do them normally but you are trying to find out whether you have a real or good DS3231 RTC chip or something different. I've got a DS3231 on my clock on the bench here and it ticked over and re-synchronized at midnight properly.

    In fact I just checked it now and on the same line told it to print the time and dump the actual registers. Yours should look somewhat similar.
    ...  .DT 0 $20 RTC DUMP Sat, 01 Sep 2018 06:56:05 UTC 
    0000.0000:   08 56 06 06  01 09 18 00  00 00 3F 10  00 3E 1C 88    .V........?..>..
    0000.0010:   00 16 C0 00  00 00 00 00  00 00 00 00  00 00 00 00    ................ ok
    
  • Peter,
    First of all I must apologize for not reading and understanding your post showing me how to set up the minutes. I totally missed the lower case time, and jumped to confusions. No wonder I got it wrong! I cut and pasted your line of code and it works perfectly. When I figure out how I am going to do the actual output. I should have my program ready to test. I will need to set up 3 output masks, %001, %010 and %100 depending upon meeting the correct answers to day and time. Initially I will test my logic with print statements then with LEDS and finally with the actual conttrol relays.
    Now on to the problem of the RTC, I set DATE! TIME! and DAY! and did a dump exactly like you show in your post. My RTC dump looks nothing like yours. In your dump I see the time, day and date clearly displayed in the first 7 characters of the dump. Mine look nothing like that. Mine look the same as the Screen copy I had a couple days ago. I am begining to think hardware issues. I may try this RTC on a different CPU board or try rewiring my breadboard connections to see if that resolves the issue. Or I may be casting about trying to figure out where to find another RTC.
    I thank you for your support, and hope that I don't try your patience too much.
    Jim
    By the way, what is your time zone UTC + ?.
  • Jim - I'm always relieved when we stop running around in circles. It certainly is looking like a hardware thing. What is the part number on the chip? Do you have pullups on the I2C bus? What happens when you write different values such as $FF and 0. Does it look like this?
    ...  14 FOR $FF I RTC! NEXT 0 $20 RTC DUMP 
    0000.0000:   7F 7F 7F 07  3F 9F FF FF  FF FF FF FF  FF FF 1C 8B    ....?...........
    0000.0010:   00 1A 40 00  00 00 00 00  00 00 00 00  00 00 00 00    ..@............. ok
    ...  14 FOR 0 I RTC! NEXT 0 $20 RTC DUMP 
    0000.0000:   00 00 00 00  00 00 00 00  00 00 00 00  00 00 1C 8B    ................
    0000.0010:   00 1A 40 00  00 00 00 00  00 00 00 00  00 00 00 00    ..@............. ok
    ...  
    
  • No, don't have pullups on I2C. Will add them and check again. 3.3 k ok? I was going to ask you if you had any connections to other pins. At work now, will do this tomorrow AM.
    Jim
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-09-01 22:37
    3k3 is fine, the absolute minimum requirement for most devices is at least a 10k pullup on SDA but preferably one on SCL as well and I prefer lower values if the lines run off-board, sometimes 2k2 even. The pull-up on the SCL is not always used and the reason is since most drivers drive the SCL line all the time. But while it is rare these days for slave chips to stretch the SCL line I know that the L3G4200D gyro chip drives the SCL low for stretching but Tachyon and most drivers don't support this directly.

    The strange thing is that the temperature registers seem to be reporting fine when you dump the RTC registers. Did you try those two test lines?
    First by writing $FFs to the registers
    14 FOR $FF I RTC! NEXT 0 $20 RTC DUMP
    
    Some bit will always read zero btw.
    14 FOR 0 I RTC! NEXT 0 $20 RTC DUMP 
    
    now all the first 14 registers show read 00
  • Good morning Peter,
    Installed 3.3k pullups on SDA & SCL and all of a sudden I have clear communication with the clock. It rolls over at midnight changing the day and date correctly. Next test is to see if the battery backup is doing its thing correctly. I will power the clock down now and go eat breakfast. When I return to the clock, the unit will get powered back up and we will see if the clock functions as it should! Thanks for all the help.
    Jim
  • Having issues with time keeping. Software clock loosing time after 2 hours. Will let it all run for 24 and see. Will in meantime check out RTC part number. And do an RTC dump.
    Jim
  • Issue is a problem with pullups, clock keeps perfect time
    Will run it for several days. May have to reinstall Tera Term as I am getting a bunch of characters with. Bit8 set. When I do a screen copy to a text editor the scrambled chars become normal. I have had issues with it in the past. I will let you know what I find.
    Jim
  • If it has pullups then I can't see that being an issue. Out of curiosity I'd really love to see a clear photo or two of your setup. Maybe the problem is obvious once seen.

    I've seen TeraTerm switch character sets to garbage characters but try sending a 14 or 15, i forget which, but that restores the character set. Of course, why the garbage in the first place?
  • I will see what I can do for a photo. What do you mean about sending a 14 or 15?
  • 14 EMIT or even just type a ^N or ^O. I will be able to check this shortly but obviously there is a hardware or software problem for this garbage on the display.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-09-05 01:22
    It's a 14 EMIT that changes TeraTerm's character set and a 15 EMIT that brings it back again. Make sure you don't take the photo too close where it's all blurred because hopefully we will be able to see what the problem is, if it's hardware (and don't change stuff for the photo).

    Screenshot%20from%202018-09-05%2011-20-39.png

    373 x 169 - 11K
  • Peter,
    I got a photo of the board but have not figured out how to compress it to be able to attach it to the forum. Will do so as soon as I figure it out.
    Jim
  • If I wish to "borrow" the SERLCD in another cog, say 4 can I issue the 3 cog stop and after use is done reissue a CLOCK Commad and have it restart?
    Jim
  • Jim - any phone can crop and or resize a photo as usually the image viewer includes simple edit functions. If it is backed up to the cloud then the other way is simply to share a link to that photo. I'm especially interested in seeing your setup because it sounds like a hardware problem plus you were trying to use I2C without pullups but the EEPROM normally has pullups anyway etc. There is no problem with the software, it works. It is a very simple loop and I have confirmed that it works fine on my end on top of which I have been running a much more complicated version day after day. We need to look at the hardware.

    If your clock code doesn't have the cog number locked in as in "3 RUN:" then yes but one cog won't work better than another so this is a dead end.
    This is the default cog usage list here:
    0: Tachyon console
    1: Serial receive
    2: Tachyon background timing functions
    3..7: Tachyon IDLE (ready to receive a job with RUN or RUN: etc).
  • RS_JimRS_Jim Posts: 1,768
    edited 2018-09-06 15:31
    Ok,I never thought of just cropping the photo. That did it. Editing post from ipad. I am now sure that the last issue I had with the clock was hardware. I had tried to add the Parallax altimeter to the I2C buss and the pullups got moved and caused a bad reading on a bootup. Ran the clock for over 24 hours in current configuration and the time remained spot on. Battery backup failed when I tried it, I need to check battery, connections etc. The thoughts about stopping cog 3 from cog 4 and restarting it was an idea I had about sharing the display with a PB setting routine. Actually planning on using parallax 5 way switch to set the clock. I will use a second serial display to test all of the routines for clock setting then see if I can figure out how to insert into CLOCK. Does Tachyon have a builtin button debounce?
    Does the Source for extend show how you Wrote the I2C read/write routines for RTC? I have another project on the shelf that I will be able to work on in OCT as I have a couple weeks of vacation comming and will spend it dog sitting and PROPELLERing.

    Jim
    1529 x 3269 - 834K
  • I see in looking at expanded photo, the pullups are very slopply installed and could be sometimes shorting. I will clean that up right a way. Will also get rid of extra wires on I2C that were put in to test another piece of hardware. Even though pullups are sloppy, the clock now runs flawlessly. Sorry I put you through so much software handholding for a hardware issue.
    Jim
  • RS_Jim wrote: »
    I see in looking at expanded photo, the pullups are very slopply installed and could be sometimes shorting. I will clean that up right a way. Will also get rid of extra wires on I2C that were put in to test another piece of hardware. Even though pullups are sloppy, the clock now runs flawlessly. Sorry I put you through so much software handholding for a hardware issue.
    Jim

    Hey Hey Hey - but look at all the stuff you learned! :)

    Conversely, when everything goes smoothly it's great but we don't learn much either. As long as we get it working in the end and we have fun and learn.
  • Yes, I learned a vast amount. Cleaning up the pullups and getting rid of the misc. wiring even allowed the battery back to start working. I have the rest of my program for the actual control worked out and will be entering and testing it later today. Still thinking about how I am going to set the clock with the 5 way switch. I think a state machine with cursor left right, digit increment and decrement will be the way to go. I will keep you posted on my other steps as I go along. By the way, if I download the listing of extend, will I be able to learn how you went about writing the commands to the RTC?
    Later,
    Jim
  • Once those DS3231s are set they should only need minor adjustment occasionally so I would prioritize the setting as a simple up/down by seconds. Debounce is actually very easy because all you need to do is accept any active signal but only poll it every 10 to 100ms or more. In your case as long as a switch is active you just keep repeating maybe five times a second and perhaps increasing the rate the longer it is held. As soon as you detect it has been released you can reset the rate and add an exit delay of maybe 500ms. Up/Down could be the +/- adjustment with left/right cycling through the units and push might be a quick exit while in the selection mode perhaps. Push can double as a menu button if you have some more functions you need setting.

    Personally I would just skip these fiddly controls and add a Bluetooth serial module and access via a Bluetooth serial terminal app. I have one called "Serial Bluetooth Terminal" and it also has buttons that you can apply "macros" to.
  • Peter, Great Idea. I have a a bluetooth module somewhere in my goodies stash and this would be a perfect application for it.
    Jim
  • RS_JimRS_Jim Posts: 1,768
    edited 2018-09-12 15:37
    Peter,
    Continuing on, if I do this:
    IF do something
    ENDIF
    SWITCH MINS@
    CASE = 0 ctlac 0 3 PINS! BREAK
    CASE >40 shop 0 3 PINS! BREAK
    CASE <20 dstairs 0 3 PINS! BREAK 
    ustairs  0 3 PINS! BREAK
    1 second
    AGAIN
    

    am I going to get the results of:
    0 minutes all off
    1 to 19 minutes dstairs on
    20 to 39 minutes ustairs on
    40 to 59 minutes shop on?
    I ask as I will not be able to get near the computer today to try it. Did try some IF statements yesterday and got a bunch of errors, so woke up this morning thinking OH I can use a switch case after I have fallen through the IF statements.
    Jim
  • Hi Peter,

    Trying to save a ROM (SIDCOG) to 5.4. All seems to work, I get the 'Saving to EEPROM' message, but no ROMS displayed on reboot.
    I'm using a FLiP chip if that makes a difference-

    Thanks, George
    AUTORUN BOOT 3146
    FREQ = 80.00MHZ
    *** INITS ***
    NO ROMS
    *** I2C ***
    $A0 EE/RTC
    I/O =  31 :UHUU 27 :DD~~ 23 :~~~~ 19 :~~~~ 15 :~~~~ 11 :~~~~ 7 :~~~~ 3 :~~~~
    INTERCOM:
    
    CODE:$39A0 = 14240 bytes
    NAME:$5B3A = 6342 bytes
    DATA:$75D9 = 201 bytes
    FREE:      = 8602 bytes
     Data Stack (0)
    Mon, 01 Jan 2001 00:00:00 UTC
    --------------------------------------------------------------------------------
    01FB Saving to EEPROM  ok
    ...
    ...
    
      Propeller .:.:--TACHYON--:.:. Forth V5x4 NEON 540180820.2300
      *** MODULES ***  Propeller .:.:--TACHYON--:.:. Forth V5x4 NEON 540180820.2300
    31B4: TOOLS            DEV TOOLS
    1980: EXTEND           Primary extensions to TACHYON V5 kernel  - 180829-0000
    
    AUTORUN BOOT 3146
    FREQ = 80.00MHZ
    *** INITS ***
    NO ROMS
    *** I2C ***
    $A0 EE/RTC
    I/O =  31 :UHUU 27 :DD~~ 23 :~~~~ 19 :~~~~ 15 :~~~~ 11 :~~~~ 7 :~~~~ 3 :~~~~
    INTERCOM:
    
    CODE:$39A0 = 14240 bytes
    NAME:$5B3A = 6342 bytes
    DATA:$75D9 = 201 bytes
    FREE:      = 8602 bytes
     Data Stack (0)
    Mon, 01 Jan 2001 00:00:00 UTC
    
  • @GHarris - I just tried this on 5.4 and pasted in the sidcog.hex file and it worked fine. What I did notice though was that I get a count of 069B which is the correct size yet your's shows $01FB as if you only had an incomplete hex file. Make sure you have line delay set to around 12ms but for a test I set mine to zero and while it dropped characters the count was still 061F.

    Funny thing though, I just noticed your kernel version V5x4 which was one I used for testing so I removed that into a testing folder. Try the standard 5r4.
    Propeller .:.:--TACHYON--:.:. Forth V5r4 NEON 540180811.0000
    

    SIDCOG.HEX
    SAVEROM
    :20000000001BB700005F10009C06CC069806D0068C060200880600002E524F4D7006534967
    :2000200044434F472020202093EDBFA091F1BFA092F3BFA0F193BFA08F93BF80F095BFA057
    :20004000CA45BF08A251BFA00450FF2C8251BF648345BF600D44FF2C0494FF80CA57BF08A1
    :20006000AB3FBFA0AB23BFA00822FF2860CBFE5C9369BFA060CBFE5C9363BFA060CBFE5C7A
    :200080009375BFA0916FBFA0046EFF20916FBF68046EFF200456FF280F56FF60013E7F61ED
    :2000A000025C7F86005CE3A0025CC7A00494FF80CA47BF08A353BFA00452FF2C8253BF647C
    :2000C0008347BF600D46FF2C0494FF80CA59BF08AC41BFA0AC23BFA00822FF2860CBFE5C68
    :2000E000936BBFA060CBFE5C9365BFA060CBFE5C9377BFA09171BFA00470FF209171BF68BC
    :200100000470FF200458FF280F58FF6001407F61025E7F86005EE3A0025EC7A00494FF80BE
    :20012000CA49BF08A455BFA00454FF2C8255BF648349BF600D48FF2C0494FF80CA5BBF08A2
    :20014000AD43BFA0AD23BFA00822FF2860CBFE5C936DBFA060CBFE5C9367BFA060CBFE5C89
    :200160009379BFA09173BFA00472FF209173BF680472FF20045AFF280F5AFF6001427F61EC
    :2001800002607F860060E3A00260C7A00494FF80CA8DBF08C683BFA0108CFF280582FF28FE
    :2001A0000782FF64C695BFA00794FF60CA83BF688483BF608C83BF80C68BBFA0088AFF284E
    :2001C000C681BFA0F080FF600480FF28A24BBF810240CF640A407F62004CD7A0A34DBF813F
    :2001E0000242CF640A427F62004ED7A0A44FBF81023ECF640A3E7F62004AD7A002567F86A9
    :20020000A523BFA09900685C01567F878000545C0122FF2D7E23B36C043E7F62854F17624E
    :200220007E23976C99007C5C04567F86A551AB857E23AB709900685C08567F868E00545C6A
    :200240008023BF60A223BF859623BF589423BF8099004C5C952D3F61012CFF3099007C5C9D
    :2002600008567F620456FF840056FF400856FF2CA595BFA01894FF28CA57BF809057BF8052
    :20028000AB238B001822CB2C8523B7A08D95BFA09995BF28CA393F85A25C7FE80132CFE031
    :2002A000B139BF817E39B3A0015CF3A0AC007C5C0132F3809CF93E85015C7F86AA00545CDC
    :2002C00099698F28B439BF84B739BF49AC007C5C99758F28BA39BFE00E22FF288823BF841D
    :2002E0009C25BFA01824FF2866D7FE5C937BBFA002587F86A623BFA0D600685C01587F87F7
    :20030000BD00545C0122FF2D7E23B36C04407F62854B17627E23976CD6007C5C04587F8640
    :20032000A653AB857E23AB70D600685C08587F86CB00545C8023BF60A323BF859723BF58C1
    :200340009423BF80D6004C5C952F3F61012EFF30D6007C5C08587F620458FF840058FF4002
    :200360000858FF2CA695BFA01894FF28CA59BF809059BF80AC238B001822CB2C8523B7A071
    :200380008D95BFA09A95BF28CA3B3F85DF5E7FE80134CFE0B23BBF817E3BB3A0015EF3A04A
    :2003A000E9007C5C0134F3809DF93E85015E7F86E700545C9A6B8F28B53BBF84B83BBF4996
    :2003C000E9007C5C9A778F28BB3BBFE00E22FF288823BF849D25BFA01824FF2866D7FE5C9F
    :2003E000937DBFA0025A7F86A723BFA01301685C015A7F87FA00545C0122FF2D7E23B36C12
    :2004000004427F62854D17627E23976C13017C5C045A7F86A755AB857E23AB701301685CB7
    :20042000085A7F860801545C8023BF60A423BF859823BF589423BF8013014C5C95313F61E5
    :200440000130FF3013017C5C085A7F62045AFF84005AFF40085AFF2CA795BFA01894FF2898
    :20046000CA5BBF80905BBF80AD238B001822CB2C8523B7A08D95BFA09B95BF28CA3D3F8500
    :200480001C617FE80136CFE0B33DBF817E3DB3A00160F3A026017C5C0136F3809EF93E855D
    :2004A00001607F862401545C9B6D8F28B63DBF84B93DBF4926017C5C9B798F28BC3DBFE0AC
    :2004C0000E22FF288823BF849E25BFA01824FF2866D7FE5C937FBFA00090FFA00084FFA0F8
    :2004E000018C7F61BD85B380BD918F80028C7F61BE85B380BE918F80048C7F61BF85B38094
    :20050000BF918F80C025BFA00624FF80C323BFA00522FF3866D7FE5CC385BF849385BF8073
    :20052000C485BF84C223BFA00A22FF38C125BFA08E25BF4C66D7FE5C9387BF80C323BFA050
    :200540000B22FF38C125BFA066D7FE5C9389BF80008EFFA0108A7F61C48FB380208A7F6149
    :20056000C38FB380408A7F61C28FB380C723BFA0C823BF808A23BF448B23BF40C525BFA0AF
    :200580000F24FF6066D7FE5C8527BF808F93BFF893F5BFA093F7BFA0F095BFA01C94FF808B
    :2005A000CA273F0805007C5C91C9BE50F0C9FE646CC9FE800422FF280026BFA000007C5C46
    :2005C0000026FFA00124FF2B9127B3800122FF2C6701545C00007C5C38079C0308E2030112
    :2005E000090184001E8A570054D0370018CD2500A3251F00CA911A000537150014830800BD
    :200600008A4104000CA90200E8200200A6B50000FF6C00001F4400005D5D5D5D0000000F9E
    :20062000FFFFFFFFFFFFFF7FFFFFFF0FFFFFFF00FFFF0F00FFFF0000FF07000000000080A8
    :200640000000001000000008000002000000010000000008000000F80C0000006C6C6C6CC3
    :200660004C0400000000000000000000010000000100000001000000000080AA00210000DC
    :1C068000FFFFFF00FFFFFF00FFFFFF000000000000000000000000003200000035
    :00000001FF
    
Sign In or Register to comment.