# Re-programming PIC microcontrollers with USB through smartphone

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?

• So... which of these unrelated questions did you want answered? – Ignacio Vazquez-Abrams Apr 26 '14 at 1:12
• 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 – KyranF Apr 26 '14 at 1:52
• 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. – Passerby Apr 26 '14 at 2:03
• 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? – WayneDinh Apr 28 '14 at 0:00