ap0201 devices log ::2004


Tue Feb  3 01:01:07 GMT 2004

1) re-acquaint bootloader
2) vm code
3) RF code
4) build extra devices + fix prototype

-->

3) RF code (+ hardware - 433 MHz / 4KHz - q of power consumption and antenna)

Manchester encoding + start sync sequence and start/stop bits

interrupt driven - when gets start sync (see article in circuit cellar 
- q is samples x8 and shift register)

size of packets / error checking -> packet


Tue Feb  3 16:20:38 GMT 2004 

1) http://www.ottawarobotics.org/articles/rf/rf.html
gives us pretty much what need to know

-> set up 2x PIC breadboarded for testbed 


 Wed Feb  4 14:43:36 2004 

1) fix proto + breadboarded PICs (RX with LED) -> note added pulldown
10k to GND on TX and pullup 10k -> 5v on RX

2) think we need to use pin RB0 for interrupt (RX) so will need to
shift ALE pin (33) to RC0 (15) on proto  (DONE) + new versions

+ change code [comment out charge stuff for moment]

3) tx/rx sequence ->

tx: 
0) are we recieving - if so return
1) transmit x junk data/preamble (30ms) - should be 101010etc
at baud rate as determined by RTCC (timer0)
2) transmit 8 start bits 01010101 (triggers interrupt on receiver -
could be longer (is 8 or 4 1111 (as in article)?)
3) transmit manchester encoded data (16 bits at a time) 
4) transmit 8 end bits 10101010 (? looks like preamble) (is 8 or 4 (as
in article) 0000?)

rx:

1) watch for RB0 interrupt -ISR starts RTCC at baud rate
2) are we transmitting - if so reset/ return
3) count/if recieved count start bits
4) then recieve data until we have stop bits (16 bits at a time) 

(see q of count number)

4) length of aerial ? -> 14 inch of 30awg wire ? (half wave) 

5) bootloader -

- q simply burn hex file (approp baud rate - 9600 i think) + use picdl
to download (hit reset) - TO TEST - DONE (after mistakes with cable ground pin)


 Thu Feb  5 11:49:04 2004 

1) test new PIC code + circuit change (RB0-RC0) + downloader

2) look at CCS compiler [remember to add appropriate line for
bootloader to C]

(decide C or assembly - if C need port LCD, NVRAM,
ADC, + dubious charge stuff)

CCS compiler notes:

a) pre-proc directives:
#use delay (clock=chip speed) = to use delay_ms() and delay_us() correctly
#use fast_io = must preprog direction with TRIS
#zero_ram

b) function with char parameter can be called with string and will loop

c) functions of note:

delay_cycles(x) (see other delays also)
enable_interrupts(level) (see sisr stwt examples)
ext_int_edge() - interrupts
get_timer()
+ all set/setup commands

+ use switch instead of pointer to functions

** - 1) mock up in v simple C first 
     2) re-code for CCS with NVRAM access, ADC and LCD routines
     3) re-code charging stuff 
     4) RF tested seperately now add 

3) start RF code

4) devices/VM code notes:

a) is cell-space full
b) fill + parse cells
[ main loop
   c) charge control
   d) LCD
   e) reciever - on interrupt
   f) run cells
   g) garbage collect
]

notes from ap0202 implementation:

[prep]
1) read channel 0 into memsz
reparse (vm2.c) whole cellspace

[main]
1) (pcur=vm.curcell)
   (step(&vm))

in cells.c

vm.curcell is next in linked list (if no next first)
garbage collect once in a while

step: a) lively ?
             b) fetch instruction (cl2m) -> offs, len and exec pointer
             c) advance exec pointer in circular buffer (cladv)
             d) call instructions (use simple case)

reparse (vm2.c) new cells added to list according to cell seperator

garbage collect gcollect (vm2.c) uses reparse and reparsebac 

works backwards - if gap then reparsebacs over it

q of linked list - maybe just contiguous data structures marked as free/non-free 

 FIXED  noppp_lx is fine on large m15 but simply doesn't run
on ibm t20 laptop (kernel/bios/hardware but own stuff seems work with it)
 - FIXED with EPP in BIOS


Fri Feb  6 13:48:34 2004

1) RF test/example code does seem to work (simple tests with LEDs for
correct data trans) [ RF_test.c for recv, RF_trans.c for trans] - port
into main body to be coded. - also could try inc baud rate /clock div

- both tx/rx on interrupts/RTCC - give rx priority - abandon tx if rx
in progress

2) possibly 3 sets code -> RF test (with LCD), charge test (with LCD,
 NVRAM), main VM code without RF + full code

3) do basic VM model in C - more or less DONE


 Sun Feb  8 22:15:27 2004 

1) basic C port completed tho need to fill in some functions and fully
test add/del/insert nodes and gc DONE

easy enough to slot in NVRAM, LCD code (+backport charging stuff)

+ TX/RX stuff

(only worry is amount of memory for variables in PIC16F877)


 Mon Feb  9 13:54:24 2004 

1) full port tested with compiler

TODO: backport 

(verify delays DONE)

ADC - done
TX/RX - done (pages rx =228 tx=226)
NVRAM - done
LCD - done (page 227)
CHARGING: - leave till rest tested

ALL to check/test


Thu Feb 12 19:28:54 2004 

1) testing - notes:

a) ADC/MIC seems bit narrow in range (could be delay - could also try inc bits)? DONE
b) slipped up with setup_port_a which sets all analog ports fixed 
c) added serial debug 9600 8N1 for cells/instructions (just a printf)
d) NVRAM and LCD working - is just VM code maybe to debug DONE mostly
e) need case for null data in event that PIC never resets (also for gc)
f) cannot test RF till more prototypes

(power bit loose on proto board TO FIX)

VM problems - 

keeps on resetting - no ideas -> look at restart_cause()
+ leave reset thing in (ie. if stuff is null - so on reset now just re-fills vm cellspace

-> problem was fuses for LVP in bootloader - TO FIX - FIXED

+ then re-test VM

+2) remember to check sizes of all ints + cast if do a larger
multiply CHECKED

3) do not input RX buffer if no reception yet DONE

4) range for ADC is question DONE (12 bits)- mics? // and null data Q TO DO OVER TIME

5) note TEA1102 stuff + interconnect DONE

so next week:

fix all above, building and tests

following week:

order extra parts USA + RF and charging tests


Mon Feb 16 23:53:21 2004

1) fixed many bugs in VM code + testing now with ADC. seems work ok
(but just frozen - why?)

2) add new functions - DONE


Tue Feb 24 15:59:11 2004

1) completed endurance test - runs over 3 hrs with change - TODO test for longer

2) 3 units tested and functioning (no charge tests - TODO USA)

3) RF to test once cabled - may need to test seperately (without what
aspects of vm) as with printf/serial is too large for ROM


Mon Apr 5

1) first day out at DRS in Hinckley,
CA

so far:

a) fixed and tested all 3 devices - looks like they should charge ok -
currently running batteries down for testing tommorrow am - fixed some
circuit issues

b) trying to get mic/adc sensitivity up in software - minor changes to
code but needs testing over long time period

Tue Apr 6

1) still endurance question but they do seem to charge fine after one
day
2) must remember two aerials per device
3) changes to reparse code and few other bugs corrected but still slow
functioning - also sleep code is kind of untested

Fri Apr 9

1) small cumulative changes to code for endurance question and now
hoping to decide on size of solar panel by tommorrow - then more
overnight discharge of batteries and do full log over serial port for
one hour or so today

still function slowly and is question of adjusting sound level going
in
also just to test if they get stuck

2) re-worked basic stuff in code which was v silly - ie. size of cell
space was 2550 bytees but we have 32kb (aside from few pages for
transmit/receive buffers so upped to 26000 and seems happier - also
max number of cells is 400 now (so changes for int16) and initlively
is 1000

logging now but looks good and should upload code as backup ap0201ccs6.c

3) large panel doesn't charge despite 22v out in sun - 6v regulator is
silly also so will try adjustable reg and go for 7.5v 

should test this tommorrow

 Sun April 11

1) adjustable regulators set at 7.5v for all devices (still unsure
which code (0) is running??) - but new code definitely working well

2) charging issues - wakeup and need to be sure on sleep code. also
put battery on device (1) on wrong connector all day so need extra day
testing for that one

3) TODO: test sleep, voltage adjust for charge voltage and check wakeup

 Tue Apr 20

1) all good charging-wise - run till maybe 4am on full days sun then
sleep and wake in sun

2) for latitude of barstow and adjustment for winter light should be
about 60 degrees from horizontal for panel and facing true south

3) again initlively error as is stored as one byte in cell data
structures - so set now to 200 and also changed wrap so above 200
stays at 200 - less activity on display but ...

 Sat/Sun Apr 25 

1) devices installed and running at N 35 07 17.6 W 117 21 32.1