Shop OBEX P1 Docs P2 Docs Learn Events
TAQOZ - Tachyon Forth for the P2 BOOT ROM - Page 23 — Parallax Forums

TAQOZ - Tachyon Forth for the P2 BOOT ROM

1202123252638

Comments

  • Here's my P2ASM version if its of help, synchronous serial mode does the work, but synchronizing all the clocks might be tricky without assembler.
    ' Smartpin I2S DAC driver  proof of concept, 3 smartpins for MCLK, BCLK, DOUT, plus LRCLK bit-banged
    ' Mark Tillotson  2019-01-12
    
    CON
        OSCMODE = $010c3f04
        FREQ = 160_000_000
    
        NCO_FREQ =%0000_0000_000_00000_00000000_01_00110_0
        SYNC_TX = %0000_1001_000_00000_00000000_01_11100_0  ' sync serial tx using pin+1 as clk
    
        DOUT_PIN_NUM  = 48
        CLOCK_PIN_NUM = DOUT_PIN_NUM + 1
        MCLK_PIN_NUM  = 50
        LRCLK_PIN_NUM = 51
    
        ' must be a multiple of 8 for MCLK = 4*BCLK
        CLKS_PER_BIT = 64  ' for 39.0625kHz samplerate (1.5MHz bitclk) (would be 48kHz for sysclk = 12.288MHz x 16)
        ' 40 will give 62.5kSPS at 160MHz sysclk
    
    PUB demo | i, a
        clkset(OSCMODE, FREQ)
    
        pausems (1000)    ' time for 'scope capture setup
        cognew (@tx_output)
        repeat
            pausems (1)
    
    DAT
                    org     0
    tx_output
                    wrpin   ##NCO_FREQ, #CLOCK_PIN_NUM
                    wxpin   ##CLKS_PER_BIT/2, #CLOCK_PIN_NUM  ' every 64 cycles (32 instructions), bit clock
                    wypin   ##$80000000, #CLOCK_PIN_NUM       ' toggle every other
    
                    wrpin   ##NCO_FREQ, #MCLK_PIN_NUM
                    wxpin   ##CLKS_PER_BIT/8, #MCLK_PIN_NUM   ' every 16 cycles (8 instructions), master clock
                    wypin   ##$80000000, #MCLK_PIN_NUM        ' toggle every other
    
                    dirh    ##CLOCK_PIN_NUM 
                    dirh    ##MCLK_PIN_NUM    ' start clocks together
    
                    mov     left, ##$80FFF000 ' test pat with bot 8 bits zero
                    mov     t, left
                    rev     t
                    shl     t, #1
                    dirh    lrclk_pin
            
                    wrpin   ##SYNC_TX, dout_pin
                    wxpin   ##%011111, dout_pin
                    wypin   t, dout_pin
                    GETCT   time
                    dirh    dout_pin
                    ADDCT1  time, idelay
                    outl    lrclk_pin
                    jmp     #.skipy       ' compensate for truncated first bit shifted by smartpin sync serial mode
                    
    .loop           ' left channel
                    outl    lrclk_pin     ' drive left/right clock
    .skipy
                    WAITCT1
                    ADDCT1 time, delay
                    sub     right, #$37   ' testing pattern, 31 bits used, decrementing
    
                    mov     t, right      ' preload right
                    rev     t
                    shl     t, #1         ' I2S justification, top bit is delayed 1 place
                    wypin   t, dout_pin
    
                    WAITCT1
                    ADDCT1  time, delay
                    
                    ' right channel
                    outh    lrclk_pin     ' drive left/right clock
                    WAITCT1
                    ADDCT1 time, delay
                    
                    add     left, #$100   ' testing pattern, strictly 24 bits
    
                    mov     t, left       ' preload left
                    rev     t
                    shl     t, #1
                    wypin   t, dout_pin
                    WAITCT1
                    ADDCT1  time, delay
                    
                    jmp     #.loop
    
    left            long    0
    right           long    0
    lrclk_pin       long    LRCLK_PIN_NUM
    dout_pin        long    DOUT_PIN_NUM
    delay           long    16 * CLKS_PER_BIT
    idelay          long    15 * CLKS_PER_BIT
    time            res     1
    t               res     1
    
  • @Mark_T - Thanks for that Mark, I might see what I can do with that as well. I think Fred wanted to see what he could do with bit-bashing but unfortunately BCLK is not just for shifting data so not only does it need to be precise, it also needs to be continuous. I'm thinking that at the TAQOZ level if he wanted to do this it should be possible to setup up two pins that output the clocks and then any data that needs to be sent can be synch'd to these.

    This is what I would call the "quick n dirty" way, but still a way :)
  • Yes, I2S devices are very fussy about their clocks and expect MCLK and BCLK (if both are used) to be phase locked
    to each other as a minimum, and all clocks to be quartz stable and jitter-free. BCLK falling edge needs to match LRCLK transitions reasonably well too.
  • @"Peter Jakacki"

    LRCLK needs to be 16kHz but I have to send the two 16 bit samples with BCLK during that time.
    I tried putting the pin in NCO Frequency and synching with Z overflow but at that speed it cannot keep up, I lose a couple cycles between each loop.
    It works really well at lower speed though.
    12 PIN L
    %1_00110_0 WRPIN
    74 WXPIN
    $8000_0000 WYPIN
    BEGIN WAITPIN AKPIN 10 HIGH 10 LOW KEY UNTIL
    
    BK00001.BMP

    By the way, when I read the smartpin Z result with RDPIN or RQPIN I don't understand the results I get.
    From the doc :
    Y[31:0] will be added into Z[31:0] at each base period.
    The pin output will reflect Z[31].
    During reset (DIR=0), IN is low, the output is low, and Z is set to zero.
    

    So I expect Z[31] to alternate evenly between 0 and 1.
    here is what I get :
    TAQOZ# 10 WXPIN ---  ok
    TAQOZ# $0000_0001 WYPIN ---  ok
    TAQOZ# RDPIN .L --- $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# F ---  ok
    TAQOZ# RDPIN .L --- $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# L ---  ok
    TAQOZ# RDPIN .L --- $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    TAQOZ# $FEF1_E50E ok
    
    

    I'm always getting the same result (ctrl-x to print multiple RDPIN .L) and I would expect Z value to be 0 when I put the DIR low,
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-02-12 11:51
    -------------------------------------------------------------------------------
      Parallax P2  *TAQOZ* Extensible Firmware  V2.0 'CHIP' 120MHz 190212-1700
    -------------------------------------------------------------------------------
    
    CHECK & FORMAT SD CARDS
    After many many days of testing and refining I now have FAT32 formatting working correctly so that PCs are happy. We like it when our PCs are happy because if they are not then there is usually not much we can do about it. I've had to switch-off my forum mode to do this and get it done as my permanently recovering chemo head only lets me get so much done in a day and it is too much of a struggle to "interface" as well :)

    The new FORMAT utility includes full SD and FAT32 reporting and diagnostics and also allows cards to be formatted in different cluster sizes from 512 to 64KB (tested). I am referring to TAQOZ as Extensible Firmware since that is what it is. You can even format the MBR by itself or other individual parts of the card if needed or extend the firmware for custom requirements.

    I had a chat with Chip the other day and decided that where we have the MBR signature "ProP" etc we can also have another signature such as "TaqO" where instead of a sector and a byte count, we simply have a vector which the SD loader calls. This is normally the TAQOZ decompress into hub memory routine which starts up TAQOZ but it may also check the buffered MBR for a clock config word to HUBSET with etc. I am also treating the first 512 bytes of the Flash the same a the MBR in SD so that this signature can also exist there. "TaqO" in SD takes priority over Flash so that a system can be overridden.

    If the TaqO signature does not exist then TAQOZ never boots unless called from the serial loader with the autobaud escape sequence. Once in TAQOZ the user can specify the clock mode easily and lock that and the baud rate into an MBR if so desired. Other features can be enabled and locked in as well including using the PS/2 keyboard and VGA monitor as the console at reboot.

    Cluso99 rang up today and we agreed on this method, he doesn't even have to worry about any hubset, just jumps to my code if there is a signature and there are no further delays. The decompress routine can even read a clock config before anything else thus speeding up reboots.

    I will have some new images later on once I add the file create routines via FOPEN with RWC permissions (RO=read-only, RW=read/write, RWC=read/write/create/delete).

    If for nothing else TAQOZ is useful for checking and formatting SD cards (and even the Flash) as FAT32.


    Format a 32GB Sandisk Ultra with 64KB clusters and then backup TAQOZ into the MBR (and check)
    -------------------------------------------------------------------------------
      Parallax P2  *TAQOZ* Extensible Firmware  V2.0 'CHIP' 120MHz 190212-1700
    -------------------------------------------------------------------------------
    TAQOZ# 64 KB CLUSTERS FORMAT --- CARD: SANDISK   SD SL32G REV$80 #2788961928 DATE:2016/8
    
                       *** CID *** 
        MANUFACTURER.................... SANDISK  
        OEM ID.......................... SD
        PRODUCT NAME.................... SL32G
        REV............................. $80
        SERIAL#......................... 2788961928
        MANUFACTURED.................... 2016/8
        CRC............................. $13 
    
                  *** OCR REGISTER *** 
        OCR VALUE....................... $C0FF_8000
        VOLTAGE RANGE................... 2.7V to 3.6V
    
                  *** CSD REGISTER *** 
        CARD TYPE....................... SDHC
        TACC LATENCY.................... 1ms+1400 clocks 
        TRANSFER SPEED.................. 50Mbps 
        CLASSES......................... 010110110101
        BLKLEN.......................... 512
        SIZE............................ 31,166MB
        Read Current @VDD min........... 35ma
        Read Current @VDD max........... 45ma
        Write Current @VDD min.......... 60ma
        Write Current @VDD max.......... 10ma
    
        SECTOR READ SPEEDS.............. 956us,543us,544us,542us,544us,542us,543us,544us,
        BLOCK READ RATE................. 1,262kB/second @120MHz
    
                       *** MBR *** 
        PARTITION....................... 0 00 INACTIVE
        FILE SYSTEM..................... FAT32 LBA
        CHS START....................... 1023,254,63
        CHS END......................... 0,0,0
        FIRST SECTOR.................... $0000_2000
        TOTAL SECTORS................... 62,325,760 = 31,910MB
    
    00170: 0000_0000 0000_0000 0000_0000 0000_0000     '................'
    
                      *** FAT32 *** 
        OEM............................. TAQOZ P2
        Byte/Sect....................... 512
        Sect/Clust...................... 128 = 64kB
        FATs............................ 2
        MEDIA........................... F8
        Sect/Track...................... $0080
        Heads........................... $0100
        Hidden Sectors.................. 8192
        Sect/Part....................... 62,325,760 = 31,910MB
        Sect/FAT........................ 3,868
        FLAGS........................... 0
        VERSION......................... 00 00 
        ROOT Cluster.................... $0000_0002 SECTOR: $0000_3EB8
        INFO Sector..................... $0001 = $0000_2001
        BACKUP Sector................... $0006 = $0000_2006
        res............................. 00 00 00 00 00 00 00 00 00 00 00 00 
        Drive#.......................... 128
        Ext sig......................... $29 OK!
        Part Serial#.................... $50AD_0021 1353515041
        Volume Name..................... P2 CARD    
        FAT Name........................ FAT32    ok
    TAQOZ# BACKUP MBR SUCCESS! ---  ok
    TAQOZ# .MBR --- 
    
                       *** MBR *** 
        PARTITION....................... 0 00 INACTIVE
        FILE SYSTEM..................... FAT32 LBA
        CHS START....................... 1023,254,63
        CHS END......................... 0,0,0
        FIRST SECTOR.................... $0000_2000
        TOTAL SECTORS................... 62,325,760 = 31,910MB
    
    00170: 0000_0000 0000_0001 0001_0000 506F_7250     '............ProP' ok
    TAQOZ# 
    

    NOTE: SDXC seems to need a little some more testing to allow writes (reading is fine) since they are setup with special speed class recording which we don't need.

    These are the forms for BACKUP:
    BACKUP <filename> --- backup to the specified file if found (does not create a file)
    BACKUP BIX --- backup to _BOOT_P2.BIX
    BACKUP MBR --- backup to sector 1 and set MBR signature (FAT32 not required)
    BACKUP FLASH --- backup to serial Flash (^R restores but does not boot yet, needs 2nd stage loader or new ROM)

    P.S. Don't expect me to be too chatty, I will have my head down to the keyboard since we need a ROM before next week.



  • Excellent work there Peter! :smiley:
  • Write Current @VDD min.......... 60ma
    Write Current @VDD max.......... 10ma
    Why is max current lower than min current?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-02-12 11:36
    frida wrote: »
    Write Current @VDD min.......... 60ma
    Write Current @VDD max.......... 10ma
    Why is max current lower than min current?

    It's a mystery, I read the CSD bit fields, look-up the table, and report the values. Some of these seem to reflect values you would see with an internal charge-pump that seems to kick in, otherwise normal, but some brands can't be trusted either as they have weird manufactured dates etc. I've combed the documents and what is there is according to the letter of the document.

    Here's a 4G Sandisk manufactured in 2010.
        Read Current @VDD min........... 10ma
        Read Current @VDD max........... 45ma
        Write Current @VDD min.......... 25ma
        Write Current @VDD max.......... 10ma
    
  • MJBMJB Posts: 1,235
    msrobots wrote: »
    Works fine, just lsio will destroy my new pinsettings.
    ...
    Mike

    you can just not use it and if you need it just make your own
    patched "lsio" which skips scanning your communication pins.

    the code is there.
  • Cluso99Cluso99 Posts: 18,069
    edited 2019-02-12 12:03
    Nice Peter :smiley:

    Presume FAT32 LBA has the identifier $0C while the older is FAT32 CHS which has $0B IIRC.
    Have you seen any FAT32 CHS formatted cards?

    I saw exFAT uses $07 shich is the same as NTFS ???

    I was reading exFAT and it seems that the hash patent is for hashing the filename to do a fast lookup to see if it exists. If so, then it seems to do a slow crawl thru the DIR looking for the filename, just like FAT32. If i get time to onfirm this, then maybe I can search for tbe filenames and load too.
  • kwinnkwinn Posts: 8,697
    frida wrote: »
    Write Current @VDD min.......... 60ma
    Write Current @VDD max.......... 10ma
    Why is max current lower than min current?

    I'm guessing those are the required currents when Vdd is at min or max.
  • Yes, DC-DC conversion inside the SDcard will be very inefficient if Vdd is 1.8V or lower, compared to 3.3V.
    The interface normally starts at 3.3V and negotiates a lower voltage for higher speed operation, IIRC
  • FredBlaisFredBlais Posts: 370
    edited 2019-02-12 14:22
    Thanks Peter, great work. The more I work with Taqoz, the more I enjoy it. It is actually easier to learn than I thought at first. It's just a matter of diving in and taking the time to learn the basics.
    I work with a OneNote notebook open beside my terminal window, I write a little bit of code in my notebook first and test it as I go. If something is wrong, I can start debugging right away in the terminal. That reminds me the way I work with Python, with a REPL prompt always open.

    When you'll be done with the ROM, it think it would be a good investment to start that GitHub repo. I've took a lot of notes so far and I would like to contribute back what I'm doing so that everyone can benefit from it. That way you can invest your time adding new features while the "Taqoz team" can help with improving the docs and example code.
  • Today is D Day, where the letter D is for Deliver the ROM. While there are a ton of things I'd still like to do I find I must stop right where I am and prepare. Now I am trimming the file to reclaim unneeded private names from the dictionary, zeroing out unused space, inserting conditional compile statements in the source to remove less important code etc so that I can end up with a target of around 12kB of compressed code. Most of the stuff is still in it with 14kB compressed so I will judiciously working it to come up with the magic 12kB number I need to squeeze into ROM. The decompress routine should hopefully take up no more than 200 bytes but I need to test that today. Once I have ROM files ready to go and I still have time I will add the extra mailbox functions and double check some timings.

    The FORMAT option is quite flexible but TAQOZ can still be extended quite easily with simple one-liners.

    Here's a terminal grab showing the detailed directory listing where it reports the exact size of the file as well as the size allocated in the cluster chain, as well as the contents of the file header. The 1.4G ISO file took a couple of seconds to report the allocated size since the cluster chain had to be scanned for 352,000 4k cluster chain entries to determine the allocated space :)
    -------------------------------------------------------------------------------
      Parallax P2  *TAQOZ* Extensible Firmware  V2.0 'CHIP' 120MHz 190212-1700
    -------------------------------------------------------------------------------
    TAQOZ# MOUNT --- CARD: SANDISK   SD SU04G REV$80 #10 DATE:2010/10 ok
    TAQOZ# DIR --- 
      0: TEST         08 
      1: _BOOT_P2.BIN 20 $0000_5B18   2018-12-24 06:48        131,072 /       131,072   X...P2D2F   ........
      2: WEBSTERS.TXT 20 $0000_5C18   2017-11-24 12:59     28,956,348 /    28,958,720   ...The Project Guten
      3: BIRD    .BMP 20 $0001_3908   2018-12-24 06:54        308,346 /       311,296   BMz.......z...l.....
      4: BUZZ    .BMP 20 $0001_3B68   2018-11-24 01:53        308,346 /       311,296   BMz.......z...l.....
      5: DRAGON  .BMP 20 $0001_3DC8   2018-10-24 01:21        308,346 /       311,296   BMz.......z...l.....
      6: EYEGOD  .BMP 20 $0001_4028   2018-10-24 04:17        308,346 /       311,296   BMz.......z...l.....
      7: FACE    .BMP 20 $0001_4288   2018-10-24 04:03        308,346 /       311,296   BMz.......z...l.....
      8: FIRE    .BMP 20 $0001_44E8   2018-11-24 23:51        308,346 /       311,296   BMz.......z...l.....
      9: LMMS    .BMP 20 $0001_4748   2018-10-24 01:01        308,280 /       311,296   BM8.......6...(.....
     10: LOVE    .WAV 20 $0001_49A8   2015-02-24 08:06     14,630,692 /    14,630,912   RIFF.?..WAVEfmt ....
     11: MCQUEEN .BMP 20 $0001_B948   2018-10-24 04:19        308,346 /       311,296   BMz.......z...l.....
     12: P2D2A   .BMP 20 $0001_BBA8   2018-12-24 14:26        308,346 /       311,296   BMz.......z...l.....
     13: POPCORN .WAV 20 $0001_BE08   2012-11-24 13:26      3,242,394 /     3,244,032   RIFF.y1.WAVEfmt ....
     14: SPIDEY  .BMP 20 $0001_D6C8   2018-10-24 04:24        308,346 /       311,296   BMz.......z...l.....
     15: SUNSET  .BMP 20 $0001_D928   2018-10-24 04:13        308,346 /       311,296   BMz.......z...l.....
     16: TIGER   .BMP 20 $0001_DB88   2018-12-24 14:23        308,346 /       311,296   BMz.......z...l.....
     17: WARPEACE.TXT 20 $0001_DDE8   2015-08-24 07:27      3,226,652 /     3,227,648   The Project Gutenber
     18: WARWORLD.TXT 20 $0001_F688   2017-11-24 13:42        365,413 /       368,640   ...The Project Guten
     19: ASCIIART.TXT 20 $0001_F958   2017-11-24 15:05         55,148 /        57,344   From dondd@hpmwtd.HP
     20: FISH2   .VT  20 $0001_F9C8   2017-11-24 15:08        211,945 /       212,992   .[H.[J..[1;0H       
     21: ILIAD   .TXT 20 $0001_FB68   2017-11-24 12:55      1,201,891 /     1,204,224   ...The Project Guten
     22: KJV     .TXT 20 $0002_0498   2017-08-24 12:28      5,504,282 /     5,505,024        _______________
     23: LEXICON .TXT 20 $0002_2E98   2017-11-24 13:48        988,130 /       991,232   ...The Project Guten
     24: MIDENG  .TXT 20 $0002_3628   2017-11-24 14:11      1,248,077 /     1,249,280   ...The Project Guten
     25: PRIDE   .TXT 20 $0002_3FB0   2017-11-24 12:54        726,223 /       729,088   ...The Project Guten
     26: ROUGES  .TXT 20 $0002_4540   2017-11-24 13:51        219,885 /       221,184   ...The Project Guten
     27: VULGAR  .TXT 20 $0002_46F0   2017-11-24 13:56        511,916 /       512,000   ...Project Gutenberg
     28: _BOOT_P2.B2  20 $0002_4AD8   2019-02-24 14:16         65,536 /        65,536   X...P2D2F   ........
     29: _BOOT_P2.LZM 20 $0002_4B58   2019-02-24 14:09         14,798 /        16,384   ].............,...T.
     30: _BOOT_P2.B1  20 $0002_4B78   2019-02-24 14:18         65,536 /        65,536   ....................
     31: WARPEACE.LZM 20 $0002_4BF8   2019-02-24 14:22        921,939 /       925,696   ].............*.....
     32: SPIDEY  .LZM 20 $0002_5308   2019-02-24 14:23        102,984 /       106,496   ].............!.K..R
     33: MX18-64 .ISO 20 $0002_53D8   2019-01-24 15:10  1,441,792,000 / 1,441,792,000   3...................  ok
    TAQOZ# ls --- 
    TEST         _BOOT_P2.BIN WEBSTERS.TXT BIRD    .BMP BUZZ    .BMP DRAGON  .BMP EYEGOD  .BMP FACE    .BMP 
    FIRE    .BMP LMMS    .BMP LOVE    .WAV MCQUEEN .BMP P2D2A   .BMP POPCORN .WAV SPIDEY  .BMP SUNSET  .BMP 
    TIGER   .BMP WARPEACE.TXT WARWORLD.TXT ASCIIART.TXT FISH2   .VT  ILIAD   .TXT KJV     .TXT LEXICON .TXT 
    MIDENG  .TXT PRIDE   .TXT ROUGES  .TXT VULGAR  .TXT _BOOT_P2.B2  _BOOT_P2.LZM _BOOT_P2.B1  WARPEACE.LZM 
    SPIDEY  .LZM MX18-64 .ISO   ok
    TAQOZ# .DISK --- 
    
                       *** CID *** 
        MANUFACTURER.................... SANDISK  
        OEM ID.......................... SD
        PRODUCT NAME.................... SU04G
        REV............................. $80
        SERIAL#......................... 10
        MANUFACTURED.................... 2010/10
        CRC............................. $E7 
    
                  *** OCR REGISTER *** 
        OCR VALUE....................... $C0FF_8000
        VOLTAGE RANGE................... 2.7V to 3.6V
    
                  *** CSD REGISTER *** 
        CARD TYPE....................... SDHC
        TACC LATENCY.................... 1ms+1400 clocks 
        TRANSFER SPEED.................. 50Mbps 
        CLASSES......................... 010110110101
        BLKLEN.......................... 512
        SIZE............................ 3,872MB
        Read Current @VDD min........... 10ma
        Read Current @VDD max........... 45ma
        Write Current @VDD min.......... 25ma
        Write Current @VDD max.......... 10ma
    
        SECTOR READ SPEEDS.............. 917us,1017us,1053us,1106us,1048us,1060us,995us,903us,
        BLOCK READ RATE................. 1,241kB/second @120MHz
    
                       *** MBR *** 
        PARTITION....................... 0 00 INACTIVE
        FILE SYSTEM..................... FAT32 LBA
        CHS START....................... 1023,254,63
        CHS END......................... 0,0,0
        FIRST SECTOR.................... $0000_2000
        TOTAL SECTORS................... 7,736,320 = 3,960MB
    
    00170: 0000_0000 0000_0001 0001_0000 506F_7250     '............ProP'
    
                      *** FAT32 *** 
        OEM............................. mkfs.fat
        Byte/Sect....................... 512
        Sect/Clust...................... 8 = 4kB
        FATs............................ 2
        MEDIA........................... F8
        Sect/Track...................... $003E
        Heads........................... $007A
        Hidden Sectors.................. 8192
        Sect/Part....................... 7,736,320 = 3,960MB
        Sect/FAT........................ 7,544
        FLAGS........................... 0
        VERSION......................... 00 00 
        ROOT Cluster.................... $0000_0002 SECTOR: $0000_5B10
        INFO Sector..................... $0001 = $0000_2001
        BACKUP Sector................... $0006 = $0000_2006
        res............................. 00 00 00 00 00 00 00 00 00 00 00 00 
        Drive#.......................... 384
        Ext sig......................... $29 OK!
        Part Serial#.................... $7806_E39C 2013717404
        Volume Name..................... TEST       
        FAT Name........................ FAT32    ok
    TAQOZ# WORDS --- 
    0E669: fibos fibo DISKINFO .SECTORS lss .SECTOR R3 R2 R1 R0 EXTRAS P2PC PC CONVGA CONKEYB KEYB@ KEYB 
    !KEYB kbb KEY#@ KBRK MAKE? RXKB kbtbl kbk rak lak rck lck rsk lsk caps kbs VEMIT VGA VCH NEWLINE 
    VSCROLL VHOME TERM NS VXY b/l _scrolls vflg row1 row col1 col CSP LSP csp lsp FONT5X7 VIEWSEC 
    VIEW$ VIEW VFLIP VFILL CLRSCR PANEL RECT VLINE HLINE LINETO X+- Y+- Y2 X2 -C64 -TERM -MAC !PALETTE 
    >RGB RGB> REVERSE PLAIN brown gray coal white magenta cyan blue yellow green red black PLOT 
    PIXEL! PEN> >PEN PAPER@ PEN@ PAPER PEN _pen1 _paper1 _pen _paper BR BL TR TL CENTER Y+! X+! 
    !XY XY@! XY! @XY h w y x Y@ X@ scr* height width _y1 _y _x1 _x SHOW HIDE FRAMES SYNCH rm lm 
    scrsz rows cols SCR PALETTE vcnt vint BMP BACKUP$ BACKUP BIX .ACTIVE .SECT FORMAT !ROOT .DISK 
    .FAT .PS .res !FAT !FATS !FATX !FSINFO CLUSTERS #s/c 64KB .MBR .MB !MBR .CHS ?FS .SD .SPEEDS 
    .SPD QV cat RENAME RENAME# FLOAD FOPEN$ FOPEN FOPEN# FINDSD FNAME= >F83 GETF$ atr ext fname 
    dirbuf FWRITE FREAD FGET FLOADS ls DIRW .DIR DIR .ENT .DATE .DECX GAP .NAME @DIR @FNAME FOPENS 
    ?MOUNT MOUNT RDFAT ALLOCATED? S>C C>S2 C>S FSECT CLUST0 CLUSTERS? @CLUST #ecc CWD! PART0 FOPENS! 
    ROOT @FAT @BOOT @ROOT SD SDW@ SDC! SDC@ SD! SD@ SDADR SDADR! @FILE SECTOR SECTORF SDRDS SDWAIT 
    SDRDX SDRD SDRDBK FLUSH ?FLUSH SDWRS SDWR SDWR? W? RWC RW wm RO .OCR .CSD .TRANS .TACC TACC 
    tval .CURRENT .xs 10^ .ma ma ,, .CIDL .BAD .CID .MAN .TITLE .LINE@ .LINE !SD !SDBUF !SX BITS@ 
    CSD@ XSHR SDDAT! SDSTAT ACMD SDRES CMD !CRC TOKEN SDCLK3 SDCLK RELEASE SD? SDPINS SDCS SDSPI 
    SDBUF+ SDBUF fcl fdate ftime fch fatsz sdsz cwdsect fat2 fat1 rootdir volname serial extsig 
    ldn bbsect rootcl fat? s/f s/p hidden media fats rsvd s/c b/s oemname fat32 parsig parts bitbuf 
    blklen sdhc fq f? file# wrens sdcrc wrflg sdcmd _fkey mntd _fread filesect @sector seccrc sdsum 
    @sdwr @sdrd sdsize csd cid ocr sdvars unum uaccept uprompt flags keypoll SYNTX VOLTS@ SETADC 
    AMIN AREF aref amin ADC V DAC HILO PULSES PULSE PW ns SMPS TRI PWM! PWM BLINK DUTY SETNCO NCO 
    HZ KHZ MHZ NCOCNT MUTE WRFNC SINK SOURCE DRAIN !OUT !IN CLOCKED OPEN 10ua 100ua 1ma 150K 15K 
    1K5 FAST PINM 14P TURBO FAST CRUISE SLOW P2MHZ RCFAST CLOCK1 CLOCK -PF 0PF 30PF 15PF CC RCSLOW 
    USEXTAL USEPLL CLKSRC PLLDIV VCOMUL XIDIV PLLOFF PLLEN CLK! CLKSET _fin _clk CONBAUD RXD BAUD 
    TXD dl -bit TABLE NULL KEY: EMIT: .SUCCESS .OK ?PINS ?PIN PIN _pinmode >! $+ V$ COMPARE $= 
    .KB D. U.R D.R #S, .BYTES .BITS DW COMMA SPINNER _sp _el RUN BUFFER USB1- USB1+ USB- USB+ AINR 
    AINL AOUTR AOUTL SDA SCL KBDAT KBCLK SDDO SDDI SDCK INB INA OUTB OUTA DIRB DIRA *** ALIAS .VER 
    DUP OVER 3RD 4TH OVER+ SWAP ROT -ROT DROP 2DROP 3DROP NIP 2SWAP 2DUP ?DUP OP2 AND ANDN OR XOR 
    ROL ROR ROR? WRCH >> << SAR 2/ 2* 4/ 4* 16<< 8<< 9<< 16>> 8>> 9>> REV |< >| 1& >N >B >9 BITS 
    NOT = <> 0= 0<> 0< < U< > U> <= => WITHIN DUPC@ C@ W@ @ C+! C! C@++ W+! W! +! ! D@ D! BIT! 
    SET CLR SET? 1+ 1- 2+ 2- 4+ + - b++ UM* * W* DM* / U/ U// // */ UM// C++ C-- W++ W-- ++ -- 
    RND GETRND SQRT SETDACS ~ ~~ W~ W~~ C~ C~~ L>S >W L>W W>B W>L B>W B>L MINS MAXS MIN MAX ABS 
    -NEGATE ?NEGATE NEGATE ON TRUE -1 FALSE OFF GOTO IF ELSE THEN BEGIN UNTIL AGAIN WHILE REPEAT 
    SWITCH CASE@ <CASE> BREAK CASE ADO DO LOOP +LOOP FOR NEXT ?NEXT I J LEAVE IC@ I+ BOUNDS H L 
    T F R HIGH LOW FLOAT MSBOUT MSBOUT PIN@ WRPIN WXPIN WYPIN RDPIN RQPIN AKPIN RDPINC WAITPIN 
    WRACK pIN @PIN WAITX WAITCNT SETSE1 SETSE2 SETSE3 SETSE4 WAITSE1 WAITSE2 WAITSE3 WAITSE4 REBOOT 
    RESET 0EXIT EXIT NOP CALL JUMP >R R> >L L> !SP DEPTH COG@ COG! LUT@ LUT! COGID COGINIT COGSTOP 
    NEWCOG COGATN POLLATN SETEDG POLLEDG KEY WKEY KEY! CON NONE COM CONKEY CONEMIT SEROUT .EMIT 
    EMIT EMITS CRLF CR CLS SPACE SPACES RAM DUMP: DUMP DUMPW DUMPL DUMPA DUMPAW QD QW ?ERROR CONSOLE 
    DEBUG lsio COG LUT KB MB M . PRINT .AS .AS" .DECL .DEC4 .DEC2 HOLD #> <# # #S <D> U. .DEC .BIN 
    .H .B .BYTE .W .WORD .L .LONG .ADDR PRINT$ LEN$ UPPER$ " ." PRINT" CTYPE NUMBER ?EXIT ERASE 
    FILL CMOVE <CMOVE LMOVE s ms us CNT@ LAP LAP@ .LAP .CLK .ms HEX DEC BIN .S W WORDS @WORDS GET$ 
    SEARCH $># uemit ukey char delim names TASK REG @WORD SPIN | || , [W] ["] NULL$ $! $= >UPPER 
    ASM FORGET CREATE$ CREATE: VAR pub pri pre public private : ; [ ] ' := :=! ALIGN DATCON ALLOT 
    HERE @HERE @CODES orglen org@ !org org bytes words longs byte word long res [C] GRAB [G] NFA' 
    CPA CFA \ --- ( { } IFNDEF IFDEF TAQOZ TERM AUTO SPIRD SPIRL SPIWB SPICE SPIWC SPIWW SPIWM 
    SPIWL SPIPINS SPIRX SPITXE SPITX CLKS CLKIN CLKOUT CLOCK WSLED WAIT CLKDIV RCSLOW HUBSET WP 
    WE CLKHZ ERROR SFPINS SF? SFWE SFCMD SFWD SFSID SFJID SFER4 SFER32 SFER64 SFERASE SFERPAGE 
    SFWRPG SFBACKUP RESTORE SFRDS SFWRS SFC@ SFW@ SF@ SF .SF END  891 ok
    TAQOZ# 
    
    
  • jmgjmg Posts: 15,171
    edited 2019-02-15 04:41
    Today is D Day, where the letter D is for Deliver the ROM. While there are a ton of things I'd still like to do I find I must stop right where I am and prepare. Now I am trimming the file to reclaim unneeded private names from the dictionary, zeroing out unused space, inserting conditional compile statements in the source to remove less important code etc so that I can end up with a target of around 12kB of compressed code. Most of the stuff is still in it with 14kB compressed so I will judiciously working it to come up with the magic 12kB number I need to squeeze into ROM. The decompress routine should hopefully take up no more than 200 bytes but I need to test that today. Once I have ROM files ready to go and I still have time I will add the extra mailbox functions and double check some timings.

    Do you have a list/mapping of supported TAQOZ operations, to Smart Pin modes ?
    I've seen a few go past, and used a couple, but a full set would be useful to many users.
    P2 Docs list:
    %MMMMM:  00000   = smart pin off (default)
             00001   = long repository              (P[12:10] != %101)
             00010   = long repository              (P[12:10] != %101)
             00011   = long repository              (P[12:10] != %101)
             00001   = DAC noise                    (P[12:10]  = %101)
             00010   = DAC 16-bit dither, noise     (P[12:10]  = %101)
             00011   = DAC 16-bit dither, PWM       (P[12:10]  = %101)
             00100*  = pulse/cycle output
             00101*  = transition output
             00110*  = NCO frequency
             00111*  = NCO duty
             01000*  = PWM triangle
             01001*  = PWM sawtooth
             01010*  = PWM switch-mode power supply, V and I feedback
             01011   = periodic/continuous: A-B quadrature encoder
             01100   = periodic/continuous: inc on A-rise & B-high
             01101   = periodic/continuous: inc on A-rise & B-high / dec on A-rise & B-low
             01110   = periodic/continuous: inc on A-rise {/ dec on B-rise}
             01111   = periodic/continuous: inc on A-high {/ dec on B-high}
             10000   = time A-states
             10001   = time A-highs
             10010   = time X A-highs/rises/edges -or- timeout a-/high/rise/edge
             10011   = for X periods, count time
             10100   = for X periods, count states
             10101   = for periods in X+ clocks, count time
             10110   = for periods in X+ clocks, count states
             10111   = for periods in X+ clocks, count periods
             11000*  = USB host, low-speed          (even/odd pin pair = DM/DP)
             11001*  = USB host, full-speed         (even/odd pin pair = DM/DP)
             11010*  = USB device, low-speed        (even/odd pin pair = DM/DP)
             11011*  = USB device, full-speed       (even/odd pin pair = DM/DP)
             11100*  = sync serial transmit         (A-data, B-clock)
             11101   = sync serial receive          (A-data, B-clock)
             11110*  = async serial transmit        (baudrate)
             11111   = async serial receive         (baudrate)
    
  • Cluso99Cluso99 Posts: 18,069
    @jmg
    I don't think you will see any answers from Peter until TAQOZ is done.
  • cgraceycgracey Posts: 14,134
    edited 2019-02-15 05:39
    Peter, any idea when you will send me the BIG source file with all of our code in it? I will compile final FPGA images when I get it. And, I will compose the final ROM file for ON Semi.

    Tonight I am working on the layout change recipe to tweak the PLL loop filter, so that it works more like it ought to.

    These are the final things that need to be done, in order to complete Parallax' input for the next silicon. After this, ON Semi runs with it and tapes out on March 1st. Prototypes should be back on May 20th.
  • Cluso99Cluso99 Posts: 18,069
    Chip,
    I know Peter is working on it. He said he would not be on the forum so I'll send him an SMS.
    Ray
  • FredBlaisFredBlais Posts: 370
    edited 2019-02-16 18:30
    I got I2S to work, no assembly required!
    16kHz sample rate, 16bit resolution
    1 cog, 2 nco frequency smartpin, 1 synchronous serial smartpin, TAQOZ reading wav file from SD card @ 80MHz
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-02-17 03:34
    @FredBlais - Sweet! Great work! But where's the code? :)

    TAQOZ ROM UPDATE
    I'm under pressure and need to get this finished but I am squeezing TAQOZ down so it can fit in a 12k compressed image. I made a big mistake early on and didn't fully check the requirements of LMZA and it seems like a 14kB image needs a 8MB dictionary!!! At least that is what the header is telling me but I am checking through that properly since it does have great compression as the only other alternative I see is to use LZ4 (which I initially confused with LZM) but while that is lean and fast to decompress, the image size is larger which requires more aggressive "squeezing" of the code.

    I had to leave out all the VGA and PS/2 stuff because I wanted to make sure that TAQOZ would be able to diagnose and fix SD card problems. It can FORMAT any SDHC and SDXC card as FAT32 with any sector/cluster size of 512 to 64KB. I thought I had a problem with trying to format a 64GB SDXC card but that turned out to be a faulty card since it wouldn't format in other PCs either although it reads fine. Doing a bit of research on why it wouldn't format led me to some people complaining that this is what happens to these Sandisk Ultra 64GB cards in that you can read them but can't write to them anymore, as if the integrated charge-pump failed or something. I seem to remember that this card was in a phone but eventually became faulty for some reason.

    So in the meantime I am busy squeezing and testing LZ4 and LZMA methods. I'd appreciate feedback from anybody with experience in this area but obviously time is not a luxury we can afford.

    NOTE: DO NOT BUY SANDISK ULTRA 64GB - I've always had problems with them and from my research it seems so does everybody else. Otherwise smaller Sandisk cards are good.
  • Cluso99Cluso99 Posts: 18,069
    I have one SanDIsk Ultra SDHC 64GB (red/grey) in exFAT. No problems yet.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-02-17 08:06
    Cluso99 wrote: »
    I have one SanDIsk Ultra SDHC 64GB (red/grey) in exFAT. No problems yet.

    Funny that I didn't even think to try to format it on a PC since I have such high regard for SanDisk, yet this card failed in a phone and I think I had another one do the same in another.
    Could you display the internal register data on your unit?

    Here's the current image for the P2D2 if that helps.
    ROM
    64K
  • Cluso99Cluso99 Posts: 18,069
    Here it is Peter...
    P2-EVAL ROM_Booter_v32i_SD_002f
    INIT:
    (CMD: 00 00000000 95)
    (CMD: 08 000001AA 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 37 00000000 87)
    (CMD: 29 40000000 87)
    (CMD: 3A 00000000 87)
    i) block mode
    (CMD: 10 00000200 87)
    CSD: (CMD: 09 00000000 87)
    00000000
    00000: 40 0E 00 32  5B 59 00 01  DB D3 7F 80  0A 40 40 DF   '@..2[Y.......@@.'
    CID: (CMD: 0A 00000000 87)
    00000000
    00010: 03 53 44 53  4C 36 34 47  80 73 CA 4B  59 01 1C 17   '.SDSL64G.s.KY...'
    MBR: sector: (CMD: 11 00000000 87)
    00000000
    00000: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00010: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00020: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00030: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00040: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00050: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00060: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00070: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00080: 00 FE 65 FD  00 00 00 00  58 12 64 FD  58 0E 64 FD   '..e.....X.d.X.d.'
    00090: 58 0A 64 FD  1A 5E 60 FD  2E 5E 60 FA  24 22 60 FD   'X.d..^`..^`.$"`.'
    000A0: 59 12 64 FD  1A 5E 60 FD  2E 5E 60 FA  24 22 60 FD   'Y.d..^`..^`.$"`.'
    000B0: 58 12 64 FD  DC FF 9F FD  00 68 89 09  00 00 00 00   'X.d......h......'
    000C0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000D0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000E0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000F0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00100: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00110: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00120: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00130: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00140: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00150: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00160: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00170: 00 00 00 00  01 00 00 00  00 02 00 00  50 72 6F 50   '............ProP'
    00180: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00190: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001A0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001B0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 0A   '................'
    001C0: 09 02 07 FE  FF FF 00 80  00 00 00 D0  6E 07 00 00   '............n...'
    001D0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001E0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001F0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 55 AA   '..............U.'
    FILE: sector: (CMD: 11 00000001 87)
    00000001
    00000: 00 FE 65 FD  00 00 00 00  04 00 90 FD  00 00 00 00   '..e.............'
    00010: 51 62 82 FF  1F 00 64 FD  5F 0E 64 FD  F0 FF 9F FD   'Qb....d._.d.....'
    00020: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00030: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00040: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00050: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00060: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00070: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00080: 00 FE 65 FD  00 00 00 00  04 00 90 FD  00 00 00 00   '..e.............'
    00090: 51 62 82 FF  1F 00 64 FD  5F 0E 64 FD  F0 FF 9F FD   'Qb....d._.d.....'
    000A0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000B0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000C0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000D0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000E0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    000F0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00100: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00110: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00120: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00130: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00140: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00150: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00160: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00170: 00 00 00 00  00 00 00 00  00 00 00 00  50 72 6F 78   '............Prox'
    00180: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    00190: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001A0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001B0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001C0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001D0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001E0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    001F0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00   '................'
    i) file loaded :)
    SD-DO tristate 0A
    i) run :)
    
  • @Cluso99 - can you boot with that P2.ROM image and see if you can format it to FAT32 using "0 FORMAT" to select autosized clusters then paste the result back? Sounds like a different type of Sandisk 64GB from what I have "SL64G" vs "SU64G". I would really like to make sure that this works fine on a 64GB since this is why I implemented the disk utilities. Those $14 64GB are local from MSY so I will test them as soon as I can but not before committing the ROM.

    If you want 32kB clusters you can type:
    32 KB FORMAT
    Smaller clusters take longer to format as there are more FAT32 table entries that have to be initialized.

  • Cluso99Cluso99 Posts: 18,069
    Do i just download the rom file with pnut?
    Ill try in the morning if i get time before work. I have a dentist appt after work so will be late home.
  • FredBlaisFredBlais Posts: 370
    edited 2019-02-17 15:08
    @"Peter Jakacki"

    I've put some examples files on my OneDrive
    Here is the code :
    {
    WAVE FILE PLAYBACK FOR PROPELLER 2 WITH ADAFRUIT MAX98357 I2S CLASS D MONO AMPLIFIER 
    
    CLOCK SETUP AT 80MHZ
    16 KHZ SAMPLE RATE, 16 BITS RESOLUTION
    BCLK FREQUENCY : 16KHZ * 16 (BITS) * 2 (LEFT/RIGHT) = 512KHZ
    
    BCLK AND LRCLK GENERATED WITH 2 SMARTPINS IN NCO FREQUENCY MODE
    WYPIN SET AT 2**32/2 = $8000_0000 
    WXPIN FOR BCLK : (80E6)/(512E3)/2 = 78.125 APPROXIMATED TO 78
    WXPIN FOR LRCLK : 78*32 = 2496
    
    DIN SETUP IN SYNCHRONOUS SERIAL MODE
    IF YOU CHANGE DIN AND BCLK PINS, YOU NEED TO CHANGE DIN MODE CONFIG
    DIN CLOCK PIN IS SETUP AT PIN + 2
    
    LINKS :
    https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/pinouts
    https://cdn-learn.adafruit.com/downloads/pdf/adafruit-max98357-i2s-class-d-mono-amp.pdf
    https://cdn-shop.adafruit.com/product-files/3006/MAX98357A-MAX98357B.pdf
    http://soundfile.sapp.org/doc/WaveFormat/
    }
    
    --- ASSIGN PINS
    14 := LRCLK
    12 := BCLK
    10 := DIN
    DIN BCLK LRCLK |< ROT |< ROT |< OR OR := PIN_MASK
    
    : DISABLE_I2S DIRA COG@ PIN_MASK NOT AND DIRA COG! ;
    : ENABLE_I2S DIRA COG@ PIN_MASK OR DIRA COG! ;
    
    --- SMARTPINS CONSTANTS
    %1010 24 << %1_11100_0 OR := SYNC_TX
    %1_00110_0 := NCO_FREQ
    1 14 << NCO_FREQ OR := NCO_FREQ_INV
    %001111 := CONTINUOUS_16_BIT
    
    --- SMARTPINS SETUP
    DISABLE_I2S
    LRCLK PIN NCO_FREQ WRPIN 2496 WXPIN $8000_0000 WYPIN
    BCLK PIN NCO_FREQ_INV WRPIN 78 WXPIN $8000_0000 WYPIN
    DIN PIN SYNC_TX WRPIN CONTINUOUS_16_BIT WXPIN
    
    FOPEN MARIO.WAV
    
    --- WAVE DATA START AT ADDRESS 44, PRIME SYNC SERIAL SHIFTER
    44 DUP SDW@ REV 16>> DUP 4* WYPIN DUP 14 >> SWAP
    ENABLE_I2S
    DUP -ROT 4* OR WYPIN 14 >> SWAP 2+ WAITPIN
    
    --- ADDRESS 40 IS SUBCHUNK2SIZE
    40 SD@ 2/ 2 -
    --- EXIT ON KEY PRESS OR EOF
    FOR DUP SDW@ REV 16>> SWAP -ROT DUP -ROT 4* OR WYPIN WAITPIN DUP 14 >> SWAP DUP -ROT 4* OR WYPIN 14 >> SWAP 2+ WAITPIN KEY ?NEXT
    
  • jmgjmg Posts: 15,171
    FredBlais wrote: »
    I've put some examples files on my OneDrive
    Here is the code :
    [code]
    {
    WAVE FILE PLAYBACK FOR PROPELLER 2 WITH ADAFRUIT MAX98357 I2S CLASS D MONO AMPLIFIER

    CLOCK SETUP AT 80MHZ
    16 KHZ SAMPLE RATE, 16 BITS RESOLUTION
    BCLK FREQUENCY : 16KHZ * 16 (BITS) * 2 (LEFT/RIGHT) = 512KHZ

    Impressive.
    What sample rate.resolution or BCLK MHz, can the code manage up to, before the software is too slow to keep up ?

    I see a cryptic FOPEN MARIO.WAV, but no comments saying how large that is, or where it resides, or how the user loads that WAV file ?
  • FredBlaisFredBlais Posts: 370
    edited 2019-02-17 22:13
    jmg wrote: »
    Impressive.
    What sample rate.resolution or BCLK MHz, can the code manage up to, before the software is too slow to keep up ?

    I see a cryptic FOPEN MARIO.WAV, but no comments saying how large that is, or where it resides, or how the user loads that WAV file ?

    The file is 5344 KB large and is sitting on the SD card along with the _BOOT_P2.BIX that is TAQOZ release from january 27 with the meta compiled extension file.

    FOPEN is Peter magic, it opens the file on the SD and then all the rest is done with the SDW@ (SD word get).
    pre FOPEN
    	GET$
    pub FOPEN$ ( str -- )
    	>F83 DROP FINDSD ?DUP IF FSECT ELSE 0 THEN FOPENS
    	;
    --- Lookup starting sector from dir entry
    pub FSECT ( diradr -- sector )
    ---	cluster low and cluster high
    	fcl OVER+ W@ SWAP fch + W@ W>L
    pub C>S --- convert cluster to to starting sector
     	rootcl @ - sectclust C@ * @ROOT +
    	;
    
    --- find current f83 name and return with file offset to directory entry
    pri FINDSD ( -- sdrel )
    	ROOT
    	0 BEGIN DUP SDADR FNAME= NOT WHILE DUP SDADR C@ 0= IF DROP 0 EXIT THEN 32 + REPEAT
    	SDADR
    	;
    

    For the speed, I've got 31.25us per sample to do my stuff and getting the 16 bit word from the SD card takes 13us.
    Going from 16 bit to 32 bit resolution should be easy because that part is all done by the smartpin.
    When I change the clock speed to 360MHZ, it takes 3us to read a word or a long from the SD Card
    TAQOZ# 44 LAP SDW@ LAP .LAP --- 1,056 cycles= 2,933ns @360MHz ok
    TAQOZ# 44 LAP SD@ LAP .LAP --- 1,064 cycles= 2,955ns @360MHz ok
    

    the max sample rate for the amplifier is 96kHz. That gives me 5.2us to send the data.
    So it seems totally possible to achieve the amplifier top speed and top resolution. :)

  • @Cluso99 - Just rename P2.ROM to _BOOT_P2.BIX etc and put it onto a FAT32 card, boot it, then swap cards. This version will automount as soon as you insert the 64GB card so it should report the verbose CID details. Then try 0 FORMAT to auto format the card to FAT32 after which it will perform a .DISK which will display all the card and FAT32 info.

    Just to be on the safe side, here is the latest P2D2 image (.BIN attachments aren't accepted by the forum anyway)
    ROM
    64K
  • @cluso99 - you may have an earlier version that had a buggy automount and would loop. Essentially the automounter checks that the card is inserted, the serial number matches, and if none if these are right it will unmount. So once the card is inserted and it detects the card (in the console keypoll loop) and it knows it isn't mounted, it will perform the automount.

    PNut doesn't handle binary files but loadp2 does or put it onto a card.
Sign In or Register to comment.