Shop OBEX P1 Docs P2 Docs Learn Events
FlexGUI 4.0.4 + MicroPython: assistance loading upython.binary into the P2 board - Page 2 — Parallax Forums

FlexGUI 4.0.4 + MicroPython: assistance loading upython.binary into the P2 board

2»

Comments

  • Ken Gracey wrote: »
    Questions:

    (1) Is only processor 1 available to MicroPython (if possible, I'd rather use the word "processor" for the audience, should it become one)?
    Yes, at the moment micropython is only single threaded, so it only uses one processor. Two others are automatically used for the USB and VGA driver, but that's not really visible to the user (or interesting to them, I suppose).
    (2) When I reset the P2 Eval Board the program does not run again. Is it stored in RAM only? Is this where the SD card comes in?
    Yes, it is in RAM only. It is possible to store things on the SD card. As was noted elsewhere, micropython automatically loads a file called "main.py" from the SD card if it finds one. Also, it's possible to put the upython.binary file on the SD card -- you'll have to name it _BOOT_P2.BIX to make the P2 boot from SD. At some point I'd like to put the ability to write binaries to the SD card into FlexGUI, but I haven't had time. It is possible to write to the SPI flash now, and I've booted upython.binary from the flash, but I'm not sure that flash boot and SD cards work well together -- they didn't seem to when I tried it.
    And I'm curious about the extent of reusability of other MicroPython code, too. Any general comments there?
    Things that are not hardware specific should work well -- standard python expressions and even disk I/O (if you've got an SD card mounted). Board specific things like SPI or I2C drivers would probably need re-writing though for the P2.

    Regards,
    Eric
  • David Betz wrote: »
    Tubular wrote: »
    Yeah it needs to go into the docs.

    It involves copying the compiled binary (from Pnut, Flexgui etc) onto a uSD card as "_BOOT_P2.BIX"



    Okay, that's working for me. Now how to I invoke loadp2 to just connect to the serial port without downloading anything? I tried this and it gave me the dreaded "Could not find a P2".
    loadp2 -t -b 230400
    

    Pass a "-n" to loadp2 to tell it not to reset the board:
    loadp2 -b230400 -n -t
    
    Depending on the OS and what you have connected to USB you may also need to use the -p option to specify which port to use, since loadp2 won't be able to do an automatic search for the P2.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-11-28 02:31
    David Betz wrote: »
    Tubular wrote: »
    This is where it gets a bit messy. Depending on the brand and type of SD card it might be interfering with rebooting (hence the not found message)

    What uSD card are you using David?
    Looks like some no-name SD 2GB SD card that I used to use for the P1.


    Those are ancient and not SDHC cards. I can't seem to buy anything smaller than 16GB from normal sources, of course ebay will sell you anything you like, probably even 1GB cards etc.
    Throw out all your old non-SDHC cards, they've had a long life and have probably wear-leveled as much as they can and at that point the card runs slower and slower as the SD controller tries to manage it as best it can, until it just fails one day.


  • David Betz wrote: »
    Tubular wrote: »
    This is where it gets a bit messy. Depending on the brand and type of SD card it might be interfering with rebooting (hence the not found message)

    What uSD card are you using David?
    Looks like some no-name SD 2GB SD card that I used to use for the P1.


    Those are ancient and not SDHC cards. I can't seem to buy anything smaller than 16GB from normal sources, of course ebay will sell you anything you like, probably even 1GB cards etc.
    Throw out all your old non-SDHC cards, they've had a long life and have probably wear-leveled as much as they can and at that point the card runs slower and slower as the SD controller tries to manage it as best it can, until it just fails one day.

    I don't mind getting a newer card but are you saying these 2gb cards aren't supported? To be honest, I doubt this card is worn out. I probably wrote to it less than 10 times in its life. What are the requirements for SD cards used for booting P2?

  • ersmith wrote: »
    Pass a "-n" to loadp2 to tell it not to reset the board:
    loadp2 -b230400 -n -t
    
    Thanks! That worked fine.
  • Cluso99Cluso99 Posts: 18,069
    The ROM SD boot code supports the older SD cards but they should be FAT32 formatted.
    The older SD cards used byte addressing whereas the newer ones of a number of years ago use sector addressing. While the ROM does support the byte addressing mode I should have removed support. It would have saved a few longs that were in short supply. Might have fitted sector write if I had the space.
  • ersmith wrote: »
    Ken Gracey wrote: »
    (5) ctrl-V to paste? This creates a [?] character in the terminal. Expected that my program would show up.

    Close. You can't use ctrl-V to paste, that just sends the ctrl-V character to the terminal. Instead select the little terminal icon next to "Propeller Output" on terminal window title bar, then go to Edit > Paste. Ignore the accelerator key there that says Ctrl-V, that doesn't work.

    I've found out that in Windows 10 at least there are some additional settings to allow easier cut/paste into console windows. If you select the icon of any console window (including the "Propeller Output" window) you'll get a menu, one of whose entries is "Properties". If you open that and select the "Options" tab, then check the "QuickEdit Mode" box and "Use Ctrl+Shift+C/V as Copy/Paste" box then you'll be able to paste with right click (that's QuickEdit) or with Ctrl-Shift-V.

    You can make these settings the default by selecting "Default" instead of "Properties"; then any future console windows will get the QuickEdit and Ctrl-Shift-V settings automatically.
  • WhitWhit Posts: 4,191
    edited 2019-12-01 02:22
  • evanhevanh Posts: 15,916
    ersmith wrote: »
    I've found out that in Windows 10 at least there are some additional settings to allow easier cut/paste into console windows. If you select the icon of any console window (including the "Propeller Output" window) you'll get a menu, one of whose entries is "Properties". If you open that and select the "Options" tab, then check the "QuickEdit Mode" box and "Use Ctrl+Shift+C/V as Copy/Paste" box then you'll be able to paste with right click (that's QuickEdit) or with Ctrl-Shift-V.

    You can make these settings the default by selecting "Default" instead of "Properties"; then any future console windows will get the QuickEdit and Ctrl-Shift-V settings automatically.
    Funnily, KDE's Konsole uses those. I imagine it's common across Linux consoles.

  • Cluso99Cluso99 Posts: 18,069
    edited 2019-12-05 08:55
    Moved this post to the Micropython for P2 thread
    forums.parallax.com/discussion/comment/1483977/#Comment_1483977
Sign In or Register to comment.