Skip to content

Getting started

Nico edited this page Aug 15, 2015 · 6 revisions

When using HoodLoader2 you have to keep one thing in mind: You are using two MCUs. Have a look at this picture:

HoodLoader2

I will call them USB MCU (16u2) and I/O MCU (328/2560). The USB MCU is normally used for the USB-Serial communication and not touched by the user. Noone of the Arduino team intended to use it the way I do with HoodLoader2. The I/O MCU is the one you always used before. You can attach shields etc.

What I do with HoodLoader2 is to provide a way to reprogram the USB MCU (with the Arduino IDE as well) and make something useful out of it. This comes with the addition of still being able to reprogram the I/O MCU within bootloader mode. Here is a comparison of both MCUs (32u4 excluded here):

USB MCU I/O MCU
8u2/16u2/32u2 328 Uno, 2560 Mega
USB Functions NO USB Functions
Not shield compatible Shield compatible
CDC Serial (USB), HW Serial1 HW Serial0 (1, 2, 3 Mega)
up to 7 I/O Pins A lot I/O Pins
500b/500b/1kb ram 2kb ram Uno, 8kb ram Mega
8kb/16kb/32kb flash 32kb flash Uno, 256kb flash Mega

You could see it this way: The USB MCU is an independent smaller version of the Arduino Leonardo (less ram, flash, pins etc). And the I/O MCU is just the one you used before. 32u4 support was added with version 2.0.5 which makes HoodLoader2 even more powerful.

So what we are doing here is to program the USB MCU separately with custom code. Both of them are running independent from each other. If you are uploading USB stuff to the USB MCU you cannot blink the LED on pin 13 of the I/O MCU within the same sketch. You'd have to upload and compile two different programs for two different MCUs and switch to bootloader mode again.

2Programs

Therefore you cannot simply control the USB functions of the USB MCU from the I/O MCU. But I guess you want to! You may implement your own connection protocol. If you have a look at the picture above again, you can see that both MCUs are connected via Hardware Serial. You can use this to exchange data between the two boards (use HW Serial1 for the USB MCU). Also see HID Bridge