UKHAS Wiki

UK High Altitude Society

User Tools

Site Tools


projects:jimbob:habtrk

PCB Version 006 Board 1

NCP1400 Voltage Reg at 1.8v

ATMega328p Processor at 4Mhz, 1.8v

uBlox GPS

RFM22B Radio

Programming the Mega

Program fuses using AtmelStudio and Olimex AVR-ISP500 - STK500 programmer.

The Olimex AVR-ISP500 has an external clock output on ICSP10 pin 3 for rescuing AVRs with enabled external clock fuse but no external clock This clock output can be really helpful when target AVR is accidentally programmed with External Clock FUSE option. To resurrect it just wire ICSP10 pin 3 to XTAL1 pin of the target AVR chip and initiate a programming session to fix the FUSE values.

Power from external battery.

Setting Default Set
BODLEVEL Disabled Disabled
RSTDISBL Clr Clr
DWEN Clr Clr
SPIEN Set Set
WDTON Clr Clr
EESAVE Clr Clr
BOOTSZ 2048W_3800 2048W_3800
BOOTRST Clr Clr
CKDIV8 Set Clr
CKOUT Clr Clr
SUT_CKSEL INTRCOSC_8Mhz_6ck_14ck_65ms ExtXOsc_3Mhz_8Mhz_16KCK_14CK_65ms

Note Full Swing Crystal Oscillator will only operate for VCC = 2.7 - 5.5 volts

Setting Default Set
Extended 0xFF 0xFF
High 0xD9 0xD9
Low 0x62 0xFD

ToDo

Arduino

Arduinio Software Serial library doesn't support 4mhz clocks - so I created a SoftwareSerial4Mhz with just a 9600 baud line - works fine, verified timing with scope to the best of my ability.

#elif F_CPU == 4000000

static const DELAY_TABLE table[] PROGMEM = 
{
  //  baud    rxcenter    rxintra    rxstop  tx
  { 9600,     19,         54,        54,     51,    },
};

const int XMIT_START_ADJUSTMENT = 3;

Arduinio wiring.c does not support 4Mhz clocks, so delays in the code will be wrong I think - either edit your delays (/2) or edit wiring.c

Added a section to boards.txt to tell the Arduinio IDE about the board:

##############################################################
HabTrk.name=HabTrk (1.8V, 4 MHz) ATmega328
HabTrk.build.mcu=atmega328p
HabTrk.build.f_cpu=4000000L
HabTrk.build.core=arduino
HabTrk.build.variant=standard

Added a section to programmers.txt to tell it about my serial Olimex AVR-ISP500, or you can just flash the hex file directly from Atmel Studio.

avrispmkiis.name=AVRISP mkII Serial
avrispmkiis.communication=serial
avrispmkiis.protocol=stk500v2

Checking

Checked frequency of transmission by measuring the pulse width - http://ssreng.com/how-do-i-know-the-baud-rate-of-the-serial-data/

Habhub Payload Config

Using the form here I generated a payload config:

Payload Name: G7PMO $$HABTRK

Primary, 434.150, USB, RTTY, 470, ASCII-7, 50 Baud, Parity none, 1 Stop bits.

{“type”:“payload_configuration”,“name”:“G7PMO $$HABTRK”,“time_created”:“2013-08-03T12:21:33+01:00”,“metadata”:{“description”:“G7PMO's HABTRK Tracker”},“transmissions”:[{“frequency”:434150000,“modulation”:“RTTY”,“mode”:“USB”,“encoding”:“ASCII-7”,“parity”:“none”,“stop”:1,“shift”:470,“baud”:50,“description”:“Primary”}],“sentences”:[{“protocol”:“UKHAS”,“callsign”:“HABTRK”,“checksum”:“crc16-ccitt”,“fields”:[{“name”:“sentence_id”,“sensor”:“base.ascii_int”},{“name”:“time”,“sensor”:“stdtelem.time”},{“name”:“latitude”,“sensor”:“stdtelem.coordinate”,“format”:“dd.dddd”},{“name”:“longitude”,“sensor”:“stdtelem.coordinate”,“format”:“dd.dddd”},{“name”:“altitude”,“sensor”:“base.ascii_int”},{“name”:“satellites”,“sensor”:“base.ascii_int”},{“name”:“battery”,“sensor”:“base.ascii_int”},{“name”:“temperature_rfm22b”,“sensor”:“base.ascii_int”}],“filters”:{“post”:[{“filter”:“common.numeric_scale”,“factor”:0.001,“round”:3,“source”:“battery”,“type”:“normal”},{“filter”:“common.invalid_gps_lock”,“ok”:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],“source”:“satellites”,“type”:“normal”}]},“description”:“$$HABTRK Std format”}]}

Doc ID: e55cc3ffb42062c70087dae3d9520903

Note the filter I use to identify if I have a satellite fix “{“filter”:“common.invalid_gps_lock”,”type“:“normal”,”ok“:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],”source“:“satellites”}”

I should really implement another variable in the sentence to define lock directly for the PUBX code, but I am told the above should do what I want it to do.

projects/jimbob/habtrk.txt · Last modified: 2013/08/08 16:58 by kevwal