Compare commits

..

No commits in common. "920938165e6c8122d3c111ef8677d84de2c35102" and "df8cdf897cfdff65eb39e5bd9720683990f4d98e" have entirely different histories.

4 changed files with 17 additions and 16 deletions

View file

@ -7,7 +7,7 @@
- `USART0-RxD/TxD-PB2…3`: transmission of data, receive commands - `USART0-RxD/TxD-PB2…3`: transmission of data, receive commands
- `PORTB-PB1`: enable the RF power regulator - `PORTB-PB1`: enable the RF power regulator
- `PORTA-PA5`: light up the LED - `PORTA-PA5`: light up the LED
- `ADC0-PA4,6,7`: read Batterie, NTC, and RF power voltage, and internal sources. - `ADC0-PA4,6…7: read Batterie, NTC, and RF power voltage, and internal sources.
- `PIT`: generate clock tick, to wake the µC once per second from deep sleep. - `PIT`: generate clock tick, to wake the µC once per second from deep sleep.
- `USERROW`: store persistent configuration - `USERROW`: store persistent configuration
- `EEPROM`: store `ADC` readings configuration, store sensor test data records. - `EEPROM`: store `ADC` readings configuration, store sensor test data records.
@ -52,8 +52,8 @@ is the number of readings sent in between without sending config records.
Debug data is only available when not disabled during compilation. Do Debug data is only available when not disabled during compilation. Do
`make DEBUG=-DNODEBUG` to disable all debugging code and data. `make DEBUG=-DNODEBUG` to disable all debugging code and data.
The `SEND` flags are stored in byte[3] of the `config` structure to The `SEND` flags are stored in byte[3] of the `config` structure with
enable the respective output records, with the bit positions the bit positions
- `SEND_CONFIG = 0x01` - `SEND_CONFIG = 0x01`
- `SEND_BATED = 0x02` - `SEND_BATED = 0x02`
@ -67,7 +67,7 @@ enable the respective output records, with the bit positions
## Configuration ## Configuration
At boot, the configuration is copied from the `USERROW` to the At boot, the configuration is copied from the `USERROW` to the
`config` structure in `RAM`, if the first byte in the `USERROW` is `config` structure in `RAM`, iff the first byte in the `USERROW` is
the magic `0xba`, and the second byte matches the version of the the magic `0xba`, and the second byte matches the version of the
`config` structure, currently `0x08`. Else, the defaults are used. `config` structure, currently `0x08`. Else, the defaults are used.
@ -86,7 +86,7 @@ The config structure is
- `[11]`: `mclk_period`: `TCA0.SINGLE.CMP0` \[÷76\] - `[11]`: `mclk_period`: `TCA0.SINGLE.CMP0` \[÷76\]
- `[12]`: `baud_div`: two bytes little endian \[÷16667\] - `[12]`: `baud_div`: two bytes little endian \[÷16667\]
- `[14]`: `uart_mode`: `USART0.CTRLB` - `[14]`: `uart_mode`: `USART0.CTRLB`
- `[15]`: `pit_period`: `RTC.CLKSEL` \[÷1024\] - `[15]`: `pit_period`: `RTC.CLKSEL` \[%1024\]
- `[16]`: `immediate`: number of immediate readings at boot. - `[16]`: `immediate`: number of immediate readings at boot.
### Triggers ### Triggers
@ -127,7 +127,7 @@ necessary to bias the NTC measured by ADC readings.
## Commands ## Commands
Commandlines received via the UART must be in the format Commandlines received via the UART must be in the format
- `«C» {[«space»]+ «hex»}+ [«space»]+ «linefeed»` - `«C» {[«space»] «hex»}+ [«space»]+ «linefeed»`
A command letter, uppercase, and up to seven (optionally space A command letter, uppercase, and up to seven (optionally space
separated) hex bytes, optionally followed by more space characters and separated) hex bytes, optionally followed by more space characters and
@ -148,22 +148,21 @@ additional byte.
### List of commands: ### List of commands:
- `R «ccp»`: Reboot the µC. The argument byte must be `d8`, the - `R «ccp»`: Reboot the µC. The argument byte must be `d8` the
`CCP[IOREG]` key, to validate the reset. `CCP[IOREG]` key, to validate the reset.
- `C «key» «bytes»…`: write to the `config` structure in `RAM` - `C «key» «bytes»…`: write to the `config` structure in `RAM`
- `U «key» «bytes»…`: write to persistent config in the `USERROW` - `U «key» «bytes»…`: write to persistent config in the `USERROW`
- `E «key» «bytes»…`: write to `EEPROM` - `E «key» «bytes»…`: write to `EEPROM`
Up to six «bytes» are written. The «key» must be `9d`, the Up to six «bytes» are written. The «key» must be `9d`, the `CCP[SPM]``
`CCP[SPM]` key, for the persistent stores, and `ba` for the `RAM`. key, for the persistent stores, and `ba` for the `RAM`. Prints
These commands return the old value of the first byte that was the old value of the first bytes written to.
written.
- `T «n»`: trigger «n» more immediate sensor readings. - `T «n»`: trigger «n» more immediate sensor readings.
- `M «aaaa»`: reads any memory address «aaaa» (two bytes, big endian) - `M «aaaa»`: reads any memory address «aaaa» (two bytes) and prints the
and prints the byte. byte.
- `W «aaaa» «bb»`: write a byte «bb» into any address «aaaa», return - `W «aaaa» «bb»`: write a byte «bb» into any address «aaaa», return
the old value of that memory location. the old value of that memory location.
@ -172,7 +171,7 @@ additional byte.
be sent little endian. be sent little endian.
- `D «n»`: process and send calibrated readings for «n» test data - `D «n»`: process and send calibrated readings for «n» test data
records. The `EEPROM` has space for up to five data records. records. The `EEPROM` has space for up to five records.
## Toolchain ## Toolchain

2
src/bate_wdt.c Normal file
View file

@ -0,0 +1,2 @@
#define WDT_TRIGGERED 1
#include "bate.c"

View file

@ -55,7 +55,7 @@ TEMP = {TEMP*0.1:.1f} °C
P = X*10//32 + 2500 P = X*10//32 + 2500
print(f"""Pressure print(f"""Pressure
D1 = {D[1]} {D[1]-7168} D1 = {D[1]} {D[1]-7168}10
TCO = {TCO} TCO = {TCO}
OFFT1 = {OFFT1} OFFT1 = {OFFT1}
OFF = {OFF} OFF = {OFF}

View file

@ -127,7 +127,7 @@ refdes=R3
T 55200 46600 5 10 0 1 90 0 1 T 55200 46600 5 10 0 1 90 0 1
footprint=C0603.fp footprint=C0603.fp
T 55450 46850 5 10 1 1 90 3 1 T 55450 46850 5 10 1 1 90 3 1
value=220kΩ value=270kΩ
T 55000 46600 5 10 0 0 90 0 1 T 55000 46600 5 10 0 0 90 0 1
symversion=0.1 symversion=0.1
} }