3
\$\begingroup\$

This question already has an answer here:

I am looking to create a platform similar to Arduino for a side project using an ARM Cortex M4 based microcontroller. The device essentially will communicate with a bunch of sensors on the board and relay that information through a USB Serial Connection to a connected USB host (similar to the Arduino Serial Monitor). I am not using an Arduino because I would like to learn about how to practically prototype a circuit like this.

My question is, what do I have to do to make my microcontroller reprogrammable via a USB connection to a computer like how the Arduino is. I am looking for a hardware explanation like what I need to include in my circuit to accomplish this goal.

Thank you and hopefully my question makes sense.

EDIT: I am looking for possible components that I have to include in my board to allow for native USB programming.

\$\endgroup\$

marked as duplicate by tcrosley, Voltage Spike, ThreePhaseEel, pipe, uint128_t Mar 12 '17 at 17:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Have you looked at the datasheet yet? \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 10 '17 at 16:32
  • \$\begingroup\$ Yes, but I am new to this really, with only a basic electrical engineering education, so I don't really understand it... I just would like a point in the right direction if that is at all possible \$\endgroup\$ – Theodore_Kim Mar 10 '17 at 16:34
  • \$\begingroup\$ Check out this question: electronics.stackexchange.com/questions/165888/… \$\endgroup\$ – Reinstate Monica Mar 10 '17 at 16:35
  • \$\begingroup\$ Ummph. Do a google search for all the folks who use the arduino firmware to make easily reprogrammable embedded projects using just the Atmel processor instead of the whole Arduino. \$\endgroup\$ – JRE Mar 10 '17 at 16:38
  • 2
    \$\begingroup\$ The information you want is in the datasheet (or possibly in related documents). Look for bootloader or similar terms. BTW did you consider using an Arduino Duo? Cortex-M3 instead of your M4, but you can buy them off the shelve. \$\endgroup\$ – Wouter van Ooijen Mar 10 '17 at 18:03
4
\$\begingroup\$

I'd go for Arduino compatible for the first iteration, because Arduino schematics are publically available, so you can use them as a reference, they don't need many extra components and are somewhat forgiving if the voltage regulation isn't perfect. More complex microcontrollers have embedded PLLs that require a very stable supply voltage, usually fed separately, that is a complication you can probably do without for now.

In general, you'd get the datasheets for the components you want to use, which list the requirements for the component to work, and usually also has reference design fragments (because the engineers that designed the component already had a general idea how it would be used).

Typically, you need

  • the microcontroller itself
  • capacitors to stabilize the power supply
  • a regulator to provide the appropriate voltage(s)
  • a crystal as a time source
  • a connector for programming
  • whatever peripherals you want

Most microcontrollers already have a bootloader in ROM to support programming them in-circuit, e.g. via USB DFU or through a serial connection.

For voltage regulation, a linear regulator is easiest to use, but generates quite a bit of heat. Switching regulators are more complex to build and get right, so I'd do that as a separate project (I did that once and optimized from there). If your microcontroller requires multiple voltages, go with an integrated solution that ensures sensible power-up and -down behaviour.

The crystal is a bit tricky to get right, but for me it worked on the first attempt, so it's certainly doable -- keep the connections short and use SMD components.

Other than that, it's fairly simple, because most of the complexity is hidden inside the ICs already.

\$\endgroup\$
  • \$\begingroup\$ Thank you, your hardware explanation was exactly what I was looking for. \$\endgroup\$ – Theodore_Kim Mar 10 '17 at 17:03
12
\$\begingroup\$

You want something called a bootloader. This is code that runs in the micro that can accept new code from externally, like a USB port, and write that to the micro's program memory. Then there also needs to be code that looks at the current program image, the new uploaded one, and decides whether to copy the latter onto the former.

There are a lot more details about bootloaders at What is a boot loader, and how would I develop one?.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the link to that question it answered some of the questions I had about bootloaders and such. \$\endgroup\$ – Theodore_Kim Mar 10 '17 at 17:02

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