copy the system files from carbonwg-pic/sdc to the SD card
SYSBOOT.SCR
CONFIG.TXT
HELP.MD
DIC2.SCR
edit CONFIG.TXT (on the SD card) and set the serial number field
if using OSX or linux, run unix2dos on the files to make sure have correct line endings
$ dos2unix path/to/sdcard/*
install the SD Card in the PCB socket
Firmware Installation
There are two firmware options
stand-alone
simpler to install
firmware updates require ICSP programmer, e.g. ICD4
with serial bootloader
firmware updates may be done via console port
requires Microchip Unified Host Java app (distributed with firmware repo)
procedure: Install stand-alone
open the pic firmware project
File > Open Project... > carbonwg-pic/cwg-pic.X
select the cwg_nonboot configuration
[carbonwg project non-boot configuration]
clean/build
make and program device
procedure: Install serial bootloader version
Installing the serial bootloader version is a three step process:
build and install the bootloader firmware
build the carbonwg firmware (uses a different configuration than stand-alone)
use the bootloader together with the Microchip Unified Host app to load the carbonwg firmware
Step 1: build and install the bootloader firmware
open the bootloader firmware project
File > Open Project... > carbonwg-pic/cwg-bl.X
clean/build
make and program device
Step 2: build and install the carbonwg firmware (bootloadable configuration)
open the bootloader firmware project
File > Open Project... > carbonwg-pic/cwg-pic.X
select the cwg_boot configuration
clean/build
WAIT (do not make and program device)
Step 3: Use the bootloader and Unified Host app to load the carbonwg firmware
unzip the Unified host file carbonwg-pic/utils/unifiedhost--bin.zip creates directory UnifiedHost-
double click the jar file to run the app UnifiedHost-/UnifiedHost-.jar
configure the Device Architecture PIC24/dsPIC33/PIC32MM MCUs
configure the Unfied Host serial port (i.e. controller console port, not host port) Settings > Serial… Bits per second 38400 Data bits 8 Stop bits 1 Parity Disabled
[unified host serial configuration]
configure the firmware image address range Application Start (Byte Address):0x1800 Application End (Byte Address):0x5B000
[unified host configuration]
select the cwg_boot firmware image File > Open/Load (*.hex) > cwg-pic.X > dist > cwg_boot > production > cwg-pic.X.production.hex
[select firmware hex image]
optionally, uncheck Enable Read Back Verification After Program (slower, but recommended to verify)
leave the Unified Host app window open
use a terminal emulator (e.g. hyperterm, minicom, etc.) to open a console session to the controller console port - the same one used by the Unified Host. Configure using 38400N81.
cycle power to the board
On power up, the LED will stay lit for 2 seconds.
When it turns off, type UUUU within 10 seconds to activate the bootloader
Each character typed should be echoed, the LED should flash when it receives a ‘U’
The LED will stay lit when the bootloader is active (10s max or when UUUU sequence complete)
The LED will flash 3 times then turn off if the bootloader is NOT activated (cycle power and start again)
close the terminal emulator, and return to the Unified Host session window
click the “Program Device” button to begin programming the device. The process takes ~5-10 min.
when the programming cycle is complete, the board should reset.
The LED will light for 2 S
After ~10s, the LED will flash three times and boot the firmware
The LED will flash at 1 Hz for a few seconds and stop flashing if no console input is received
Now it should be possible to initiate a terminal session on the console port (9600N81)
Test Procedures
Pre-test
complete board prep checklist (above)
turn off power to the controller board
unplug all cables
testing should be conducted on a non-conductive, static safe surface
[typed characters - should be echoed] * remove loopback connector
[typed characters - should not be echoed] * measure licor port power (pins 1,4 - ~11-12 V)
enter CTRL-D to quit con session
measure licor port power (pins 1,4 - ~0 V)
PASS:
port power responds, voltage levels correct
serial port loopback test OK
Set Real Time Clock
establish a console session
set the time (YYYY M D H M S)
>> set time 2019 11 20 14 20 0
get the time (should be later than set time)
>> get time
2019-11-20T14:27:20Z
issue reset or cycle power
get the time (should be later than previous check)
>> get time
2019-11-20T14:32:20Z
PASS:
time retained across power cycle
time matches value entered
Analog Inputs
connect 10-20k pot center/end to pins 2,3 of ANALOG port
assert ADC enable bits
>> set bits a*
read ADC for ends and middle of pot range
>> GET AD 0 1
ADC0 : 3.5547 V
ADC1 : 4.9805 V
repeat for channels 0,1
PASS:
voltage should vary X-5V (0<X<5, depending on pot value)
Battery Voltage Input
read ADC2 (VBATT)
>> GET AD 2
ADC0 : 11.4001 V
PASS:
voltage should be ~11-12V
Valve Ports
install 3-pin test cable on port SV0
connect a DMM or scope to the test cable
DMM negative:
DMM positive: SVn:A
assert all SV ports ON
>> set bits v* pa ps
>> get bits
DMM should indicate ~11-12V
Move the connector to each of the SV*A ports (check voltage)
Connect the DMM to the B port and repeat for SV*B
assert all valve ports OFF
>> clr bits v* pa ps
>> get bits
repeat SVA, SVB checks (should be ~0.3V)
PASS:
all valve ports should on/off @ nominal voltage
Pump Ports
install 2-pin test cable on port P0
connect a DMM or scope to the test cable
DMM negative: P0-
DMM positive: P0+
assert all Pump ports ON
>> set bits p*
>> get bits
DMM should indicate ~11-12V
Move the connector to each of the pump ports (check voltage)
assert all valve ports OFF
>> clr bits p*
>> get bits
repeat P( checks (should be ~0.0V)
PASS:
all pump ports should cycle on/off @ nominal voltage
SD Card
run filesystem info utility
>>dstat
FAT type FAT32
Bytes/Cluster 32768
Number of FATs 2
Root DIR entries 0
Sectors/FAT 3834
Number of clusters 490720
Volume start (lba) 8192
FAT start (lba) 8716
DIR start (lba,clustor) 2
Data start (lba) 16384
768312 bytes in 71 files 16 directories
15703040 KiB total 15700192 KiB available