Go Down

Topic: Reporgramming sparkfun openlog (Read 8 times) previous topic - next topic

cyclegadget

Looking at the board, I would guess that the pro-mini 328 would be similar to the open-log board. Try that and if it does work try other 328 board choices.

http://www.sparkfun.com/products/9530
Quote
Reprogrammable ATmega328 using the Arduino IDE

jumpjack

Found in google cache:

IDE: "Arduino Pro or Pro Mini 5V/16MHz w/ ATmega328"
Quote

    Get an FTDI Basic and a crossover board
    Download a new copy of the Arduino IDE version 0022 into a different directory than your normal Arduino installation. For example 'c:\arduino-0022-openlog\'. Note that Arduino v1.0 is not yet supported. Please use v0022.
    Download the OpenLog firmware either directly here or by checking out the repository (more advanced and not necessary for more people)
    Replace the file located here: C:\arduino-0022-openLog\hardware\arduino\cores\arduino\HardwareSerial.cpp with the HardwareSerial.cpp found in the OpenLog firmware zip file that you just downloaded. More information below.
    Open the OpenLog_v2 sketch in this special version of Arduino-OpenLog and compile. (If you experience problems, make sure that Arduino isn't referencing a newer SdFat library in your home/Arduino/libraries folder)
    Connecting the FTDI Basic, then the crossover board, then the OpenLog
    Select the "Arduino Pro or Pro Mini 5V/16MHz w/ ATmega328" under the Arduino Boards tab
    Select the right COM port to connect to the FTDI Basic
    Upload the code
    High five your nearest neighbor


I also found this:




jumpjack

Version 3 of firmware looks quite different; this appears to be the code part I'll have to modify to get analog pins logged:

Code: [Select]
  //Start recording incoming characters
  while(escape_chars_received < setting_max_escape_character) {

    uint8_t n = NewSerial.read(localBuffer, sizeof(localBuffer)); //Read characters from global buffer into the local buffer
    if (n > 0) {

      if (localBuffer[0] == setting_escape_character) {
        escape_chars_received++;

        //Scan the local buffer for esacape characters
        for(checkedSpot = 1 ; checkedSpot < n ; checkedSpot++) {
          if(localBuffer[checkedSpot] == setting_escape_character) {
            escape_chars_received++;
            //If n is greater than 3 there's a chance here where we receive three esc chars
            // and then reset the variable: 26 26 26 A T + would not escape correctly
            if(escape_chars_received == setting_max_escape_character) break;
          }
          else
            escape_chars_received = 0;
        }
      }

      file.write(localBuffer, n); //Record the buffer to the card

      STAT1_PORT ^= (1<<STAT1); //Toggle the STAT1 LED each time we record the buffer

      idleTime = 0; //We have characters so reset the idleTime

      if(timeSinceLastRecord++ > maxLoops) { //This will force a sync approximately every second
        timeSinceLastRecord = 0;
        file.sync(); //Sync the card
      }

    }
    else if(idleTime > MAX_IDLE_TIME_MSEC) { //If we haven't received any characters in 2s, goto sleep
      file.sync(); //Sync the card before we go to sleep

      STAT1_PORT &= ~(1<<STAT1); //Turn off stat LED to save power

      power_timer0_disable(); //Shut down peripherals we don't need
      power_spi_disable();
      sleep_mode(); //Stop everything and go to sleep. Wake up if serial character received

      power_spi_enable(); //After wake up, power up peripherals
      power_timer0_enable();

      escape_chars_received = 0; // Clear the esc flag as it has timed out
      idleTime = 0; //A received character woke us up to reset the idleTime
    }
    else {
      idleTime++;
      delay(1); //Burn 1ms waiting for new characters coming in
    }

  }

jumpjack

I received the device but can't get it working: upon connecting to FTDI and to PC, LEDs blink (in a "random" sequence", the they completely stop blinking; no prompt visible in terminal; I switch off and I extract the card, which put into a card reader shows several log files, all empty, and a log file setting baud rate to 9600 bps, just like my terminal was set.

How can I know the meaning of LEDs sequences? How can I get this thing working?!?

cyclegadget

Quote
Remember, if you get OpenLog stuck into an unknown baud rate, there is a safety mechanism built-in. Tie the RX pin to ground and power up OpenLog. You should see the LEDs blink back and forth for 2 seconds, then blink in unison. Now power down OpenLog and remove the RX/GND jumper. OpenLog is now reset to 9600bps with an escape character of 'ctrl+z' pressed three consecutive times.


https://github.com/sparkfun/OpenLog/wiki/Command-Set

Go Up