I am a beginner with regard to micro controllers and electronics.
I have just completed a small learning project consisting of a custom breadboard intended to boot-load ATMegas328 chips, or upload sketches without the boot loader. I have used an MCP2221 to receive the data from USB, which in turn communicates with a dedicated ATMega328 loaded with the ArduinoISP sketch, which then boat-loads a new ATMega328 mounted in a ZIF socket. This all works well, but I cannot load sketches without overwriting the boot loader.
For my next learning project I want to make a custom board to load sketches to an ATMega328 without overwriting the boot loader. I know I can make a simple breadboard Arduino and use an FTDI breakout board, but for the sake of learning I don't want to use a break out. I have considered using MCP2200 but can't find a configuration suitable for the bread board. The MCP2221 that I used in the previous project does not generate a reset signal. SO I am wondering if it is feasible to use a tiny ATMega to intercept the signal before or after the MCP2221 to generate the reset signal for the ATMega328 being programmed. If that is possible what would I be looking for in the data stream to know when to generate the reset signal.
Is this possible? Am I completely off track here?
I am just learning, I know there are simple ways to do this, but I do not want to use a breakout board, for the sake of getting a better understanding of what is going on.
I'd value your comments.
The typical advice for manual upload: if it doesn't start, press the reset button.
Communication between programmer and bootloader typically starts with opening a COM port, which seems to generate the reset signal with USB. On a general COM port some of the RTS/CTS or DSR/DTR signals can be used for this purpose. Then the transmission starts with the verification of the target, until the bootloader responds or a retry count is exceeded. That's another chance to create a reset signal, from the first transitions of RxD/TxD.
So, and please forgive my ignorance, if the ATTiny was listening to the RX/TX from the MCP2221 it would be able to determine when a COM port was being opened, and then issue the reset signal? What would that (opening a COM port) look like? Is that something that can be detected using the Serial library?
I'm not sure about USB details, which also depend on the OS of the USB master (Mac/Win/Linux). In general an USB device is recognized when plugged in, then a MCP2221 it identifies itself as a serial (COM) device or a HID (mouse...) device to the master. Provided that an applicable driver is found for this device, it becomes visible in the device list, so that programs can connect to that device.
The rest depends on the capabilities of such a chip. At least the state information (connected...) should be available, and if it can be programmed, it may be possible to let it create a reset pulse on one of the GPIO pins. Please find out more yourself.
I guess that I2C has to be used for accessing everything except the serial pins RxD/TxD. This means that, if the chip cannot generate a reset signal by itself, a special bootloader is required on the ATTiny, which uses at least an I2C connection. Dunno if then pins remain for the RxD/TxD signals on the ATTiny.
I guess i need to sped some time with the MCP2200 documentation to see what is available. At least I have a better idea of what i need to do. Thank you.
What is different (apart from the brand name) between an MCP2200 and an FTDI cable?
It is very easy to upload programs to an Attiny using SPI. I have put an 8Mhz Atmega 328 on a little breadboard with a few capacitors and it performs the role of an Uno acting as an ArduinoISP. The breadboard connects to the PC with an FTDI cable. I have a 3,3v regulator on the breadboard so I can run the 328 at 3.3v or 5v depending on what the chip being programmed requires. Power for the 328 comes from the FTDI cable, either directly or via the 3.3v regulator.
As far as I understand it, the chip in the FTDI cable and the MCP2200 do similar things. The FTDI cable is an implementation of the FTDI chip, in the same way that I am trying to implement the MCP2221 to enable communication with an ATMega328.
What I am trying to achieve is not simply upload a program, that I can do easily using the FTDI breakout board. What I am trying to do is implement the MCP2221 chip, this is an exercise in understanding how it works more than anything else.
The MCP2221 seems to have 4 "alternate function" pins - what can you do with them? Can one of them be used to represent RTS?
I am not sure, I am new to this, but i think that if one updated the firmware of the MCP2221 then maybe they could be used in that way. See DrDiettrich's post above.
if one updated the firmware of the MCP2221
Sounds like a subject for a MicroChip Forum
Everyone has ignored the question of uploading sketch without losing the boot loader.
In order to achieve this, you have to combine the two.