-
-
Notifications
You must be signed in to change notification settings - Fork 183
Getting started
When using HoodLoader2 you have to keep one thing in mind: You are using two MCUs. Have a look at this picture:
I will call them I/O MCU (328/2560) and USB MCU (16u2). The I/O MCU is the one you always used before. You can attach shields etc. 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.
What I do with HoodLoader2 is to provide a way to reprogram the 16u2 (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:
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.
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.
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, you can see that boths MCUs are connected via Hardware Serial. You can use this to exchange data between the two boards.
With HID Project 2.2 I will provide a so called HID Bridge that does the job for you. All you have to do is to upload the receiver code to the USB MCU once and then only upload your sketch to the I/O MCU which can control the USB MCU with the normal Keyboard APIs etc. Will do some more documentation when its done...
Copyright (c) 2014-2021 NicoHood
Additional Information