I've built a small board containing an ATMEGA328p and a CC1101 radio chip, both communicating via SPI. Everything works perfect except the Arduino bootloader. On four boards, the bootloader works well only in one of them, the one without the CC1101 IC mounted on it. On the rest of boards (with CC1101), the bootloader gives a lot of errors and rarely complete with "Upload done". However, even with errors, the image seems to upload correctly most of the times.
Anyway, I'm thinking that the serial bootloader is somehow driving the SPI lines and the CC1101 IC is responding to the avr, altering the upload process. In my next design, I'll be adding in-line 1k resistors to CSn, MOSI, MISO and SCK lines in order to isolate the radio chip whenever the SPI lines go into tri-state but I'm wondering if I could do anything else to solve this issue.
Thanks in advance for your ideas!
Can you pull the 328 chip and program it in an UNO or equivalent?
Or otherwise ensure that there is no acivity on the RX/TX lines to interfere with the start up comms with the PC for loading?
Thanks for your reply!
Unfortunately my atmegas are surface mounted so I can not pull them from the board. On the uart side, I'm pretty sure that there is no traffic when I'm running the upload but I can not say the same on the SPI side,
Suggest adding pull-up/pull-down resistors on the SPI bus to hold it safely idle, also that RF chip is 3.3V, what voltage are you running the 328 at when uploading?
Suggest adding pull-up/pull-down resistors on the SPI bus to hold it safely idle
I wanted to avoid unnecessary pull-ups since this is a low power design but I could give it a try I guess.
also that RF chip is 3.3V, what voltage are you running the 328 at when uploading?
The atmega is running at 3.3V too. I'm also using a bootloader for 3.3V/8MHz systems that has proven to work well on different designs, even with SPI comms.
Floating CMOS inputs aren't compatible with very low power! Just make sure the 'normal' state is the one you pull to (so CS bar should be pulled up, SCLK pulled down, etc). Use 47k resistors rather than 1k... Still I'm not sure if this causes the original problem, but it might be sending the RF chip haywire if the inputs gates are oscillating or shooting-through. Sure the 3V3 supply is providing enough current during upload (the FTDI chip only provides 50mA I think, if its an FTDI cable).
You're making very good observations.
There are no floating pins except during the bootloading I think. I'll check the in-line and pull-up/down resistor stuff. I too think that a high impedance output on the SPI bus could be causing the problem. As for the maximum power provided by the FTDI chip I'll check it too. The CC1101 sinks much less than 50 mA but again I don't know about the consumption of the atmega during the upload process.