Owner manual

MAXQ1004
1-Wire and SPI Authentication Microcontroller
11
Loading Flash Memory with
the Bootstrap Loader
An internal bootstrap loader allows the device to be
reloaded over a simple JTAG interface. As a result, soft-
ware can be upgraded in-system, eliminating the need
for a costly hardware retrofit when updates are required.
Remote software uploads are possible that enable
physically inaccessible applications to be frequently
updated. If in-system programmability is not required,
a commercial gang programmer can be used for mass
programming.
In-Application Flash Programming
From user-application code, internal flash memory can
be programmed/erased by calling internal ROM utility
functions from either C or assembly language. Memory
protection is enforced by the ROM utility functions. The
function declarations below show examples of some of
the ROM utility functions provided for in-application flash
memory programming.
/* Write one 16-bit word to code address dest.
* Dest must be aligned to 16 bits.
* Returns 0 = failure, 1 = OK.
*/
int flash_write16(uint16_t dest, uint16_t data);
To erase, the following function would be used:
/* Erase the given Flash page
* addr: Flash offset (anywhere within page)
*/
int flash_erasepage(uint16_t addr);
Code Scrambling
Automated code scrambling protects user-code mem-
ory against attempts to determine the code contents.
The proprietary scrambling algorithm is transparent to
the user and still allows in-application programming.
Address shuffling prevents well-known startup code from
always being at the known location 0000h and interrupt
vector code at known locations. This obfuscates confi-
dential software and makes the application secure from
hackers and copiers.
ADC
The 10-bit delta-sigma analog-to-digital converter (ADC)
allows the application to measure external voltages,
most commonly the voltage of the batteries driving V
DD
.
The analog input, AN0, can be optionally scaled by 50%
for direct supply voltage measurement. The ADC value
saturates (all data bits read 1) when the input voltage
exceeds the maximum allowable ADC reference voltage.
The internal temperature sensor is measured by the ADC
when selected.
Each conversion can choose its own reference from
AVDD or the internal reference. Data can be retrieved
in either left-justified or right-justified format, giving the
application direct control on data format.
A conversion takes 1025 ADCCLK cycles to com-
plete. The ADCCLK is derived from the system clock
with divide ratio defined by the ADC clock-divider bits
(ADCCLK). Therefore, with 1025 ADCCLK to acquire
one data, the fastest ADC rate = Sysclk/1025 (ADCCLK
= 0h). See Figure 1.
Temperature Sensor
An integrated temperature sensor measures the internal
temperature of the device with an error of Q6NC. The tem-
perature sensor is connected to channel 1 of the ADC.
To read the temperature sensor, select ADCH to 1.
Nanopower Ring Wake-Up Timer
A nanopower-ring oscillator can be used to drive a
wake-up timer that causes the device to exit stop mode
after a user-selectable time period. The wake-up timer is
software programmable in 16-bit steps of the nanopower
ring clock up to approximately 8 seconds.
Serial Number/Device ID
Each device has a factory-programmed, unique, 64-bit
device identification number (ID). This ID ensures device
traceability and serves as an input to the device’s
authentication protocol.
The first 8 bits of the device ID are a 1-Wire family code
that is the same for all MAXQ1004 devices. The next 48
bits are a factory-programmed unique serial number.
Even if multiple devices are used in a 1-Wire network, the
unique, 48-bit serialization field prevents any address
conflict, allowing communication with each device indi-
vidually. The last 8 bits are a factory-programmed cyclic
redundancy check (CRC) of the first 56 bits. The 1-Wire
CRC is generated using a polynomial generator consist-
ing of a shift register and XOR gates. The polynomial is
x
8
+ x
5
+ x
4
+ 1.