powerpic

Replacement board for a Casio CA-53W

= PowerPIC Getting Started Guide
:toc: left
:toc-title: Getting Started
include::attributes-urls.adoc[]

Get started with the PowerPIC.

== Prerequisits

=== Software
A few programs are required to build and upload the firmware:

`make`::
Make is required for the `make` command. It should be installable from your
distro's package manager.

`xc8-cc`::
The firmware is compiled with Microchip's xc8 compiler. It can be downloaded
{link-xc8-dl}[from their website] for all operating systems. If you use Arch
Linux, an AUR package is available: {link-xc8-aur}[microchip-mplabxc8-bin].

`picchick`::
This is required for flashing the bootloader and uploading firmware to the
watch. It's installable via `pip` {link-picchick-pypi}[from pypi]. Checkout the
{link-picchick-github}[github] for more information.

=== Firmware
Firmware for the PowerPIC includes the bootloader (flipflop) and the main app (CasiOS).

flipflop::
Serial bootloader for the PowerPIC. {link-flipflop-github}[github]

CasioOS::
"Operating System" for the PowerPIC. Get the latest code {link-powerpic-github}[from github].

=== Hardware
To get started you should have a completed PowerPIC PCB and a doner
Casio CA-53W.

Flashing the bootloader requires an ICSP programmer. This only needs to be done
once, afterwards you may upload firmware using the 1-wire method.

Updating the firmware requires a 1-wire capable UART adapter. If you would like
to update firmware without disassembling the watch, a programming adapter is
also needed.


== Uploading Firmware

=== Flashing Bootloader
Flipflop is a serial bootloader for PIC16's. It communicates with the programmer
using a 1-wire serial connection. This makes it possible to upload new firmware
to the PowerPIC without disassembly.

Flipflop must be flashed initially using the PIC ICSP protocol. This requires
an ICSP programmer and 5 connections: vcc, gnd, clock, data, and reset. Any
programmer that supports the low-voltage ICSP protocol will work(PICKit, etc.),
but an Arduino with the {link-arduino-icsp-github}[arduino-icsp sketch] is compatible with picchick, which
is the method used in this guide.

==== Building flipflop
Clone the latest source code from github. Then in the flipflop directory, run
`make flipflop`. The compiled flipflop hex file will be in `build/flipflop.hex`

==== Upload flipflop
Connect the PowerPIC PCB to the ICSP programmer. This can be done inside or
outside the watch, if outside the watch you will need to supply your own power
source. If you flash it while installed in the watch, make sure to install a
battery to supply the watch with power.

A simple programming cable can be made with some female headers and some pogo pins:
[picture of icsp programming cable]

Next, upload the compiled hexfile using picchick: +
`picchick -d 16lf19197 -c arduino-icsp -P <serial_port> -B 115200 -f flipflop.hex`

The bootloader should now be uploaded to the PowerPIC.


=== Updating CasiOS
To upload code to the watch, you must restart the watch and enter the bootloader.
The bootloader waits to receive the start command from the programmer over
UART. If the start command is not received in ~15? seconds, the bootloader will
start the user application.

You can enter bootloader mode on the watch by one of the following:

. *Dedicated "Update Mode"* +
It is recommend to include the Update mode in all CasiOS builds, this allows
entering bootloader mode by a simple button combination. +
First navigate to the Update mode: the secondary display will read "UP" and the
primary display will read "uPdAtE". Press the Adj button, the screen will now
display "rEboot". A press of any keypad key or the Mode button will reset the
watch. Another press of the Adj button will cancel the reset.

. *Manually short [.overline]#MCLR#* +
By default flipflop enters bootloader mode upon a reset, so you can force enter
bootloader mode by manually shorting [.overline]#MCLR# to ground, i.e. with a pair of tweezers or
similar. This is useful when the watch is unresponsive, but it does require
removing the watch back.

Note that if only the bootloader is uploaded, it will never leave bootloader mode.

---
[.text-center]
[.big]#{link-powerpic-github}[github] |
{link-powerpic-docs}[documentation] |
{link-powerpic-home}[website]# +
&copy; 2025 Rex McKinnon <[email protected]>