LPC2138 responds using terminal, but unable to communicate using flash magic

Started by preraksheth, July 20, 2011, 11:47:21 PM

Previous topic - Next topic

preraksheth

I seem to have a peculiar problem with a prototype board that I have made
microcontroller: LPC2138
Flash Magic version: 5.87.2331 (Same problem with older version as well)
Baud rate: 9600
Crystal: 12 MHz
Communication: Serial (no USB conversion)

When I use a terminal (Putty or in built flash magic terminal), I am able to communicate.
I have tried:

?
Response> Synchronized
Synchronized
Response>OK
12000
Response>OK
J
Response>
0
196839
K
Response>
0
13
2

But if I try to read device signature, it keeps failing (and so obviously it can not program either)
I have put P0.14 to ground, and reset it before trying this everytime

Apart from this, if I want to program using terminal, what Unlock code do I have to use?
Thanks to all - I am new to the forum, and may have missed if this is already replied - in which case you can just point me to the right link

Andy Ayre

Embedded Systems Academy, Inc.
support at esacademy dot com


preraksheth

Andy - is the file good enough? Do I provide more info? Your help is greatly appreciated. Thanks

Andy Ayre

rx> Synchronized\d\a
tx> Synchronized\d\a
rx> \fd\bf\7f\9f\ff\fb\ef\fb\ff\aOK\d\a

This shows Flash Magic received "Synchronized" followed by CR-LF. It then sends "Synchronized" back to the device and the device responds however the baudrate seems to have changed. Note that \fd = 0xFD. Oddly "OK" is correctly returned.

I am not sure why it works in a terminal but not for Flash Magic. Please put a logic analyzer on the TxD pin of the microcontroller and try to measure the baudrate through the process to see if it really does change.

I see you are using DTR/RTS to place the device into programming mode. Are you doing that with PuTTY somehow? Can you disable that and use switches on the board instead?

Another thought is that something disturbed the microcontroller. Check the sine waves on the XTAL pins and check the power supply.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

preraksheth

Thanks so much Andy.

After keeping the flash magic in "Half Duplex" mode and disabling any default behavior for DTS/DTR/RTS etc, I am able to read device signature. (Don't know why)
But it still could not program (failed to send data).
Then I tried to put in debug mode, and suddenly it could program!
This has repeated multiple times - 70% times, it is able to program in debug mode. Never outside debug mode.
But now, it did not create a debug file :-(
I am totally zapped at what's going on. Will be great if you could shade some light based on above. Meanwhile I will try to get a debug file
Regards,
Prerak

Andy Ayre

The only influence debug mode would have is to slow things down. The same is true with half-duplex mode if you don't really need it (which you don't). My guess is that there is something strange with your Windows installation or the microcontroller, but I don't know what.

We've seen symptoms like yours a couple of times before over the last 11 years but we were never able to pin down what was going on. We don't have anyone else reporting this issue.

Can you try a different microcontroller?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Klaus Jäger

Hello,

I have the same problem with the LPC2378 and LPC1768. Keil evolution boards.
I get a new laptop Dell M6600 with docking station for serial communication.
I cannot flash the controller. The message autobaud came.
I can communicate with the controller with your terminal.
When I use in the laptop a pcie serial card from Exys EX-1372 it works.
My old laptop T60p IBM works too over the docking station.
It could be a hardware problem of the laptops or docking stations.
Perhaps the FIFO.

Klaus

Andy Ayre

Klaus,

If possible, the following test would be interesting:

Using the same Flash Magic settings and the same micrcontroller and target board, use a scope and logic analyser to capture the serial comms in both directions for an attempt to read the signature with the PCIe card and the docking station.

We should then be able to compare the waveforms side by side and see what the difference is. It may be possible to modify Flash Magic to compensate for what is going on.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Klaus Jäger

Hello Andy,

I am sorry that I answer so late.

I have no logic analyzer, so I cannot make the measurements for you.

I have a similar problem with program that I write with C# 2005.
There use the RS232 from C# and I must raise the buffer for write and read.


Klaus

Andy Ayre

What did you raise the buffers to? Flash Magic attempts to use 16k although not all PCs support that for some unknown reason.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

preraksheth

Andy,

I am back with the problem. Originally, my problem was solved by putting the flash magic in debug mode and programming in debug mode.
Unfortunately, now even that does not work.
I can say that the serial communication line is working fine, as the previously loaded program does communicate with the PC properly (although sometimes with glitches).
I wonder what I could do next. I don't have logic analyzer to provide you with the hard baud rate info.

Any help would be greatly appreciated.
Regards,
Prerak

preraksheth

Again, I am able to communicate thru terminal and the protocol seems to be ok in terminal
Regards,
Prerak

preraksheth

After putting the flash magic in Debug mode and communication in Half Duplex mode, it worked for some time.
But then again, it started failing - now with an error "failed to send data to device" after successfully erasing sectors
This is now getting weird!
Please, please help
Regards,
Prerak

Andy Ayre

My suspicion based on all the information so far is something to do with your Windows installation and perhaps the COM port driver. The other person never responded to my last question unfortunately.

Please generate two debug files and send them to me. One using the Start button and one using the terminal. Perhaps this time there will be more of a clue.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com