Author Topic: problem with USB=> RS232  (Read 6790 times)

JCAM

  • Guest
problem with USB=> RS232
« on: September 22, 2005, 02:47:57 pm »
Hi,
When I use Flasmagic (recent version) to program a  p89c51rd2 via a  max232 for the serial interface.All was well when i was using the serial port of a p.c.But when i tried programming the circuit using a laptop( with a usb to com cable),The communication is not always establish.
I use the good com4 which appears in the peripheric system and i don't unterstand what' the problem ?
Please Can you help me ?
Thanks
Jcam

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2143
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: problem with USB=> RS232
« Reply #1 on: September 22, 2005, 03:01:06 pm »
It's probably a timing issue. Try slowing down the baud rate to see if that helps. Try your cable and drivers on a different PC. If you are attempting to use DTR and RTS to enter ISP mode try increasing T1 and T2 in the advanced options.

Some USB to RS232 cables work better than others. I haven't experienced any problems with my IOGear cable.

Embedded Systems Academy, Inc.
support at esacademy dot com

JCAM

  • Guest
Re: problem with USB=> RS232
« Reply #2 on: September 22, 2005, 11:56:33 pm »

It's sames problems whith different PC and when I change the baud rate
But why with a true COM RS232 it's alway good ?
I'have also note with the true COM RS232 , the choice of the baudrate is important. It's work good at 7200 baud . WHY ??

Details of my procedure with USB ==> RS232.
I use the 5V of USB for the alim of my target.
With a soft PC(with cable USB)  I transmet the trame for put my target in ISP mode
I deconnect the cable USB and the target reset and it is in ISP mode.
all this is alway good.
But after when I reconnect the cable USB to use flashmagic for reprogramming my target. Now it's dont work alway. Some time it's good.
Some time there is no connection. And when I return with true COM RS232 It's alway good.
Is it timing problem ??
I must compare the trame with true COM and  USB ==> COM
What is the first trame of connexion ?

thanks

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: problem with USB=> RS232
« Reply #3 on: September 23, 2005, 03:15:14 am »
Try to find out the brand of the CHIP used in your USB-COM "cable" (not the "brand" of the cable). Some chips are flawed.

http://www.8052.com/forum/thread.phtml?thread=97853

Jan Waclawek

JCAM

  • Guest
Re: problem with USB=> RS232
« Reply #4 on: September 26, 2005, 12:28:30 pm »
NOW it' OK with a baudrate = 4800.

The chip used is a chip ftdi.

With a scope, on the Rx and the Tx of my target, I note that the response of my target (P89C51RD2) is not always at the good baudrate.
For a ask of 7200 bauds the response is, when it's no good with the USB==> RS232 convert, < 7000 bauds.
With a true COM RS232, there is the same probem but it's OKwith flahmagic.
Perhaps the convert USB_RS232 add more delay and flashmagic can't work correctly.

How we can explain this difference of baudrate response ?

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: problem with USB=> RS232
« Reply #5 on: September 27, 2005, 01:32:39 am »
The autobaud routine works so that it waits for one edge of the incoming signal ('U' character) using jb, starts timer2, waits for another edge using jnb, stops timer and calculates the reload value based on the measured bit time (maybe the jb and jnb are the other way round but that does not matter here).
Depending on the ratio of oscillator/timer ticks to bit time, it might make one more or on less jb or jnb, hence the reload time might be a little off. This happens with a certain probability again based on the particular oscillator to bit time ratio and can be calculated. See http://www.efton.sk/t0t1/autobaud_error.htm for more details - there is also an xls sheet where you can try your settings (by the way, what is your crystal value?)

So what I think could happen is that at 7200 baud the autobaud sometimes results actually in around 7000bauds; and while the "real COM port" (the UART behind it) might be tolerant for the error (it is below 3% so it might be good, although marginal), the FTDI chip might be not, or the RS232-to-5V level convertor used with the FTDI chip might distort the signal enough to get outside the acceptable error margin.

Jan Waclawek