In the new Arduino boards, the traditional FTDI USB-to-serial chip has been replaced with an Atmel ATmega8U2 chip, which has built-in USB. We'd like to do the same on the next APM board, and use this chip to do double-duty: replace the FTDI chip that's now on the IMU shield, and replace the PPM encoder chip (now an Atmega328) that's on the APM board. This will make smaller, simpler, cheaper APM boards for all going forward. And bye-bye FTDI drivers!
There should be enough memory in the Atmega8U2 for both the OptiBoot bootloader and the PPM encoder code. But we need some help in combining them in a way that each won't interfere with the other. We've got a lot of great programmers here at DIY Drones. Who's up for the challenge? (Free boards for any volunteers)
Here are some starting links.
- A tutorial on reprogramming the Atmega8u2 (you need to log into the Arduino forums to see it)
- The APM PPM encoder source code
- Details on how this chip works with Arduino: The ATmega8U2 firmware source code is available in the Arduino repository. The ATmega8U2 is loaded with a DFU bootloader, which can be activated by connecting the solder jumper on the back of the board (near the map of Italy) and then resetting the 8U2. You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can use the ISP header with an external programmer (overwriting the DFU bootloader). See this user-contributed tutorial for more information.
- The Atmega8U2 datasheet. We can move to the 16k or 32k versions if necessary
Comments
Running both the USB and PPM encoder at the same time would not be a problem. The PPM code is driven by external interrupts and hardware timers, making it simpler to integrate. But there are some possible problems. Browsing the code I see that both USB and PPM use timer0. And there might also be some problems with available pins for external interrupts (PCINT) used to read the servo pulses. But with some modifications (mostly to the PPM code) I see no reason why it should not work.
@sebastian
some editing was lost.
i have troubles to understand why a lipo and usb port are challenging with regards to transparent communications.
the only real problem i see is the failsafe behaviour. this has to be carefully designed.
regards
robert
@sebastian:
>should it be able to go into USB mode when running?
should be like you said, else the mcu is programmed in such a way that it is unusable.
>eg plug in your lipo first and then plug in USB, that would be more challanging
the lipo provides power to the system. without having a lipo transparent communications would be impossible.
should USB connection work AFTER initial power up?
The USB Cartell really is a DIY barrior of Entry.
That said, I think there are no barriers legal or technical to making up your own VID out of thin air - and it's a meritorious exercise to prove that USB can be Hacked used under terms which are amenable to DIY.
FDTI chip on oilpan can communicate while ppm encoder is working. This is a "must" for ArduPilot (for example trasnmitter calibration). Also it can be used in bench testing to view parameters and communications. FDTI chip is not used for only programming Arduino programs to mega1280.
Switching between programming mode and ppm mode seems a bit wrong to me. I think new chip must be able to handle both ppm and usb communications simultaneously.
@Chris, One issue that may need to be resolved is USB Vendor ID.
It seems that the Arduino folks have purchased their own USB VID. I do not believe they want 2nd parties using their VID. You may have to buy a USB VID from USB.org if it is worth it (Cost savings of FTDI chip/board amortized over the cost of the VID). This USB VID hurdle is what will probably impede clones of the UNO 8U2 style boards regarding the FTDI replacement, this is just my take on the whole situation, i'm not an expert, maybe others could shed additional more promising insight into this.
From the firmware readme.txt of the repository:
"The production version of the arduino-usbserial firmware uses the Arduino VID. This is only for use with official Arduino hardware and should not be used on other products."
sebastian,
the usb interface is located on the 'small' chip. to talk with the other mcu you are in a need having transparent communications because of the 'missing' link provided by the ftdi chip previously.
more challenging, isn't it :)
robert
I know its more money for the 16k and 32k chips, but that would leave it open to more features with these chips in the future. Like a parallel data logging system or using it for in the look simulation or even I suppose a fail safe RTL if it had a connection to the SPI or I2C lines. I know this is some what optimistic but I would think it can be done.
WylieSt