wasp-os: MicroPython for PineTime!
#21
I've been hard at work on documentation over most of the the past weekend... as a result, among several other documentation improvements, wasp-os now has an first attempt at an Applicaiton Writer's Guide! wasp-os has a single pervasive goal and that is to make writing applications easy (and fun). The Application Writer's Guide is a massive step towards meeting that vision (and one of the last big pieces before I can make that M2 release I teased a couple of weeks back).

If you find any problems with the guide then feel free to file something in the issue tracker at github (or even better send me a pull request to fix it).
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#22
WOW! Great work
#23
Rainbow 
I am proud, pleased, relieved and exhausted to announce the v0.2 release of wasp-os: https://github.com/daniel-thompson/wasp-...s/tag/v0.2 . This is the first version numbered release of wasp-os and is also the first edition to come with pre-compiled binaries (although you will still require an SWD programmer and to read the wiki page on Reprogramming the PineTime to get started).

For wasp-os v0.2 (called M2 in the roadmap) the focus has been to build the best developer experience possible.

That means there is now a file system that allows developers to transfer python source code to the device and arrange for it to be executed automatically at boot without needing to recompile the firmware itself. Not only does this make wasp-os more approachable but it also encourages much faster development cycles for your applications. There are also many new applications together with an application launcher to hold things together.

This is supplemented with comprehensive documentation available at: https://wasp-os.readthedocs.io, and which includes a comprehensive Application Writer's Guide together with install instructions, a reference manual and much more.
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#24
The documentation is impressive.  I decided to replace JF002's FreeRTOS code on my Pinetime with your code, using the bootloader.hex and micropython.zip files from wasp-os-0.2.tar.gz file on your web page. I flashed the bootloader.hex with a STLINK and that went well, the Pine64 logo appeared along with a Bluetooth icon, and arrow and the word start.  I then used nRF Connect to send the micropython.zip file over Bluetooth to the watch.  It was slow but it completed.

However, I do not get the time on the screen, I just get a black screen.  It does not respond to the button or screen taps.  If I hold down the button for 10 seconds or so the bootloader screen appears.  If I press the button the screen goes black and stays that way.

Any thoughts on what I am doing wrong?
#25
(05-24-2020, 03:40 PM)VMMainFrame Wrote: The documentation is impressive.  I decided to replace JF002's FreeRTOS code on my Pinetime with your code, using the bootloader.hex and micropython.zip files from wasp-os-0.2.tar.gz file on your web page. I flashed the bootloader.hex with a STLINK and that went well, the Pine64 logo appeared along with a Bluetooth icon, and arrow and the word start.  I then used nRF Connect to send the micropython.zip file over Bluetooth to the watch.  It was slow but it completed.

However, I do not get the time on the screen, I just get a black screen.  It does not respond to the button or screen taps.  If I hold down the button for 10 seconds or so the bootloader screen appears.  If I press the button the screen goes black and stays that way.

Any thoughts on what I am doing wrong?

Does the watch reappear in nRF Connect when the screen is black (if you launch a scan it should appear as PineTime rather than PineDFU but the MAC address will be the same)?

If the watch scans via BLE then we should be able to debug it by connecting via the Nordic UART Service (you can use an Android program called Serial Bluetooth Terminal for this). If you send an empty command the watch should respond with a python prompt (">>> ").

The best way to debug is to do a special "debugging" reboot: Long press to return to bootloader, wait for 5 seconds, press the button to start wasp-os but keep it held down until the screen goes black for a second or so (e.g. release it a little bit after the Pine64 logo disappears for good). This will look pretty much the same (a black display after the Pine64 logo disappears) but it bypass the watch startup files which means we can get more useful debug information.

To access the debug information then run the following commands via the Nordic UART Service:

Code:
import wasp
wasp.system.run(no_except=False)

Let me know how it goes!
BTW @JF002's firmware also works with the wasp-bootloader (IIRC you have to make the .zip file by hand)... you can switch back and forth with OTA updates ;-) .
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#26
Daniel, thank you for the quick response.  I have done a lot of testing and this is what I have found:

If I hold the button down for over 5 seconds the watch boots into the bootloader, the Pine64 logo, a Bluetooth icon, an arrow and the word Start appear on the screen. If I do a single press of the button nothing happens.  If I hold the button down for 2 seconds or so the screen goes black, then the Pine64 logo appears, then the screen goes black.  Pressing the button does nothing after that.  If I go to my phone, open Serial Bluetooth Terminal, and send:

wasp.system.run()

I get the message: Watch is running,  use Ctrl-C to stop.  The time and date and battery icon appear on the Pinetime screen.  From that point on the watch works perfectly.  The screen turns off after a few seconds but comes back with a button press.  I can scroll to the other screens and go back to the clock screen.

Notes:  1) When I connect to the watch from Serial Bluetooth Terminal, the connection drops after about 40 seconds.  Is this normal?
2) How do I send a Ctrl-C from Serial Bluetooth Terminal?

Thanks,

Hugh
#27
(05-26-2020, 06:27 PM)VMMainFrame Wrote: Daniel, thank you for the quick response.  I have done a lot of testing and this is what I have found:

If I hold the button down for over 5 seconds the watch boots into the bootloader, the Pine64 logo, a Bluetooth icon, an arrow and the word Start appear on the screen. If I do a single press of the button nothing happens.

There is a short period (4 seconds IIRC) just after the bootloader starts where the button is ignored. This is to give you time to release the button after provoking a reset ;-) but I think many people misunderstand how it works (so I logged https://github.com/daniel-thompson/wasp-os/issues/28

(05-26-2020, 06:27 PM)VMMainFrame Wrote: If I hold the button down for 2 seconds or so the screen goes black, then the Pine64 logo appears, then the screen goes black.  Pressing the button does nothing after that.  If I go to my phone, open Serial Bluetooth Terminal, and send:

wasp.system.run()

I get the message: Watch is running,  use Ctrl-C to stop.  The time and date and battery icon appear on the Pinetime screen.  From that point on the watch works perfectly.  The screen turns off after a few seconds but comes back with a button press.  I can scroll to the other screens and go back to the clock screen.

Did you run "import wasp" too?

If the system reports no errors during import wasp; wasp.system.run() then it is likely there has been some problem talking to the external flash chip on your watch. It would be great if you can help debug this.

Firstly, if the back of your watch isn't glued on then reading the part number of the external flash chip would be really useful. The chip on question is the second largest one, has 8 pins and is located fairly near the middle (between the heart rate monitor and the button). Read everything you can from the package. Sometimes if is very hard to read: strong side-angled lighting can help, as can a magnifying glass or a zoom lens on a camera (probably with the flash off otherwise it whites everything out).

Secondly the bit of code I think is not working correctly is here so if you could try running that by hand on the python console that would be really helpful. You can't type it exactly as you see in the link above but it's pretty close. Try the following (stop at the first error message and share happened):

Code:
from watch import *
flash = FLASH(spi, (Pin('NOR_CS', Pin.OUT, value=1),))
import os
os.mount(flash, '/flash')
from shell import *
ls('/flash')


(05-26-2020, 06:27 PM)VMMainFrame Wrote: Notes:  1) When I connect to the watch from Serial Bluetooth Terminal, the connection drops after about 40 seconds.  Is this normal?
2) How do I send a Ctrl-C from Serial Bluetooth Terminal?

Dropping the connection isn't normal but BLE can be a bit fickle so I wouldn't worry too much. Note there are other tools that can be used to access the console (./tools/wasptool --console for example) but I suggested an Android tool because I saw you are using nRF Connect to install the binary.

Finally to send a ^C using SBT you must use the macro feature (press and hold one of the macro buttons at the bottom of screen and then click the (i) button to read the built in help on how to send ^C.
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#28
Daniel,

Yesterday on the first of many tests I issued the commands "import wasp" and "wasp.system.run(no_except=False)"  Both were accepted without any error messages.  After the second command I noticed the Pinetime screen had lit up with the time and date.

The chip in my watch is very easy to read except for the company logo which is partly blurred.  it says:

XT25F32BWOIG
1924HTC
E96035

Today I rebooted into the bootloader and then waited a full minute.  I then pressed the button once, with no response.  A long press after that got me the Pine64 logo by itself, and then a black screen.

I entered the commands you gave me, it failed on "os.mount(flash,'/flash')" with OSError: 1.  Attached is the screen from Serial Bluetooth Terminal and a picture of the inside of the watch.

Hugh


.png   Pinetime-log.png (Size: 263.13 KB / Downloads: 560)
.jpg   inside3.jpg (Size: 314.43 KB / Downloads: 558)
#29
Hi Daniel: wasp-os is really amazing, now that I have seen the code inside [emoji3]

I'm now documenting my attempt to run wasp-os on Mynewt. Maybe this will take off, maybe it won't. But either way it's a fascinating educational look inside wasp-os [emoji3]

https://lupyuen.github.io/pinetime-rust-...icropython

Sent from my Pixel 4 XL using Tapatalk
#30
(05-27-2020, 03:02 PM)VMMainFrame Wrote: I entered the commands you gave me, it failed on "os.mount(flash,'/flash')" with OSError: 1.  Attached is the screen from Serial Bluetooth Terminal and a picture of the inside of the watch.

Thanks for all the detail. It helps a lot, especially because this isn't what I was expecting.

You might be able to fix it my formatting the external flash. Normally this happens automatically when there is no filesystem but it doesn't seem to be working for you because you are getting the "wrong" error message. Of course the wrong error message is not expected so they could still be something else causing us trouble... but either way we won't know until we try!


The following sequence of commands is pretty long and might not be fun to type via the Android keyboard. Howver if these commands run without error then they will probably fix the problem (e.g. get it booting properly with manual help):


Code:
from watch import *
flash = FLASH(spi, (Pin('NOR_CS', Pin.OUT, value=1),))
import os
os.VfsLfs2.mkfs(flash)
os.mount(flash,'/flash')
f = open('/flash/main.py', 'w')
f.write('''\
import wasp
wasp.system.run()
''')
f.close()

Good luck!

(05-28-2020, 01:59 AM)lupyuen Wrote: Hi Daniel: wasp-os is really amazing, now that I have seen the code inside [emoji3]

I'm now documenting my attempt to run wasp-os on Mynewt. Maybe this will take off, maybe it won't. But either way it's a fascinating educational look inside wasp-os [emoji3]

I'm quite pleased with how wasp-os is turning out so far althogh I must concede that the most amazing bits I have inherited from MicroPython!

Anyhow I'll be very interested to see how wasp-os on MyNewt comes together. I'd definitely like to see it running on top of a FOSS BLE stack at some point and MyNewt is an interesting way to do that. The number that will really matter is the amount of free memory once wasp-os is running. Micropython systems often live or die based on whether there is enough spare RAM. I'm hopeful that NimBLE (perhaps tuned for a reduced feature set) will have less overhead.

PS On the subject of multi-threading for comms. Micropython has an special execution state that is a little bit like a softirq handler in Linux. In terms of multi-threading I am planning (eventually) to try running wasp-os from that execution context. wasp-os apps are event driven in order to make that possible. Such an approach should leave the regular execution state available to handle BLE comms and/or the REPL.
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinetime - Kids with special needs hidara 0 552 06-11-2024, 10:42 PM
Last Post: hidara
  Develop a new firmware for PineTime belushi 2 1,991 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 885 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 1,061 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,687 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 1,260 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 2,636 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 2,141 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,877 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 4,914 03-02-2022, 05:58 AM
Last Post: wibble

Forum Jump:


Users browsing this thread: 2 Guest(s)