Shop OBEX P1 Docs P2 Docs Learn Events
LoadP2 errors with custom board — Parallax Forums

LoadP2 errors with custom board

I finally got a P2 board where everything looks right, but noticed errors on load about 25% or so of the time using LoadP2.
I don't seem to get any errors with the Prop Tool.

I'm pretty sure it's because of the way I'm using the FT231X... I have it with 5V I/O and using 10k resistors on TX & RX (see attached).

Maybe I can fix this by swapping for 1k resistors.

But, if it works with the Prop Tool 100%, maybe I could argue that something is wrong with LoadP2?
1826 x 900 - 20K
«1

Comments

  • RaymanRayman Posts: 14,646
    These are the kind of errors I see:

    ERROR: timeout waiting for initial checksum: got -1

    ERROR: bad checksum, expected 50 got ffffffd0 (chksum characters EÀ )



  • evanhevanh Posts: 15,916
    Try using the -SINGLE switch.

  • Yes, loadp2 is broken somehow. The autobaud seems to fail if the frequency is > 80 MHz. I have no idea why, and I'd welcome input. The more eyes on the code the better!
  • RaymanRayman Posts: 14,646
    edited 2020-07-17 15:12
    -single didn't help

    But, switching my 10k resistor array to a 1k array seems to have fixed it.

    This also switches the RESn pullup from 10k to 1k, same for the pull-down on the 2N3904 in the reset circuit.
    But, all seems to be OK.

    Problem solved, I guess.
  • evanhevanh Posts: 15,916
    edited 2020-07-17 15:20
    Rayman wrote: »
    Problem solved, I guess.
    Oh, I didn't look at the schematic! Any inline resistor on the data pins will decrease your max bitrate - The larger the resistance the lower the bitrate limit becomes.

    I'd bridge those out for a direct path. Then you can go back to having the 10k pull-ups. Bad idea - see below.

  • @Rayman
    the FTDI TX resistor can be lowered but can be as is
    the problem is FTDI RX (or P2 TX) resistor. This can be completely removed or replaced with a very low value
  • evanhevanh Posts: 15,916
    edited 2020-07-17 15:17
    Ah, I see, the Prop2 Eval Board has 10 kR inline resistors plus 1 nF inline capacitors for retaining the data shape. Also has 10 kR pull-ups to kill random data from floating.

    PS: I now understand these are like this to allow powering either side separately without the protection diodes causing power up of the other side.

  • Try removing the 47pf from the USB lines. And the VOCIO to the 3.3 out instead of the USB 5V
  • The FTDI chip has 5V outputs? I have the same problem with some RS485 transceivers. I use a 2k2/3k3 resistor divider for RX (P2 input) and no resistor at all for TX (P2 output). When using a lower value series resistor you could damage the P2.
  • RaymanRayman Posts: 14,646
    Yes, the idea is to prevent the P2 from powering up the FTDI chip when USB is not connected.

    This may be a relic from my old FT232R circuit and maybe this issue is fixed in the new chip.
    But, I think I'll just leave it with the 1k resistors.

    Removes any chance of pin contention issues with bad code...
  • evanhevanh Posts: 15,916
    edited 2020-07-17 15:30
    ManAtWork wrote: »
    The FTDI chip has 5V outputs? I have the same problem with some RS485 transceivers. I use a 2k2/3k3 resistor divider for RX (P2 input) and no resistor at all for TX (P2 output). When using a lower value series resistor you could damage the P2.
    It's to prevent power-up/boot-up confusion. The UART signals are all 3v3. Oops, Rayman does have it configured wrong at 5 Volts. He's got two issues now. :(

  • RaymanRayman Posts: 14,646
    edited 2020-07-17 15:30
    I think the RX and TX pins of the FTDI chip are actually at 5V level logic, the way I have it configured...

    It can be 5V or 3.3V, I believe.


    Wait, I'm wrong about that, that was for FT232R....
    Uh Oh! Just realized I shouldn't be putting 5V on VCCIO with this chip!

    Guess I need another revision...
  • evanhevanh Posts: 15,916
    Rayman wrote: »
    But, I think I'll just leave it with the 1k resistors.
    Removes any chance of pin contention issues with bad code...
    It'll probably be borderline at you current bitrate. Strongly advise adding the inline capacitors in parallel with those resistors.

  • evanhevanh Posts: 15,916
    Rayman wrote: »
    Guess I need another revision...
    Hate that.

  • I am feeding 3.3V into my USB chip rather than leaving it unpowered when it is not plugged into USB. Perhaps this is something you can do with the FT232 rather than the resistor kludge. VBUS is still used to signal the FT232 chip and you can feed a diode from VBUS to power your board. It's good though to have a low value resistor from the FT232 TX into the P2 RX if you are thinking of any direct serial connection too. The pullup on the P2 TX prevents floating garbage during a reset when the P2 floats all its I/O.

    The EFM8UB3 that I use looks after reset without the need for external circuits and also floats the TX to the P2 if USB is not connected. Of course it does way more than all that and the firmware can be loaded from the PC over USB.
  • My typo "VCCIO" not VOCIO for the FT231pin 13 to pin 3
  • RaymanRayman Posts: 14,646
    Yeah, I should have read the datasheet closer... Assumed this was same as FT232R...

    They actually when the opposite way with FT231X: Instead of 5V or 3.3V, the I/O voltage options are 3.3V or 1.8V...
  • RaymanRayman Posts: 14,646
    @"Peter Jakacki" I'm interested to see how that chip works out for your customers
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-07-18 01:06
    Rayman wrote: »
    @"Peter Jakacki" I'm interested to see how that chip works out for your customers

    I have had it working up to 8Mbd and it has been customized for the P2D2 and the P2 in general. When it detects the serial loader "pulse" internally it will not only generate a perfectly timed P2 reset pulse, but it will also pullup P59 which tells the P2 to ignore the SD and Flash and just load serially. This saves having to disable any bootable media. There's also a reset input for external reset and reset button. If the input is held longer than 1 second it will force it into the serial load mode which is handy for entering the debugging and TAQOZ in ROM. The reset input is also an output so any chips that require or could benefit from a reset can just connect to this.

    You can integrate the blank QFN or QSOP24 version and simply load the firmware into the chip via USB the first time you power-up after it has been assembled. I have an 8051 assembly source code version of it that you can customize easily using asem-51, so there is no need for any "tooling". The QFN version has the exact same pinout as the CP2102N btw which is what this device appears as to the PC.

    If you use the optional I2C bus you can talk to the chip and change the IDs and options etc from the P2. The state of the P2 reset can also be configured since my default is to have a pulldown on the P2 reset and let the UB3 enable the P2 when power is good and stable, which is also effective as a brown-out and I also incorporate a watchdog. But to use it effectively, you should power this chip from the P2's 3.3V supply which is what I do even with my old FT232 designs and I never have a problem with phantom power.

    BTW, it's way cheaper than a slow and boring FT232
    I should also mention that I get the UB3 to switch the supply to the SD card as well which is necessary sometimes as the card can be stuck in an uncertain state.
  • Peter does UB3 USB need any special drivers for Windows or Linux or Mac or does it just work out of the box?
  • rogloh wrote: »
    Peter does UB3 USB need any special drivers for Windows or Linux or Mac or does it just work out of the box?

    The FT232 and CP2102 drivers seem to be included with any computer I use, even phones and tablets. Certainly works with Linux, WIn10, and even WinXP etc.

  • evanhevanh Posts: 15,916
    Peter,
    I read the question as about the 8051 uC you're using rather than CP2102/FT232. Or are you saying the same driver works for the UB3 as well?

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-07-18 09:30
    evanh wrote: »
    Peter,
    I read the question as about the 8051 uC you're using rather than CP2102/FT232. Or are you saying the same driver works for the UB3 as well?

    Yes, absolutely. This is the dmesg output on unplug/plug event. I can even change these descriptors over I2C with commands from the P2.
    [63986.006592] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
    [63986.006616] cp210x 1-2:1.0: device disconnected
    [63986.319943] usb 1-2: new full-speed USB device number 15 using xhci_hcd
    [63986.473180] usb 1-2: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 2.56
    [63986.473183] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [63986.473184] usb 1-2: Product: EFM8UB3 P2D2v4  USB Bridge UB3_2.5.7G
    [63986.473186] usb 1-2: Manufacturer: Silicon LaBS
    [63986.473187] usb 1-2: SerialNumber: 0005
    [63986.474492] cp210x 1-2:1.0: cp210x converter detected
    [63986.475321] usb 1-2: cp210x converter now attached to ttyUSB0
    

    Dumping the Flash area where this is all stored:
    TAQOZ# $8000 $300 UB DUMP --- 
    08000: 81 C0 03 FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08010: 11 40 10 C4  EA 60 FF 81  00 FF 81 40  FF 81 E0 FA     '.@...`.....@....'
    08020: 80 02 56 00  FF FF FF FF  FF FF FF FF  FF FF FF FF     '..V.............'
    08030: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08040: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08050: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08060: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08070: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08080: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08090: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080A0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080B0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080C0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080D0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080E0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    080F0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08100: 1A 03 53 00  69 00 6C 00  69 00 63 00  6F 00 6E 00     '..S.i.l.i.c.o.n.'
    08110: 20 00 4C 00  61 00 42 00  53 00 FF FF  FF FF FF FF     ' .L.a.B.S.......'
    08120: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08130: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08140: 4C 03 45 00  46 00 4D 00  38 00 55 00  42 00 33 00     'L.E.F.M.8.U.B.3.'
    08150: 20 00 50 00  32 00 44 00  32 00 76 00  34 00 20 00     ' .P.2.D.2.v.4. .'
    08160: 20 00 55 00  53 00 42 00  20 00 42 00  72 00 69 00     ' .U.S.B. .B.r.i.'
    08170: 64 00 67 00  65 00 20 00  55 00 42 00  33 00 5F 00     'd.g.e. .U.B.3._.'
    08180: 32 00 2E 00  35 00 2E 00  37 00 47 00  FF FF FF FF     '2...5...7.G.....'
    08190: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    081A0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    081B0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    081C0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    081D0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    081E0: 0A 03 30 00  30 00 30 00  35 00 FF FF  FF FF FF FF     '..0.0.0.5.......'
    081F0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    08200: 28 02 43 03  00 10 8C 11  8C 12 8C 13  8C 14 8C 15     '(.C.............'
    08210: 8C 16 8C 17  8C 1A 00 1B  01 1C 00 1D  10 1E 00 1F     '................'
    08220: 00 20 00 21  00 32 00 33  01 34 00 35  14 36 80 37     '. .!.2.3.4.5.6.7'
    08230: 00 38 00 39  00 5A 00 5B  00 95 00 96  00 97 00 98     '.8.9.Z.[........'
    08240: 00 99 00 9A  00 9B 00 A2  00 A3 00 A4  00 B7 92 11     '................'
    08250: 0D FF 53 69  35 33 35 31  41 5F E4 65  67 54 61 62     '..Si5351A_.egTa.'
    08260: 6C 65 73 20  76 32 2E 35  2E 36 20 32  35 2D 3E 32     'les v2.5.6 25->2'
    08270: 30 4D 48 7A  20 43 4C 4B  31 32 36 2D  3E 35 4D 2C     '0MHz CLK126->5M,'
    08280: 32 30 4D 2C  34 38 4D FF  FF FF FF FF  FF FF FF FF     '20M,48M.........'
    08290: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082A0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082B0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082C0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082D0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082E0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    082F0: FF FF FF FF  FF FF FF FF  FF FF FF FF  FF FF FF FF     '................'
    
    
    1235 x 548 - 140K
  • jmgjmg Posts: 15,173
    evanh wrote: »
    Peter,
    I read the question as about the 8051 uC you're using rather than CP2102/FT232. Or are you saying the same driver works for the UB3 as well?
    Yes, Silabs provide a library for the EFM8 series that 'looks like' a CP210x at the PC side, so their drivers work.
    Win10 and Linux vary in what parts of the USB info they decide to make visible, but the firmware release version number looks to be visible in both. Currently that is 2.5.7
    The Silicon LaBS you see in Peter's report above, is a deliberate case-flip to see what is visible. Linux shows that, but Win10 does not)

    UB3 is coded to also echo DTR and RTS back, so you can confirm it is a UB3 with that simple test.

    There is a PC-side driver update due from SiLabs 'soon'? to address some of the issues I found.
    In their current release, their SW artificially limits baud settings, you need to enter a low 'baud' value of 2..24, which UB3 handles as 24M/N

  • ReinhardReinhard Posts: 489
    edited 2020-07-20 16:59
    Maybe my problem is not a issue for this thread. I don't know.
    Few month ago I buy a new notebook, for the reason because my old netbook had a very small screen, not ideal for programming.
    First I test the new one with all possible usb - devices, also with the P1 - demo board.
    With all this devices I got no problems.
    But with the P2 Eval board, after a second the green ON - LED turned off and the blue ACT LED turned on.
    loadp2 say "Device not found".
    The same if I support the Board with AUX - USB and use the "normal" USB just for communication.
    Steady State is I program on notebook and sent the binary via homenet to the old netbook. After a while you got used to it.
    I think the new notebook is not to blame and neither is loadp2.
  • I thought it might be related to new notebooks have USB3.0, but my Eval Board (REVB), programs without problems on my new Alienware with USB3.0.
  • Computer
    Prozessor Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
    Hauptspeicher 7856MB (1587MB used)
    Maschinen-Typ Notebook
    Betriebssystem Ubuntu 18.04.4 LTS
    Benutzername reinhard (Reinhard)
    Date/Time Mo 20 Jul 2020 19:38:03 CEST

    USB-Geräte
    Linux Foundation 3.0 root hub
    Acer, Inc
    *** Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO) <---- P2 Eval board detected ***
    Cherry GmbH SmartBoard XX44
    Intel Corp.
    Logitech, Inc. LX3 Optical Mouse
    Linux Foundation 2.0 root hub
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-07-21 00:01
    I must admit that I was using loadp2 for a while but then I had problems with loading the P2 as the timing seemed to be off, so I used ozpropdev's python loader instead.
    I renamed it to loadp2.py. The good thing about a python loader is that you can tweak it to suit very easily. Use Python3 as your default Python.
    Part of the load problem seems to be the simple one capacitor reset circuit I think.

    btw, try lsusb and lspci for specific information about devices, and then play with these commands for even more detailed info.

    console output
    09:56:07 TAQOZ$ python3 loadp2.py taqoz.bin
    
    Python Prop2 loader Ver 1.2 14th Jan 2019 - ozpropdev
    Python version: 3.8.2 (default, Apr 27 2020, 15:53:34) 
    [GCC 9.3.0] 
    
    Scanning ports....
    /dev/ttyUSB0 = Prop_Ver G
    Project =  taqoz.bin on /dev/ttyUSB0
    HUBSET #1 Ok
    HUBSET #2 Ok
    Loading TXT ....complete
    09:56:28 TAQOZ$
    


    Python code (slightly modified)
    # command line now accepts filename (no .obj extension required)
    #auto detection of P2 com port added
    
    mytitle = "\nPython Prop2 loader Ver 1.2 14th Jan 2019 - ozpropdev"
    
    project = 'noname'
    
    import sys
    import serial
    import serial.tools.list_ports
    
    from time import sleep
    import string
    from base64 import b64encode
    
    
    baud = 3000000
    
    
    xtal = 20000000
    pll_div = 20
    pll_mul = 180
    sys_clk = xtal / pll_div * pll_mul
    clk = 1 << 24 | (pll_div-1) << 18 | (pll_mul-1) << 8
    clk1 = clk + 0xf4
    clk2 = clk + 0xf7
    
    sp = serial.Serial()
    p2_list = []
    
    
    #######################################################################
    
    def loadp2(project):
    
        #if not project.endswith('.bin'):
            #project += '.bin'
    
        print("Project = ",project,end="")
        print(" on",p2_list[0])
    
        sp.dtr = True  #toggle DTR
        sleep(0.01)
        sp.dtr = False
        sleep(0.1)    #switch P2 clock to max speed
    
        sp.timeout=1
        sp.write(b'> Prop_Clk 0 0 0 0 ')
        m = hex(clk1)[2:]+'\n'
        cs = m.encode('ascii')
        sp.write(cs)
        reply = sp.read()
        if len(reply) == 1 and reply == b'.':
            print("HUBSET #1 Ok")
    
        sleep(0.02)
    
        sp.write(b'> Prop_Clk 0 0 0 0 ')
        m = hex(clk2)[2:]+'\n'
        cs = m.encode('ascii')
        sp.write(cs)
    
        reply = sp.read()
    
        if len(reply) == 1 and reply == b'.':
            sp.baudrate = baud
            print("HUBSET #2 Ok")
        else:
            print("No response from P2.")
            exit()
    
    
        myfile = open(project,"rb")
        buff1 = myfile.read(filesize(myfile))
        myfile.close()
    
    
    
        print("Loading TXT ....",end="")
        sp.write(b'> Prop_Txt 0 0 0 0 ')
        sp.write(b64encode(bytes(buff1)))
        sleep(0.05)
        sp.write(b'~')  #run
        print('complete')
        exit()
    
    
    #######################################################################
    
    
    def filesize(f):
    
        f.seek(0,2)
        z = f.tell()
        f.seek(0,0)
        return z
    
    #######################################################################
    
    def find_p2():
    
    
        print("Scanning ports....")
    
        for spx in portlist:
    
              if str(spx.device).strip() != "":
    
                   print (spx.device + " = ",end="")
                   sp.port = spx.device
                   sp.baudrate = 19200
                   sp.datasize = 8
                   sp.stopbits=1
                   sp.parity = serial.PARITY_NONE
                   sp.ReadBufferSize = 65000 #512000 #65536
    
                   sp.open()
                   sp.timeout= 1
    
                   sp.dtr = True  #toggle DTR
                   sleep(0.01)
                   sp.dtr = False
                   sleep(0.1) #0.01)
    
                   sp.write(b'> Prop_Chk 0 0 0 0 ')
                   q = sp.read(14).decode('ascii')
                   q = q.strip()
                   sp.close()
    
    
                   if q.startswith("Prop"):
                       print(q)
                       p2_list.append(spx.device)
                   else:
                       print(" no P2 found.")
    
    
        return p2_list
    
    
    
    #######################################################################
    #######################################################################
    #######################################################################
    
    
    if len(sys.argv) == 2:
        project = sys.argv[1]
    else:
        project = input("Filename to load: ")
    
    
    print(mytitle)
    print("Python version:",sys.version,"\n")
    
    
    portlist = serial.tools.list_ports.comports()
    find_p2()
    
    if len(p2_list)==0:
        print("No P2's detected.")
        exit()
    
    
    sp.baudrate = baud
    
    sp.datasize = 8
    sp.stopbits=1
    sp.parity = serial.PARITY_NONE
    sp.timeout = .2
    sp.port = p2_list[0]
    sp.dtr = False
    try:
            sp.open()
    except:
            ec = sys.exc_info()[1]
            m1 = str(ec)
            m2 = m1.split(":")
            m3 = m2[0]
            print(m3)
            sleep(5)
            exit()
    
    
    loadp2(project)
    
  • @"Peter Jakacki"
    Thank you, I think the info above is for me.

    more detailed info . . .
    Propeller2$ dmesg
    .
    .
    .
    [  609.594717] wlp2s0: AP c0:25:06:6d:32:7f changed bandwidth, new config is 2412 MHz, width 2 (2422/0 MHz)
    [  697.617448] usb 1-6: new full-speed USB device number 6 using xhci_hcd
    [  697.776228] usb 1-6: New USB device found, idVendor=0403, idProduct=6015, bcdDevice=10.00
    [  697.776232] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  697.776235] usb 1-6: Product: Propeller P2-EVAL-ES
    [  697.776237] usb 1-6: Manufacturer: Parallax Inc.
    [  697.776240] usb 1-6: SerialNumber: DN43WLL5
    [  698.319616] usbcore: registered new interface driver usbserial_generic
    [  698.319623] usbserial: USB Serial support registered for generic
    [  698.322924] usbcore: registered new interface driver ftdi_sio
    [  698.322940] usbserial: USB Serial support registered for FTDI USB Serial Device
    [  698.323019] ftdi_sio 1-6:1.0: FTDI USB Serial Device converter detected
    [  698.323051] usb 1-6: Detected FT-X
    [  698.323661] usb 1-6: FTDI USB Serial Device converter now attached to ttyUSB0
    
    Propeller2$ lsusb
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 004: ID 5986:9102 Acer, Inc 
    Bus 001 Device 006: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
    Bus 001 Device 003: ID 046a:0010 Cherry GmbH SmartBoard XX44
    Bus 001 Device 005: ID 8087:0029 Intel Corp. 
    Bus 001 Device 002: ID 046d:c044 Logitech, Inc. LX3 Optical Mouse
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    But it looks more like an electronical problem, maybe you can see on the picture the green PC USB ON LED is off and the ACT LED is on. This is not the normal behaviour.
    5184 x 3456 - 7M
  • I have to look to get the serial module for python3
    Propeller2$ python3 loadp2.py
    Traceback (most recent call last):
      File "loadp2.py", line 9, in <module>
        import serial
    ModuleNotFoundError: No module named 'serial'
    
    
Sign In or Register to comment.