EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   OpenGauge / MPGuino FE computer (https://ecomodder.com/forum/opengauge-mpguino-fe-computer.html)
-   -   t vago's MPGuino workspace thread, continued (https://ecomodder.com/forum/showthread.php/t-vagos-mpguino-workspace-thread-continued-34733.html)

t vago 01-05-2017 07:25 PM

t vago's MPGuino workspace thread, continued
 
1 Attachment(s)
In the course of modifying the original MPGuino 0.86 code to incorporate the fuel injection correction factor for Chrysler vehicles with returnless fuel systems, I've been fiddling with the code, doing this and that and the other thing.

Since that other thread is really only meant for addressing that issue with Chrysler returnless fuel systems, it became increasingly apparent that a separate thread was needed to describe the other things I have done with the code. So, here it is. (All CPU workload figures assume a 20 MHz processor)

Known Issues (as of 01 March 2017):
  • On the AtMega2560 platform, MPGuino does not always wake up from deep sleep when the engine is started. MPGuino reacts correctly otherwise. Investigation on-going.
  • With the Adafruit RGB LCD module, there is no way to wake up MPGuino from a deep sleep by pressing the 5 input buttons - not without modifying the RGB LCD module itself. The Reset button can still be pressed to wake up MPGuino, if desired. MPGuino still wakes up normally if the engine is started or if it senses the vehicle starting to move.
  • AtMega2560 sometimes freezes up when attempting to upload MPGuino code to it. Issue is with buggy AtMega2560 bootloader, and reflashing the bootloader with Arduino IDE 1.0.4 or later will fix the issue. No workarounds within the MPGuino code itself.
  • FE vs. speed graph shows a lone datum line at an impossibly high speed. Will investigate as time permits.

Hardware Support added (as of 08 February 2017):
  • Support for the Adafruit RGB LCD module with 5-button input. (h/t meelis11)
  • Support for just about any generic 2x16 LCD module that uses a Two Wire Interface (TWI) interface. Tested with a SainSmart IIC/I2C/TWI 1602 Serial LCD Module Display.
  • Support for the Arduino Mega as a hardware platform. (via josemapiro)
  • Support for 5 different buttons via a single wire, while freeing up the TWI (Two-Wire Interface) pins for use for other functionality. (via nickdigger)
  • Support for the Parallax 5-position switch.
  • Support for the Parallax serial UART LCD module. (Minor changes had to be made to the spiffy big number font to enable it to work with the Parallax LCD module - these changes do not appear if the legacy MPGuino LCD display is used).
  • Chrysler returnless fuel injector correction factor, based off of intake manifold pressure. Utilizes existing manifold pressure (MAP) sensor built into the existing engine control system, but requires an additional barometric sensor (in other words, a spare/extra MAP sensor).
  • Support for the TinkerKit! LCD hardware as a commercially-produced MPGuino module, with enhanced 5-button functionality (see above).

Implemented features undergoing testing (as of 25 January 2017):
  • Reduced-power sleep (via meelis11). Deep sleep mode implemented and appears to be working well on JBD board, AtMega2560, and TinkerKit! module. Still need to test on Meelis MPGuino (have to rig up a power circuit for it)

Program Features built into the base MPGuino code (as of 08 February 2017):
  • Dedicated timeouts related to EOC, Idle, Park (engine off/vehicle stopped). Enables quick auto-saving of Current Trip and Tank Trip data. Allows auto-selection of EOC screen and Idle screen, as appropriate, after a programmable length of time has occurred.
  • Menu display system that provides access to added features or to system stored parameters.
  • Reduction of power consumption. MPGuino now consumes between 5 to 20 percent less power during normal operation.
  • On-The-Fly support for Metric vs SAE (or Imperial) readouts. Metric/US functionality has been more tightly integrated into the display coding. Selected stored parameters and parameter labels also reflect the metric parameter setting.
  • 2-second temporary Status Line, with real-time updating of lower LCD data display.
  • Display labels have been changed to be more descriptive, a la OBDuino.
  • Debounced buttons, with a "long-press" feature that effectively doubles the number of addressable button presses.
  • Button shortcuts are also possible. "Long-press" of the right button can now cause the main display to go directly to the next screen (like large Fuel Economy, FE vs. Time, FE vs. Speed, Large Distance to Empty, large Time To Empty, or System Clock)
  • Interface routines now take advantage of the above button enhancement to provide safeguards, such as requiring "long-press" button combinations to reset current and tank trip. Parameter editing has been enhanced with the addition of parameter reversion, and the ability to cancel settings changes instead of saving them to EEPROM.
  • The settings interface has been enhanced to allow stepping back and forth between different stored parameters, without having to go through editing all of them in sequence.
  • Leading spaces instead of zeros (of course).
  • Time values now show hhmmss, where they used to show mmm.ss
  • Inactivity timeout that shuts off LCD backlight when this timout is reached.
  • Ability to display the following calculations for Instant Trip, Current Trip, and Tank Trip.
    • Fuel Economy (MPG or L/K)
    • Speed (MPH or kph)
    • Distance (miles or km)
    • Fuel Consumption Rate (gal/hr or L/hr)
    • Fuel Consumed (gallons or liters)
    • Engine Speed (RPMs)
    • Engine Run Time (hhmmss)
    • Time spent moving (hhmmss)
    • Fuel Remaining (gallons or liters)
    • Distance To Empty (miles or km)
    • Time To Empty (hhmmss)

Optional Compile-Tile Program Features added (as of 25 January 2017):
  • Idle/EOC Tracking - Tracks idle/EOC using separate Instant Idle/EOC Trip, Current Idle/EOC Trip, and Tank Idle/EOC Trip. Current and Tank Idle/EOC Trips are treated identically to Current and Tank Trip (auto-saved/auto-restored/auto-reset) with regard to the base MPGuino code and the other optional features here.
  • Deep Sleep Mode - Reduced-power sleep (via meelis11), which is entered once inactivity timeout has been reached. Not compatible with system clock function.
  • Software Clock - System clock, which is used as a "screen saver" once inactivity timeout has been reached. Not compatible with reduced-power sleep mode.
  • Programmable Current Trip Auto-Reset - Ability to select current trip reset upon wakeup due to running engine only, current trip reset upon wakeup due to button press only, current trip reset upon wakeup due to both running engine or button press, or disable current trip reset upon wakeup.
  • Trip Save - Saving of complete current trip or tank trip data. Current Trip and Tank Trip are auto-saved into EEPROM once inactivity timeout has been reached. Current Trip and Tank Trip are auto-restored from EEPROM, if MPGuino is then switched off and switched back on at some later time.
  • Stored Trip View - Ability to view raw trip data stored in EEPROM.
  • Imperial Gallons - Support for Imperial gallons vs US gallons.
  • Spiffy large numbers have been added from the MPGuino Code Hacks wiki page.
  • Large Fuel Economy - Instant Trip Fuel Economy, Current Trip Fuel Economy, and Tank Trip Fuel Economy large number displays.
  • Large Distance-To-Empty - Instant Trip Distance-To-Empty, Current Trip Distance-To-Empty, and Tank Trip Distance-To-Empty large number displays.
  • Large Time-To-Empty - Instant Trip Time-To-Empty, Current Trip Time-To-Empty, and Tank Trip Time-To-Empty large number displays.
  • Drag Race Mode - (via meelis11), Enables recording 0-30 MPH, 0-60 MPH, and 1/4 mile time. Also records fuel consumption and distance travelled.
  • Partial Refuel - For Partial Refuel, Tank Trip Reset has been replaced with a smaller sub-menu that allows temporary increases in Tank Size by a Partial Refuel amount. Each Partial Refuel amount is additive; the total Partial Refuel amount increases with each partial refuel value entered. It is also possible to reset just the Partial Refuel value by itself, or to reset the Tank Trip and Partial Refuel value together.
  • Easy Fuel Calibration - Eliminated requirement to know or look up microseconds/(gallons or liters) from somewhere on the web. Ability to calculate microseconds/(gallons or liters). # of injectors, reference injector flow rate in cc/min, reference fuel pressure for reference flow rate, and system fuel pressure are used to determine microseconds per unit volume figure. This figure can then be tweaked as necessary, as before.
  • Fuel Cost - Addition of below calculations for Instant Trip, Current Trip, Tank Trip (and Instant Idle/EOC Trip, Current EOC/Trip, Tank Idle/EOC Trip). Fuel Cost per (gallon or liter) is a stored parameter accessible through the Settings screen.
    • Fuel Consumed Cost
    • Remaining Fuel Cost
    • Fuel Cost per distance (money/mile or money/km) - example 0.12 dollars per mile
    • Distance per Fuel Cost (mile/money or km/money) - example 8.33 miles per dollar
    • Fuel Cost per hour (money/hr)
  • Tank and Current trip save/load menu now adds shortcuts to their respective pages for easy pen-and-paper logging.
  • CPU Monitoring - "Long-press" of the center button briefly shows the CPU loading for that page. System display mode added which shows CPU loading, time since power-up, and
  • Editable Display Screens - 8 user-programmable display screens. Any combination of 4 instant, trip, or tank readings may be displayed on any of 8 screens. These combinations are stored in EEPROM.
  • Fuel Economy vs. Time - Bar graph for fuel economy vs. time. Bar graph for differential fuel economy vs. time (a la ScanGauge E)
    http://www.tom-viki.com/spgm/gal/Cars/Projects/p.jpg
  • Fuel Economy vs. Speed - Bar graphs for fuel economy vs. speed, total (tank) time travelled vs. speed, total (tank) distance travelled vs. speed, and total (tank) fuel used vs. speed. Bar graphs are plotted graphically on-the-fly, vs. using a clunky custom font. 15 elements are supported. FE vs. time and dFE vs. time periods are selectable via a single EEPROM parameter. FE vs. speed, fuel rate vs. speed, distance traveled vs. speed, and time spent travelling vs. speed have two EEPROM parameters (lower speed cutoff which is set at a default of 25 MPH, and speed bar length which is set at a default of 5 MPH).
  • JSON Output Logging - JSON output capability to show a more capable output screen via Raspberry PI or similar (via skybolt). Sample output looks like this:

    http://www.tom-viki.com/spgm/gal/Car...put_HQn0xt.gif

    Not compatible with serial data logging on Legacy MPGuino hardware.
  • Serial Data Logging - MPGuino spits out 5 parameters to the serial output port while active, 2 times a second. A user-programmable stored parameter allows enabling or disabling of serial data logging. Not compatible with JSON output logging on Legacy MPGuino hardware.

Technical Features added (as of 08 February 2017):
  • MPGuino now consumes less power to operate, taking advantage of the built-in ability to turn on/off various hardware modules within the AVR chip that MPGuino runs on.
  • Interrupts for injector capture and VSS capture have been optimized for speed. This code can now easily handle VSS pulse-trains that come from an ABS wheel speed sensor.
  • The acceleration test (drag race) function operates completely independently of the display routines.
  • Interrupt driven, buffered LCD character output. The LCD buffer is processed through the freewheeling ADC interrupt handler, which now causes LCD character processing to be transparent to the display update loop.
  • Interrupt driven, buffered serial character output. Serial output is now transparent to the display update loop. Serial output can be enabled or disabled via a dedicated parameter, if desired.
  • Interface coding has been re-written so that any display mode (primary display, clock set, settings edit, parameter edit, trip save/retrieval, or trip raw data view) will reliably allow fuel readings to be collected and updated, and serial logging data to be output (if selected), regardless of mode. The inactivity timeout function also works, regardless of mode.
  • Parameters can now be variable length, whereas before they were all 32-bit numbers. Parameters may be sized from 1 bit to 32 bits in length. The parameter entry/editing routine enforces this specified length. The EEPROM routines have been modified to read and write these variable length parameters along byte boundaries.
  • Arrays, consisting of strings and characters and program pointers, have all been moved into Flash memory, as opposed to RAM. This has freed up some 200 bytes of RAM.
  • Fuel injector pulse measurement has been made more robust. Two separate rationality checks have been added.
  • Display routines were re-written to separate low-level LCD hardware support from higher-level character output. A common text streaming module handles string and character output, and can output to multiple output devices. This should make it easier to modify the code to support alternate display devices.
  • A fully functional TWI interface library was added, based off the twi.c library for Arduino. MPGuino itself could be configured as a slave TWI device, with a little extra coding. The TWI interface plays nicely with the rest of the MPGuino interrupt infrastructure, and allows for TWI input button pressing and output interfacing in a manner transparent to the main loop.

Technical 64-bit math specific features added (as of 25 January 2017):
  • 64-bit math routines are all written in bytecode that is interpreted by a 64-bit pseudoprocessor that I've named SWEET64. All of the 64-bit math routines have been shrunk by about 70%, compared to the original code.
  • CPU workload per display update loop is now between 1.15% and 11.3%.
  • Portions of the SWEET64 64-bit pseudoprocessor have been re-written in assembly language, to speed up 64-bit shifts, adds, and condition tests. Minor portions of the rest of the code have also been re-written in assembly language.
  • 64-bit division has been re-written to gain speed.
  • Time-to-empty, distance-to-empty, and idle-time-to-empty values have been added. Engine speed (RPM) value has also been added. Time-to-Empty is accurate to the second, and Distance-to-Empty is accurate to 1/10th of a mile/kilometer.
  • The decimal number output function now uses SWEET64 to perform conversions from 64-bit numbers into strings. The function can output 0 through 3 decimal places (dependent on the value to be output). Distance and speed values now have one decimal place, and engine speed and remaining available RAM have no decimal places.

Features in progress (as of 08 February 2017):
  • Coastdown variable determination. Underlying data capture mechanism in place. Currently working on adding matrix math support into SWEET64.
  • Add user-definable support for two separate output pins, that can either drive LEDs (as described in the MPGuino Code Hacks), or be used as a variable voltage source for external gauges. Currently coding SWEET64 bytecode routines to support variable voltage output.
  • Add alert displays for up to 4 different programmable monitored variables. Currently modifying display code to support this feature.

Features to be added (as of 13 March 2017):
  • Easy method for performing VSS and fuel calibration
  • Addition of RTC support. Two-Wire Interface code has been written, needs testing for master receiver. Once done, should be a simple matter to read in clock data from the RTC module I own.
  • System date setting, in conjunction with system time. Possibly limited just to adding day of week.
  • Addition of vehicle battery voltage display (via meelis11)
  • Addition of SPI communications.
  • A-B comparison mode for saved trip/tank data, based off of fuel rate vs. speed graphs. Debugging of bar graph code is in progress.
  • ?

The attached source code was developed to be copied and pasted into an Arduino 1.6.4 IDE window.

Also, the code is configured to work on base legacy MPGuino board - a 16 MHz AtMega328 with the traditional MPGuino 3 direct-wired pushbuttons and 2x16 character LCD screen. Make changes to the "#define" section, beginning at line 246, as needed, to fit your configuration.

If you use the AVR command-line tools, use these settings for setting the programmable fuses to ensure that your MPGuino will work:
Quote:

Originally Posted by Ettore_M (Post 504940)
lfuse:0xf7 hfuse:0xd9 efuse:0x07


Ardent 01-05-2017 07:50 PM

Quote:

Originally Posted by t vago (Post 531318)
  • Reduced-power sleep

That's on my wish list!

josemapiro 01-06-2017 01:39 PM

Hi t vago as a lot of work to do.

Quote:

Originally Posted by t vago (Post 531318)
[*]Addition of vehicle battery voltage display (via meelis11)

Regarding the battery voltage, it was good to have the information when starting and not only the battery but also the voltage drop when starting the engine and the voltage with the engine running.
Indicating whether the condition of the battery and the alternator are in good condition.

Thanks
José Rodrigues

sallen 01-07-2017 10:49 AM

Hey man - treid the 5-1-17 version for 250miles using the imperial define and it has a time bug. The MPH seem spot on, but it clocks up the miles significantly slower than the odo.

System clock is way out too and won't let me set it either so perhaps it's a related issue. E.g. it knows the miles part of MPH but is getting the Hour part wrong.

t vago 01-07-2017 12:27 PM

Go back to around line 246 and change the clock frequency from 20 to 16.

sallen 01-07-2017 12:57 PM

Awesome - sorry probs could've worked that out as I'm using a nano as my arduino.

I still can't set the system time tho.

josemapiro 01-07-2017 02:11 PM

Hi t vago
I've been updating and found that the new version does not allow you to change the number of injectors.
In setting the number changes but then shows the previous number which is 6.

Thanks
José Rodrigues

t vago 01-07-2017 10:12 PM

Quote:

Originally Posted by Ardent (Post 531321)
That's on my wish list!

I put in some basic stuff that actually idles the CPU when MPGuino is active and is not actually calculating anything or capturing any signal. It should reduce power consumption somewhat.

Quote:

Originally Posted by sallen (Post 531432)
Awesome - sorry probs could've worked that out as I'm using a nano as my arduino.

I still can't set the system time tho.

System time edit bug was due to a faulty re-write of the display code, and has been reverted. Try it now.
Quote:

Originally Posted by josemapiro (Post 531440)
Hi t vago
I've been updating and found that the new version does not allow you to change the number of injectors.
In setting the number changes but then shows the previous number which is 6.

Logic fault was found in the parameter save section, and has been fixed. Try it now.

Ardent 01-08-2017 11:01 AM

Quote:

Originally Posted by t vago (Post 531483)
I put in some basic stuff that actually idles the CPU when MPGuino is active and is not actually calculating anything or capturing any signal. It should reduce power consumption somewhat.

The issue I've seen is parasitic drain during prolonged non-use. I thought perhaps there was a deeper sleep mode.

I try to remember to unplug it after the EEPROM write.

josemapiro 01-08-2017 11:29 AM

Hi t vago
Thanks for the correction, now you can make the change.
But in the settings when switching to the metric system, it does not change to Microsec/L.
The previous version also had the problem, but when I informed it, I checked that I already had a new version, I thought the new version would correct the problem, but no.

Thanks
José Rodrigues

t vago 01-08-2017 01:43 PM

Quote:

Originally Posted by Ardent (Post 531505)
The issue I've seen is parasitic drain during prolonged non-use. I thought perhaps there was a deeper sleep mode.

I try to remember to unplug it after the EEPROM write.

This idle mode may yet provide some savings. Current, when MPGuino goes to sleep, all it really does is display the system time and turns off the backlighting, also also stops transmitting serial logging /JSON data. Other than that, it still sits there and "spins its wheels" when it's not actually displaying or calculating things. Idle mode is intended to stop the CPU when MPGuino isn't required to do anything that resembles calculation, which is a surprisingly large fraction of the time it's powered up.

I am considering how to implement deep sleep mode, but you would lose the ability to wake up the MPGuino if you have 5-button analog switches or the Parallax switch assembly or buffered LCD. I might could work around buffered LCD, but analog/Parallax switch support is a show stopper.

I will likely end up making deep sleep incompatible with analog/Parallax switches. That is, you can have either one or the other, but not both.

Oh, and deep sleep would also be incompatible with the built-in clock display - the onboard clock would simply stop once MPGuino entered deep sleep.

Quote:

Originally Posted by josemapiro (Post 531506)
Hi t vago
Thanks for the correction, now you can make the change.
But in the settings when switching to the metric system, it does not change to Microsec/L.
The previous version also had the problem, but when I informed it, I checked that I already had a new version, I thought the new version would correct the problem, but no.

I actually gave up on autoconverting and storing that microseconds/gallon figure as a parameter, seeing as how all of the listed vehicles on the MPGuino Wiki listed their numbers as microseconds/gallon, and it would have led to more confusion once people started using Imperial gallons vs US gallons.

Besides, the number is already autoconverted inside the code itself. It just isn't stored as a parameter.

josemapiro 01-08-2017 02:21 PM

Hi t vago
When I speak in the metric system I am not referring to the imperial gallon, but to liters, which is the international norm "SI".
The MPGuino used to do the conversion before and it was all in liters when switching to the metric system, now it does not, it changes all the others to liters less microseconds/L, I think how it worked before, because it avoids converting liters to US Gallon.

Thanks
José Rodrigues

t vago 01-08-2017 03:36 PM

Quote:

Originally Posted by josemapiro (Post 531522)
Hi t vago
When I speak in the metric system I am not referring to the imperial gallon, but to liters, which is the international norm "SI".
The MPGuino used to do the conversion before and it was all in liters when switching to the metric system, now it does not, it changes all the others to liters less microseconds/L, I think how it worked before, because it avoids converting liters to US Gallon.

The code still correctly displays fuel consumption in liters, when metric mode is selected.

I took out the storing of microseconds/liter, because this unit is not used on the MPGuino Wiki page.

I did this because it would be confusing for people to list microseconds per US gallon, microsecond per liter, and microsecond per Imperial gallon. I decided that only one unit should ever be used, and since the MPGuino Wiki already uses only microseconds per US gallon, that is what I would also use.

I do not understand why this should even be a problem, since MPGuino can now calculate this figure directly from injector size and the number of injectors.

josemapiro 01-08-2017 04:26 PM

Hi t vago

Quote:

Originally Posted by t vago (Post 531528)
I do not understand why this should even be a problem, since MPGuino can now calculate this figure directly from injector size and the number of injectors.

What are the values that he uses to do this calculation.

Thanks
José Rodrigues

Ardent 01-08-2017 05:39 PM

Regarding deep sleep: like the positives, unaffected by the negatives.

t vago 01-08-2017 06:14 PM

Quote:

Originally Posted by josemapiro (Post 531533)
What are the values that he uses to do this calculation.

value = (number of fuel injectors) * (fuel flow rate of each injector, in cc/min)

value = value * sqrt( (vehicle fuel pressure) / (injector test flow fuel pressure) )

value = 1 / value

value = value * 3785 cc/gallon

value = value * 60 sec/min

value = value * 1000000 microseconds/sec

Quote:

Originally Posted by Ardent (Post 531540)
Regarding deep sleep: like the positives, unaffected by the negatives.

Yah, I kind of figured the same. Once I debug the accel test module, I'll work on adding deep sleep to the code.

josemapiro 01-08-2017 06:48 PM

Hi t vago

Quote:

Originally Posted by t vago (Post 531547)
value = value * sqrt( (vehicle fuel pressure) / (injector test flow fuel pressure) )

Knowing the first value, this value is not necessary correct.
If I need to, how do I get it?

Thanks
José Rodrigues

t vago 01-09-2017 12:09 PM

Quote:

Originally Posted by josemapiro (Post 531550)
Knowing the first value, this value is not necessary correct.
If I need to, how do I get it?

There are two stored parameters before the "# of cylinders" parameter.

The first is "P(Fuel)" and it can be in either psig *1000 or in Pa. The second is "P(Ref)" and it can also be in either psig *1000 or in Pa.

In the code I have attached at the beginning of this thread, I have both of those values set to 43500 psig * 1000, so that square root portion will evaluate to 1.

P(ref) should remain at 43500 psig * 1000, because that is the pressure that fuel injectors are normally flow-tested at, to get their flow ratings.

P(Fuel) is the fuel pressure of your vehicle, and should be set accordingly.

josemapiro 01-09-2017 04:34 PM

Hi t vago
It's great I had no idea it worked like that.
One change that I believe takes some confusion is in InjSize mL/min which could have an InjFlow text and use cc/min which seems to be more common in the specs of the injectors, what do you think.
Another question, the InjSize mL/min does not allow a decimal number in my case, the injector has a value of 191.8 cc/min, I have to put "192" correct.

Quote:

Originally Posted by t vago (Post 531547)
value = value * 1000000 microseconds/sec

I think you mean microseconds/USGal

Thanks
José Rodrigues

t vago 01-10-2017 07:16 PM

Worked over the timer scheduler a bit, toward the goal of enabling deep sleep mode. I estimate that I reduced the code's power consumption by anywhere between 20% and 40%, with a given configuration.

Quote:

Originally Posted by josemapiro (Post 531614)
Hi t vago
It's great I had no idea it worked like that.

I figured this would be a useful addition to MPGuino. That, along with some sort of calibration mode for both distance and fuel, would go far in making MPGuino more user-friendly.

Quote:

Originally Posted by josemapiro (Post 531614)
One change that I believe takes some confusion is in InjSize mL/min which could have an InjFlow text and use cc/min which seems to be more common in the specs of the injectors, what do you think.

Good idea. Done.

Quote:

Originally Posted by josemapiro (Post 531614)
Another question, the InjSize mL/min does not allow a decimal number in my case, the injector has a value of 191.8 cc/min, I have to put "192" correct.

Yes, that is correct. With the number you gave, and assuming 4 cylinders, the two values differed by about 3 million microseconds/USgal.

I may have to increase the precision of this injSize parameter, such as making the units cc/min * 1000.

Quote:

Originally Posted by josemapiro (Post 531614)
I think you mean microseconds/USGal

Nope.

step 1: value is in cc/min

step 2: value is in cc/min

step 3: value is in min/cc

step 4: value is in min/gal

step 5: value is in sec/gal

step 6: value is in microseconds/gal (value = value * 1000000 microseconds/sec)

josemapiro 01-12-2017 06:15 PM

Hi t vago
Thanks for the help calculating, I created a file in excel to help in some calculations, if I can check if everything is working well thank you and can make some corrections if necessary.
The file is here.https://mega.nz/#!hZEDnJpQ!hJ1LKufAT...xUxGz6fUnj2lO4

This last version of MPGuino I am not able to upload the code for the arduino, it starts but then it takes a lot of time and in the end it gives an error but does not specify what it is, maybe it is deep sleep before concluding, because it takes a lot of time for later give the error.

Thanks
José Rodrigues

t vago 01-13-2017 12:37 AM

1 Attachment(s)
Quote:

Originally Posted by josemapiro (Post 531903)
Thanks for the help calculating, I created a file in excel to help in some calculations, if I can check if everything is working well thank you and can make some corrections if necessary.

Your spreadsheet looks good. I did make a couple of corrections. One was with the labels on your microseconds/gal section, and the other was with your SI correction factor section.

Quote:

Originally Posted by josemapiro (Post 531903)
This last version of MPGuino I am not able to upload the code for the arduino, it starts but then it takes a lot of time and in the end it gives an error but does not specify what it is, maybe it is deep sleep before concluding, because it takes a lot of time for later give the error.

Can you post a screenshot of your Arduino IDE? That would help me in troubleshooting.

I have also included an alpha version of the latest code. I am not sure whether the LCD works, because I am trying to get the deep sleep code working and I need to move the LCD part of the code away from the ADC. I was using ADC for LCD delay generation, and now I am using timer0.

josemapiro 01-13-2017 01:33 PM

Hi t vago
Quote:

Originally Posted by t vago (Post 531941)
I did make a couple of corrections. One was with the labels on your microseconds/gal section, and the other was with your SI correction factor section.

Thank you for the correction.

This new version also has the same problem, the compilation is done without errors when it starts to send it is slow and does not send.
This is the information it shows.
Code:

Arduino: 1.8.0 (Windows 10), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

E:\arduino-1.8.0-windows\arduino-1.8.0\arduino-builder -dump-prefs -logger=machine -hardware E:\arduino-1.8.0-windows\arduino-1.8.0\hardware -tools E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder -tools E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -built-in-libraries E:\arduino-1.8.0-windows\arduino-1.8.0\libraries -libraries C:\Users\josem\OneDrive\Documentos\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0042 -ide-version=10800 -build-path C:\Users\josem\AppData\Local\Temp\arduino_build_882241 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -verbose C:\Users\josem\Desktop\MPGuino.ino\MPGuino.ino.ino
E:\arduino-1.8.0-windows\arduino-1.8.0\arduino-builder -compile -logger=machine -hardware E:\arduino-1.8.0-windows\arduino-1.8.0\hardware -tools E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder -tools E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -built-in-libraries E:\arduino-1.8.0-windows\arduino-1.8.0\libraries -libraries C:\Users\josem\OneDrive\Documentos\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0042 -ide-version=10800 -build-path C:\Users\josem\AppData\Local\Temp\arduino_build_882241 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -verbose C:\Users\josem\Desktop\MPGuino.ino\MPGuino.ino.ino
Using board 'mega' from platform in folder: E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr
Using core 'arduino' from platform in folder: E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr
Detecting libraries used...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "nul"
Generating function prototypes...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\preproc\ctags_target_for_gcc_minus_e.cpp"
"E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\preproc\ctags_target_for_gcc_minus_e.cpp"
A compilar o rascunho...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp.o"
Compiling libraries...
Compiling core...
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_pulse.S.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WInterrupts.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\hooks.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_analog.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_digital.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_pulse.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_shift.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\CDC.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial0.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial1.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial2.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial3.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\IPAddress.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\PluggableUSB.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Print.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Stream.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Tone.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\USBCore.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WMath.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WString.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\abi.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\main.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\new.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\core.a
Linking everything together...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560  -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp.o" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/core\core.a" "-LC:\Users\josem\AppData\Local\Temp\arduino_build_882241" -lm
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0  "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.eep"
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-objcopy" -O ihex -R .eeprom  "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex"
O rascunho usa 22174 bytes (8%) do espaço de armazenamento do programa. O máximo é 253952 bytes.
Variáveis globais usam 1286 bytes (15%) de memória dinâmica, restando 6906 bytes para variáveis locais. O maximo é 8192 bytes.
E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avrdude -CE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM4 -b115200 -D -Uflash:w:C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex:i

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/etc/avrdude.conf"

        Using Port                    : COM4
        Using Programmer              : wiring
        Overriding Baud Rate          : 115200
        AVR Part                      : ATmega2560
        Chip Erase delay              : 9000 us
        PAGEL                        : PD7
        BS2                          : PA0
        RESET disposition            : dedicated
        RETRY pulse                  : SCK
        serial program mode          : yes
        parallel program mode        : yes
        Timeout                      : 200
        StabDelay                    : 100
        CmdexeDelay                  : 25
        SyncLoops                    : 32
        ByteDelay                    : 0
        PollIndex                    : 3
        PollValue                    : 0x53
        Memory Detail                :

                                  Block Poll              Page                      Polled
          Memory Type Mode Delay Size  Indx Paged  Size  Size #Pages MinW  MaxW  ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          eeprom        65    10    8    0 no      4096    8      0  9000  9000 0x00 0x00
          flash        65    10  256    0 yes    262144  256  1024  4500  4500 0x00 0x00
          lfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          hfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          efuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          lock          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          calibration    0    0    0    0 no          1    0      0    0    0 0x00 0x00
          signature      0    0    0    0 no          3    0      0    0    0 0x00 0x00

        Programmer Type : Wiring
        Description    : Wiring
        Programmer Model: AVRISP
        Hardware Version: 15
        Firmware Version Master : 2.10
        Vtarget        : 0.0 V
        SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex"
avrdude: writing flash (22174 bytes):

Writing | #####avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
#avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
Ocorreu um erro a enviar o rascunho

Thanks
José Rodrigues

t vago 01-13-2017 01:57 PM

Quote:

Originally Posted by josemapiro (Post 532001)
Code:

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex"
avrdude: writing flash (22174 bytes):

Writing | #####avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
#avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
Ocorreu um erro a enviar o rascunho


Yah, my Mega2560 did that a week ago. It would not accept any Arduino program, regardless of what I did. I had to reprogram the bootloader onto it, to make it work again.

I used one of these:

Pololu USB AVR Programmer

to reflash my Mega2560 with its bootloader.

My Mega2560 is my primary test platform, followed by my TinkerKit! LCD module. I was finally able to test the LCD code, and it works... but it is incredibly slow. I am going to revert to using the ADC interrupt for the LCD timing.

josemapiro 01-13-2017 02:57 PM

Hi t vago
There must be some problem with the code because if I use the version "20170107 - mpguino_1.94_tav.c" it works normally as you can see below, this error only happened in these last two versions.
Code:

E:\arduino-1.8.0-windows\arduino-1.8.0\arduino-builder -dump-prefs -logger=machine -hardware E:\arduino-1.8.0-windows\arduino-1.8.0\hardware -tools E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder -tools E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -built-in-libraries E:\arduino-1.8.0-windows\arduino-1.8.0\libraries -libraries C:\Users\josem\OneDrive\Documentos\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0042 -ide-version=10800 -build-path C:\Users\josem\AppData\Local\Temp\arduino_build_882241 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -verbose C:\Users\josem\Desktop\MPGuino.ino\MPGuino.ino.ino
E:\arduino-1.8.0-windows\arduino-1.8.0\arduino-builder -compile -logger=machine -hardware E:\arduino-1.8.0-windows\arduino-1.8.0\hardware -tools E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder -tools E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -built-in-libraries E:\arduino-1.8.0-windows\arduino-1.8.0\libraries -libraries C:\Users\josem\OneDrive\Documentos\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0042 -ide-version=10800 -build-path C:\Users\josem\AppData\Local\Temp\arduino_build_882241 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr -verbose C:\Users\josem\Desktop\MPGuino.ino\MPGuino.ino.ino
Using board 'mega' from platform in folder: E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr
Using core 'arduino' from platform in folder: E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr
Detecting libraries used...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "nul"
Generating function prototypes...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\preproc\ctags_target_for_gcc_minus_e.cpp"
"E:\arduino-1.8.0-windows\arduino-1.8.0\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\preproc\ctags_target_for_gcc_minus_e.cpp"
A compilar o rascunho...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR  "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\cores\arduino" "-IE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\arduino\avr\variants\mega" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp" -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp.o"
Compiling libraries...
Compiling core...
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_pulse.S.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WInterrupts.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\hooks.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_analog.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_digital.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_pulse.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\wiring_shift.c.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\CDC.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial0.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial1.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial2.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\HardwareSerial3.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\IPAddress.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\PluggableUSB.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Print.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Stream.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\Tone.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\USBCore.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WMath.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\WString.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\abi.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\main.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\new.cpp.o
A usar o ficheiro previamente compilado: C:\Users\josem\AppData\Local\Temp\arduino_build_882241\core\core.a
Linking everything together...
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560  -o "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241\sketch\MPGuino.ino.ino.cpp.o" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/core\core.a" "-LC:\Users\josem\AppData\Local\Temp\arduino_build_882241" -lm
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0  "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.eep"
"E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avr-objcopy" -O ihex -R .eeprom  "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.elf" "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex"
O rascunho usa 19920 bytes (7%) do espaço de armazenamento do programa. O máximo é 253952 bytes.
Variáveis globais usam 1296 bytes (15%) de memória dinâmica, restando 6896 bytes para variáveis locais. O maximo é 8192 bytes.
E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/bin/avrdude -CE:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM4 -b115200 -D -Uflash:w:C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex:i

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "E:\arduino-1.8.0-windows\arduino-1.8.0\hardware\tools\avr/etc/avrdude.conf"

        Using Port                    : COM4
        Using Programmer              : wiring
        Overriding Baud Rate          : 115200
        AVR Part                      : ATmega2560
        Chip Erase delay              : 9000 us
        PAGEL                        : PD7
        BS2                          : PA0
        RESET disposition            : dedicated
        RETRY pulse                  : SCK
        serial program mode          : yes
        parallel program mode        : yes
        Timeout                      : 200
        StabDelay                    : 100
        CmdexeDelay                  : 25
        SyncLoops                    : 32
        ByteDelay                    : 0
        PollIndex                    : 3
        PollValue                    : 0x53
        Memory Detail                :

                                  Block Poll              Page                      Polled
          Memory Type Mode Delay Size  Indx Paged  Size  Size #Pages MinW  MaxW  ReadBack
          ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
          eeprom        65    10    8    0 no      4096    8      0  9000  9000 0x00 0x00
          flash        65    10  256    0 yes    262144  256  1024  4500  4500 0x00 0x00
          lfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          hfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          efuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          lock          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          calibration    0    0    0    0 no          1    0      0    0    0 0x00 0x00
          signature      0    0    0    0 no          3    0      0    0    0 0x00 0x00

        Programmer Type : Wiring
        Description    : Wiring
        Programmer Model: AVRISP
        Hardware Version: 15
        Firmware Version Master : 2.10
        Vtarget        : 0.0 V
        SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex"
avrdude: writing flash (19920 bytes):

Writing | ################################################## | 100% 3.21s

avrdude: 19920 bytes of flash written
avrdude: verifying flash memory against C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex:
avrdude: load data flash data from input file C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex:
avrdude: input file C:\Users\josem\AppData\Local\Temp\arduino_build_882241/MPGuino.ino.ino.hex contains 19920 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.56s

avrdude: verifying ...
avrdude: 19920 bytes of flash verified

avrdude done.  Thank you.

Final version of the spreadsheet https://mega.nz/#!ccNBRToC!-hUaaizAv...EDtY_zK2OZ7cFU

Thanks
José Rodrigues

t vago 01-13-2017 03:49 PM

Quote:

Originally Posted by josemapiro (Post 532014)
Hi t vago
There must be some problem with the code because if I use the version "20170107 - mpguino_1.94_tav.c" it works normally as you can see below, this error only happened in these last two versions.

Can you tell me (or copy and paste into your reply) what all options you selected? I cannot duplicate your problem, either with the 20170107 version or the version I am currently working on. It might be an issue with your Arduino IDE, as I notice you're using 1.8.0 for Windows. I am using version 1.6.12 for Windows and 1.0.5+dfsg2-4 for Linux.

josemapiro 01-13-2017 04:22 PM

Hi t vago
Quote:

Originally Posted by t vago (Post 532018)
Can you tell me (or copy and paste into your reply) what all options you selected? I cannot duplicate your problem, either with the 20170107 version or the version I am currently working on. It might be an issue with your Arduino IDE, as I notice you're using 1.8.0 for Windows. I am using version 1.6.12 for Windows and 1.0.5+dfsg2-4 for Linux.

I select all the code copy and paste it in the arduino IDE and retreat the commented in #define ArduinoMega2560 true.
I use the portable version 1.8.0 of the arduino IDE, I already tested with the portable version 1.6.0 and it happens the same.
https://www.arduino.cc/download_hand....0-windows.zip

Thanks
José Rodrigues

t vago 01-13-2017 06:40 PM

Quote:

Originally Posted by josemapiro (Post 532028)
Hi t vago

I select all the code copy and paste it in the arduino IDE and retreat the commented in #define ArduinoMega2560 true.
I use the portable version 1.8.0 of the arduino IDE, I already tested with the portable version 1.6.0 and it happens the same.

Can you reflash back to the 20170107 version and get it to work again?

josemapiro 01-13-2017 06:50 PM

Quote:

Originally Posted by t vago (Post 532065)
Can you reflash back to the 20170107 version and get it to work again?

Yes without problems, the information I put in the previous post was made after having had the error, and as you can see was done successfully.
I think there is something in the code that disables anything and does not premise communication between the Arduino IDE and the Arduino Mega.

Thanks
José Rodrigues

t vago 01-13-2017 07:50 PM

Quote:

Originally Posted by josemapiro (Post 532066)
Yes without problems, the information I put in the previous post was made after having had the error, and as you can see was done successfully.
I think there is something in the code that disables anything and does not premise communication between the Arduino IDE and the Arduino Mega.

I am going to do an experiment here, and edit this post with my results.

https://youtu.be/XLfNDOeNIw4

I can find nothing wrong. I used the most recent version of this code as of this post, and I used the 1.8.0 IDE to upload it to my AtMega 2560.

The code, with the reversion to the fast LCD code, was also successfully tested on my TinkerKit! LCD module.

I honestly can't think of any situation where the Arduino IDE could not upload a sketch it successfully compiled, because of something inside the compiled sketch itself.

josemapiro 01-14-2017 08:08 AM

Hi t vago
This new version holds the error.
Your procedure is the same as mine, the only differences are in the LCD selection and buttons your selection is different, one thing that is also different and may justify the problem is that I use the Arduino Mega without anything connected only with the USB cable, it is only speculation but what you have connected do not let the arduino fall asleep and allow to complete the recording.
Because this problem only started after infusing deep sleep into the code I think that's the problem.

Thanks
José Rodrigues

meelis11 01-14-2017 05:31 PM

Hi,
I am Meelis, I have planned lately that I publish my GIT repository and/or maybe we can merge our codes. Seems that you are already taking features from my code and implementing them to your version. I dont mind, my plan was to suggest merging anyway :)


I dont know how much you use my code, but at least you use some of features I added (referencing them "via Meelis11").
I can say that if you implement all features to your code, them maybe I can ditch mine and there is only one code :)
Your code seem so low level so I am not sure that I can contribute (assembler and low level pure C)

How many mpguino code "forks" are out there that can be downloaded? (different versions from different people) that are worth considering (not just custom features for persons own use)
They should be added to wiki.

Too bad that I cannot test your code right now, because I have run out all atmega328 chips at the moment, only one is in my car, my arduino is chipless :)
I am checking your source code and reading what features you have implemented - feature list is really inspiring!

Some questions:

1) are you using some kind of repository for version tracking? If not, then please start using GIT (github or bitbucket, I am using https://bitbucket.org)
https://www.sitepoint.com/git-for-beginners/

2) why are you keeping all sourcecode in one file?

3) How do you compile and upload code to mpguino? do I need to compile it using avr-gcc and use programmer and avrdude, or does copy-paste to arduino IDE and upload using arduino work?
At least it seems to compile in arduino IDE, but gives one warning
"WARNING: Category '' in library OneWire is not valid. Setting to 'Uncategorized'"
Like I said, I cannot test uploading (no atmega chips)

keep up good work!
Meelis

t vago 01-16-2017 12:55 PM

Quote:

Originally Posted by josemapiro (Post 532109)
This new version holds the error.
Your procedure is the same as mine, the only differences are in the LCD selection and buttons your selection is different, one thing that is also different and may justify the problem is that I use the Arduino Mega without anything connected only with the USB cable, it is only speculation but what you have connected do not let the arduino fall asleep and allow to complete the recording.
Because this problem only started after infusing deep sleep into the code I think that's the problem.

I still could not duplicate the issue, even with removing everything off my AtMega2560 and programming it with your LCD and button configuration.

I think I may have inadvertently solved the issue when I re-burned my AtMega2560's bootloader.

I also think this problem is not limited to my version of the MPGuino code.

Google: "mega2560 programming times out site:forum.arduino.cc"

So I was wrong to assume that there wouldn't be anything within a successfully compiled sketch that would cause the programming to fail, simply because there was something within the sketch itself. The AtMega2560 appears to suffer from a bootloader bug that does exactly this.

Trouble is, there's nothing in my code that is obviously the cause of the problem. For instance, many users report that if they include "!!!" within a string in their sketch, it will not load onto their AtMega2560. In my code, there is no "!!!" that gets compiled. There were "!!!"s in the source file, in the #error directives, but they do not get compiled into the code. Besides, those "!!!"s in the #error directives were in the 20170107 version, and you reported that it successfully uploaded.

There is also another sequence of hex numbers that apparently causes programming to fail with this timeout error, but I am not able to find this sequence. Like I said, I re-programmed my AtMega2560's bootloader, and apparently, the new bootloader does not have this bug. I cannot duplicate this problem with my AtMega2560.

t vago 01-16-2017 01:10 PM

Quote:

Originally Posted by meelis11 (Post 532134)
Hi,
I am Meelis, I have planned lately that I publish my GIT repository and/or maybe we can merge our codes. Seems that you are already taking features from my code and implementing them to your version. I dont mind, my plan was to suggest merging anyway :)

Hello, Meelis! You've been an inspiration to me. Glad we're on the same page.

Quote:

Originally Posted by meelis11 (Post 532134)
I dont know how much you use my code, but at least you use some of features I added (referencing them "via Meelis11").
I can say that if you implement all features to your code, them maybe I can ditch mine and there is only one code :)
Your code seem so low level so I am not sure that I can contribute (assembler and low level pure C)

Yah, I have been able to implement some features, but up until I started working with skybolt, I never had direct access to your code. You appear to have grafted your modifications onto the existing 0.86 DCB code, and my own code is almost a complete re-write. I think that there are a few text strings from the DCB code that are still there.

The code itself is a bit complex, but I have also been trying to make it easier to understand with re-arranging data structures and with inserting these strange things into the code, that begin with a "// ". I think they're called "comments..." :D

Quote:

Originally Posted by meelis11 (Post 532134)
How many mpguino code "forks" are out there that can be downloaded? (different versions from different people) that are worth considering (not just custom features for persons own use)
They should be added to wiki.

Too bad that I cannot test your code right now, because I have run out all atmega328 chips at the moment, only one is in my car, my arduino is chipless :)
I am checking your source code and reading what features you have implemented - feature list is really inspiring!

Glad you like the list! I am trying to figure out how to add the "idle" and "EOC" auto-select screens that your code has. That's a real nice feature.

Quote:

Originally Posted by meelis11 (Post 532134)
Some questions:

1) are you using some kind of repository for version tracking? If not, then please start using GIT (github or bitbucket, I am using https://bitbucket.org)
https://www.sitepoint.com/git-for-beginners/

I work on this code from several different locations. One of them does not allow access to GitHub.

Quote:

Originally Posted by meelis11 (Post 532134)
2) why are you keeping all sourcecode in one file?

It's easier for me to search for locations within the program, if I need to make a code fix or modification.

I am trying to re-arrange the code so that it will be easy to split apart into modules. This is a long-term issue that I am keeping in the back of my mind.

Quote:

Originally Posted by meelis11 (Post 532134)
3) How do you compile and upload code to mpguino? do I need to compile it using avr-gcc and use programmer and avrdude, or does copy-paste to arduino IDE and upload using arduino work?
At least it seems to compile in arduino IDE, but gives one warning
"WARNING: Category '' in library OneWire is not valid. Setting to 'Uncategorized'"
Like I said, I cannot test uploading (no atmega chips)

I edit the code with a program named "TextPad," and copy/paste it into an Arduino IDE. From there, I program whatever platform I am testing the code on.

Not sure what this OneWire error is - I've never seen it. I try not to use any Arduino-specific library functions. They are great for tinkering, but I would rather optimize for speed, and those Arduino libraries are not optimized for speed.

Currently, I have a AtMega2560 test platform, a TinkerKit! LCD module test platform, and a JellyBeanDriver MPGuino test platform. I also have one of your MPGuinos, that I bought off another EcoModder.com member, but I have not yet started testing on it.

Quote:

Originally Posted by meelis11 (Post 532134)
keep up good work!
Meelis

Thanks again!

josemapiro 01-16-2017 05:54 PM

Hi t vago
Quote:

Originally Posted by t vago (Post 532275)
I still could not duplicate the issue, even with removing everything off my AtMega2560 and programming it with your LCD and button configuration.

I think I may have inadvertently solved the issue when I re-burned my AtMega2560's bootloader.

I also think this problem is not limited to my version of the MPGuino code.

Google: "mega2560 programming times out site:forum.arduino.cc"

So I was wrong to assume that there wouldn't be anything within a successfully compiled sketch that would cause the programming to fail, simply because there was something within the sketch itself. The AtMega2560 appears to suffer from a bootloader bug that does exactly this.

Trouble is, there's nothing in my code that is obviously the cause of the problem. For instance, many users report that if they include "!!!" within a string in their sketch, it will not load onto their AtMega2560. In my code, there is no "!!!" that gets compiled. There were "!!!"s in the source file, in the #error directives, but they do not get compiled into the code. Besides, those "!!!"s in the #error directives were in the 20170107 version, and you reported that it successfully uploaded.

There is also another sequence of hex numbers that apparently causes programming to fail with this timeout error, but I am not able to find this sequence. Like I said, I re-programmed my AtMega2560's bootloader, and apparently, the new bootloader does not have this bug. I cannot duplicate this problem with my AtMega2560.

I'm going to install the bootloader again, as suggested, but it will take quite a few days because I bought USBasp on ebay today and it will take several days to arrive.

Thanks
José Rodrigues

t vago 01-16-2017 07:04 PM

Did some more work on the deep sleep function. I believe I have something that will work, and am going to test it tonight.

Considering re-writing the ADC routines to save even more power during idle mode, when MPGuino is patiently waiting for the next injector pulse or VSS pulse or button press. Right now, for those configurations which require ADC (mainly the 5-position Parallax switch or the 5 analog buttons or the Chrysler MAP sensor input), the ADC is pretty much sampling all the time.

This won't affect those of you who do not use these things right now. However, in the future, it may affect those of you who want vehicle battery voltage readings or coolant temperature or other analog readings.

josemapiro 01-16-2017 07:31 PM

Quote:

Originally Posted by t vago (Post 532329)
This won't affect those of you who do not use these things right now. However, in the future, it may affect those of you who want vehicle battery voltage readings or coolant temperature or other analog readings.

I think that this inactivity only happens after a certain time without activity in the injectors, VSS or button, if it is thus who wants to consult the voltage of the battery or any other reading, when using the button activates the system again, leaving all the information again available.

Thanks
José Rodrigues

josemapiro 01-17-2017 04:41 PM

Hi t vago
Good news, I was able to upload the new version without any problem like the one on the 7th, maybe because the sum of the day is also 7 LOL.

http://i68.tinypic.com/ay7y11.jpg

Thanks
José Rodrigues

Uusitalo 01-18-2017 08:27 AM

Does this version also need full time power for Arduino?
In thinking to install this to motorcycle and battery cant handle long time load and it might be a problem?

Sorry for asking but whole device is new to me and found it yesterday...

And did you put the GIT repo up somewhere?

t vago 01-18-2017 11:46 PM

Quote:

Originally Posted by josemapiro (Post 532399)
Good news, I was able to upload the new version without any problem like the one on the 7th, maybe because the sum of the day is also 7 LOL.

http://i68.tinypic.com/ay7y11.jpg

That's wonderful! It may well have worked because the sum of the day is also 7! Heh!

I think I will keep available both a "latest version" and a "version last known to upload successfully to the AtMega2560," at least until they finally figure out why the AtMega2560 occasionally fails to program.

Quote:

Originally Posted by Uusitalo (Post 532422)
Does this version also need full time power for Arduino?
In thinking to install this to motorcycle and battery cant handle long time load and it might be a problem?

Sorry for asking but whole device is new to me and found it yesterday...

And did you put the GIT repo up somewhere?

Yah, MPGuino still requires a full-time power source.

Good news, though - I am finishing up the deep sleep addition to my code, and should release it here soon. This will drastically reduce power consumption when the MPGuino goes to sleep (after 2 minutes of no engine, no vehicle movement, and no button pressing).

I do not currently use GIT, so there is no available repo. I post the latest version here on Ecomodder, and keep all of the previous versions on my network storage, and (for November 2016 and later) in a Gmail draft email as attachments. I've got versions dating from 2013 July 06.


All times are GMT -4. The time now is 07:08 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com