Novatron

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
alastair
Posts: 68
Joined: 10 Oct 2019, 14:28

Re: Novatron

Post by alastair »

Thanks for the new ROM Leo. The original card is showing three lines after the boot message. The first is all white pixels and the next two are all red. I picked up a new SD card and get three all white lines. This was the case with the card in its original FAT32 formatted state and after loaded the SD card image via dd.

Original card:
card1.png
card1.png (299.08 KiB) Viewed 1534 times
New card:
card2.png
card2.png (281.57 KiB) Viewed 1534 times
.
I wonder if this is an issue with my hardware? It could be a timing issue or something with the logic levels. I'll have to dig in a bit deeper to understand the code and how to debug things.

I was busy the last couple of weeks with a trip to VCF Midwest. I did some demos of the Novasaur and Novatron. The picture below shows a text madelbrot generated by MS BASIC and Super Star Trek on a serial terminal. The Novatron was using the @denjhang dev/game ROM so the kids had some games to play :D
.
IMG_20220911_132917.jpg
IMG_20220911_132917.jpg (1.54 MiB) Viewed 1534 times
.
All the "famous" YouTubers were there and I got an 8 second clip in the latest 8-bit Guy video (don't blink else you'll miss it!) - https://www.youtube.com/watch?v=5BfxUiF58Co&t=604s

There's also a more in depth interview from Dr. Dave's Diversions available here - https://www.youtube.com/watch?v=k-uPHyWJZMU
lb3361
Posts: 360
Joined: 17 Feb 2021, 23:07

Re: Novatron

Post by lb3361 »

The top white row is a page of 0xff that used as input for the spi exchange operation (send 0xff to the card, receive data from the card) The next two rows are the sector buffer. The fact that the gigatron reads constant bytes is highly suspicious since most windows formatters put things there (boot block, metadata). Those who put nothing there would have zeroes.

That said I do not understand why both cases still read a partition type 0D. Should be 0C as if one bit had been lit up incorrectly. But for this to happens one also needs to correctly read the $AA55 signature at position $1fe in sector zero. I guess I should prepare a rom file with more debug code (which is not easy because this happens in a GCL mess)....

And congrats for you VCF show.


Update
I just attached another dev.rom with a lot more debug output in CardBoot. The screenshot below show the cardtype detection, then reading sector 0 (cmd17 0000000 ok) and checking the mbr, then reading the fat superblock (cmd17 0000003f ok) and checking that it looks like fat32, then reading the directory block and spotting system.gt1, then reading the cluster list which goes at the bottom of the screen (scanline 119), then reading the file sectors in sequence. That way, when it stops, you can see which sector was read into the buffer (scanlines 117 and 118), and check whether this data matches what you can read from the sd card with a simple dd command.
    Screenshot from 2022-09-20 09-22-16.png
    Screenshot from 2022-09-20 09-22-16.png (15.02 KiB) Viewed 1494 times
    Attachments
    dev.rom
    (128 KiB) Downloaded 73 times
    lb3361
    Posts: 360
    Joined: 17 Feb 2021, 23:07

    Re: Novatron

    Post by lb3361 »

    I looked again at the novatron schematics (from this thread) and I see that bus0/bus1 are connected to outputs of the U31 gal.

    I assume that these outputs are only driven when sclk=1 and /oe=0 with. At the same time /woe should be 1 to prevent the ram from driving the bus. Does this mean that bus2 and bus3 are floating when this happens. This is important because the SPI code in the rom does not sort out what's on each bus line. It simply asserts sclk, reads a byte, ands with 0xf, and checks whether the result is zero or not. Therefore, one reads a 1 if any of the bus0123 is high, without regards to which spi port is active. So if bus123 are floating, one can easily read incorrectly from the spi device.

    This works with Marcel's expansion because it pulls down all the miso0123 lines. This is a bad idea because many spi devices want a pull up instead. My solution was to make sure that when sclk=0, the bus lines bus321 are always zero, and bus0 reflects the miso of the active device. To do this one needs to have the /ss0 /ss1 signals (which U35 does not have. Note that I am using 22v10s, not 16v8s in the expansion).

    The SPI code looks like this:

    Code: Select all

    for i in range(8):
      st([vTmp],Y);C('Bit %d'%(7-i))#23+i*12
      ld([sysArgs+4],X)             #24+i*12
      ctrl(Y,Xpp)                   #25+i*12 Set MOSI
      ctrl(Y,Xpp)                   #26+i*12 Raise SCLK, disable RAM!
      ld([0])                       #27+i*12 Get MISO
      anda(0b00001111)              #28+i*12 This is why R1 as pull-DOWN is simpler
      beq(pc()+3)                   #29+i*12
      bra(pc()+2)                   #30+i*12
      ld(1)                         #31+i*12
      ctrl(Y,X)                     #32+i*12,29+i*12 (Must be idempotent) Lower SCLK
      adda([vTmp])                  #33+i*12 Shift
      adda([vTmp])  
    
    If indeed MISO0 drives BUS0, then one could test the theory by replacing anda(0xf) by anda(0x1). Since this is an easy patch, I just did that in the attached rom (leaving all the debug output as well, meaning that the load is a bit slow. But it would be interesting to see if this works better. Of course this patch means that only SPI0 works, but this is a good way to know....
    Attachments
    dev.rom
    (128 KiB) Downloaded 75 times
    alastair
    Posts: 68
    Joined: 10 Oct 2019, 14:28

    Re: Novatron

    Post by alastair »

    Thanks for figuring this out @lb3361 I was going to take a closer look at the code but got tied up with another project. I tried the latest ROM and everything is working correctly now!

    I don't have enough pins on the 16V8 PAL to connect the four BUS lines. I'm only using BUS0 but also have BUS1 connected just in case. This is currently pulled low, but BUS2-7 are not connected to anything and left in tri-state.

    This is the current expansion circuit and PLD code.
    .
    novatron-rev4.png
    novatron-rev4.png (114.07 KiB) Viewed 1399 times

    Code: Select all

    Name     EXPAND ;
    PartNo   00 ;
    Date     9/7/2022 ;
    Revision 03 ;
    Designer A J Hewitt ;
    Company  Solid-state Machines ;
    Assembly Novatron ;
    Location None ;
    Device   g16v8a ; /* PAL 10L8 */
    
    /****************************** INPUT PINS *******************************/
    PIN 1        = B1             ; /* Bank Select 1                         */
    PIN 2        = B0             ; /* Bank Select 0                         */
    PIN [3..4]   = [MISO0..MISO1] ; /* Master In Slave Out                   */
    PIN 5        = SCLK           ; /* Serial Clock                          */
    PIN 6        = NOE            ; /* Output Enable                         */
    PIN 7        = NWE            ; /* Write Enable                          */
    PIN 8        = NSS0           ; /* SS0                                   */
    PIN 9        = A15            ; /* Address MSB                           */
    PIN 11       = NSS1           ; /* SS1                                   */
    /****************************** OUTPUT PINS ******************************/
    PIN 12       = MA15           ; /* Memory A15                            */
    PIN 13       = MA16           ; /* Memory A16                            */
    PIN 14       = !MWE           ; /* Memory Write Enable                   */
    PIN 15       = !MOE           ; /* Memory Output Enable                  */
    PIN 16       = !PWE           ; /* Port Write Enable                     */
    PIN [17..18] = [BUS1..BUS0]   ; /* Bus                                   */
    PIN 19       = NC             ; /* Not Connected                         */
    /*************************************************************************/
    
    !MA15 = A15 & B0 ;
    
    !MA16 = A15 & B1 ;
    
    !MWE =  NWE # !NOE ;
    
    !MOE = SCLK # NOE ;
    
    !PWE = NWE # NOE ;
    
    !POE = !SCLK # NOE ;
    
    BUS0 = (MISO0 & !NSS0) # (MISO1 & !NSS1) ;
    
    BUS1 = 'b'0 ;
    
    BUS0.OE = POE ;
    
    BUS1.OE = POE ;
    
    
    lb3361
    Posts: 360
    Joined: 17 Feb 2021, 23:07

    Re: Novatron

    Post by lb3361 »

    Glad that the sd card works :-)

    I see that you're sorting out the two SPI ports into BUS0. The solution might simply be to require a custom rom with anda(0x1) or anda(0x3) instead of anda(0xf) and call it a day. Both SPIs should work.

    Otherwise you could repurpose the PAL output 17 as BUS123CLAMP and connect it to BUS[1..3] with three diodes (cathode towards the PAL). When BUS123CLAMP is driven to zero, this would drive all three lines to zero. When BUS123CLAMP is tri-stated (or driven to one). this would leave all three lines free. In fact you would not even have to change the PAL equations. But you'd have to find space for three diodes. Forest style maybe :-)
    alastair
    Posts: 68
    Joined: 10 Oct 2019, 14:28

    Re: Novatron

    Post by alastair »

    The SPI1 connector matches the standard SD card pinout so I plugged one in just now and tested it. I can read both SD cards no problem. I have one unused pin on the PAL (19) and could connect that to BUS2 and BUS3 using two diodes. I should be able to fit those on the board in a future revision. Thanks for the help and ideas!
    lb3361
    Posts: 360
    Joined: 17 Feb 2021, 23:07

    Re: Novatron

    Post by lb3361 »

    Here is a ROM with the anda(0x1) in the SPI code and with the full speed Cardboot.
    Just to save a few seconds after reset...
    Attachments
    dev.rom
    (128 KiB) Downloaded 75 times
    Post Reply