How to get data from one micro controller to another using UART

Discussion in 'Embedded Systems and Microcontrollers' started by veerubiji, Dec 6, 2012.

  1. veerubiji

    Thread Starter New Member

    Oct 9, 2012
    My concept is I have two designed boards, One with AT90USB1287, other with ATmega32A both are working properly.

    AT90USB1287 is talking to the PC via USB. ATmega32A is talking to the PC via USART(RS232).

    Now i have connected ATmega32A board to AT90USB1287 using UART communication(RS232 cable by disabling connection to PC) Because both boards has to work together with one PC. Easiest way is UART connection between those two.

    If i want to send data from ATmega32A to PC means, I have to get data from ATmega32A to ATusb901287 and send it to PC via USB.

    I am confusing how to get data from ATmega32A to AT90USB1287.
    I have given connections like
    1. connected RxD pin i.e., PD0 i.e., Pin 14 of ATMega32 to TxD pin i.e., PD3 i.e., Pin 28 of AT90USB1287
    2. connected TxD pin i.e., PD1 i.e., Pin 15 of ATMega32 to RxD pin i.e., PD2 i.e., Pin 27 of AT90USB1287
    3. USB pins of AT90USB1287 are connected to PC USB.

    I have wrote usart communication for ATmega32 and i am confusing I have to write same usart communication for AT90usb1287? how to get data from ATmega32a to AT90usb1298 and then from it to pc via usb.

    Please describe me what i have to do in the firmware of two micro controllers. i have the firmware for both boards when those are connected to PC's directly.

    Ask if more information needed from my side. Please help me.
  2. BillO

    Distinguished Member

    Nov 24, 2008
    Hi veerubiji,

    Are the grounds of the two MCUs connected? I know it sounds like a 'Is it plugged in?' question, but inadequate grounding is the #1 mistake.

    Now that's out of the way, have you considered using the I2C interface between the two MCUs? I think that might be a better and easier way to get data between them.

    As far as code goes, it's probably best not to re-invent the wheel. There are many, many libraries for both UART and I2C available free on the internet. Just google "UART library for AVR" or "I2C library for AVR" and you will find all that you would ever need or want in various languages.