Random Projects and Comments

Home 2011 (Page 2)

Arduino bootloader for Atmega 1284P

Published on June 26, 2011, by in Arduino, Software.

Arduino Atmega1284p bootloader @8mhz

When I was running into some issues of running out of sram on the atmega 328 I started to look at alternative chips, unfortunally the next chip up in the standard line is the atmega 2560 that is used in the Arduino Mega. Since I was focusing on sram i was mainly concentrating on that aspect for my next chip. The 2560 has 8k sram, which is nice ( compared to the 2k in the 328 ) but I saw the 1284P which has 16k. Before ordering some i looked around to see if anyone had put a arduino bootloader on it, and there were a number of people tinkering with them on the arduino.cc forms so I went for it.

The main issue I was running into was that everyone on the forms wanted to run their chips at 16mhz or 20mhz, way faster then the 8mhz I use. So, this ment no using or even trying the .hex files posted by others. It was pretty clear from this thread, that the direction to go would be a modified Sanguino bootloader. The Sanguino project is a modified arduino stack ( bootloader and wireing library ) for the atmega644 which is the same class of processors and is pin compatible with the 1284.

I had the timing issues with the clock change sorted out pretty early, but was still having issues getting the bootloader to write code into the flash. I could see code going from serial, to buffer, to page buffer, but the page just wasn’t being written by SPM into flash. I believe my main issue was the calculation of where the boot section actually started. When you look at the fuse descriptions they tell you where the boot section should start. For example I am using a 2048 word boot section. What they don’t make clear is that the address they give you ( 0xF800 ) is in words as well, then when you specify the load point to avrdude it is in bytes. This is probably something I should have found sooner, epically since this is the main problem referenced on the forms. So, when you load your application into the wrong section say 0x7C00 it will still run ( assuming your chip is otherwise blank ) since it is the first instruction in memory, but when it hit the SPM call, it will fail since SPM is only allowed in the bootloader section.

Here is the files that ended up working for me, see the form above for where they came from:

  • ATmegaBOOT.c
  • Makefile
  • ATmegaBOOT_1284P-8mhz.hex
  • UPDATE: Broken Links fixed.

     

    New Toy

    Published on March 12, 2011, by in Arduino, Gear.

    DSCN0837
    I got my first digital oscilloscope today, Ended up going with a Rigol DS1052E which seems to get great reviews around the net for a cheap scope. At about $400 it’s not the cheapest one around, but also far from the most expensive. I would say my tipping point was David’s teardown over on eevblog.com where he found exceptional build quality. I’m not going to do a full review, there are plenty of people who have done that, there is probaly more infomation on this scope on the internet then any other.
    (more…)

     

    GPX Library Bug

    Drive-022711
    Ran into a bug in my GPX Library that produced some interesting results. The problem manifested itself as what initially looked like half my data from a test drive being currupted, I initially was thinking it was a memory problem, or data being currupted in the I2C transfer. After looking at the tracks for a while trying to figure out how they got currupted I noticed that the point where the data went from clean to corrupt appeared to be level. When I focused in on these points they were in fact exactly at 43deg latitude. I then noticed a small piece of what looked to be clean data a bit north of the 43deg point. Uppon inspection clean data was at 43.10000 deg latitude. It didn’t take long to realise that I had not padded the fraction part, so 43.00001 was going into the file as 43.1
    Drive-022711-fix
    I went back to the source file and quickly fixed them with ‘sed’ and the result is a much cleaner track.
    Drive-022711-2
    And when over layered with OSM (http://www.openstreetmap.org/) data the track appears to be very accurate!

     

    GPS Logger Hardware v3.1

    DSCN0811
    Bit of a delay moving on this project, mainly because an error in the board I was building to mount the SUP500f GPS to had an error which fried it. Since sparkfun stopped selling SUP500f I had to find another GPS module. I ended up not going with the recommended replacement mainly due to the odd SMT connector in the middle of the device, I have no reason to this but it just felt like that would not work very well. (more…)

     

    GPS Logger Hardware v3

    MainBoard-v3

    Well this is not as much a new version but moving the components off the breadboard. It has always been my intension to use the small prototyping area on the microSD shield for my first revision of the hardware. All in all it has worked out well, the shield is for the most part the exact right size, nothing is too tight, but yet it is still small enough to fit in a small box along with the LiPo battery.

    (more…)

     

    Arduino Producer-Consumer Library v0.1

    As I mentioned in my last post I have cleaned up the Producer-Consumer library I started yesterday. It now includes the Producer class and some examples.

    Technically I believe the Producer::writeBuffer(…) method should report back that the buffer is full so that the Producer stops writing to the buffer until the Consumer has read something from the buffer. The particular use I have for this I am more interested in the most recent values rater then stale values in the buffer so if the buffer overflows it will send a buffer overflow message to the Consumer on the next read, then reset the buffer ( _buffRead = _buffWrite ).

    (more…)

     

    GPS Logger Hardware v2

    Due to some memory and timing issues with my attempt to do everything on a single processor I have split the tasks into two processors. There is one processor dedicated to parsing the info from the GPS as well as any other sensors which will be added later. The other processor takes the input from the sensor processor then builds and writes the GPX file to the microSD card.

    MainBoard-v2
    (more…)

     
    credit
    © Ryan M Sutton, 2015