Random Projects and Comments

Home Archive for category "Arduino" (Page 2)

Updated Dev Enviroment

IMAG0618.jpg
In order to get some of the features like serial ports and I2C working on my atmega1284p chips, I needed to update the Sanguino core I have been using. The latest one published is based off arduino 0018 which works ok, but 0018 is before they had added strings and other useful features built into the core. I initially started updating the Sanguino core to 0021 which is what I was using as my dev environment but was having some issues with some conflicts in stdio and stdlib. From looking at the release notes the arduino team moved to register based pre-compiler directives rather then the CPU based ones used before. This method seems to be much better suited to alternative processors and is illustrated well here.

So I moved forward updating the Sanguino core files to 0023 which is the current version on arduino.cc. The modifications are pretty simple, update the pin outs in pins_arduino.c and everything else just falls into place.

I am currently working through testing functions on the atmega1284p I have gotten both UARTs  working with out issue.  I did need to make some modifications to the Wire library to get I2C working.  Just needed to have it add pullups to the correct pins, this could have been done in hardware but I like using the software pullups.  I believe SPI will work, but am still testing that.

Here are the modified Sanguino files which support 644p,1284p,and 1284p @8mhz and also the updated Wire library:

Sanguino-0023r1.zip UPDATED (details): Sanguino-0023r2.zip UPDATED (details): Sanguino-0023r3.zip UPDATED (details):Sanguino-0023r4.zip  UPDATED(details): Sanguino-0101r1.zip
Wire-Sanguino-0023.zip

 

GPS Logger Hardware v4.0

IMAG0620
After having the boards for at least a month I finally built one up.  This board dosn’t really do much new it is basically my GPS logging hardware v3.1 built onto one board.  Since I was building my own boards I opted to use a atmega1284p since I was having issues running out of sram before (though I did clear that up in software).  So there are two atmega1284p processors one to deal with the GPS and sensors, and another to talk to remote sensors as well as build and write the GPX file to the SD card. I also added an accelerometer and gyroscope to add to the data the sensor uC is collecting, I will probaly replace the atmega1284p on the sensor side with a atmega88 if the memory utilization is low enough, the 1284 seems a bit overkill for what it is doing.
(more…)

 

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…)

     

    GPS Logger Hardware v1

    So my next step in my GPS logger project will be to pull the components off the breadboard and build a small prototype to gather some more real world data without needing to be so careful with it. So I figured I would take some time to describe the general layout of the current board.

    SkiGPS-MainBoard
    (more…)

     
    credit
    © Ryan M Sutton, 2015