Inverted UART

4 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quick question: is there any software method for inverting the output of the xmega USART modules? I am using an IR module which requires signals of the opposite polarity from normal (ie idle needs to be low, active high). I know that I could use a hardware inverter or a software serial library, but this seems like the kind of thing Atmel might have put in somewhere. I'm using the ATxmega16D4 chip to be precise.

Thanks!

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

Every port pin has a PINnCTRL register containing an INVEN bit - does this come into effect even when the port is being used for UART (I think I read somewhere that it would allow for inversion in any circumstance).

EDIT well it certainly says INVEN can invert the output when a pin is driven by a Waveform Generator (WG) in a timer - so I'm guessing it might work for UART too - I'm guessing it's an inversion gate right before the output.

 

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

Yup - setting the INVEN bit works to invert the output of the USART (tested on 32A4 and 32D4's).

Nigel Batten
www.batsocks.co.uk

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

That did the trick! Thanks for the help.