I want to run my python code off the SD card (like raspberry pi). Is there documentation which describes how to setup the pyboard to do this?
Thanks
Boot from SD Card
Re: Boot from SD Card
Just put your 'boot.py' and 'main.py' files on your SD card; when the card is present in the pyboard it will run the code there instead of from the internal flash.
Re: Boot from SD Card
Thanks for the response.
Do I need to remove the boot.py and main.py from flash?
Do I need to remove the boot.py and main.py from flash?
Re: Boot from SD Card
No, the files on the SD card just get run instead of the internal Flash.
Re: Boot from SD Card
Based on what I have understand (from post/response) it is not possible to output debug information (like print statements) to the terminal (REPL) if running a program on the SD card. Can anyone verify this.
Thanks
Thanks
Re: Boot from SD Card
The REPL works the same whether you boot from internal flash or SD card.
You can use 'boot.py' to set whether the REPL uses USB or one of the hardware serial ports (uarts). You can also set whether USB Mass Storage is turned on or off. If the SD card is present then that boot.py and main.py will be run.
You can use 'boot.py' to set whether the REPL uses USB or one of the hardware serial ports (uarts). You can also set whether USB Mass Storage is turned on or off. If the SD card is present then that boot.py and main.py will be run.
Re: Boot from SD Card
Thanks blmorris,
Can you point me to the documentation which elaborates on setting the USB mode?
Can you point me to the documentation which elaborates on setting the USB mode?
Re: Boot from SD Card
It looks like there isn't any documentation.
The function in question is called pyb.usb_mode. There is a brief amount of documentaiton in the default boot.py file:
https://github.com/micropython/micropyt ... #L131-L132
There is a bit more information in the actual source file:
https://github.com/micropython/micropyt ... #L182-L189
If you use pyb.usb_mode('VCP') or pyb.usb_mode('CDC') then you'll get usb-serial only with no Mass Storage. If you use pyb.usb_mode(None) then it should disable all USB functionality.
You can get the REPL on a HW UART by using the pyb.repl_uart function:
http://docs.micropython.org/en/latest/l ... .repl_uart
The function in question is called pyb.usb_mode. There is a brief amount of documentaiton in the default boot.py file:
https://github.com/micropython/micropyt ... #L131-L132
There is a bit more information in the actual source file:
https://github.com/micropython/micropyt ... #L182-L189
If you use pyb.usb_mode('VCP') or pyb.usb_mode('CDC') then you'll get usb-serial only with no Mass Storage. If you use pyb.usb_mode(None) then it should disable all USB functionality.
You can get the REPL on a HW UART by using the pyb.repl_uart function:
http://docs.micropython.org/en/latest/l ... .repl_uart