\ deca.txt -- Decade Divider for the Arduino -- 160513rjn \ \ -----[OVERVIEW]----- This project uses an arduino pro mini board with a serial connection to implement a decade divider chain using the Arduino counter timers. The objective is to demonstrate the feasibility of duplicating the DECUS divider that was implemented on the SiLabs 300 chip. -----[DESCRIPTION]----- For now, this is a "feasibility" project, implementing a decade counter using a clock frequency of 16 MHz. Serial I/O capability is retained in the event that the standalone interpreter is needed to provide an on-line configuration capability. -----[ DEVELOPMENT ENVIRONMENT ]----- An Arduino pro mini board with a serial interface plugged into a custom breadboard. -----[ HARDWARE ]----- 1. Arduino Pro Mini board directly interfaced to a USB to serial adapter such as an Adafruit FTDI Friend. 2. An oscilloscope and the display itself is used to checkout I/O pins. -----[ SOFTWARE ]----- 1. myforth-arduino system, downloaded from github, is the basis for the code. Extensions are in the application code. 2. See init.fs for pin configuration, job.fs for application load file. -----[ DOCUMENTATION ]----- For now, this is the project documentation. Nano Modification Procedure --------------------------- 1. Verify that the nano is working (e.g., with the check application). DO NOT INSTALL ANY STAKE PINS ON THE BOARD EXCEPT THOSE FOR THE PROGRAMMER INTERFACE (a 2x6 group on the end of the board). 2. BEFORE REMOVING THE CRYSTAL, program the nano for an external clock. Use the "xclock" shell script in the DUDE directory to program the nano to use an external clock (e.g., "sudo xclock"). The fuse read should come back with ?? on all of the fuses. This is because the chip needs a clock for the programer to work. If set for an external clock, there will be none for the programmer. 3. Prepare to install a stake pin in the empty hole on the corner of the chip near the 2x6 programmer connector and on the same side of the board as the crystal. With the board components facing up and viewing the board from the programming connector end, the empty stake pin hole is to the right of the programming connector. 4. Once the target hole is located, you will be installing a stake pin in the hole and epoxying it to the top of the board. The epoxy is to prevent the stake pin from pushing up when the modified nano is inserted into a solderless breadboard. 5. To hold the stake pin in place and in alignment, use a small strip of three stake pins. Two of the pins will be soldered to the board and the third pin will peek up through the end hole. 6. It is best to have the stake pin used in the hole to be longer than the standard stake pins. You can insert a longer stake pin in the carrier board by pushing the small end of the stake pin down on a hard surface (e.g., steel vice). The pin will resist at first but will enventually slide until it is flush with the carrier strip. Finish removing the pin by holding the carrier strip in a vice and pulling the pin out with the needle-nose pliers. The pin should come out easily if pulled straight up. Once the stake pin is removed, a longer pin in the carrier board by pushing it in with needle-nose pliers. The stake pin should protrude the same amount as the other two pins on the carrier strip and should protrude on the hole end by at least as much (extra length is good). 7. The prepared 3-pin group can be held in place for soldering and epoxying by temporarily inserting them into the end of a terminal breakout board. Insert two pins in the two socket pins at the end of the breakout board with the extra long third pin hanging loose over the socket end. 8. Place the board on the socket so that the hanging pin peeks through the hole on the end and the other two pins are peek through solder holes on the nano board. The two nano pins should be labeled something like "TX1" and "RX0" on the board. To keep the board stable and ensure that the three pins are level, place a 1x15 row of stake pins on the opposite board edge. This edge should have pin labels ranging from "vin" to "D13"). Once everything is in place, solder the two pins at TX1 and RX0 and also solder all the pins on the opposite side of the board. Make sure the board is installed tight against the stake pin carriers. To help maintain everything flat, you can install the remaining pins on the "extra pin" side of the board (i.e., a 1x13 stake pin strip). 9. Epoxy the corner stake pin to the top of the nano board with a small dab of epoxy. Make sure that the epoxy covers the entire base of the pin on the top side of the board but does not "ride up" too far on the stake pin. This isn't too critical, but there must be enough conducting area on the stake pin to wrap a few turns of wire wrap wire near its base, as described below. We recommend letting the epoxy set overnight. 10. Once the "extra" pin is epoxied firmly in place, remove the crystal assembly from the nano board by applying a heat gun with a small nozzle opening directly over the crystal. The crystal can be pulled off the board with tweezers (or just "flicked" off with a dental pick. 11. Once the crystal assembly is removed, there should be three SMD solder pads visible on the board near the processor chip. You will be soldering to the pad nearest the outside of the board that is connected to pin 7 of the chip. You can see the connecting trace under the solder mask if you use a high-power magnifier (e.g., a 30X loupe). 12. The external clock is wired on the board with a short wire-wrap jumper between the pin 7 solder pad and the extra stake pin epoxied to the corner of the board. Strip about 1/2" of wire from an 1 1/2 inch length of wire wrap wire and use a wire wrap tool to wrap it around the corner stake pin. This should leave about 3 turns of wire on the stake pin with some insulated wire also wrapped on the bottom of the pin. Solder the wrapped wire to the pin (do not depend on the wrap connection alone). 13. Position the free end of the wire near the crystal solder pad going to pin 7 of the chip and cut it to length. Strip a very short piece of insulation off of the end of the wire so that it just fits on the SMD pad. Tin the wire with some solder, being careful to not leave any excess solder on the wire. Hold the wire end on the top of the SMD pad with a small piece of painters' tape (you don't want to be holding the wire in place when soldering). Once the wire end is in place, briefly touch the soldering iron to the wire and pad, making sure that the wire and solder doesn't creep over and short to the adjacent pin (ground). 14. After inspecting the two solder joints with a magnifier and plenty of light, you can tack the jumper wire in place by placing a small dab of E6000 (or similar) glue to hold the wire down on the board. 15. The modification is now complete. Verify that all of the nano holes have stake pins soldered to them and then carefully remove the modified nano from the terminal socket and verify that it will insert and remove from a solderless breadboard (e.g., the "extra pin" inserts in correct alignment with all of the other pins. 16. At this point you have a nano board that requires an external clock to operate. Apply an external clock to the board between ground and the external clock pin that was just installed. The amplitude of the clock should be no more than 5 Volts and not dip below ground. The best way to ensure this is to furnish the external clock through a 5 Volt logic chip. We use a 328 chip wired to an external 10 MHz crystal and caps. The 328 "oscillator" chip has fuse options set to echo the system clock to port pin PB0. This buffered clock signal is perfect for driving the external clock input of DECA. 17. With an external clock applied to DECA, use the hardware programmer (e.g., usbtiny) to download the DECA program to the modified nano. Note that the hardware programmer will now work because it has an SPI clock from the modified nano. Once the DECA programming is complete, the 10 MHz clock input should be echoed to PB0 (labeled D8 on the nano). Programming a Raw Chip ---------------------- 1. Use the usbtiny programmer with a "d" file modified to use the slowest SPI clock (e.g., no "-Bx" parameter on avrdude command line). 2. Insert a raw chip into the STAR-TQFP32 programming adapter (STAR) and connect the usbtiny programmer, via the 10-pin cable. 3. Change to the deca directory (e.g., deca alias) and program the chip (e.g., sudo ./d). 4. Change to the dude directory (e.g., dude alias) for fuse programming. 5. Program the chip for an external clock (use xclock script). 6. Fuses should read: ===== lfuse write: 0xb0 ===== 160513/10:25:10 ===== read fuses ===== 160513/10:25:10 lfuse=?? hfuse=?? efuse=?? This is correct! After programming for an external clock, the programmer cannot function to read the fuses. ------------------------------------------------------------------------------ Revision History ------------------------------------------------------------------------------ Date By Comments ======= === ================================================================== 160513 rjn added raw chip programming procedure. 151229 rjn initial writeup.