Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USB to serial(RS232) communication - AT89C5131

Status
Not open for further replies.

foton13

Newbie level 2
Joined
Feb 26, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Slovakia
Activity points
1,307
Hello everyone,

first of all, I'm a total beginner to microcontrollers. I'm working on my bachelor's thesis and it's a collaboration with one company which is designing and constructing audio devices. My task is to connect a peak programme meter with PC via USB to send data corresponding to audio levels. The PPM has Atmel AT89C5131 microcontroller on it. I was told that the easiest way to do the communication(because of avoiding the USB programming) is to make the USB connection act like serial RS232 connection. I found some test/sample program from atmel for AT89C5131 and an .INI file. I installed the .INI file, wrote the sample program using Flip. After that the PC was still recognizing the microcontroller as unrecognized USB device, not as a virtual COM port that i was hoping for. I also tried manually installing the COM port in Windows using Add Hardware(where pointing on the .INI file). Then in the device manager i could see a COM port called "AT89C5131 CDC USB to UART MGM" but it wasn't connected with the microcontroller whatsoever.

I'd be grateful for any help/advice on how to make this work.
 

When you say USB to serial, do you mean RS232 levels or TTL levels?

I found the easiest way to accomplish this (especially if you are a beginner)
is with a low cost CP2102 module.

They are extremely reliable.
 

I've not used the AT89C5131 (and not really any Atmel - I use PICs and TI chips mostly), but from a quick scan of the datasheet it has a built-in USB interface and this document ( http://www.atmel.com/Images/doc4322.pdf ) describes how it is used in the virtual COM port mode.

If your PC is not recognizing it as a COM port, then the MCU is probably not configured correctly to be one. What exactly is the test code you have found? Does it definitely implement the USB as a virtual COM port - there are several other ways to use the USB. If it does, is your code frequently calling the 'connection upkeep' function that probably exists (see below)?

Note that using USB on an MCU consumes a bit of time on it, because the USB connection needs continual upkeep (like a crying baby) or the PC will lose the connection. Can your existing software on the chip cope with the additional load?

The MCU also has a UART so using a serial-to-USB chip as ctownsend mentioned is also an option (that would not impact the MCU code like a USB connection would). That seems a waste though, and it sounds like you already have a USB connection on the board and don't want to modify the board (am I wrong?)

Check the USB implementation code on the Atmel.
 

Yes FoxyRick, you're right. The device has USB port so it's connected via USB cable. The code I found is from the Atmel site(I've just noticed that it is available to download as software next to the document you mentioned). It's a zip with a hex file and a folder, where it is in C. (http://www.atmel.com/Images/c5131-usb-cdc-1_2_1.zip)

In the folder there are two C files - main.c, usb_task.c

Then there are subfolders:
modules - more subfolders - scheduler, timer_soft, usb_cdc_enum (each cointains a .c and .h file with the folder name)
lib_mcu - lots of .h files ..subfolders uart an usb with more .c and .h files
lib_board - c5131_evab.h

I can open the codes in Visual C++ or in Keil. Unfortunately, I'm lost here and I don't know what each code is supposed to do(even with the comment lines) as I've never been dealing with USB before. And posting all the codes here probably wouldn't be the best idea.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top