Shop OBEX P1 Docs P2 Docs Learn Events
Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i - Page 143 — Parallax Forums

Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i

1140141143145146160

Comments

  • jmgjmg Posts: 15,140
    cgracey wrote: »
    It's a limit of the math operations. Do you think we should make it work with lower bauds?

    What is the smart pin Baud Limit ?
    What is the code cost, of extending toward that ?

    I just have a natural aversion to limits that are 'self imposed' ie not set by hardware :)
    I'm known to complain to vendors who limit their Clock or Baud choices, for example, to less than what they could have.

    That said, I've not used low baud rates to move large blocks of data, but I have used low baud rates to test system margins, and for easy clock measurements/calibration.

    Looking at recent UARTS/HW I've used, one was limited to 184 Baud, and another to 50 Baud, and another could go to 8 Baud. Those are all HW limits, not maths imposed limits.

    For a possible growing low baud arena, look at the new LoRa network standard. That trades off speed. to get power and distance gains.

    I can think of one immediate/useful P2 use of low baud, which would be to connect at a low baud rate, and query the Baud capture timer, to measure the RC Oscillator Frequency, using the UART timebase.
  • Cluso99Cluso99 Posts: 18,066
    You can always use bit-bang for lower speeds. It's just the download serial plus monitor and TAQOZ.
  • cgracey wrote: »
    Do you think we should make it work with lower bauds?

    No, unless you want to accommodate Heater and his Flexowriter. Will the serial loader support paper tape in EBCDIC format?

    Surely that's an integral feature of TAQOZ?
  • jmgjmg Posts: 15,140
    jmg wrote: »
    cgracey wrote: »
    It's a limit of the math operations. Do you think we should make it work with lower bauds?
    I can think of one immediate/useful P2 use of low baud, which would be to connect at a low baud rate, and query the Baud capture timer, to measure the RC Oscillator Frequency, using the UART timebase.

    One application where this gets interesting, is extreme environment operation, where you want minimal external analog and prefer to avoid flash.
    (eg down drill holes / bores ). In this area, you would have no crystal, & no local flash, but instead (re)measure the RC osc, and use that live value in downloaded code, tracking any variations.

    Expanding on that use example, at the RCFAST speeds, I get numbers like this for 16b resolution capture of Osc Speed, for the raw baud 7b capture value
    7*20M/2^16 = 2136 Baud
    7*30M/2^16 = 3204 Baud

    I'm thinking it would be useful to store the raw 7b baud value (as that has highest precision) in some HUB location, so user code could access that.
    Such-calibrate-values-in-memory-map, are quite common in other MCUs, even very cheap ones.

    and these, if that 7b value is not so easily available, so users have to use the baud-bit-time.
    20M/2^16 = 306 Baud
    30M/2^16 = 458 Baud


    If users can autobaud at speeds in that region, they can then (easily?) interrogate for the raw Baud capture value, and extract a calibrate number.
    It would be nice if the Serial loader could echo the calibrate baud value, but I think the Full ROM anyway allows some pathway to read any location ?

    Q : What is the simplest Serial string to : Autobaud the part, then read the calibrate baud value ?

  • Cluso99,
    You could also try this patch in the ROM to fix that missing wz. It applies to SD1 cards, and causes an error to be reported rather than continuing.
    *fc620L
     addr  -0--1--2--3  -4--5--6--7  -8--9--A--B  -C--D--E--F
    FC620- 05 8C 07 F2  2C 04 90 5D  00 86 07 F6  77 80 07 F6   '....,..]....w...'
    *fc620- 05 8c 0f f2
    *fc620L
     addr  -0--1--2--3  -4--5--6--7  -8--9--A--B  -C--D--E--F
    FC620- 05 8C 0F F2  2C 04 90 5D  00 86 07 F6  77 80 07 F6   '....,..]....w...'
    *R<filename><cr>
    
    Applying the patch and using the R command still hangs when the filename is spelled correctly. If it's misspell the monitor responds with "!", as expected.

    Peter, I loaded your TAQOZ extensions (very cool!) and the output looks like there may be a card issue of some sort:
    TAQOZ# lsio
    P:00000000001111111111222222222233333333334444444444555555555566
    P:01234567890123456789012345678901234567890123456789012345678901
    =:ddd~~~~d~~~~~~~~~~~d~~~~d~~~~~d~~~~~~~~~~~~~~~~~~~~~~~~hhhhhhh ok
    TAQOZ# MOUNT
    Mounted             6B43_C07C-0000_0000 [PHSD01G]                   0MB (0kB/cluster)  ok
    TAQOZ#
    
    I've only got the one microSD available for testing, so I'll pick up a couple of different brand to try.
  • Cluso99Cluso99 Posts: 18,066
    Garry,
    Since the SD is checking for a file and if it's not found the program returns with "!" then I suspect when the file is found that the file is corrupt or has a bug.

    Have you tried replacing the file?
    It may be worthwhile deleting the file first and then copying the new file as W10 seems to be more interested in the long filenames and I think that sometimes the 8.3 directory doesn't get updated correctly.

    The files I posted above flash pins (leds) on specific pins. I know they work.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-05-21 00:42
    As I mentioned in another post, if you want to find out what is happening in hardware, such as "why doesn't my SD card work", then jump to TAQOZ and paste in this file using line delays of ~20ms. This will give you full FAT32 access as well as low-level access so there is no need to guess, TAQOZ is the TOOL, that's why it is in ROM so it is there when you need it and nothing else seems to work.

    After loading TAQOZ.FTH you can MOUNT the SD card and some information about the card type and format is printed. Then ls (or DIR) will list the directory. All good so far, now open a file with FOPEN _BOOT_P2.BIX and you can handle that file like any other memory use FS style words such as FS@ or FSC!. In this case we dump the start of the file as longs and make sure DUMP knows to use FS (file-system) memory. You could also dump SD memory, that is the first 4GB of a raw card.
    TAQOZ# MOUNT 
    Mounted TAQOZ       550D_1961-5E5F_7F14 [SDSL08G] MSWIN4.1 FAT32    7,944MB (32kB/cluster)  ok
    TAQOZ# ls
    /TAQOZ       
    [CODE    ]      [HELP    ]      [MUSIC   ]      [VIDEOS  ]      3X5     .TXT   
    ASCIIART.TXT   CALCDEMO.FTH   EASYFILE.FTH   EASYNET .FTH   EXTEND  .FTH   
    FISH2   .VT    HOME    .HTM   HTTP001 .HTM   HTTP404 .HTM   ILIAD   .TXT   
    KJV     .TXT   LEXICON .TXT   LIFE    .FTH   LOGON   .HTM   LOVE    .WAV   
    MIDENG  .TXT   P8X32A  .PDF   PARALLAX.PNG   POPCORN .WAV   PRIDE   .TXT   
    ROUGES  .TXT   SEE     .FTH   SPLAT-V4.FTH   VULGAR  .TXT   WARPEACE.TXT   
    WARWORLD.TXT   WEBSTERS.TXT   _BOOT_P2.BIX   _BOOT_P2.BIY     ok
    TAQOZ# FOPEN _BOOT_P2.BIX...opened at 0009_88C0   ok
    TAQOZ# 0 $80 FS DUMPL 
    00000- FD65_FE00 0000_0000 FD64_1258 FD64_0E58     '..e.....X.d.X.d.'
    00010- FD64_0A59 FD60_2C1A FA60_2C15 FD60_2224     'Y.d..,`..,`.$"`.'
    00020- FD64_0A58 FD64_0E59 FD60_2C1A FA60_2C15     'X.d.Y.d..,`..,`.'
    00030- FD60_2224 FD64_0E58 FD64_1259 FD60_2C1A     '$"`.X.d.Y.d..,`.'
    00040- FA60_2C15 FD60_2224 FD64_1258 FD64_0A59     '.,`.$"`.X.d.Y.d.'
    00050- FD9F_FFC0 04C4_B400 0000_0000 0000_0000     '................'
    00060- 0000_0000 0000_0000 0000_0000 0000_0000     '................'
    00070- 0000_0000 0000_0000 0000_0000 0000_0000     '................' ok
    
  • Cluso99 wrote: »
    Garry,
    Since the SD is checking for a file and if it's not found the program returns with "!" then I suspect when the file is found that the file is corrupt or has a bug.

    Have you tried replacing the file?
    It may be worthwhile deleting the file first and then copying the new file as W10 seems to be more interested in the long filenames and I think that sometimes the 8.3 directory doesn't get updated correctly.

    The files I posted above flash pins (leds) on specific pins. I know they work.
    Yes, I copied the red/blu/grn to the SD and all failed to load in the same manner I described. I just picked up a couple of microSD cards to add to the test pool.
    As I mentioned in another post, if you want to find out what is happening in hardware, such as "why doesn't my SD card work", then jump to TAQOZ and paste in this file using line delays of ~20ms.
    Sorry I didn't specify, Peter, but I had successfully copied/pasted loaded your TAQOZ.FTH prior to generating the above output. Now that I've got more than one card I might be able to get a better idea of what's going on.

    Thanks to you both for the help you've provided so far.

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-05-21 01:41
    @garryj - it looks as if you are trying to use an old 1GB non-SDHC card and I would recommend not bothering otherwise we would have to cater for paper-tape readers as well (just to keep Heater happy).
  • @garryj - it looks as if you are trying to use an old 1GB non-SDHC card and I would recommend not bothering otherwise we would have to cater for paper-tape readers as well (just to keep Heater happy).
    Yep, I'm guilty of trying to get a little more use out of an antique :blush: With the new microSD card, the monitor "R" command is working fine and getting sensible dir output with TOQAZ.FTH. The only thing that's not working yet is startup boot using the _BOOT_P2.BIX/BIY files. I probed the CS line of the SDCard and the pull-up is there, but I have to hang it up for the night. But it's good knowing that it's 99% there :smile:
  • Cluso99Cluso99 Posts: 18,066
    My code used to handle original SD cards correctly. Since we are passing the boot and dir phase, and it's just the actual final sector reading and executing that is failing, I am fairly sure it's not an initialisation problem.
  • Cluso99Cluso99 Posts: 18,066
    For those wanting to look at the current Boot ROM (v138PBJ) for the FPGA (v32f 19May2018),
    1. It is available on Peter's dropbox
    2. Attached here
  • Cluso99 wrote: »
    For those wanting to look at the current Boot ROM (v138PBJ) for the FPGA (v32f 19May2018),
    1. It is available on Peter's dropbox
    2. Attached here

    Just checked it against p2asm, all good as it doesn't matter if this part gets clobbered by anything that needs that area.
    fff97     444e4503         byte 3, "END"
    fff9b     e3f4             word                    _END
                       
    fff9d     00000000         long    0
    fffa1              enddict
                       
    fffa1                      alignl
    
  • Cluso99Cluso99 Posts: 18,066
    garryj wrote: »
    @garryj - it looks as if you are trying to use an old 1GB non-SDHC card and I would recommend not bothering otherwise we would have to cater for paper-tape readers as well (just to keep Heater happy).
    Yep, I'm guilty of trying to get a little more use out of an antique :blush: With the new microSD card, the monitor "R" command is working fine and getting sensible dir output with TOQAZ.FTH. The only thing that's not working yet is startup boot using the _BOOT_P2.BIX/BIY files. I probed the CS line of the SDCard and the pull-up is there, but I have to hang it up for the night. But it's good knowing that it's 99% there :smile:

    I just spoke to tubular and they had a problem booting from an SD card. They found it had 8K clusters rather than the 32K clusters. It reported MSDOS5.0 and was FAT32.
    The cluster size could perhaps be a problem. I don't verify the cluster size so perhaps my file start position is incorrect.

    Can you check the cluster size please Garry?
  • Thanks for posting that code Cluso
  • :) :cool:
    Got SD running on my P123-A9 today.
    Now Botting a 330K image in 6 seconds!
    Using SD boot changes the "personality" of P2 big time.
    Nice work Cluso.
  • kwinnkwinn Posts: 8,697
    Cluso99 wrote: »
    cgracey wrote: »
    jmg wrote: »
    cgracey wrote: »
    In looking at the 4800 baud problem (it doesn't auto-baud that low), I see the problem.

    Within autobaud_isr, the max measurement allowed is $58E4 ('limit'). This gets multiplied by $1_0000/7 = $2492 ('baud0'). The product is $0CB2C208. The top 16 bits become the bit period in system clocks: ...


    Is that a limit in the Smart Hardware (eg 16b Divider ?), or just a limit in the maths of a fitting the scale into a 32b result ?

    It's a limit of the math operations. Do you think we should make it work with lower bauds?
    Does that mean I cannot use P2 with my 300 baud acoustic coupler modem :(
    https://en.m.wikipedia.org/wiki/Modem#/media/File:Analogue_modem_-_acoustic_coupler.jpg

    LOL, nope, just use software bit banging.
  • Cluso99Cluso99 Posts: 18,066
    edited 2018-05-21 13:55
    Who has tested the SD Boot and the Monitor Run commands?
    If so, what board(s) do you have?
  • dgatelydgately Posts: 1,620
    edited 2018-05-21 17:03
    Cluso99 wrote: »
    Who has tested the SD Boot and the Monitor Run commands?
    If so, what board(s) do you have?

    Should the booter and monitor be able to run on the BeMicro CV A2 (there appears to be a 32b .jic for that board, available)? That board, unlike the DE0-Nano has 128k of RAM...

    dgately
  • Cluso99 wrote: »
    I just spoke to tubular and they had a problem booting from an SD card. They found it had 8K clusters rather than the 32K clusters. It reported MSDOS5.0 and was FAT32.
    The cluster size could perhaps be a problem. I don't verify the cluster size so perhaps my file start position is incorrect.

    Can you check the cluster size please Garry?
    Cluster size is 32KB. Regarding SD, the only thing that isn't working for me now is the auto load/run at startup. I've got a Prop123-A9 and I've been using Chip's "all_cogs_blink.spin2" program as the test file. After the program fails to run at boot I can bring up the monitor and execute R_BOOT_P2.BIX the file is loaded and run. So it looks like it may be a card detection issue of some sort. I'm using the Parallax #32312 microSD breakout board, which is an older part#. Unfortunately, my play time today is short, so I'll have to dig into it later.
  • Garry, since you can run the .bix file, it's really likely the extra pullups on the breakout board that are putting the P2 into a different boot mode

    I've found we have to remove all the pullups and pulldowns and just rely on the CS pullup in the card itself.



    981 x 615 - 28K
  • Tubular wrote: »
    Garry, since you can run the .bix file, it's really likely the extra pullups on the breakout board that are putting the P2 into a different boot mode

    I've found we have to remove all the pullups and pulldowns and just rely on the CS pullup in the card itself.
    Doh! And yet another senior moment :sick:
    All is good now on the sd card boot/load front. Thanks to all for the help to get this geezer over the finish line.
  • Good news Garryj

    I wonder whether all these timeouts need to be exactly 60 seconds, or whether we could spread them apart eg 40/50/60/70 seconds, to indicate what path we've gone down. For a while there the 'cog run' led was our only clue as to what was going on
  • Cluso99Cluso99 Posts: 18,066
    The timeouts are going to vary depending on the rc oscillator anyways.
  • ozpropdevozpropdev Posts: 2,791
    edited 2018-05-22 10:10
    Cluso99 wrote: »
    Who has tested the SD Boot and the Monitor Run commands?
    If so, what board(s) do you have?
    I had SD boot working and also have been using the R command from the monitor.
    I also saved files on the SD with no extensions i.e 'DEMO' and used 'RDEMO' to run Ok.

    I also tried different cluster sizes 8,16,32 and 64k and found only 32k works.

  • Cluso99Cluso99 Posts: 18,066
    ozpropdev wrote: »
    Cluso99 wrote: »
    Who has tested the SD Boot and the Monitor Run commands?
    If so, what board(s) do you have?
    I had SD boot working and also have been using the R command from the monitor.
    I also saved files on the SD with no extensions i.e 'DEMO' and used 'RDEMO' to run Ok.

    I also tried different cluster sizes 8,16,32 and 64k and found only 32k works.


    I have a fix for the cluster bug. I had hard-coded the cluster size :(
    There is a filename problem if the decimal in the first 4 bytes.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-05-22 13:21
    Cluso99 wrote: »
    I have a fix for the cluster bug. I had hard-coded the cluster size :(
    There is a filename problem if the decimal in the first 4 bytes.

    These small cluster sizes normally only happen when a card is reformatted in an incorrect format and technically shoudn't be as they are optimized to operate with their default format. The SD card association has SD card formatter software that anyone can use so why do you have to cater for what I would essentially regard as "faulty" cards? All cards from 4GB to 32GB have 4.2MB free before the FAT32 partition and the cluster size is 32kB. This is the normal specification for SD cards, what is wrong with specifying that after all?

    Any cards I find that are incorrectly formatted I will reformat with a Panasonic SD Card Formatter but MS and Mac formatters are readily available from sdcard.org

    Actually now that I'm thinking about it, I could build in a compact SD card formatter in TAQOZ itself.

  • You should put that one in there. Seriously Peter.

    Doing that will provide a "we know they have the tool" fix for a bunch of future problems. No brainer.

    I am dealing with SD cards right now, and improper formatting leads to very rapid failure and or numerous little problems.

  • potatohead wrote: »
    You should put that one in there. Seriously Peter.

    Doing that will provide a "we know they have the tool" fix for a bunch of future problems. No brainer.

    I am dealing with SD cards right now, and improper formatting leads to very rapid failure and or numerous little problems.

    Yes, I have the low level tools and virtual memory for SD already built in so I am checking formats of cards and I will devise a suitable method. The formatter will check the card itself first and if it is suitable will proceed to format it firstly with 4.2MB free then FAT32 with 32k clusters. Hopefully I can fit it all in.

  • cgraceycgracey Posts: 14,131
    edited 2018-05-26 07:59
    At the top of this thread, I posted a new PNut_v32h.exe which doubles the size of the symbol table.

    Also, there's a new Prop123_A9_8cogs_v32h.rbf which has the CORDIC (the last version was missing the CORDIC). This version also allows ROM rewriting.

    Here's the link the new .zip:

    https://drive.google.com/file/d/13X3cXH2-O3hx-ldjroR78m5c_MPM1fqB/view?usp=sharing
Sign In or Register to comment.