# Digirule 2U FAQs 30 April 2022 ## Introduction This document contains answers to questions that have either been asked previously or are quite likely to be asked in the future. Links to specific sections of the online versions of the User Manuals are provided where they are deemed appropriate. This is by no means an exhaustive list and new FAQs will be added when and if required. ## FAQs --- ### Battery :::warning **Question 1.1:** Why does my CR2032 battery keep falling out of my Digirule 2U? ::: :::success **Answer 1.1:** It is extremely important that you follow the [battery installation procedure](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Getting-Started) contained in the Digirule 2U User Manual to prevent damage to the battery holder retaining tab. ::: :::warning **Question 1.2:** What is the best way to *remove* the battery? ::: :::success **Answer 1.2:** Gently slide the spring-loaded metal retaining tab away from the battery until it just clears the top edge. The battery will then pop up due to the spring underneath it, allowing it to easily be removed. ::: --- ### Programming :::warning **Question 2.1:** Why do the [ADDLA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x11-ADDLA), [ADDRA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x12-ADDRA), [SUBLA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x13-SUBLA) and [SUBRA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x14-SUBRA) instructions sometimes produce the wrong result? ::: :::success **Answer 2.1:** In order to support multi-byte arithmetic, the [ADDLA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x11-ADDLA), [ADDRA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x12-ADDRA), [SUBLA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x13-SUBLA) and [SUBRA](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x14-SUBRA) instructions include the [Status Register C (carry) flag](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Status-Register) in their calculations. If you don't want that, you must ensure the C flag is clear prior to executing the instruction. This can be accomplished in several ways, including using [BCLR](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x23-BCLR) or many of the [COPYxx](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x04-COPYLA) instructions. ::: :::warning **Question 2.2:** Why does the information my program has written to the Address and/or Data LEDs registers not remain displayed after the program HALTs? ::: :::success **Answer 2.2:** When the Digirule 2U [HALT](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x00-HALT)s, it transitions from [Run Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Run-Mode) to [Stop Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Stop-Mode). Data you've written is displayed only while in [Run Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Run-Mode). In [Stop Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Stop-Mode), the Address LEDs display the Program Counter and the Data LEDs display the contents of RAM at the address in the Program Counter. If you want to effectively stop your program but keep the Digirule 2U in [Run Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Run-Mode), use a [JUMP](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x28-JUMP) * instruction instead, where * is the address of the [JUMP](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#0x28-JUMP) instruction itself. ::: :::warning **Question 2.3:** Do I need to be concerned about “switch contact bounce” when using the contents of the [Button Register](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Memory-Mapped-Registers) in my program? ::: :::success **Answer 2.3:** No. The button status information provided in the [Button Register](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Memory-Mapped-Registers) has already been debounced for you by the firmware. ::: :::warning **Question 2.4:** Why does my program stop when I haven't pressed the Stop button? ::: :::success **Answer 2.4:** There are several conditions that will cause the CPU to halt. See the list [here](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Running-and-Stopping-a-Program). ::: :::warning **Question 2.5:** When a BTSTSC or BTSTSS instruction "skips", does it skip one instruction or two? ::: :::success **Answer 2.5:** It skips two *memory locations*, i.e. the address in the program counter is advanced by two, regardless of how many instructions are stored in those locations. So you can skip two 1-byte instructions or one 2-byte instruction. If you want to skip a single 1-byte instruction, place a NOP instruction in the second location. If you want to skip more than two bytes of program code, use a CALL instruction to transfer control to a small subroutine. The same applies to the DECRJZ and INCRJZ instructions. ::: --- ### Communications :::warning **Question 3.1:** Why does my Digirule 2U show up as an “unknown device” in Device Manager? ::: :::success **Answer 3.1:** You need to download and install the FTDI VCP (Virtual COM Port) driver which can be found here: https://www.ftdichip.com/Drivers/VCP.htm ::: :::warning **Question 3.2:** What "flow control" / "local echo" / "terminal emulation" settings should I choose when configuring my computer's serial port to communicate with the Digirule 2U? ::: :::success **Answer 3.2:** The Digirule 2U does not support any form of flow control, so choose "None" if you have that option. The Digirule 2U Debug Monitor will automatically echo characters you type when appropriate to do so, so disable local echo in your software to avoid duplication of characters on your screen. The Digirule 2U Debug Monitor uses only basic TTY control characters that should be interpreted identically by all terminal types, so the choice is arbitrary. ::: :::warning **Question 3.3:** I’ve configured the serial port baud rate (etc.) in Device Manager but I still can’t talk to the Digirule 2U from the command line. But after running my terminal emulation program, the command line then works. Why? ::: :::success **Answer 3.3:** After opening your *Command Prompt* window, use the *mode* command to configure the serial port: ``` mode COMxx baud=9600 data=8 parity=n stop=1 ``` ::: :::warning **Question 3.4:** Can the comm port on the Digirule 2U be configured to use a different baud rate? ::: :::success **Answer 3.4:** No. The baud rate is fixed at 9600. ::: :::warning **Question 3.5:** How do I send a hex file to the Digirule 2U under Linux/Mac/Windows? ::: :::success **Answer 3.5:** First, prepare your Digirule 2U to receive the file. Refer to the [Modes of Operation](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Modes-of-Operation) section of the *Digirule 2U User Manual* for instructions on placing it into [Comm Load Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Comm-Load-Mode). Then, send the file using one of the following methods. > Perhaps the easiest method is to use a terminal emulation program, such as [CoolTerm](https://freeware.the-meiers.org/). Use your program's "send file" or "upload file" function to select a file and send it to the appropriate device. > If you're using the command line on Linux, first use the *stty* command to configure your serial port, then use the *cat* command and redirect the output to the appropriate device. ``` stty -F /dev/ttyxxx 9600 cs8 -parenb -cstopb cat your_hex_file > /dev/ttyxxx ``` If you're using the command line on Mac, use the [*dldr2*](https://hackmd.io/-8lZR2n1R0CShyK9jtXFXg) utility to copy the file to the appropriate device. ``` dldr2 < your_hex_file /dev/ttyxxx ``` If you're using the command line on Windows, first use the *mode* command to configure your serial port, then use the *copy* command to copy the file to the appropriate device. ``` mode COMxx baud=9600 data=8 parity=n stop=1 copy your_hex_file COMxx ``` These examples are not exhaustive. Please refer to your terminal emulation program or operating system documentation for more information. ::: :::warning **Question 3.6:** Why did the Digirule 2U not load into RAM the hex program data I just sent to it? ::: :::success **Answer 3.6:** The Digirule 2U must be in [Comm Load Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Comm-Load-Mode) (as indicated by a blinking D7 "listening" LED) in order to receive hex program data. Please refer to the [Modes of Operation](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Modes-of-Operation) section in the *Digirule 2U User Manual* for instructions on setting the mode. ::: :::warning **Question 3.7:** Why is there no "download utility" for Linux or Windows like the one you provided for Mac? ::: :::success **Answer 3.7:** The purpose of the [*dldr2*](https://hackmd.io/-8lZR2n1R0CShyK9jtXFXg) "download utility" is to work around a problem configuring the serial port that is unique to the Mac command line. On Linux and Windows the standard command line utilities provided by the operating system suffice, so there is no need for a dedicated utility on those systems. ::: :::warning **Question 3.8:** How can I save the current contents of RAM to a file on my PC? ::: :::success **Answer 3.8:** Use your terminal emulation program's "receive file" or "download file" function. First prepare your program to receive the data, then put the Digirule 2U into [Comm Save Mode](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Comm-Save-Mode). ::: --- ### Firmware :::warning **Question 4.1:** How can I determine what version of (official) firmware is installed on my Digirule 2U? ::: :::success **Answer 4.1:** The Digirule 2U uses a build date to identify the firmware. The build date is shown at the top of the [Debug Monitor](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Using-the-Debug-Monitor) menu. ``` Digirule 2U Debug Monitor | 22 Sep 2020 ``` ::: :::warning **Question 4.2:** What is the difference between the firmware contained in the file posted on the [Digirule 2U GitHub Repository](https://github.com/bradsprojects/Digirule2U) and the firmware that came pre-loaded on the Digirule 2U? ::: :::success **Answer 4.2:** At this time, there is no difference. The firmware file is provided in case you want to restore the firmware on your Digirule 2U back to the factory default configuration. For example, you might want to do this after trying out experimental firmware, or to restore the original sample programs in the non-volatile memory files. In the future, you may be able to find on the website versions of firmware newer than what originally came with your Digirule 2U. ::: :::warning **Question 4.3:** Why do I receive this error when running [udr2](https://hackmd.io/lGnWbzQuT_m-NEFMFxpDDg#UDR2-Digirule-2U-Firmware-Updater-User-Manual) to update the firmware? ``` Erasing flash... FAILED! (read error) ``` ::: :::success **Answer 4.3:** The Digirule 2U must be in the proper mode (as indicated by the Run and Stop LEDs alternately blinking) prior to launching [udr2](https://hackmd.io/lGnWbzQuT_m-NEFMFxpDDg#UDR2-Digirule-2U-Firmware-Updater-User-Manual). Please follow the procedure in the *Digirule 2U User Manual* section entitled [Updating the Firmware](https://hackmd.io/B988CXtgQtqD5pjI3849jw?view#Updating-the-Firmware). ::: --- <center> <img "height=50" src="https://i.imgur.com/WSqeSrI.png"> </center>