new loadp2, now with simple scripting

2

Comments

  • Ok, I got the flash loader to work with this command line:
    /C loadp2.exe  -l921600 -p COM9 "@0=Flashloader.bin,@1000+E:\Parallax\Prop2\EvalBoardB\led_matrix_demo\demo.binary" > loadp2.out
    

    Where I just renamed the .bin file and put it in my SpinEdit folder...
    So, looks like it will work for me, thanks.
  • RaymanRayman Posts: 10,068
    edited 2019-12-03 - 17:40:29
    Still, strange that I can use SmartSerial at 3 Mbaud with this board, in receive mode anyway...
    I'll have to bring in the Eval board tomorrow and try it...
  • jmgjmg Posts: 14,177
    Rayman wrote: »
    Now that I think about it, I do have 10k resistors between FTDI Tx/Rx and P2 pins...
    That might slow it down a bit...
    That's quite high a protection resistor, as 10k and 15pF will be 330ns rise time.
    3k3 is faster and still only 1mA, 1k5 is faster still, and ~ 2mA max contention current.
    Rayman wrote: »
    Still, strange that I can use SmartSerial at 3 Mbaud with this board, in receive mode anyway...
    I'll have to bring in the Eval board tomorrow and try it...

    The Eval B I think includes parallel peaking capacitors
  • The 10k resistors/5VIO are what I use on P1 systems to keep the FTDI chip from powering up and resetting the P1.
    I just copied that over here...
  • Is the flash loader binary file compatible with both Rev.A and Rev.B silicon?
  • Rayman wrote: »
    Is the flash loader binary file compatible with both Rev.A and Rev.B silicon?

    No, it's for Rev B only.
  • ersmith wrote: »
    Rayman wrote: »
    Is the flash loader binary file compatible with both Rev.A and Rev.B silicon?
    No, it's for Rev B only.
    What? Why? There's no schematic difference that I can see, and likewise nothing unique in the source code either.

  • Possibly the board layout slew rate issue is present ...
  • hmm, there's PTRx indexing, that could be it ... except assembling it with -2a option doesn't make it work either ...

  • evanhevanh Posts: 8,619
    edited 2019-12-05 - 10:59:08
    Bugger! I've been editing the wrong source file. doh!

    EDIT: Okay, got it working ... yep pretty sure it's the PTRA indexing differences between v32 and v33 ... yep, proven now. Replaced all the PTRA++ with extra instruction of either ADD #4 or ADD #1 depending on whether it was a RDLONG or RDBYTE operation.

    I won't post it though because I've edited too many things that didn't need editing.

  • Okay, re-cloned it from github and made just those edits. Here's the updated source and matching universal binary:
  • Thanks for the flashloader update, Evan! I'll update that in github shortly.
  • I've updated the first post with a new loadp2. I've completely re-worked the scripting language. Previously it was focused on what characters to send to the P2, with cryptic escapes to implement other commands. Now it's command oriented, with a "send" command to send characters. The list of supported commands are:
    binfile(fname):    send a binary file to the P2
    pauseafter(N):     insert a 1ms pause after every N characters transmitted
    pausems(N):        delay for N milliseconds
    recv(string):      wait until string is received
    recvtimeout(N):    set a timeout in ms for the recv() command
    scriptfile(fname): read script commands from file "fname"
    send(string):      send a string to the P2
    textfile(fname):   send contents of a text file to the P2
    

    For example, to launch micropython and tell it to print hello:
    loadp2 -b230400 upython.binary -e "recv(>>> ) send{print('hello')^M}" -t
    
  • Thanks.
    Is using the flashloader still the same?

    Still like this:
    loadp2.exe  -l921600 -p COM9 "@0=Flashloader.bin,@1000+E:\Parallax\Prop2\EvalBoardB\led_matrix_demo\demo.binary"
    
  • Yes, the @ syntax for file loading is still the same. It's only the script (stuff after -e that gets executed after the load) that has changed.
  • Should the flashloader not reboot the P2 after loading?
    Doesn't seem like it does now...

    I'm pretty sure when you load eeprom on P1 it reboots when done...
  • Eric has added a four second delay after programming before the reset. One second would be good I feel.
  • RaymanRayman Posts: 10,068
    edited 2019-12-05 - 17:13:41
    I wasn't seeing it reboot at all... It is now though... Strange...
  • RaymanRayman Posts: 10,068
    edited 2019-12-05 - 19:06:14
    This 4-second delay is not so good...
    Maybe zero seconds is better? Why wait? I don't get it...

    Is it loadp2.exe that is resetting the P2 after loading flash? Doesn't seem to...
    Wait, I think I see something...

    I had a "-m 010c1f08 -SINGLE" in there...
    loadp2 doesn't seem to like that anymore...
    Works and reboots after 4 seconds now...
  • Ah, right, yeah, I noticed that at couple of days back too. It's to do with Eric's fancy multi part loading he's added to loadp2. The feature only works when not using -SINGLE.

  • -SINGLE loading uses the loader built into the ROM, which can only load 1 file and always loads it to 0. So it can't be used for the multi-part loading. It should be throwing an error if you try to use it with @, is it not doing that?
  • Oh, and I've reduced the delay to 1 second, 4 was excessive (can't remember why I did that). The short delay is to make sure the status messages have been written to serial and the user gets a chance to read them before the reset.
  • Cool.

    Eric,
    I've got one more minor fix: The smartpins are currently left engaged at the end of the second stage loading. I recommend clearing the pin configs for them. See - https://forums.parallax.com/discussion/comment/1484025/#Comment_1484025

  • No, no error messages with the -SINGLE....
  • RaymanRayman Posts: 10,068
    edited 2019-12-05 - 19:55:28
    Should I just get rid of the -SINGLE and the load crystal setting options in SpinEdit?
  • jmgjmg Posts: 14,177
    ersmith wrote: »
    I've updated the first post with a new loadp2. I've completely re-worked the scripting language. Previously it was focused on what characters to send to the P2, with cryptic escapes to implement other commands. Now it's command oriented, with a "send" command to send characters. The list of supported commands are:
    binfile(fname):    send a binary file to the P2
    pauseafter(N):     insert a 1ms pause after every N characters transmitted
    pausems(N):        delay for N milliseconds
    recv(string):      wait until string is received
    recvtimeout(N):    set a timeout in ms for the recv() command
    scriptfile(fname): read script commands from file "fname"
    send(string):      send a string to the P2
    textfile(fname):   send contents of a text file to the P2
    

    For example, to launch micropython and tell it to print hello:
    loadp2 -b230400 upython.binary -e "recv(>>> ) send{print('hello')^M}" -t
    

    Wow, very nice.
    That is going to create some very nice P2 demo - wrappers, that will load-and-go.

    Few questions on Terminal modes :
    Can you add a simple comment echo to the terminal ? For longer board test script files, running multiple little test pgms, it's nice to say what test is being done.
    I guess here simple strings, and date/time are useful tags
    It is easy to capture the terminal output to a file ? I'm thinking here of logging board tests.


    Is there a list somewhere of the terminal commands supported, in the 2 terminal modes ?

    For more general 'quick instrument' use, I've often thought it would be nice to have a terminal mode with fewer chars/larger font, so you can read it across a room.
    Not sure how easy that is to do & keep the simplicity of command line ?
  • jmg wrote: »
    Few questions on Terminal modes :
    Can you add a simple comment echo to the terminal ? For longer board test script files, running multiple little test pgms, it's nice to say what test is being done.

    loadp2 itself can only run one program on the P2 per invocation. The script commands are to send data to that program. For running multiple tests you would put multiple loadp2 calls into a .bat file, and you could then put "echo" commands or something similar in that .bat file to say which test you were running.
    It is easy to capture the terminal output to a file ? I'm thinking here of logging board tests.

    That depends on your environment. loadp2 itself is just a command line program, and all its output goes to the standard output, so you can use the usual > and | file redirection operators on it.
    Is there a list somewhere of the terminal commands supported, in the 2 terminal modes ?

    For more general 'quick instrument' use, I've often thought it would be nice to have a terminal mode with fewer chars/larger font, so you can read it across a room.
    Not sure how easy that is to do & keep the simplicity of command line ?
    loadp2 itself does no terminal emulation, that's up to whatever program runs it. FlexGUI on Windows launches a new copy of the usual Windows command terminal. I think there are registry settings and/or menu items to change the font of that. You could alternatively configure FlexGUI to use a different shell program for launching loadp2.

  • jmgjmg Posts: 14,177
    ersmith wrote: »
    Is there a list somewhere of the terminal commands supported, in the 2 terminal modes ?
    loadp2 itself does no terminal emulation, that's up to whatever program runs it. FlexGUI on Windows launches a new copy of the usual Windows command terminal. I think there are registry settings and/or menu items to change the font of that. You could alternatively configure FlexGUI to use a different shell program for launching loadp2.
    I was looking for more info for these modes - I was guessing they at least echo the serial port to the standard output ?
    [ -t ] enter terminal mode after running the program
    [ -T ] enter PST-compatible terminal mode


  • jmg wrote: »
    ersmith wrote: »
    Is there a list somewhere of the terminal commands supported, in the 2 terminal modes ?
    loadp2 itself does no terminal emulation, that's up to whatever program runs it. FlexGUI on Windows launches a new copy of the usual Windows command terminal. I think there are registry settings and/or menu items to change the font of that. You could alternatively configure FlexGUI to use a different shell program for launching loadp2.
    I was looking for more info for these modes - I was guessing they at least echo the serial port to the standard output ?
    [ -t ] enter terminal mode after running the program
    [ -T ] enter PST-compatible terminal mode


    Yeah, all they do is echo the serial port to standard output. I thought I had removed the -T option, since it didn't do anything different from -t. I'll fix that, thanks.
  • I thought -T echoed a CRLF after a RETURN is entered and -t didn't do any echoing.
Sign In or Register to comment.