I have a board with an AVR32 (AT32UC3B0512) and a USB port. I would like to send data to the USART, using a terminal from my PC, but I don't know how to use the USB to access the RXD and TXD pins.
I read on some forums about implementing a CDC. Could someone tell me if this is needed or how to do it ?

Additional details :

  • There is a bootloader on the AVR
  • Datasheet
  • The following picture shows how the USB port is connected to the microcontroller : enter image description here
  • \$\begingroup\$ You should not read some forum but the actual documentation in appnotes 8447 and 42337. \$\endgroup\$ – CL. Mar 25 '17 at 7:43
  • \$\begingroup\$ "I don't know how to use the USB to access the RXD and TXD pins" - why do you want to do this? \$\endgroup\$ – Bruce Abbott Mar 25 '17 at 8:25
  • \$\begingroup\$ @BruceAbbott Because the only interface I have to my MCU is the USB port on the board and I want to send keypresses. \$\endgroup\$ – fholly Mar 25 '17 at 9:17
  • \$\begingroup\$ You want to send key presses from the PC (via a terminal program) to the AVR32? What do you want the key presses to do when they get there? What will be connected to the RXD and TXD pins on the AVR32? \$\endgroup\$ – Bruce Abbott Mar 25 '17 at 17:15
  • \$\begingroup\$ @BruceAbbott There are no dedicated RXD and TXD pins, only GPIO pins that can be configured to assume these functions. I want the AVR to listen to key presses and play a note through a speaker, as shown in the book AVR Programming: Learning to Write Software for Hardware. I do realise it's a book about AVR not AVR32. \$\endgroup\$ – fholly Mar 25 '17 at 18:52

It is not clear if you are connecting your AVR with PC via USB or COM port.

  1. USB

    This requires device driver for your AVR on the PC (either HID, libusb, winusb, jungo, custom ...) and write a PC program that connects to the driver and send/receive the USB packets which is not an easy stuff to do as drivers are usually KERNEL mode (although winusb and jungo (expensive as hell) ease up things a lot without the need for KERNEL mode code). Also you would need to code the AVR32 firmware for USB (adapt any USB example from the ASF).

    This approach will not set the TX,RX state instead the USB HW will do the heavy lifting for you.

  2. COM

    Well this is easy you just need to change the voltage levels from RS232 to TTL or 3.3V logic with MAX or any other converter. And on PC just open file representing COM port you are connected to and read/write whatever you want. How ever using USB pins on MCU side complicates things a bit. If you use RX/TX of serial link then you can use serial port HW directly. In this case you would need to configure RX as input and TX as output GPIO and write custom serial protocol handler in SW (like in timer interrupt) but still much much easier than to write USB stuff if you do not know what you are doing.

Well I got the impression You are aiming for the #1 option so I recommend to use some HID class example (like mouse or keyboard) or even better USB to USART Gateway example (I think it was in UC3L0 Xplained kit examples) as those should work with native OS drivers eliminating the need for expensive (time/cost) driver stuff issues and in case of the bridge very easy PC side code (the same as for real COM ports) like this:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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