Is my uart module busted?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can transmit fine.
If I probe the Rx pin, which is being pulled up by a 1k resistor to 5v, I get a voltage around 1v. The tx pin is sending "c" to my serial on my computer over and over. Probing the Tx pin and Rx pin simultaneously, I can see that the Rx pin has some cross talk with the Tx pin.

Does this mean its busted?
Anyone ever seen this before?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what kind of board are you using? are you going through some kind of rs232 level shifter? 1 k is a strong pull but the serial converter chips that I know about wouldn't need it. What are your trying to trouble shoot?

link

i am a NOOO00B!!

Don’t let that undermine what I just said.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

custom board. no level shifters.
trying to establish comms between uC and computer.

just wrote a piece of code with TX and RX pins setup as just outputs:

while(1)
{
PORTD |= (1<<PD0);
PORTD &= !(1<<PD1);
PORTD &= !(1<<PD1);
PORTD &= !(1<<PD1);
	
	
PORTD &= !(1<<PD0);
		
PORTD &= !(1<<PD1);
}

Pin1 stays low
Pin0 is high for ~4/6 the time of a cycle.

On the scope: When pin0 goes high, its for 1/6th the time. Pin1 follows it - doesnt get to 5V, but to about 1V.

If I use delay_ms instead of repeating the instruction, you see no output (since pin0 seems to only go high for one cpu cycle).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Pin0
  __           __
  | |          | |
  | |          | |
  | |          | |
__| |__________| |________

Pin1
  __           __
__| |__________| |________
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok, step back for a moment,
What are you trying to do?
How are you connecting to the pc? USB? serial?
tell us about the circuit, which mcu are you using?
need more info

link

i am a NOOO00B!!

Don’t let that undermine what I just said.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I can see that the Rx pin has some cross talk with the Tx pin.
Solder bridge?

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tkurowski wrote:
just wrote a piece of code with TX and RX pins setup as just outputs:

while(1)
{
PORTD |= (1<<PD0);
PORTD &= !(1<<PD1);
PORTD &= !(1<<PD1);
PORTD &= !(1<<PD1);
	
	
PORTD &= !(1<<PD0);
		
PORTD &= !(1<<PD1);
}


What is it you are trying to do with this code? Can you tell me what you expect each statement to do?

Show all of the code please.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
no level shifters

???

The classic PC serial port puts out an RS-232 signal. This is typically +/- 12 Volts, NOT logic level 0/5V.

On the micro end one usually puts a Max232 chip, or the equivalent, to convert between RS-232 levels and logic levels.

A USB to logic level converter cable exists, but if that isn't what you are using you need to rethink how this is suppose to work.

Wiki RS-232 has more info on RS-232.

Note, also, that the PC logic level signal is inverted by its logic level to RS-232 convert chip. The signal is then inverted again by the Max232, (or equivalent), on the micro's end.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry guys. I try to make simple statements to describe my situation. Everything in terms of basic setup works properly. If you don't believe me, that's fine, but I'd like to hear some troubleshooting tips under the assumption everything is "supposed" to work.

No solder bridge.
Not talking to rs232 port on computer, therefore no level shifters. 5v to 5v.

With the above example code, assume each instruction takes the same amount of time. Ive got two probes. one on pin 0, one on pin 1 (port d).

OBJECTIVE: find out if the pin doesnt work.
step1) screw uart. lets see if simple output works.

pin0 = on for 4 cycles and off for 2
pin1 = off for the whole thing

the above scope output was found.

though pin1 was supposed to be 0V the whole time, there was cross talk from pin0.

pin0 was supposed to be on 2/3rds of the time. it was on for 1/6th.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Doc,

I think he is running the code above without a connection to the PC, just measuring the Tx an Rx pins.

I don't think he set PD1 to be an output.

DDRD = 0x03;

Now look at your signals.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Tue. May 15, 2012 - 01:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes both are outputs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Show us the whole test program and we can help you better.

Here try this:

#include 

int main(void) {

	volatile int i;

	DDRD = 0x03;	// Make PORTD pins PD0 and PD1 outputs
	PORTD = 0x01;	// Start with pin PD0 high


	while(1) { 

		PORTD ^=  0x03;	// Toggle PD0 and PD1 

		for (i = 0; i<30000; i++);
		for (i = 0; i<30000; i++);

	}

}

EDIT: Sorry for the edits, it has been a long day.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your suggestions.
The hardware broke. Failure mode unknown.

New chip. Working fine.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, that's good news AND bad news.

The good news is you know the chip is bad and won't waste hours, or days, struggling with your code.

The bad news is the chip is bad. You need to figure out WHY the pin got fried, and hence figure out what you need to do to prevent it from happening again.

The above ought to be obvious, but some people tend to forget about it once the immediate problem has been solved.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
      for (i = 0; i<30000; i++);
      for (i = 0; i<30000; i++);

Note for the future - you appear to use avr-gcc so those for() loops will not generate any code at all (unless you make the mistake of building with -O0)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I am using avr-gcc. The variable "i" is declared as volatile. I am using -Os.

Part of .lss file.

00000034 
: #include int main(void) { 34: df 93 push r29 36: cf 93 push r28 38: 00 d0 rcall .+0 ; 0x3a 3a: cd b7 in r28, 0x3d ; 61 3c: de b7 in r29, 0x3e ; 62 volatile int i; DDRD = 0x03; 3e: 83 e0 ldi r24, 0x03 ; 3 40: 81 bb out 0x11, r24 ; 17 PORTD = 0x01; 42: 81 e0 ldi r24, 0x01 ; 1 44: 82 bb out 0x12, r24 ; 18 while(1) { PORTD ^= 0x03; 46: 23 e0 ldi r18, 0x03 ; 3 48: 82 b3 in r24, 0x12 ; 18 4a: 82 27 eor r24, r18 4c: 82 bb out 0x12, r24 ; 18 for (i = 0; i<30000; i++); 4e: 1a 82 std Y+2, r1 ; 0x02 50: 19 82 std Y+1, r1 ; 0x01 52: 05 c0 rjmp .+10 ; 0x5e <__SREG__+0x1f> 54: 89 81 ldd r24, Y+1 ; 0x01 56: 9a 81 ldd r25, Y+2 ; 0x02 58: 01 96 adiw r24, 0x01 ; 1 5a: 9a 83 std Y+2, r25 ; 0x02 5c: 89 83 std Y+1, r24 ; 0x01 5e: 89 81 ldd r24, Y+1 ; 0x01 60: 9a 81 ldd r25, Y+2 ; 0x02 62: 80 53 subi r24, 0x30 ; 48 64: 95 47 sbci r25, 0x75 ; 117 66: b4 f3 brlt .-20 ; 0x54 <__SREG__+0x15> for (i = 0; i<30000; i++); 68: 1a 82 std Y+2, r1 ; 0x02 6a: 19 82 std Y+1, r1 ; 0x01 6c: 05 c0 rjmp .+10 ; 0x78 <__SREG__+0x39> 6e: 89 81 ldd r24, Y+1 ; 0x01 70: 9a 81 ldd r25, Y+2 ; 0x02 72: 01 96 adiw r24, 0x01 ; 1 74: 9a 83 std Y+2, r25 ; 0x02 76: 89 83 std Y+1, r24 ; 0x01 78: 89 81 ldd r24, Y+1 ; 0x01 7a: 9a 81 ldd r25, Y+2 ; 0x02 7c: 80 53 subi r24, 0x30 ; 48 7e: 95 47 sbci r25, 0x75 ; 117 80: 1c f7 brge .-58 ; 0x48 <__SREG__+0x9> 82: f5 cf rjmp .-22 ; 0x6e <__SREG__+0x2f> 00000084 <_exit>: 84: f8 94 cli 00000086 <__stop_program>: 86: ff cf rjmp .-2 ; 0x86 <__stop_program>

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC: I just installed it. Its a chip thats been sitting around for months. Probably static. Nothing to do with my circuit. But good point.

clawson: Nice. I actually didnt know that. Thanks.

larryvc: I appreciate the laugh of randomness.