0
\$\begingroup\$

I am working with an ATmega328. What I want to do is finding a way to save any value in any GPR of the microcontroller using the PC.

I found this video where an already made interface is shown. Apparently, that is very user-friendly. But does it what I'm trying to achieve? For example, if I want to save the value 0x3B in register R16, could I use that software to do it via USB?

Also, I don't know how to connect the USB with the microcontroller pins. I've found this image

enter image description here

but I would have expected the pins TXD and RXD to be used. Is this connection alright?

Sorry if the question is a bit messy, I'm a beginner with this stuff. If you need any further information please let me know.

\$\endgroup\$
4
\$\begingroup\$

TXD and RXD would be used if you were using the UART - that is, connecting the chip to a USB to UART (TTL) adaptor. You aren't, you're interfacing directly to USB and bit-banging the USB protocol (which is IMHO one of the nastiest things anyone could ever do on a USB bus), so you have to use the pins mandated by the software that is doing said bit-banging.

Can you get it to set registers? Sure - if you write the software (using the V-USB library) to do it.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your answer! So do you think that with the V-USB library I could do such a task? When you say "write the software", do you mean the program that goes into de microcontroller or a software to run on the PC to send the necessary data via the USB connection? \$\endgroup\$ – Tendero Dec 17 '16 at 22:13
  • \$\begingroup\$ Both, though the PC side could just be a terminal emulator if you write the AVR side well enough. V-USB is just a library for Arduino. You need to write the rest to receive commands and act upon them. \$\endgroup\$ – Majenko Dec 17 '16 at 22:14
  • \$\begingroup\$ Or use an FTDI (or Silabs or whatever) USB to UART chip (or cable) to avoid a ton of complexity. \$\endgroup\$ – vicatcu Dec 18 '16 at 16:59
  • 1
    \$\begingroup\$ Or just get an Arduino and avoid a ton of wires as well. \$\endgroup\$ – Majenko Dec 18 '16 at 17:00
  • \$\begingroup\$ Right, especially because the OP is using an ATmega328 as well \$\endgroup\$ – vicatcu Dec 18 '16 at 17:02
0
\$\begingroup\$

What I want to do is finding a way to save any value in any GPR of the microcontroller using the PC.

What you want is a JTAG debugging interface. This is a special piece of hardware to interface with the AVR which will allow you to view and modify its state directly. Unfortunately, these are rather uncommon for AVR. The main one I'm aware of is the AVR Dragon, which is a bit expensive.

V-USB is not a debugging interface. It is software that runs on the AVR to make it behave like a USB device. USB is not a TTL serial interface, so the TX/RX pins are not useful for implementing USB -- I'm not especially familiar with V-USB, but I suspect the pins they chose to use have some special properties that make them useful here.

For what it's worth, JTAG debuggers are much more common for ARM microcontrollers. If you're just getting started, you might want to consider using an ARM microcontroller instead of AVR.

\$\endgroup\$
  • \$\begingroup\$ ATmega328 doesn't have any JTAG support afaik \$\endgroup\$ – vicatcu Dec 18 '16 at 17:33

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.