Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am using a ATMEGA32HVB microcontroller which has a facility for cell balancing by which we can connnect 4 batteries in series and use one at a time. That is very useful for power management so I can't use a different microcontroller. Please suggest some methods to add a UART to it so I can easily interface to serial devices.

share|improve this question
7  
The software UART way as described by user26129 is called bit-banging. – Johan.A Aug 14 at 10:56
3  
Just my very subjective $0.02, but I would usually prefer a separate dedicated battery controller and uC-integrated UART instead of the other way around. Why do you need the battery management integrated in the uC? – Mels Aug 14 at 13:58
I have to use rechargeable batteries which will be getting charged using a solar panel so I need 4 battries in series whch will be used one at a time – user27475 yesterday

3 Answers

If you are looking for a hardware solution, Maxim has several UART ICs with an SPI interface to the microcontroller (which is included in your part). Look at MAX3100 or the other options here: http://www.maximintegrated.com/products/interface/controllers-expanders/uart.cfm

share|improve this answer

As others have noted, you can either add additional hardware to your system to provide the UART functionality, or you can emulate one in software. If you have control of the overall hardware design and adding another IC is an option, I would strongly consider the hardware-based approach. You can certainly make a software UART work using bit-banging, but you might not want to dedicate the CPU resources to generating the required timing.

From a glance at the datasheet, it appears that your microcontroller has both SPI and I2C (which Atmel calls a Two-Wire Interface (TWI)). These would probably be the best interfaces to use in order to attach an external UART. Said devices are available from a number of manufacturers. Some examples:

  • Exar (http://www.exar.com/connectivity/uart-and-bridging-solutions/i2c-spi-uarts) has a line of SPI/I2C 1- and 2-channel UART devices available, covering the ~1.6-3.3V operating range. I've not used any of these parts specifically, but I have used Exar devices in the past (with parallel memory-bus interfaces), and they have worked well.

  • NXP (http://ics.nxp.com/products/bridges/i2c.spi.slave.uart.irda.gpio/) has a line of SPI/I2C UART/IrDA/GPIO devices available, also in 1- and 2-channel varieties over a couple voltage ranges. I have used these parts (specifically the SC16IS762) extensively in the past with great success.

  • Maxim (http://www.maximintegrated.com/datasheet/index.mvp/id/2052) has the MAX3110E and MAX3111E devices, which are SPI-connected UARTs. One unique feature of these devices is that they have an integrated RS-232 line driver. So, if you need your UART to interface to a device that uses RS-232 line voltages instead of logic levels (e.g. a PC), this might be useful, as it will save you from adding another line driver IC to your board.

share|improve this answer

You will need to use a software UART driver. Depending on exactly what you expect from this UART, you could use AVR305 (extremely compact, but no features beyond blocking half-duplex send/receive), AVR274 (interrupt driven, fairly feature complete), you could write your own software UART driver or you can use one you find on the internet, for instance by googling 'avr software uart'

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.