Introduction: Cheap AVR/51 Development Board

I recently discovered STC microcontrollers produced by TSMC. Being curious about these microcontrollers I started looking for a development board for them.
After some searches on google / ebay / AliExpress / I decided to buy this PCB that I ordered on AliExpress at an affordable price of $ 10 / 2 pieces (In fact I reordered ten pieces of PCB in total and five complete kits for me and my team)

After analyzing circuit I realized that may be used for ATMEGA162, ATMEGA8515, AT89S51, AT89S52 besides STC8051 and that made ​​it interesting enough to continue.

Step 1: PCB

The PCB is very well made. and the component side is very good marked.

Although the markings on the PCB are self-explanatory I felt the need to have a circuit diagram of it (and some sort of user-manual).

Step 2: Schematics

I made circuit diagram in Kicad (In my opinion the best freeware software for drawing electronic diagrams and printed circuits boards).

For printing I recommend downloading the PDF file attached. Although it is in A3 format can be printed on A4 or Letter.

KIcad project files will be available after completion of the PCB design (will be posted as reference are not required for this Instructables, nor for the use of the development board). For this tutorial it is sufficient diagram in PDF format.

Step 3: Overview of Components

All components will be detailed in the following steps

Step 4: Resistors

We started installing the small components. This step is about resistors.

Step 5: Diodes and LEDs

Step 6: Capacitors and Transistors

Step 7: Small Connectors and Switches

Step 8: Last Components

Step 9: Completed Boards.


For programming ATMEL microcontrollers I used a programmer USBASP compatible and AVRDUDE .
Attention to the JTAG interface. If you want to use the entire PORTC must disable the JTAG interface. Anyway development board does not have JTAG connector.

For programming STC microcontrollers we do not need specialized programmer.
It only requires a serial cable if your computer has serial port. If not,  will work with a USB to Serial adapter (work with the cheaper and slower adapter found with $ 3 on ebay). But there is a catch: It is necessary to use a specific software for these microcontrollers.
I will not insist on programming STC microcontrollers because it is not the purpose of this intructable. Additional information (including data sheet in English) can be found on openhardware.ro

I will supplement with additional information as soon as possible

Step 10: With ARDUINO and ATMEGA162

Development board can be made ARDUINO compatible  if used with ATMEGA162 microcontroller.
(Note: This is not supported by the official Arduino libraries)

To use ARDUINO need to be made ​​the following changes:

1. In the <arduino>\hardware\arduino\avr\boards.txt file, add these lines:

##############################################################

atmega162.name= ATmega162

atmega162.upload.protocol=arduino
atmega162.upload.maximum_size=14336
atmega162.upload.speed=57600

atmega162.bootloader.low_fuses=0xFF
atmega162.bootloader.high_fuses=0xD8
atmega162.bootloader.extended_fuses=0xFB
atmega162.bootloader.path=optiboot
atmega162.bootloader.file=optiboot_atmega162.hex
atmega162.bootloader.unlock_bits=0x3F
atmega162.bootloader.lock_bits=0x0F

atmega162.build.mcu=atmega162
atmega162.build.f_cpu=16000000L
atmega162.build.core=arduino
atmega162.build.variant=atmega162

##############################################################

2. Make a folder
[<arduino>\hardware\arduino\avr\variants\atmega162\]
in this folder save file [pins_arduino.h]

3. We will overwrite the file iom162.h in folder
[<arduino>\hardware\tools\avr\avr\include\avr\] with the file attached here.

4.File [optiboot_atmega162.hex] will be saved to:
[<arduino>\hardware\arduino\avr\bootloaders\optiboot\]

Step 11: Arduino IDE

Arduino configuration is finished now.

I use the programmer USBASP bought for $ 3 on AliExpress.

I have not yet tested the bootloader because my USBASP programmer stay connected to the development board all the time. :)
It is necessary considering using almost all available processors for this board. And also not just use Arduino/Processing, but other programming languages ​​(C, ASM).

Step 12: With LCD16x2

Here's a sample code to use a 16x2 display.
I used an old display without backlight so I can take the picture. :)
//------------------------------------------------------------------------------------------------------------------------------
// include the library code:
#include <LiquidCrystal.h>

/*
* LCD RS pin to digital pin 8
* LCD Enable pin to digital 19
* LCD D4 pin to digital pin 31
* LCD D5 pin to digital pin 32
* LCD D6 pin to digital pin 33
* LCD D7 pin to digital pin 34
* LCD R/W pin to ground ... in this case digital pin 9 -> LOW
*/

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 19, 31, 32, 33, 34);

const int RWPin = 9;

void setup()
{
  // set the digital pin as output:
  pinMode(RWPin, OUTPUT);
  // R/W Pin to ground
  digitalWrite(RWPin, LOW);
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("Arduino"); 
  lcd.setCursor(0,1);
  lcd.print("atmega162"); 
}

void loop()
{

}
//------------------------------------------------------------------------------------------------------------------------------
 

Step 13: Last Word

Into final, result is to get a PCB designed mainly for exotic processor (STC51) and extend the possibilities up there, it can be used with a friendly environment like Arduino.

PS.
Into the next few weeks I will update information on openhardware.ro
I will provide code in Arduino and C to explore all possibilities of the board.
and I work on a new Instructable for ATmega32 development board, compatible Arduino, designed from scratch.




 

Comments

author
zeekforall (author)2017-02-28

Hi, can you give any support with this adapter YSUMA01-341A? I'm trying to program a STC12a5a60s2 chip.

author
Silvius (author)zeekforall2017-03-01

No... Seems like a very interesting adapter... I do not have such an adapter... or STC12A5A60S2.

author
dunk8888 (author)2016-02-22

hi have you ever used nthe stc controllers?ime thinking of giving them ago,just need to find the ide for them.

author
Silvius (author)dunk88882016-02-23

Yes... I used STC MCU... but not so much as ATmega ... :)

anyway, you can look at these:

SDCC - Small Device C Compiler

MCU 8051 IDE

author
DARKHOURS (author)2015-05-30

Thanks great instructions I have had the same board for some time now and been looking every where to use it.. The only problem now is when I try uploading a program is this error:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: programm enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check

Again Thank You

author
Silvius (author)DARKHOURS2015-05-30

I need some more information for a proper answer. (microcontroller type, quartz frequency, using Arduino IDE... or not...) I'll try anyway.

I'll assume that you use ATmega162 in Arduino IDE, with 16MHz quartz ...

You can ignore avrdude warning... It's about old firmware in USBASP device... you can use another usbasp to upgrade firmware... or self-programing (depending on your USBASP)... or or you can leave it as it is (the safest choice).... :)

avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1

These two last messages telling that the microcontroller does not respond at all. There may be many causes.

1. Incorect fuse setting.. SPIEN disabled or CKSEL =0000 ... or.

2. microcontroller defective

3. The two jumpers near reset button (marked with AVR/51) must be in AVR postition for Atmega and in 51 position for STC ...

I hope my answer to be useful to you...

author
zamanm (author)2014-12-10

i got it. a picture just for me. great! thank you so much.

author
zamanm (author)2014-12-09

is it possible to program a stc12c5a60s2 MCU using this board connected to a USBtinyISP's ISP header, i.e., PC > usbtinyisp > TSMC dev. board.

author
Silvius (author)zamanm2014-12-10

No. USBtinyISP is for ATmega. To program STC MCU you need only USB to serial adapter, or serial cable (if you have serial port available on PC). You have to connect the board to PC using serial port. You have to set jumpers of dev board for STC like in picture attached.

And you need to use a specialized app for STC MCU. Check the link below:

http://openhardware.ro/stc-mcu-software/

STCSETUP.jpg
author
Silvius (author)Silvius2014-12-10

STC MCU have built-in bootloader. After you hit PROGRAM button on flashing APP you need to press Reset button on dev board about ~1 second for bootloading sequence.

author
Yoruk (author)2014-10-24

Can you tell me if this board can handle other micro-controllers ? I mean, microcontrollers with same pinout ?

author
Silvius (author)Yoruk2014-10-24

Yes. Same pinout: ATMEGA162, ATMEGA8515, AT89S51, AT89S52

With an adapter working even with Atmega16, Atmega32, Atmega64 (DIP40).

You can search 51 MCU ATMEGA16/32 Chip Converter.

Should look like image below. About $4.52 on e-bay (quick search) ... I think you can find cheaper if you try searching more.

adapter.jpg
author
Yoruk (author)Silvius2014-10-25

Thanks !

I have one more question. I have a very similar board, (with less devices^^) and a AT89S52. I usually work with AVR Studio and AVRDUDE (+usbasp) to flash my micro controllers. Unfortunately, the AT89 is not supported by both AVR studio and avrdude.

Did you know if it is possible to add the AT89S52 to the Arduino IDE to the file boards.txt ?

author
Silvius (author)Yoruk2014-10-25

AT89S52 is indeed an Atmel microcontroller but not part of the AVR family. ...and AVR Studio and AVRDUDE... is as the name says for AVR :).

The reset pin on the AT89S52 is active-high.

The reset pin on an AVR is active-low.

AT80S52 microcontroller can be programmed with USBASP and progisp172. Search progisp172 or progisp1.72 .

About arduino... not working with boards.txt method as above. AT80S52 microcontroller architecture is totally different from AVR, another compiler, other libraries, etc...

author
Yoruk (author)Silvius2014-10-25

Thanks ! I'll study that.

author
hhesham1 (author)2014-05-10

i tryed to open the pro file with Kicad but dont work can you post a photo of the Schematic file using proteus Thank you

author
Silvius (author)hhesham12014-05-11

I have not installed on my computer Proteus.

I use KICAD (and GEDA.) This project is made entirely in Kicad.

You may have used an older version of Kicad?

This is my version:

Application: KiCad
Version: (2013-07-07 BZR 4022)-stable
Build: wxWidgets 2.9.4 (wchar_t,compiler with C++ ABI 1002,GCC 4.7.2,wx containers,compatible with 2.8)
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Boost version: 1.53.0

author
hhesham1 (author)2014-05-09

the FKECL-AVR-51 file in the FKECL AVR-51(KICAD PROJECT).zip62 KB download don't work with my proteus

author
Silvius (author)hhesham12014-05-10

because is Kicad project not Proteus

http://www.kicad-pcb.org/

author
hhesham1 (author)2014-05-09

the FKECL-AVR-51 file in the FKECL AVR-51(KICAD PROJECT).zip62 KB download don't work with my proteus

author
garvamel (author)2013-11-05

Greetings Silvius! Thank you for this instructable!

Do you know if the Arduino-ed ATmega162 has both UART's fully working and supports Time.h and Xbee.h libraries?

Thanks in advance!

author
Silvius (author)garvamel2013-11-05

No problem!

Serial.begin(9600);
Serial1.begin(9600);
xbee.begin(Serial);


has been properly compiled.
Seems to be ok...

I do not own Xbee hardware. So I can't proceed further with the test.

Thank you so, for posting!

About This Instructable

24,388views

28favorites

License:

More by Silvius:Reading 15 Rotary Encoders with Arduino and ATmega1284Open Source TV Box - GeekBoxAVR Transistor Tester
Add instructable to: