Comments (17)
What did not work:
- Export the *.hex file using the arduino IDE.
- Convert *.hex to binary using tools like hex2bin
The size of the binary file was too big...
What worked:
- Export the *.hex file using the arduino IDE.
- use: avr-objcopy.exe -I ihex application.hex -O binary application.bin
This way the size of the binary matched the size the IDE showed after compiling.
from miniboot.
What do you mean you use only one line for the I2C communication? I2C requires 2 lines : SDA and SCL. Have a look at the Drivers repo for the EEPROM driver. You can find the sketch there.
from miniboot.
Thanks for your answer. Two lines pulled up via two resistors to Vcc. But in my case connected to one of the atmega pins. I found the hex file but I have trouble using it. Might be my lack of knowledge :-D I would like to adapt the miniboot_uart_to_eeprom_uploader program to my case.
from miniboot.
No ideea what you are talking about. You need 2 lines connected to the atmega : SDA and SCL, not one. In the above link, look at src/ and the files inside. I cannot help you if you do not know what you are doing.
from miniboot.
I think I was not clear on the problem I have. I use 3 lines to get the I2C communication to work. Two lines are SDA and SCL and a 3. line that pulls SDA and SCL high and powers the EEPROM. (similar to this: http://forum.arduino.cc/index.php?topic=296269.0)
Every time when I want to use I2C I pull the 3. line (used to call it power line) high and afterwards start the I2C communication with the eeprom. That is also what I changed in the bootloader code in io.h and init.h.
The problem that I face now is that I haven't been able to get the program and the header written to the EEPROM. When I unterstand the purpose of the "miniboot_uart_to_eeprom_uploader" sketch correctly, its purpose is to write the header into the eeprom followed by the application... And I could not find the sketch where I can make the changes that are necessary (pull the 3. line high etc.).
Thanks for your help!
from miniboot.
I see. Did you look into src/examples/e2prom.ino ?
from miniboot.
Yeah. I changed the sketch to adapt for my case and I was able to upload the binary to the EEPROM. Currently, I use a simple sketch for testing. But starting the sketch from the eerpom is still not working... The status LED blinks a few times, turns off and starts blinking again before it remains on. I'll try to track down the error that I do somewhere along. I checked the Fuses and I thing there that is ok. Size of miniboot.elf is 1942bytes with bootloader_start_address: 0x7800. I'll check next if I make the error somewhere with the timestamps. Thanks for pointing at the eprom.ino.
from miniboot.
The blinking of the led is fine, indicating pages are read from the i2c, checked for CRC and written to the internal flash of the MCU, as implemented here and here.
-
What fuse settings are you using? I'm using a board with an external crystal at 16Mhz with clock divider /8, and the following fusebits: Ext, Hi, Lo : FE DA EF Lock: EF for <=3.3V.
-
It would also be nice to dump the contents of the EEPROM over UART and see what is there.
-
Most people do not get the metadata right in the external EEPROM. Please follow the miniboot instructions to the letter, otherwise you will not be able to reflash. In particular, be sure to update the CRC checksum,
but I guess you already did that correctly since the led is blinking.EDIT: Since there is only one led blinking for both checking the CRC and indicating page writes, it is impossible to distinguish the checking from the writing part. So make sure the CRC is correct in the metadata part, as described in the readme. -
And of course the metadata needs to be updated for the timestamp. This is to prevent reflashing if the code had been previously flashed. Again, the readme is your best friend here.
-
Make sure the sketch does not overflow into the bootloader section, watch out for big sized sketches at around ~30kB (2kB required for miniboot).
from miniboot.
I've improved the readme (commit 5b4377bed556314a5da45dcedc49b7a77f5546fc) to make it clearer that one really needs to update the metadata before they are able to successfully use miniboot. Since I assume you were not using YAT, you didn't get promted to fill in the metadata fields.
from miniboot.
I use the Atmega328p with the internal RC Oscillator and 3.3V supply voltage.
Fusebits:
- Lo: D2
- Hi: DA
- Ext: 06 (BOD 1.8V)
Lock: FE
I do the following:
- I use the arduino IDE to generate a HEX file and use a Hex2Bin converter to get the binary file. (Size ~2kB)
- Upload the e2prom.ino and switch to YAT where I follow the instructions.
- Timestemps: timestamp application < timestamp of write (every time I use new timestamp to avoid problems with old timestamps)
- The CRC32 checksum is generated with the online-tool (like you recommend in readme)
- Length: I used the size of the binary file
- Switch to binary mode and send the file (300 bits per second)
- Burn the miniboot bootloader
I'll check later on the EEPROM content
from miniboot.
While you're at it, check both the contents of the I2C eeprom and the contents of the atmega eeprom. After each reflash, miniboot stores the timestamp from the i2c eeprom in the atmega eeprom. Next time the device boots, a diff between the two is performed. If it is 0, no reflash occurs.
from miniboot.
Your Lock fuse looks wrong (is: 0xFE should be: 0xEF). The current value, 0xFE means "Mode2: further programming disabled".
from miniboot.
First of all, thanks a lot for your help!
I checked the fuses again and I think that is not the issue.
The internal EEPROM was empty and the i2c eeprom had the header stored correctly. I'll try to calculate the CRC32 checksum. I'm still confused about the program size, because the arduino IDE shows 2030 bytes. The hex is 5724 bytes and the bin file is 2670 bytes, which does not match with the value the IDE showed. Do you think the error could be somehow related to how I generated the bin file?
from miniboot.
The size required in the metadata needs to be size of the bin. It is the only thing relevant here, since miniboot writes exactly size amount of bytes to the atmega flash.
I think you're nearly there, you should have a successful reflash very soon! :-)
from miniboot.
I think there is only one way to generate the bin, the way described in the readme:
avr-objcopy.exe -I ihex application.hex -O binary application.bin
from miniboot.
It finally works :-) Thanks a lot for your advice and helping me getting it to work. The issue was related to how I build the binary file...
If you like you can add a simple binary file for other people for testing purposes. The attached files contains a file that starts Serial communication (9600 baudrate) and sends something.
from miniboot.
Glad you finally got it running. I've improved the readme, since I also think the previous wording was poor and misled you. A compiled *.hex and *.bin is of no use on a source-sharing website.
Can you please specify how you've built the binary and why it didn't work? That way other people can benefit too.
from miniboot.
Related Issues (13)
- Makefile won't rebuild HOT 1
- Escape the double quotes HOT 1
- TRAVIS_PULL_REQUEST HOT 8
- Question: Upload sketches from i2c Master with Ethernet webgui to i2c address slaves? HOT 1
- LED just blinks quickly, program never flashes HOT 6
- Switch I2C address with switch HOT 6
- I2C master library is not available anymore HOT 4
- Error in the generated bootloader.h made by the Makefile HOT 10
- Unrecognized option: --distinct_host_configuration=false HOT 1
- Bootloader corrupting code HOT 1
- Issue with large programs HOT 32
- Application fails to load from external memory HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miniboot.