I want to be able to reprogram my microcontroller through my smartphone. My microcontroller will be sending data to the phone through USB with a built-in USB module. However, I will run into the problem of wanting to update my firmware without changing the unit completely.

If I were to send a .hex file through USB, would I need to have USB OTG capabilities to re-program my microcontroller?

Can I get away with just a USB slave device to send data, and be reprogrammed through it?

I am hoping to use just the PIC18F45J50 to get this done. However, it only has full-speed USB device capabilities.

The other one I'm looking at is the PIC24FJ32GB004.

Can I update the firmware of PIC18F45J50 with just that chip by sending it a .hex file with a smartphone?

If not, could the PIC24FJ32GB004 be what I'm looking for?

An example would be the Arduino Uno. It uses an ATMega8u2 as a FTDI chip to communicate with the computer, and I'm assuming this is the device that flashes the ATMega328's memory. The smartphone is able to read data accurately from the Uno through Physicaloid.

The Arduino Micro uses an ATMega32u4, which has a built in USB module. It is able to be reprogrammed and is supported in the Arduino IDE as well. However, when using the Micro to communicate with the smartphone, it only sends the phone garbage data. Is there a workaround for this?

  • 1
    \$\begingroup\$ So... which of these unrelated questions did you want answered? \$\endgroup\$ Apr 26, 2014 at 1:12
  • 1
    \$\begingroup\$ About the atmega32u4 sending garbage, I think you just had some other issue. The controller works fine. You can get something they call 'bootloaders' and use them to reprogram your device over UART \$\endgroup\$
    – KyranF
    Apr 26, 2014 at 1:52
  • 1
    \$\begingroup\$ I'm assuming this is the device that flashes the ATMega328's memory. Nope. The bootloader on the ATMega328, is what receives and writes to the ATMega328's memory. The FTDI/ATMega8u2 are simple usb-serial adaptors. The bootloader is special firmware that can modify and run other code, like an OS does on computers. \$\endgroup\$
    – Passerby
    Apr 26, 2014 at 2:03
  • \$\begingroup\$ Ignacio Vazquez-Abrams, can you answer them all? Hah, I'm still new to USB. Just learning as I go. KyranF and Passerby, the bootloader would be something with USB capabilities, correct? I mention the ATMega8u2 as the usb-serial adapter, and wouldn't that be the chip that runs the special firmware? \$\endgroup\$
    – WayneDinh
    Apr 28, 2014 at 0:00

1 Answer 1


Whether or not you need USB OTG depends on the capabilities of your phone. If your phone cannot act as the USB host, you will need the microcontroller to act as the USB host.

There are many PIC devices that have USB hardware (and USB OTG) and can be self-programmed. You may need to be more specific about your needs if you want recommendations for particular microcontrollers.

  • \$\begingroup\$ I'd like a microcontroller with at least 1 I2C, at least 1 ADC, and at least 1 timer. Most of what I've seen offers this from what I've seen. Sorry about the details. I don't know much about USB, and I don't know how else to describe this, but I'd very much like to reprogram my microcontroller through the phone. There's multiple solutions, such as using a bootloader, but I was wondering if it was possible to have one chip do all that. \$\endgroup\$
    – WayneDinh
    Apr 28, 2014 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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