In my last projects, I always use the same CPU. DSETA board, I say in the posts. Well, here it is, a CPU based on the AT89C51RE2 microcontroller from Atmel. I develop this board for some reasons. The first and main one is because I want to have a small board with a great (an known) 8-bit microcontroller, ready to use and with many of the peripherals I usually use. The other reason is that I want to test the PCB service from Seeedstudio, a PCB manufacturer from Shenzhen, China. Here are the results.
- The Hardware
The schematics of this board can be found here: DSETA CPU Scheme. There’re many pages in the design: I like to divide schematics in functional blocks, and I usually use one (or more) pages to each block, independently of the number of components. Here’s a brief description of each block:
Power Supply. Based on the MC33269DT low dropout voltage regulator. Output is fixed to 3.3V, and with 1.0V dropout, is perfect for a 5V input from USB port. This input voltage can be find in the output connector. This allows power other boards with these 5V or power this board with an external +5V and don’t use the USB port. A green led (D1) indicates the board is powered.
Microcontroller: AT89C51RE2, from Atmel. The core of the board. I select this device for some reasons. Mainly, because I work with this family some time ago, and I’ve a great experience with this chips. I know the internal architecture (it’s an improved 8051 core), and I’ve experience with the Keil C51 compiler. This device has many features: It’s compatible with the 8051architecture, ISP that allows programming in circuit using standard VCC, and a high speed architecture: it can run up to 60MHz. Flash memory is up to 128 KB, and it has a 8KB expanded RAM. The rest of the features can be found in the datasheet. Here in Spain, you can find this chip for less than 4€.
USB-Serial bridge. Based on the TUSB3410 chip, from Texas Instruments. I’ve been using for 6 years, and it works fine, I’ve never had any problem with it. The schematic is based on the application note from Texas. To work with this device, you need the driver for PC, to use it as a virtual port. The connector is a B-type, much easy to populate by hand that a micro-USB one.
Human Interface (Switchs, Pushbuttons, led’s and buzzer). This peripherals are very usefull to fast debugging, and allows direct inputs and outputs to the microcontroller. The buzzer is from eBay, is similar to this one.
I/O connectors, that allows connect other boards or peripherals. These connectors has the +5V and the +3V3 power lines, direct I/O’s (+3V3 levels) and two analog inputs.
Auto ISP. This feature allows to program the microcontroller over the serial port automatically. In this way, the software to program the microcontroller (FLIP), manages both RESET and PSEN signals to force the programming mode. Also, you can enter in this mode manually, using the SW3 and SW4 pushbuttons (RESET and PSEN signals). To do this, you must follow the following steps:
- Press the RESET button.
- Maintains RESET button pressed and press PSEN button.
- Release RESET button, while PSEN button is still pressed.
- Finally, release PSEN button.
External I2C Bus (powered at +5V). Allows to connect external devices powered at +5V to this bus. This bus is isolated through the ADUM1250 isolator, to protect it on the microcontroller side. Also, it’s used as a level translator, from +3V3 to +5V. Notice that this bus is implemented by software. For example, here Iconnect the MCP23017 breakout board.
Internal I2C Bus (powered at +3V3). This bus (again implemented by software), has most ot the peripherals that I usually use. The RTC is the M41T00S, from ST Microelectronics, and includes a CR1220 baterry to keep it in date. The signal ‘RTC_INT’ can be used to calibrating the clock. A serial EEPROM is included in the bus. I usually use the 24LCxxx series from Microchip. You can populate the 24LC256, 24LC512 or 24LC1026 (32KB, 64 KB or 128KB). In the case of the last one, be sure that pin 1 is not connected to the board, as indicated in the datasheet. The other two components in the bus are two 8-bit analog to digital converters over I2C. The models I use are the ADC081C021 and the ADC081C027, from Texas Instruments. Basically, the two converters are identical, but the ADC0810C027 has a pin to set the address, wich allows connect some of these converters in the same bus. And finally, I let an external connector to expand this bus over the board. In the scheme, you can find all the address of the different devices, both in read and write access.
Temperature sensor. The sensor I use is the DS18B20, from Maxim. It has a programmable resolution between 9 to 12 bits. The communication with the CPU is over the 1-wire protocol, so you only need one pin to communicate with it. The microcontroller must implement, by software, this protocol.
- The PCB Design
I try to fit the design in a 5cm x 5cm board, because this size is the cheaper option at Seeedstudio. Also, I follow the PCB specifications from Dangerous Prototypes, in order to use the DP5050 case also available at Seeedstudio. Another thing that I’ve got in mind is that I’ll mount the board by hand, so size components and distances must be enough to allow the manual mounting. The board is designed using Protel 2.71 and Protel 99SE to generate all the documentation, including gerber files and topographic schemes to placing the components.
- Manufacturing and mounting the board
Once I’ve the gerber files, I uploaded to the Seeed Studio PCB Fusion. I check the 100% E-test ($10, now i’ts free!) because the board is complex to test it manually one by one. The online service works well, indicating in each moment the status oh the process. Here’s a resume of the dates:
After paying the service, in eight days the board is manufactured, tested and shipped with track number. Four weeks later, the board arrives in a perfect condition, including one extra board :-). Here’re a couple of photos, ready to mounting:
Mounting the board is a delicate process. The more difficult part is select the order of components to mount it. First, I mount the passive ones, later the integrated circuits and finally the big parts, including the connectors, switches and the buzzer. Here’s the board finished, ready to use and show if works:
Top Layer – Full View
Top Layer – Detail
Bottom Layer – Full View
Bottom Layer – Detail
DP5050 case detail (from Dangerousprototypes)
- Testing the board and improvements
I write some test code in C, for the Keil C51 compiler. Here you can download the full project, including the pinout definitions and the hex file ready to burn in the microcontroller. I also use a MCP23017 breakout board with a 2×16 LCD for a fast debugging. In this process, I notice three design flaws:
- The DS18B20 footprint is incorrect, the top and bottom views are changed. So for the sensor works, it must be mounted on the bottom layer or in the top, but horizontally flipped.
- The Y3 footprint is so close to the J6 connector, so the crystal can’t be mounted in horizontal position.
- If you use the auto-ISP circuit, using the 74LVC125A buffer, the circuit works fine with both OCD port or UART0. But, if you try to sue UART0 in your program as a communication port, you can’t use it with the USB interface. I think this happens because when you use this interface (with a virtual port in the PC), the RTS holds high, so the RESET signal are in a high level and the microcontroller is permanently reset. To avoid this situation, there-re two options:
- Do not use the UART0 with the USB port in the application, and mantain the auto-ISP feature 🙁
- Remove the buffer, to allow communication between the UART0 and the USB converter. This works OK, but you lost the ability of the auto-ISP programming, In this case, you should use the RESET and PSEN pushbuttons (SW3 and SW4) to force manually the program mode.