1. About this User Manual

This user manual refers to special features of DM42.

Look at the following documentation for description of basic calculator functionality:

SwissMicros calculators forum for discussion and help:


Many thanks to Godwin also known as grsbanks in SwissMicros Forum for extensive contribution to DM42 project. Especially for his fearless testing, proofreading of this manual, fruitful ideas, forum moderation and top-notch release posts.

2. General Information

2.1. Specifications

Specification Details

Construction

Case made from stainless steel, matte black Physical Vapour Deposition (PVD) coated and laser engraved

Software

Open Source Free42 running on SwissMicros Operating System (DMCP)

Floating point standard

IEEE 754-2008, 128-bit floating point precision implementation with 128-bit transcendental function support

ISO conformity

ISO/IEC TR 24732

Processor

Ultra low power ARM Cortex-M4F 80 MHz

Flash memory

32 MBit external flash

Display type

Monochromatic ultra high contrast (14:1) transflective memory LCD display

Display resolution

400 × 240 pixels

Display active area

58.8 mm × 35.28 mm

Display dot pitch

147 µm × 147 µm

Connectivity (PC)

USB-Micro-B port, connects as USB mass storage device

Connectivity (IR)

IR Transmitter compatible with the original HP-82240A/B printer

Battery type

1 × CR2032 lithium coin cell, 3.0 volts[1]

Battery life

Up to 3 years

Sound

4 kHz resonance frequency Piezo-electric buzzer

Size

77 mm × 144 mm × 12 mm

Weight

180 g

Warranty

5 years

[1] The battery isn’t rechargeable. See Battery chapter below for battery replacement and further info.

2.2. CPU Speed

CPU speed is 24MHz when running on battery (due to limited battery current) and increases to 80MHz when the USB cable is connected.

2.3. IR Printing

Calculator contains IR output and can print on HP 82240B infrared printer.

2.4. Internal FAT disk

The calculator has 6MB of internal flash storage formatted as a FAT filesystem that is used for loading/saving programs and for backing up calculator state. It is accessible as USB disk when activated via the menu 'File > Activate USB Disk >'.

Internal flash has limited amount of write cycles. While the lifetime with ordinary usage could be dozens of years, an excessive number of writes will wear the flash memory much quicker.

In the worst case scenario, you would have to replace the flash chip, which is worth less than $1. If needed, SwissMicros will replace the chip at no cost, but shipping costs must be covered by the customer.

The datasheet mentions a minimum of 100,000 write cycles, which sounds like a lot, but any change in the filesystem means overwriting at least part of the file allocation table, which is stored in a static location.

Calculator comes with pre-filled FAT disk contents. In case the contents of the FAT area is lost it could be always downloaded from the SwissMicros DM42 FAT files page. There are the contents of individual directories accessible separately or the whole contents of FAT disk can be downloaded as single zip file DM42_FAT.zip.

There are several directories with special names on the FAT disk:

HELP

Contains help file(s) for built-in DM42 help that can be activated from main system soft menu by pressing F1 key (leftmost in top row of keys).

OFFIMG

Bitmap files from this directory are displayed when the calculator is turned off. See OFF Images chapter for more details.

PRINTS

Printing to a file creates output files (both text and images) in this directory.

PROGRAMS

Raw files with programs are loaded/saved from/to this directory.

SCREENS

Screenshots of calculator LCD are saved into this directory. See LCD Screenshots for more details.

STATE

Calculator state files with extension .f42 are stored in this directory. See chapters Load State or Save State how the load or save calculator state.

2.5. Battery

The calculator uses a single CR-2032 Lithium 3V battery. It is not rechargeable, therefore it has to be replaced when depleted.

Please remember it is always wise to make calculator data backup before battery replacement. Use USB power during data backup if possible.

You can power calculator from USB during battery replacement.

To change the battery:

  • remove the 2 screws on the upper rear of the case,

  • remove the back,

  • (optional) connect USB cable to prevent power loss

  • extract the old battery by gently pushing it out of the holder from the bottom towards the top of the case;

  • then insert the new battery with plus (+) side facing up (away from the board),

  • slide all the way down to the bottom of the holder,

  • then replace the back and screw-in the 2 original screws.

3. Calculator Extensions

3.1. Virtual variables

Managing some of the new features specific to the DM42 is something that spurred a lot of discussion. Initially we wanted to re-purpose some of the so-called "reserved" flags of the HP-42S but it soon became apparent that others had already done so in various patches for Free42, and we wanted to avoid trampling on anybody’s toes with our own patches for Free42.

The next idea was to extend the number of flags available beyond 100 but obviously only have them accessible via indirect addressing as there was no question of patching Free42 to accept 3 digits in the various flag instructions. But then, how do we make integer values (and one real value) available to programs without assigning a whole block of flags that are going to be awkward to read?

After that we thought of using extended register numbers. They would either have to be assigned ridiculously high index numbers in order to avoid conflict if someone decided to go for a register array SIZE of 2000, or they would have to be assigned negative index numbers. We couldn’t use negative indexes because the HP-42S and Free42 just take the absolute value of the index and use that to access the correct register and some programs might rely on that.

We settled on the concept of "Virtual Variables". These are variables that do not (and cannot, for that matter) exist in the DM42’s variable table. Because of this, they are not listed in the variable menu when you press RCL or STO but there is a way to make them easy-ish to access, just read on…​

There are six such virtual variables:

"DevID"

Device ID (read-only) — RCL "DevID" returns the type of DM42 you’re using. There are currently two hardware models only identified by value 0 (zero) is returned by the DM42 units that we have. Other types of unit that may be produced in future will have different DevID values.

"GrMod"

Graphics Mode (read-write) — RCL "GrMod" retrieves the current graphics mode and STO "GrMod" sets the graphics mode to the number present in the X register. Graphics modes currently supported are:

  • 0 = standard HP-42S resolution 131x16

  • 1 = reserved for future use and maps to 0 on the DM42

  • 2 = DM42 full resolution 200x120

  • 3 = DM42 full resolution 400x240

"ResX" and "ResY"

X- and Y-resolution (read-only) — RCL "ResX" or RCL "ResY" recalls the current X-resolution or Y-resolution respectively into the X stack register. The values that you will get are 131, 200 or 400 for RCL "ResX" and 16, 120 or 240 for RCL "ResY" depending on the current graphics mode (0, 2 or 3).

"Vbat"

Battery voltage (read-only) — If you’re running off battery power then this will give you the voltage read at that precise moment in time. If you’re running on USB power then this will give you the last battery voltage that was recorded before connecting the USB cable. Note that the value retrieved here can and almost always will be different to the voltage displayed in the status bar. The latter is cached and almost always retrieved when the DM42 is idle. The voltage read from "Vbat" is the voltage read while you are using the keyboard and/or running a program. This can be useful for pausing lengthy processing if the battery voltage drops below a threshold and allowing it to recover before resuming.

"RefLCD"

The purpose of programs can vary significantly. There are programs like a stopwatch or games, where quick refreshing of the LCD is required. On the other end of the spectrum are pure computational programs, where no LCD output is required throughout program execution and where it is more beneficial to utilize all the CPU time for computation rather than wasting it on unnecessary LCD updates. The "RefLCD" virtual variable was introduced specifically to address those different requirements. It is possible to disable LCD refreshing altogether or to enable the periodic refresh of individual portions of the LCD.

3.1.1. RefLCD in more detail

It is possible to disable LCD refreshing altogether or to enable the periodic refresh of individual portions of the LCD. The value that you store in this variable is in fact a bitmask as per the table below. Items whose corresponding bit is cleared are not refreshed whereas those whose bit is set are refreshed with 200ms timeout after the LCD contents changes.

Bit Value Zone

0

1

Main area (stack/graphics)

1

2

Goose

2

4

Annunciators

In order to prevent any part of the LCD from refreshing and thus maximize performance, store the value 0 (zero) in "RefLCD". Storing 1 in the variable means that the main area will be updated with 200ms timeout (stack or the graphics display if that is what is active). 2 will allow the goose to fly and 4 will allow the annunciators (including the flag tiles) to be updated. To have more than one zone refreshed during program execution, store the sum of the bit value(s) in "RefLCD" as follows:

Value Binary Zone(s)

0

000

None (no refreshing occurs)

1

001

Main area

2

010

Goose

3

011

Main area and goose

4

100

Annunciators

5

101

Annunciators and main area

6

110

Annunciators and goose

7

111

Annunciators, goose and main area (everything)

You can, however, still refresh zones on an ad hoc basis even when they don’t normally refresh by storing the negative value of the bitmask value in "RefLCD". For example, to update the annunciators programatically "now", store -4 to "RefLCD".

One exception to this is the message area in which VIEW and AVIEW show their results. This is never disabled and is repainted with 200ms delay(if needed) even if zero is stored in "RefLCD". If the redraw response isn’t fast enough (e.g. for a stopwatch application, see below) then you can have the message area refreshed by program by storing the value -8 in "RefLCD". This program shows an example of how to use it:

00 { 49-Byte Prgm }
01▸LBL "STOPW"
02 TIME
03 →HR
04 STO 02
05 "RefLCD"
06 ASTO 03
07 CLX
08 STO IND 03 @ Disable refreshing
09 FIX 02
10▸LBL 00
11 TIME
12 →HR
13 RCL- 02
14 3600
15 ×
16 VIEW ST X
17 -8
18 STO IND 03 @ refresh the message area now
19 GTO 00

3.1.2. Accessing virtual variables

Attempting to STO a value in a read-only virtual variable has no effect, so it is not possible to create these variables in the variables table within Free42. Because of this it is a bit awkward to RCL and STO them directly. We recommend adding a reference to the virtual variables that you will need in your program in order to access the variables indirectly later on. Something like this:

"GrMod"
ASTO 10
"ResX"
ASTO 11
"ResY"
ASTO 12

Where needed you can then simply address the virtual variables this way:

3
STO IND 10
"Pixels on "
├"screen: "
RCL IND 11
RCLx IND 12
ARCL ST X
AVIEW
STOP

3.2. F-Buttons

The top row of keyboard consists of six unprinted buttons referenced as F-Buttons (F1-F6) or Soft-Menu Buttons. When no calculator menu is in action those buttons have following functions:

F1

Displays the Help. Note that the /HELP/index.htm file has to be present. The latest version can be downloaded from the DM42 help page.

F2

Toggle this system soft menu visibility.

F3

(not assigned)

F4

Increase buzzer volume

SHIFT-F4

Decrease buzzer volume

F5

Toggle stack alignment (Left, Right, Right Underlined)

SHIFT-F5

Toggle between sans and HP font

F6

Increase font size

SHIFT-F6

Decrease font size

3.3. Flag State Indicators

There is special 'Flags area' which indicates state of calculator flags 0-10.

Flag Indicators

3.4. PIXEL and AGRAPH

PIXEL and AGRAPH are not limited to the original HP-42S’s resolution of 131x16 pixels. The compatibility with negative values to display lines and with complex numbers and matrices is conserved. You can now use horizontal values of 1≤X≤200 and vertical values of 1≤Y≤120 in 200x120 mode, or 1≤X≤400 and 1≤Y≤240 in 400x240 mode. Switching between 131x16, 200x120 and 400x240 modes is achieved using the GrMod virtual variable and current graphics resolution could be probed by ResX and ResY.

3.5. Alpha Input Mode

Upon entering Alpha input mode you will see a new annunciator on the screen:

  • "[ ]" denotes original HP-42S input mode. This is the mode that Alpha input starts with when entered for the first time.

  • "[a]" denotes lower case DM42 input mode.

  • "[A]" denotes upper case DM42 input mode.

SHIFT followed by and allow you to cycle through the modes.

The DM42 remembers which mode you were in last time alpha input was active and upon entering alpha input modes switches immediately to that mode.

Original HP-42S mode
  • Function keys work as expected for standard characters.

  • ASTO (STO) and ARCL (RCL) work as expected.

  • "%", "pi" and "E" work as expected.

  • SHIFT SHOW works as expected.

  • Local labels LBL 01, LBL A and LBL a work as expected.

  • Global labels LBL "ABC", LBL "123" and LBL "A123" work as expected.

  • Un-shifted [R/S] works as expected and [SHIFT] [R/S] enters/leaves Prgm mode as expected.

Lower and upper case DM42 modes
  • The function keys still allow input in HP-42S mode.

  • All alpha keys A-Z give the expected characters.

  • SHIFT A to SHIFT O give the same characters.

  • SHIFT 0 (zero) to SHIFT 9 give the digits 0-9 instead of the alpha characters.

  • Shifted ÷, ×, - and + give '÷', '×', '-' and '+' instead of the alpha characters.

  • Shifted R/S gives '?' instead of entering/leaving Prgm mode.

  • ASTO, ARCL, '%', 'pi' and 'E' (exponent) are not available. Switch to standard HP-42S mode to get them.

  • SHIFT SHOW is not available. Use standard HP-42S mode.

  • Two-digit local labels LBL 01 are not available. Use standard HP-42S mode.

  • Local labels LBL A and LBL a and global labels LBL "ABC", LBL "123" and LBL "A123" work as expected.

  • Un-shifted R/S still behaves as usual allowing program execution to resume after inputting alpha data to a program.

  • Function arguments (eg. STO* "h") work as expected

SST/BST in alpha input mode

Press and hold the SHIFT key while pressing or in order to execute BST or SST respectively when in alpha input mode. As on the original HP-42S, BST will start auto-repeating after a while and SST will NULL after a couple of seconds if you press and hold or respectively.

Since DM42 3.10 in addition to default IR printing user can choose printing to file.

This functionality can be activated in Printing menu.

Two output formats are supported:

Graphics Print

Creates bitmap (.bmp) file with printed data in graphics.

Text Print

Creates text (.txt) file with printed data in UTF-8.

The output file /PRINTS/<time-stamp>.txt for text output and /PRINTS/<times-tamp>.bmp for graphics output is created just after the 'Text Print' or 'Graphics Print' (respectively) is activated in menu.

Disabling one of those options flushes appropriate buffer and finishes the file. Next activation of previously deactivated 'Text Print' or 'Graphics Print' creates new file with current time-stamp.

Printing buffers are allocated from available calculator memory just after the 'Text Print' or 'Graphics Print' is selected in menu. Error is displayed if not enough memory is available also no file is created and selected option isn’t activated.

There are two options for tweaking the print to file functionality:

Don’t print to IR

(affects both 'Text Print' and 'Graphics Print')
Disables printing to IR and printing delays.

Graphics in Text

(affects 'Text Print' only)
If enabled graphics prints appear as block graphics in text file using Unicode "Block Elements". Note that you need reasonably equipped font to display the graphics print correctly (which isn’t the default case for Windows users).

3.7. LCD Screenshots

Hold SHIFT and press DISP to get a screenshot.

You will find a .bmp file named according to the current time and date in the /SCREENS folder of the FAT drive.

3.8. OFF Images

The LCD display used in DM42 calculator behaves in similar way as e-ink displays and contents of the LCD is visible for a long time after the calculator is turned OFF.

This feature is used to display images when the calculator is turned OFF.

Single hard-coded OFF image is present in calculator firmware and this image is displayed whenever the calculator is turned OFF and FAT disk doesn’t contain any valid custom image or the FAT disk is in error state.

Custom OFF images should be stored in /OFFIMG/ directory. All valid images are then cyclically displayed one after each calculator OFF in the order how they appear in /OFFIMG/ directory.

OFF images require specific image format. It has to be .bmp file with dimensions 400 x 240 and 1 bit depth.

Examples of OFF images can be found on "A collection of off-screen images" page.

3.9. RTC correction

Note that to apply RTC correction you have to know (measure and calculate) ppm drift of calculator clock first.

Use following steps to apply clock frequency correction.

  1. Calculate correction factor C which best matches required ppm correction P

    C = 2^20 P /(10^6 + P)

    resulting value C has to be integer and -511 <= C <= 512.

  2. Create file /rtccalib.cfg in root directory of calculator FAT disk and write value C there.

  3. Once the RTC correction is active the ppm value is written in Setting menu at the end of "Set Time >" line.

It is possible to use approximate expressions between correction factor C and ppm value P (with reasonable precision):

C = 1.04858 P

P = 0.953674 C

4. Program Decoder/Encoder

Thanks to generous contribution of Godwin (known as grsbanks in forum) we can use web based program decoder and encoder for Free42 raw files - i.e. those files used for program import/export in DM42.

Thus you can prepare your DM42 program directly on PC and then download it to DM42 and import it there. As well as export programs written directly on DM42 and edit them on PC.

The program decoder/encoder is located at https://technical.swissmicros.com/dm42/decoder/. Follow this link and look into instructions tab for more details.

5. DM42 Menus

Menu navigation:

  • Select menu items using , keys.

  • Activate current menu item by pressing ENTER key or by pressing the number key corresponding to particular menu line.

  • Return to previous menu level by EXIT or key.

5.1. Main Setup menu

Main 'Setup menu' could be entered by pressing SHIFT+SETUP.

From there other sub-menus could be entered or about screen displayed

5.2. File menu

5.2.1. Load Program >

Used for loading the .raw programs stored in the /PROGRAMS/ directory of the flash storage.

It should display all .raw files from /PROGRAMS/ directory in alphabetical order.

To load program

  • Select the program to load using the and keys

  • ENTER to load the selected program

Loading info flashes for a second until the program is loaded into calculator memory.

Then the program list is displayed again. You can load next program or leave the menu by EXIT key.

5.2.2. Save Program >

Used for saving one or more program(s) from the calculator memory to a .raw file in the /PROGRAMS/ directory of the flash storage.

  • Select the program or programs to save, confirm with ENTER

  • Choose existing filename as target or type new target filename, confirm with ENTER

5.2.3. Activate USB Disk >

Used to copy files from/to a host computer - e.g. backup/restore the calculator state files from /STATE/ directory or read/write programs in RAW format into /PROGRAMS/ directory.

  • Connect the calculator to a computer using a USB cable

  • The DM42’s flash disk should be visible on the computer

  • Read/write files

  • 'Eject device' on the host machine.

  • Calculator should end USB disk mode automatically if correctly ejected by OS. You can end USB disk mode by pressing EXIT key on the calculator but be sure all data are flushed to disk first.

The last two points 'Eject device' and 'Press EXIT key on calculator' (if it doesn’t end automatically) are important to avoid unsaved data and possible FAT disk corruption!

5.2.4. Show Disk Info >

Displays disk status and disk block info.

5.3. Calculator State menu

The calculator reads last used state file after a hardware RESET (i.e. after pressing the [RESET] on the back of the calculator).

Reading of last stored calculator state file can be bypassed (eg. when the FAT disk is corrupted and the calculator hangs after a reset while reading the state file) by holding the - key and pressing the [RESET] button on the back of the calculator.

5.3.1. Load State

Displays list of available calculator state files (.f42 extension) from /STATE/ directory.

To load calculator state file:

  • Select particular file and press ENTER to load the state file.

  • Confirmation dialog appears and you have to acknowledge you want to abandon current calculator state.

If confirmed, calculator is restarted and selected calculator state file loaded.

5.3.2. Save State

Used for saving current calculator state to a .f42 file into the /STATE/ directory of the flash storage.

To save state file: - Select existing filename as target or type new target filename, confirm with ENTER - Confirmation dialog can appear if existing file is about to be overwritten

If confirmed, calculator state is saved and subsequently is the calculator restarted and the calculator state file reloaded.

5.3.3. Load Clean State

Restarts the calculator without reading the state file (same as [RESET] + -).

For functional details look at Printing to File.

5.4.1. Graphics Print

Selecting this menu item enables printing to graphics file.

5.4.2. Text Print

Selecting this menu item enables printing to text file.

5.4.3. Graphics in Text

Selecting this menu item enables to see graphics in text file.

5.4.4. Don’t print to IR

Selecting this menu item disables default printing to IR printer.

5.4.5. Double Newline

Place one more newline after each printed line. This option applies only for printing to IR printer.

5.5. Settings menu

5.5.1. Set Time >

Used for setting the time.

  • Use the function keys to adjust the time.

  • Press ENTER to write the new time to the calculator clock or EXIT to cancel your changes.

5.5.2. Set Date >

Used for setting the date.

  • Use the function keys to adjust the date.

  • Press ENTER to write the new date to the calculator clock or EXIT to cancel your changes.

  • Σ+ could be used to change between DMY/MDY formats.

5.5.3. Status Bar >

Displays filed selector for what should be displayed in calculator top status bar:

Status Bar menu
1. State Filename
2. Day of Week
3. Date
4. Date Separator
5. Month Shortcut
6. Time
7. Power Voltage in Header

Fields are always displayed in order how they appear in this menu.

5.5.4. Stack Font Sizes >

Enters font size configuration for stack registers:

Stack Font Sizes menu
1. Font Size Offset Reg X: 0
2. Font Size Offset Reg Y: 0
3. Font Size Offset Reg Z: 0
4. Font Size Offset Reg T: 0
5. Font Size Offset Reg L: 0
6. Font Size Offset Reg A: 0

For each register a font offset in range -5 .. 5 could be specified. Each font offset is relative to current font size set by F6 / SHIFT+F6 keys.

Example:
Lets expect there are five font sizes 1 to 5 and third font size is selected. If the "Font Size Offset Reg X" is set to 1 and other offsets remain zeroed, then the X register will be displayed in one step larger font then others.

Note that the if the maximal font size is reached the font remains at maximal size. So, setting all font offsets to 5 actually disables any effect of F6 / SHIFT+F6 keys.

5.5.5. Beep Mute

Selecting this menu item toggles the 'Beep Mute' flag.

When the 'Beep Mute' flag is active, no sounds are produced by the calculator.

Note that this value is stored in the calculator state file.

5.5.6. Slow Auto-repeat

Selecting this menu item toggles the 'Slow Auto-repeat' flag.

When the 'Slow Auto-repeat' flag is active auto-repeat delays are prolonged.

Note that this value is stored in the calculator state file.

5.5.7. Stack Layout

Enters stack layout selector where one of following layouts could be selected

Stack Layout menu
1. XYZTL
2. XYZTA
3. XYZT
4. XYL
5. XYA
6. XY

5.5.8. Dynamic Stack Extension

Selecting this menu item enables or disables the 'Big Stack' extension of Free42.

5.6. System menu

5.6.1. Flash firmware from FAT

Starts flashing of new firmware if the firmware file is stored in root directory of FAT disk. This is usually not necessary because calculator automatically detects presence of new firmware file and asks for update after end of USB disk mode.

See Firmware update chapter for more information about firmware update.

5.6.2. Bootloader

Activates bootloader mode for firmware flashing.

You can flash DM42 firmware once is the bootloader mode entered. See Firmware update chapter for more information about firmware update.

Press the RESET button on the back of the calculator if you activate Bootloader mode accidentally.

5.6.3. Program Info

Displays information about currently loaded DM42PGM. This is mainly for diagnostics.

5.6.4. Reset to DMCP menu

Reboots calculator back to DMCP system menu.

All unsaved data is lost.

5.6.5. Format FAT Disk >

Format the internal FAT disk storage.

All data is erased from disk.

5.6.6. FAT Disk Media Test >

Checks whole flash disk FAT area for bad blocks. Disk is formatted starting from first good block after the check.

All data is erased from disk.

5.6.7. Power OFF mode

This item is purely for power OFF testing purposes to avoid time consuming switching between firmwares. It is in no way mentioned to be changed by users.

  • Mode 0 means no deep sleep for QSPI giving approx. 12uA sleep current.

  • Mode 1 corresponds to pre 3.9 DMCP behavior.

  • Mode 2 corresponds to DMCP 3.9 and newer versions.

  • Mode 3 is the latest update to mode 2 which should fix possible deficiencies of mode 2 by adding further pull-ups.

Defaults:

hwid=0 : Mode 1
hwid=1 : Mode 3

Note that the "Power OFF mode" value is preserved during calculator RESET, but is lost when battery is removed.

5.6.8. Self Test

Displays production test menu where tests of various parts of calculator could be run from.

Self Test menu
1. KBD Test
2. LCD Test
3. IR Test
4. BEEP Test
5. Diagnostics

6. Firmware Update

Please remember it is always wise to make FAT disk backups periodically and especially before any update.
The latest firmware version is available at https://technical.swissmicros.com/dm42/firmware/

For quick update instructions, please follow Quick Update Guide.

DM42 has two firmware areas. First one is the main flash area which is updated with each firmware update, the second one is auxiliary QSPI area which is rarely updated and special update menu appears when the firmware needs new QSPI contents.

No action related to QSPI contents is needed until firmware requests QSPI update by showing DMCP System menu (or "QSPI Load" menu for firmware versions before 3.7).

Note that since version 3.7 the calculator operating system (called DMCP) is separated from the DM42 program. Thus, both DMCP and DM42 program could be loaded separately. For more details see Changes since v3.7 and Quick DMCP and PGM Update Guide for separate DMCP and PGM update procedure.

The preferred firmware update method is by copying firmware file to calculator FAT disk. This update method is available since DMCP version 3.5. See Quick Update Guide for update procedure.

Firmware update from FAT disk is implemented in main firmware, so it could be unavailable if the main firmware is corrupted. In such a case, another method of update based on internal CPU flashing routine should be used. This method requires the calculator to be switched in so called 'Bootloader mode'. Once activated, the internal bootloader exposes standard DFU interface and can be programmed by any DFU programming software.

Following sections cover the use of two programs able to use this DFU interface:

Availability of the particular update method on mainstream operating systems outlines following table:

FAT disk[1] dm_tool dfu-util[2]

Windows

Linux i686

Linux x86_64

macOS

[1] FAT disk update was made available starting with DMCP version 3.5; therefore, a calculator with an earlier firmware version must be updated with one of the other methods.

[2] macOS users can get dfu-util via Homebrew.

6.1. Changes since v3.7

Since version 3.7 the firmware for the calculator contains only operating system (called DMCP). DM42 program could be loaded separately as described in section "Program update".

Instructions for quick update of both DMCP firmware and program load are in "Quick Update Guide".

There is new DMCP User Manual future plan which should contain information about SDK and program development for DMCP platform. Before the manual becomes available here are some useful links related to DMCP development:

  • Source code for DM42PGM program: https://github.com/swissmicros/DM42PGM
    Follow instructions in README files for program building

  • Source code for base DMCP_SDK with simple "Hello World" program: https://github.com/swissmicros/DMCP_SDK
    Follow instructions in README files for program building

  • More enhanced SDK demo: https://github.com/swissmicros/SDKdemo.
    It is simple RPN style calculator with

    1. Power management

    2. LCD printing

    3. Keyboard handling

    4. Use of Intel® Decimal Floating-Point Math Library (which leads to project with data in QSPI flash)

    5. Menu system

    And as usually, follow instructions in README files for program building.

Developing programs for embedded systems requires some level of expertise and SwissMicros doesn’t have enough resources to make individual support for program building and SDK use.

6.2. Quick Update Guide (FAT disk update)

Here we will update DMCP system and DM42 program at once using combined flashing file.

Prerequisites

DMCP_flash_x.x_DM42-y.y.bin - Complete DM42 firmware file e.g. DMCP_flash_3.10_DM42-3.10.bin

Steps

  1. Activate USB disk from SETUP → File → Activate USB Disk or alternatively from DMCP System menu.

  2. Connect USB cable from DM42 to PC/Mac computer.

  3. Copy the DMCP_flash_x.x_DM42-y.y.bin file from the PC/Mac computer to root folder of calculator disk.

  4. Eject (safely remove) the calculator disk from PC/Mac computer. Please, be patient this can take some time. Do not unplug the cable, even after the calculator’s USB disk has been successfully ejected by the OS, as USB power is required for the rest of the procedure.

  5. If calculator does not detect OS ejection, shut down USB connection by pressing C. New firmware file is detected and the calculator prompts for update. Confirm it immediately with ENTER or cancel by pressing EXIT to activate flashing process later using Flash firmware from FAT either from DM42 program SETUP → System or directly from DMCP System menu Enter System Menu.

  6. Flash progress is displayed from 0 to 100%. An automatic verification pass follows.

  7. Once finished, the calculator resets and should restart to updated DM42.

Any State which hasn’t been saved to a Statefile prior to updating is lost.

6.3. DMCP and PGM Update Guide

Since version 3.7

Here we will update DMCP system and DM42 program separately, therefore we need two files for that:

Prerequisites

DMCP_flash_x.x.bin - DMCP system file, e.g. DMCP_flash_3.10.bin
DM42-x.x.pgm - DM42 program file, e.g. DM42-3.10.pgm

Steps

  1. Activate USB disk from DM42 program SETUP → File → Activate USB Disk or directly from DMCP System menu.

  2. Connect USB cable from DM42 to PC/Mac computer.

  3. Copy both DMCP_flash_x.x.bin and DM42-x.x.pgm files from the PC/Mac computer to root folder of calculator disk.

  4. Eject (safely remove) the calculator disk from PC/Mac computer. Please, be patient this can take some time. Don’t unplug USB cable until safely ejected from OS.

  5. Calculator detects presence of new firmware file and asks for update. You can confirm it immediately or press EXIT key and activate flashing process later using "Flash firmware from FAT" either from DM42 program SETUP → System or directly from DMCP System menu Enter System Menu

  6. Once finished the calculator resets and displays the DMCP System menu.

  7. Choose "Load Program" and select appropriate DM42-x.x.pgm file, loading process should start

  8. Once loaded the system should (after key press) restart to DM42 program.

6.4. Program Loading/Update

Since version 3.7

Use this if you want to switch between programs or load new program to already loaded DMCP system.

DMCP system can have one loaded program and only loaded program can be started. Programs have .pgm extension and are expected to be stored in root folder of calculator disk.

Prerequisites

Program file with .pgm extension, e.g. DM42-3.10.pgm, SDKdemo-1.0.pgm, etc.

Steps

  1. Activate USB disk from DM42 program SETUP → File → Activate USB Disk or directly from DMCP System menu.

  2. Connect USB cable from DM42 to PC/Mac computer.

  3. Copy the program file to root folder of calculator disk.

  4. Eject (safely remove) the calculator disk from PC/Mac computer. Please, be patient this can take some time. Don’t unplug USB cable until safely ejected from OS.

  5. Issue "Load Program" from DMCP System menu. This menu can be reached from DM42 program at SETUP → System → Enter System Menu→Reset to DMCP menu.

  6. Program list from root folder of FAT disk is displayed. Choose required program, press ENTER. After confirmation question the loading process should start.

  7. Once loaded the system should (after key press) restart to loaded program.

If anything goes wrong, like the current DMCP system is older than program requires, the restart ends in Program Info screen which should show reason why program cannot start.

6.5. DMCP Update Guide

Here we will update DMCP system only. Note that this will end just in DMCP menu and you will need to load some program to get some real functionality.

Prerequisites

DMCP_flash_x.x.bin - DMCP system file, e.g. DMCP_flash_3.10.bin

Steps

  1. Activate USB disk from DM42 program SETUP → File → Activate USB Disk or directly from DMCP System menu.

  2. Connect USB cable from DM42 to PC/Mac computer.

  3. Copy the DMCP_flash_x.x.bin file from the PC/Mac computer to root folder of calculator disk.

  4. Eject (safely remove) the calculator disk from PC/Mac computer. Please, be patient this can take some time. Don’t unplug USB cable until safely ejected from OS.

  5. Calculator detects presence of new firmware file and asks for update. You can confirm it immediately or press EXIT key and activate flashing process later using Flash firmware from FAT either from DM42 program SETUP → System or directly from DMCP System menu Enter System Menu

  6. Once finished the calculator resets and should restart to DMCP menu.

6.6. Bootloader mode activation

Bootloader mode can be activated from main Setup menu: SETUP → System → Bootloader or by using RESET and PGM button.

The sequence of entering bootloader mode using RESET and PGM button is:

  • Press and hold PGM button

  • Press and release the RESET button

  • Release the PGM button

Older models have both buttons accessible through the holes in the calculator backplate.

Newer models have one hole in the backplate for RESET button only, therefore the backplate should be removed first, then use the RESET and PGM buttons directly on PCB.

6.7. FW Update Using dm_tool

The latest version of dm_tool can be downloaded from the Tools web page.

6.7.1. Prerequisites for Windows

6.7.2. Prerequisites for Linux

USB device access rights: this configuration is optional.

Allow access to the DFU device for users in plugdev group by running as root:

cd /etc/udev/rules.d/
cat << OI > 49-stm32-dfuse.rules
# This is udev rules file (place in /etc/udev/rules.d)
# Makes STM32 DfuSe device accessible to the "plugdev" group

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="664", GROUP="plugdev"
OI
udevadm control --reload-rules

Then add users to plugdev group.

6.7.3. Launching dm_tool

Switch the calculator to bootloader mode

From menu or by RESET+PGM buttons (see Bootloader mode activation).

Connect the calculator to the PC

Be sure the libusb driver is installed if used in Windows (http://technical.swissmicros.com/doc/libusb_install/libusb_install.html).

Launch dm_tool

It can be launched by clicking on the exe file or from command line with firmware filename as argument.

If everything works well and the calculator was connected before launching dm_tool, then the message on the right side of [Program] button should show device number. If it shows "No DFU capable devices found (Click to refresh)" try to click at the message and it should display the ID of connected device after refresh and

Memory layout:
    0x8000000-0x80fffff:  size 1024kB = 512*2kB pages

in the text area.

If the message "No DFU capable devices found" still remains there something is wrong with libusb driver installation or connection to the calculator or the calculator isn’t in bootloader mode.

Finally press the [Program] button to flash new firmware. When the update is completed, you can close dm_tool, then Press [ON] to launch the new f/w.

6.8. FW Update Using dfu-util

macOS users can get dfu-util via Homebrew
Linux users (and possibly macOS users too) can avoid sudo use by setting appropriate user rights for DFU interface, see user rights configuration for Linux.

Note that dfu-util is command line utility launched from a terminal application and controlled by commands from the console. For new users, here are some tutorials on how to use command-line interfaces:

Proceed with the following steps:

Switch the calculator to bootloader mode

From menu or by RESET+PGM buttons (see Bootloader mode activation).

Connect the calculator to the computer

List information about connected DFU device using console command sudo dfu-util -l

Sample output of this command (from macOS)

$ sudo dfu-util -l
Password:
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Deducing device DFU version from functional descriptor length
Found Runtime: [05ac:828b] ver=0149, devnum=6, cfg=1, intf=3, path="29-1.8.1.3", alt=0, name="UNKNOWN", serial="UNKNOWN"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="20-4", alt=2, name="@OTP Memory /0x1FFF7000/01*0001Ke", serial="207B35994E34"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="20-4", alt=1, name="@Option Bytes  /0x1FFF7800/01*040 e/0x1FFFF800/01*040 e", serial="207B35994E34"
Found DFU: [0483:df11] ver=2200, devnum=14, cfg=1, intf=0, path="20-4", alt=0, name="@Internal Flash  /0x08000000/512*0002Kg", serial="207B35994E34"

Where lines Found DFU: [0483:df11] indicate that calculator is correctly connected to the computer and switched into bootloader mode.

Prepare firmware file

Download the latest firmware file from https://technical.swissmicros.com/dm42/firmware/ and ensure it is accessible from current directory in console e.g. by ls -l DMCP_flash_3.10_DM42-3.10.bin.

Alternatively, download firmware file directly to current directory using command (edit to use correct firmware file name according to before-mentioned page)

curl -O https://technical.swissmicros.com/dm42/firmware/DMCP_flash_3.10_DM42-3.10.bin
Launch dfu-util command

Start flashing using command (edit to use correct firmware file name)

sudo dfu-util -D DMCP_flash_3.10_DM42-3.10.bin -d 0483:df11 -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x8000000

Please, be patient, as the operation takes some time (up to a few minutes).

Press RESET button after dfu-util finishes the flashing.

Example output of dfu-util

$ dfu-util -D DMCP_flash_3.10_DM42-3.10.bin -d 0483:df11 -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x8000000
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting # 0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 756288
Download	[=========================] 100%       756288 bytes
Download done.
File downloaded successfully

real	1m55.929s
user	0m0.044s
sys	0m0.048s

6.9. QSPI flashing

No action related to QSPI contents is needed until firmware requests QSPI update by showing DMCP System menu or "QSPI Load" menu for versions before 3.7.
Latest QSPI flash contents could be found at https://technical.swissmicros.com/dm42/firmware/qspi_data/.

If you are looking for quick QSPI update instructions you most probably want to follow Flashing QSPI from FAT disk instructions.

6.9.1. General information

While the contents of main flash changes with each firmware version. The QSPI contents is usually preserved and it will be explicitly noted in release notes when the QSPI contents changes.

Moreover, DMCP system makes checksum of expected QSPI contents after RESET before launching loaded program. If this check fails the DMCP system doesn’t allow to start the program and writes information about missing QSPI data. Then you can use DMCP System Menu for both copying the QSPI data file to calculator as well to install this file.

Obsolete: Firware versions from 2.10.13 to 3.7 contain built-in QSPI loader which is activated when QSPI data doesn’t match.

The prefered option for QSPI update is to use "QSPI Load" menu to copy firmware to the calculator filesystem and flash the QSPI contents from the file.

User can also switch the calculator into bootloader mode and then use dfu-util or dm_tool (obsolete) described below.

6.9.2. Flashing QSPI from FAT disk

Here we will update QSPI flash contents. We expect here calculator in DMCP menu. Which is the place where calculator stops if you need to update QSPI flash contents.

Prerequisites

DM42_qspi_x.x.bin - QSPI data file, e.g. DM42_qspi_3.x.bin

Steps

  1. We expect the calculator in DMCP menu.

  2. Activate USB disk from DMCP menu "Activate USB Disk"

  3. Connect USB cable from DM42 to PC/Mac computer.

  4. Copy the DMCP_flash_x.x.bin file from the PC/Mac computer to root folder of calculator disk.

  5. Eject (safely remove) the calculator disk from PC/Mac computer. Please, be patient this can take some time. Don’t unplug USB cable until safely ejected from OS.

  6. Start QSPI update from DMCP menu "Load QSPI from FAT"

  7. After successful updating the QSPI data file is removed from calculator disk

6.9.3. Flashing QSPI using dm_tool (obsolete)

Note that this method is obsolete and will be removed.

The dm_tool takes care about QSPI loader itself. Thus flashing new QSPI contents is as easy as flashing QSPI and ordinary flash contents in a row:

  1. Flash DM42_qspi_xxx.bin

  2. Flash DM42_flash_xxx.bin

The second step is important as the ordinary firmware is replaced by QSPI loader in first step.

See Launching dm_tool for details about flashing using dm_tool.

6.9.4. Flashing QSPI using dfu-util

Download QSPI loader firmware DMflash.bin

Get DMflash.bin from the URL http://technical.swissmicros.com/tools/DMflash-2.3.bin.

Switch the calculator into bootloader mode

From menu or by RESET+PGM buttons (see Bootloader mode activation).

Flash QSPI bootloader

dfu-util -D DMflash.bin -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x8000000

Press RESET button after dfu-util finishes the flashing.

Flash QSPI contents

dfu-util -D DM42_qspi_2.10.12.bin -a "@QSPI Flash   /0x90000000/512*04Kg" -s 0x90000000

Press F6 (top right key) to switch the calculator back to bootloader mode.

Flash main firmware

dfu-util -D DM42_flash_2.10.12.bin -a "@Internal Flash  /0x08000000/512*0002Kg" -s 0x8000000

Press RESET button after dfu-util finishes the flashing.

Note that this step is important as the ordinary firmware is replaced by QSPI loader earlier.

6.10. DMCP System Menu

This is main menu of DMCP system (i.e. operating system of the calculator).

This menu is automatically displayed if DMCP system doesn’t contain any loaded program or starting of the program fails.

If there is valid program loaded into DMCP system it is automatically started after RESET and thus the DMCP menu isn’t displayed.

To force DMCP menu start you can use F1+[RESET] (i.e. upper left key + RESET button through the hole in calculator backplate).

DMCP System menu

6.10.1. Program Info

Displays information about program loaded into DMCP system.

6.10.2. Run Program

Starts currently loaded program.

6.10.3. Load Program

Displays selection dialog to choose among programs stored in FAT root directory. Loads selected program to DMCP system.

6.10.4. Load QSPI from FAT

Starts flashing of the QSPI firmware. The firmware DM42_qspi_xxx.bin or DMCP_qspi_xxx.bin is expected to be stored in the FAT filesystem root directory.

Note that some programs dont use QSPI firmware area (e.g. the DM41X). If Program Info displays QSPI NOT USED then the contents of the QSPI firmware area is irrelevant for proper run of the program.

6.10.5. Settings >

Time and Date settings.

6.10.6. Activate USB Disk

Used to copy files from/to a host computer.

  • Connect the calculator to a computer using a USB cable

  • The DM42’s flash disk should be visible on the computer

  • Read/write files

  • 'Eject device' on the host machine.

  • Calculator should end USB disk mode automatically if correctly ejected by OS. You can end USB disk mode by pressing EXIT key on the calculator but be sure all data are flushed to disk first.

The last two points 'Eject device' and 'Press EXIT key on calculator' (if it doesn’t end automatically) are important to avoid unsaved data and possible FAT disk corruption!

6.10.7. Enter System Menu

Jumps to the main System menu

6.10.8. About

Displays general information about DMCP system

6.11. QSPI Load menu

Obsolete, valid for versions before 3.7

This menu is displayed only when the calculator detects invalid contents of QSPI firmware area.

QSPI Load menu

6.11.1. Bootloader

Activates bootloader mode for firmware flashing.

Press the RESET button on the back of the calculator if you activate Bootloader mode accidentally.

6.11.2. Load QSPI from FAT

Starts flashing of the QSPI firmware. The firmware DM42_qspi_xxx.bin is expected to be stored in the FAT filesystem root directory.

6.11.3. Activate USB Disk >

Used to copy files from/to a host computer.

  • Connect the calculator to a computer using a USB cable

  • The DM42’s flash disk should be visible on the computer

  • Read/write files

  • 'Eject device' on the host machine.

  • Calculator should end USB disk mode automatically if correctly ejected by OS. You can end USB disk mode by pressing EXIT key on the calculator but be sure all data are flushed to disk first.

The last two points 'Eject device' and 'Press EXIT key on calculator' (if it doesn’t end automatically) are important to avoid unsaved data and possible FAT disk corruption!

6.11.4. Format FAT Disk >

Format the internal FAT disk storage. All data is erased.

6.11.5. FAT Disk Media Test >

Checks whole flash disk FAT area for bad blocks. Disk is formatted starting from first good block after the check.

All data is erased from disk.

6.11.6. Show Disk Info >

Displays disk status and disk block info.

DM42