Показаны сообщения с ярлыком low power. Показать все сообщения
Показаны сообщения с ярлыком low power. Показать все сообщения

вторник, 20 января 2015 г.

Incorrectly flashed atmega328p back to life

Hi,

I'm new to microprocessor programming and all the related stuff (bootloaders, fuses, ISPs, etc.), so I faced a newbee issue.

Symptom:

I was trying to flash atmega328P with bootloader that will suport 8MHz internal clock (so that I don't need an external oscillator) and can be futher optimized in terms of power consumption. I did everything correctly in terms of wiring USBasp programmer (I was using the following instructable), but then unintentionally (I just knew that LilyPad bootloader would also work) I programmed LilyPad's bootloader which also means LilyPad's fuses, which also means (as I later discovered) usage of external oscillator (nice tool to decode fuses).

So, that brought me all the way to "Yikes invalid signature 000000" with usage of -F option in avrdude, or "avrdude: error: programm enable: target doesn't answer. 1" without it. Different "-B" options (-B250, -B5, etc.) didn't work for me. Chip is just completely silent.

And also "avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0xfc" when I try to talk to the MCU via Serial ports with help of FTDI chip. At least I could see that chip is not dead comletely, it's replying something. Probably abrakadabra and maybe it could be decoded by using a proper avrdude settings, but I tried different baud rates and other settings and nothing worked.

Cause:

MCU just expect an external clock source and just doing nothing without it.

Resolution:

Connect an oscillator. But what if you don't have a spare one? Do it like me:


This is a wireless NRF24L01 board and it has an oscillator on it, just connect board ground (yellow on the photo and PIN1 on this wireless board) to your MCU ground and oscillator lines (green and white) to PIN9 and PIN10 on your atmega328P.

This fixed everything for me, Chip is alive and I can see all fuses, so I was able to reprogram them.

Although it's a little bit ackward - because oscillator is 16Mhz and LilyPad bootloader expects 8Mhz.

Hopefully this post will save some time for someone who faced the same issue.

UPDATE:
Looks like this is only a one part of the puzzle, the other one is protocol issue which I also mentioned above, it is still present after a correct bootloader is flashed.

Apparently the issue is with not very accurate internal oscillator - it just doesn't work with high baud rates for programming. There is a very good and detailed explanation on how to fix this by re-compiling a bootloader to use slower upload speed, I do not have necessary tools to do that, so I do think I'm going to do that, I think for me it's OK to load firmware via the ISP


I was able to confirm that it's working and chip is perfoming properly using its internal oscillator. Then I can install a code that will programmaticaly set slower baud rate if I need to talk to the firmware onboard the atmega chip.

среда, 24 сентября 2014 г.

Low power wireless sensor node, using stock arduino

Hi ardu-people,
There are a lot of posts in the Internet about making a low power arduino projects. However most of them assume you have to do it with custom built arduinos using atmega chips, I think it’s a correct approach, BUT it is still possible to do a low power node even on stock parts. Below are some hacks I discovered or confirmed while creating my low power projects.
  • LED lights
    There are a lot of articles about how much power do they really consume and I can only confirm that, even this tiny power led on your Pro Mini or Nano. I used sharp knife to cut the connection to the power led on my Pro Mini and I desoldered leds on all other peripherals such as radio power converter
  • Power down mode
    For my arduino I was using Narcoleptic library, and PowerDown mode for the nrf24l01 radio. For arduino everything worked perfectly, for radio see below
  • Cut power to peripheral devices
    To save some more power we can disable sensors while arduino and radio are sleeping, simple solution is to power up sensors using arduino pins, set pin to HIGH to enable device, LOW to power it down, this worked perfectly for me. If you see issues with measurements, you may need to add a delay after powering a sensor up. More appropriate solution is to use tip120 or something similar to disable/enable power for all sensors at once.
  • Radio nrf24l01 power down issues
    Unfortunately looks like Nfr chip doesn’t like power manipulations, after several cycles of powering it down with arduino pin as a power source as per above while radio is in the powerdown mode, the radio developed some kind of a power leak and started to consume more (~6ma). Radio is functioning properly, but consuming a lot for a sleep period. I’ve understood that it’s consuming power via MOSI line (pin11), the solution was to set all nrf pins to low and to switch MOSI pin to input mode, don’t forget to switch it back to output when powering everything back up.
Stay tuned, I’ll be working with reducing power consumption with relays, coz they are eating a LOT
Written with StackEdit.