Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Problem with ATMega32 send UART

(you are viewing a thread; or go back to list of threads)

Problem with ATMega32 send UART (by David R)
Hi,
I I am trying to send uart string but it is not working.
The yellow led just stays on and nothing comes out the port
I tryed send char over uart and this does not work but the yellow led does flash and there is movement on the pin but not data.

It is quit possible I am doing something wrong here as it is the first time I have used these chips.
The receive seams to be working ok.

Regards
David.
Mon Nov 9 2009, 05:11:40, download attachment simple_uart_test.ld
(no subject) (by Jonathan Westhues)
That's odd. I don't have the hardware, so I've never tested that target. But your program looks like it should work.

What happens if you run with a faster (~10 ms) cycle time? Not that that should affect anything, of course. Or different baud rates?
Mon Nov 9 2009, 05:23:43
(no subject) (by David R)
I tried different board rate and scan time.

I tried setting the uart pin as A digital out to check the pin was working and it is.

When set to UART the pin pulls high like it should.

when I use the (send CHAR over serial) the pin will pull low (may be for the length of time it takes to send the char??) but does not send data.

When I use send format string the pin seams to stay high and the out put of the instruction also stays high.

I hope I am not some how wasting your time here.
Regards
David
Mon Nov 9 2009, 14:31:28
(no subject) (by Jonathan Westhues)
This could very well be a real problem. Do you have an oscilloscope? If yes, then can you get a trace of what the pin is doing?
Mon Nov 9 2009, 14:35:13
(no subject) (by David R)
Yes I have A scope is only an analog which makes looking at uart vary hard.

I did scope it last night and there only seem to be one pull low and back high again when using (send CHAR)

I had A another quick look before going to work and
the pull low looked to be 1 bit long.

when using format string there was no pull low that I could see.

I will test again when I get home from work.
Mon Nov 9 2009, 15:43:35
(no subject) (by David R)
HI,
Back home now
The when sending format string, pin never pulls low and rung condition past the command is all ways true even if the format string command is never called.

when sending CHAR over UART command pin will pull low for about 0.5ms~ every time the instruction is called and rung condition past uart instruction pulse true.
no data is ever sent.

The only thing that I note is there seams to be more noise on the pin outs of the atmega32 chip enough the make the scope line slightly thick were on the pic there is no noise.
yes I have decoupled vary well.

Regards
David
Tue Nov 10 2009, 01:44:52
(no subject) (by Jonathan Westhues)
Does this help? I was previously polling TXC, not UDRE like the sample code.

If anyone is able to test this, on any AVR, then I would be curious to know the result.
Wed Nov 11 2009, 00:38:26, download attachment ldmicro.zip
(no subject) (by David R)
Oh yes that does help!!!!
It works vary well now.

Regards
David.
Wed Nov 11 2009, 02:17:36
(no subject) (by Jonathan Westhues)
Excellent. Have you tried both the UART tx op and the formatted string op? And do you have any other AVRs that you can test it on?
Wed Nov 11 2009, 02:22:50
(no subject) (by David R)
That is A good point I had not tested (send char) OP and it does not work sorry, the same result with this OP as last time.

I don't have any other AVR but I will get some so I can test for you.
Wed Nov 11 2009, 02:33:59
(no subject) (by Jonathan Westhues)
That is mysterious. Can you post the exact program that you used with the UART tx op?
Wed Nov 11 2009, 03:05:26
(no subject) (by David R)
I tried with different scan times and with and with out OSR.
with OSR the LED4 never lights up, with out OSR led4 lights for the duration of the rung being true from the (= op).
Wed Nov 11 2009, 03:15:45, download attachment first_atmega32_test.ld
(no subject) (by Jonathan Westhues)
The character to be output is ASCII code 0, which probably won't print in your terminal program.

Is this what you intended? That would be consistent with the scope trace where the output just goes low for a byte time.
Wed Nov 11 2009, 03:21:30
(no subject) (by David R)
I changed it to 5, still nothing But It looks like I am getting
3 bits only on the scope (short, short, long)
Wed Nov 11 2009, 03:32:53
(no subject) (by Jonathan Westhues)
But 5 is not printable either. Can you try a letter like 'a' (specified in quotes, or decimal 97)?
Wed Nov 11 2009, 03:36:39
(no subject) (by David R)
Ok It is going It was the fact I was sending 0 must keep that in mind next time sorry to mess you around.
I forgot 0 is not ascii 0
Wed Nov 11 2009, 03:36:50
(no subject) (by David R)
This little mess up of mine does not effect the problem with
the format string that is real and now fixed thanks
do you still need me to get more targets and test?.
Wed Nov 11 2009, 03:42:37
(no subject) (by David R)
With the new program, The only thing left with this is the send CHAR op does not output A true condition any more when sending A char. the formatted does output A true condition.
Wed Nov 11 2009, 03:55:13
(no subject) (by Jonathan Westhues)
Both ops output true only when they're busy. But the AVR has a two-character FIFO, so if you transmit a single character at a time then the buffer will never be full, and the transmit operation will always complete immediately.

I've posted a new official release of LDmicro, version 2.1. Let me know if you see any problems.

Don't go out of your way to get new targets to test; but if you (or anyone else) has success or failure reports, then I am curious to hear them.
Wed Nov 11 2009, 04:06:25
(no subject) (by David R)
Thanks,
I would like to go out of my way to help as you have done so much for so many people, If getting some targets and milling A few boards to test then that is the least I can do,as it might save some one A lot of confusion and time down the line.
Regards
David.
Wed Nov 11 2009, 04:15:00
example serial (by jose)
I have an example:
Tue Feb 9 2010, 17:44:56, download attachment 628relogTeste.ld
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):