MYSBootloader for atmega168
pillarama last edited by
Hi, I'm still relatively new to MySensors however it has successfully 100% consumed me for the past few weeks and I'm unsure now how I managed to miss such an amazing project and community until now!! This is my first post so please be gentle!
I have done quite a lot of searching and I don't think I've found this topic discussed before but apologies if I just missed it.
I am aware that atmega168 is considered by many to be of limited use to MySensors due to the limited flash, but unfortunately I accidentally ordered a batch of 168 based pro minis recently, waited ~5 weeks(!) for them to arrive and these are now the majority of what I have spare to use. Due to COVID19 it's becoming much slower and more expensive to source parts like this so I'm making do with what I have....
I've am now actually having good success with the 168 and MySensors - it's certainly forced me to hone my skills in space optimisation but that's a good thing anyway...
I have successfully set up FOTA using the one spare atmega328 pro mini I had left and it's given me a taste of how amazing it is.... so I turned my attention to the 168.
I have succeeded in modifying/building/flashing the MYSBootloader for the 168, it registers against MyController and I can assign a firmware upgrade! This unfortunately is where I've run into the current roadblock. The node apparently begins to download the firmware but I suspect it's failing to write the first block. I guess mostly likely this is because the flash layout on the 168 is unavoidably different and this is tripping up the process of writing the data to flash. I've trawled the code for some hours trying to digest it and figure out what could be wrong but without any feedback from the node to give me clues I'm running out of steam...
I have a few thoughts on why this might be happening and I've spent some time trying to figure it out but unfortunately I'm not knowledgeable enough on the self-programming facility to go much further. Just wondering if someone (@Tekka) ? would be willing to assist me with debugging this?
Thanks and best regards
pillarama last edited by
Ok well I got it working in the end. Apparently my code changes were correct already but it seems I was accidentally setting some fuses wrong when burning it causing the download process to fail. Turns out there's not to many things to change to get this to work. I haven't integrated the changes into a proper selectable build option or anything which would probably be a better patch, however would a patch for my changes to simply convert the code for a 168p be appreciated still as a reference? If so could someone who knows please advise me how best to submit it?
@mfalkvidd What do you recommend he do to make a code submission? It would be a nice contribution, and It might show the way for what needs to be done to get the code working on other atmega chips also.
I have no experience with bootloader code, but as long as it doesn't affect atmega328 it should be fine I guess.
I don't know if the contribution guidelines are applicable for the bootloader code bit reading the guidelines could be a good start.
I bought a few atmega168 by mistake but I think I threw them away. Couldn't fit anyhing useful onto them; ram and flash is very small.
@mfalkvidd Getting it to run on the ATmega328PB seems like it might be worthwhile upgrade. Actually, it's so similar maybe it already does. The atmega328pb is a slightly more capable chip than the atmega328p, and yet (oddly enough) it's priced lower than the atmega328p. It's priced 95 cents/chip from Mouser/digikey in quantity 1, so there's no need to risk getting counterfeit atmega328p's from aliexpress or similar, which would probably cost more anyway.