PineTime Smartwatch And Good Code Play Bad Apple

Several frames from Bad Apple

PineTime is the open smartwatch from our friends at Pine64. [TT-392] wanted to prove the hardware can play a full-motion music video, and they are correct, to a point. When you watch the video below, you should notice the monochromatic animation maintaining a healthy framerate, and there lies all the hard work. Without any modifications, video would top out at approximately eight frames per second.

To convert an MP4, you need to break it down into images, which will strip out the sound. Next, you load them into the Linux-only video processor, which looks for clusters of pixels that need changing and ignores the static ones. Relevant pixel selection takes some of the load off the data running to the display and boosts the fps since you don’t waste time reminding it that a block of black pixels should stay the way they are. Lastly, the process will compress everything to fit it into the watch’s onboard memory. Even though it is a few minutes of black and white pictures, compiling can take a couple of hours.

You will need access to the watch’s innards, so hopefully, you have the developer kit or don’t mind cracking the seal. Who are we kidding, you aren’t here for intact warranties. The video resides in the flash chip and you have to transfer blocks one at a time. Bad Apple needs fourteen, so you may want to practice on a shorter video. Lastly, the core memory needs some updating to play correctly. Now you can sit back and…watch.

Pine64 had a rough start with the single-board computers, but they’re earning our trust with things like soldering irons and Google-less Linux mobile phones.

11 thoughts on “PineTime Smartwatch And Good Code Play Bad Apple

    1. and what is weird about it?

      Sadly this article completely lacks technical details. Pinetime is nrf52832 watch with ST7789 240×240 display. This means you need to transfer 16bit or 12bit RGB over 8MHz 1 bit SPI bus. There is no other display mode. In this case the bus is even shared with SPI flash you load the data from. to start drawing pixels to random place on ST7789 you need to send three short commands with parameters so you need to toggle d/c pin 6 times during sending those 11 starting bytes. so unless you do clever trick like here you cannot even use DMA properly for sending those.

      1. I find it interesting the same video was used for the 5150 demo on extremely limited hardware. It was an incomplete thought… Although I would think with current processing power, the pinetime would decodes mp4 on board, filter which pixels change and send only those in real time vs the 5150 demo of having all the video data pre compiled to send only chaged pixel data. Thank you for pointing out the spi limits, i assumed there was more power/space than 64mhz, 32k ram and 512k rom… definately some tough limits to stay within.

      2. To provide some technical details: The data is send in 12bit RGB. And there is indeed a clever trick for the d/c pin switching. Using the PPI system of the nrf52 a timer is started on a spim TASK_START, and compare flags are set on this timer to switch the d/c pin at the right moments during the DMA transfer (also using PPI), this DMA transfer is usually just one DMA transfer (if smaller than the max DMA size) to make the code simpler. As for the flash being on the same bus. Most of the data is fetched and decompressed (lz4) to ram during still frames and other non display writing time.

  1. On violating the warranty. Unless you’ve damaged the device your (USA) warranty is intact. Seals can’t be used as a part of warranty terms as you’ve got the right to take apart your purchased products (again, here in the USA) as long as you don’t damage them and retain any stated warranty.

    Maybe someone can correct me but I recall that you can’t both offer a warranty here and tie repair to your own service department. Which I think includes your own firmware unless you cause damage or corrupt the device in some way through your use.

    Here’s NPR’s take: https://www.npr.org/sections/thetwo-way/2018/04/11/601582169/warranty-void-if-removed-as-it-turns-out-feds-say-those-warnings-are-illegal

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.