Pages: 1 2 3 [4] 5 6 ... 31   Go Down
Author Topic: Cosa: An Object-Oriented Platform for Arduino programming  (Read 94401 times)
0 Members and 2 Guests are viewing this topic.
Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Sirhax!

Sorry but I could not recreate this on my Linux/Windows machines. Would need to know more about the configuration. Googled the below link by using a section of the error message:

http://arduino.cc/forum/index.php?action=printpage;topic=60649.0

This might give some help. Looks like the linker in your Arduino installation is not working correctly. The RTC is not used.

Cheers!
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm...

FWIW, The CosaVWIkey example compiles fine for the AtTiny85.

I was able to get the CosaVWIsender example to compile for the AtTiny85 after removing the Watchdog references...

I will keep poking around...

Thanks!

Update:  It does appear to be exploiting a bug in the Arduino installation linker.  In the CorsaVWIsender example, if I comment out the "tx.send(&msg, sizeof(msg));" line, it complies fine too.  This seems to be common-enough problem with unlucky code structure.
Here's more info: https://code.google.com/p/arduino/issues/detail?id=1071
Others have essentially said: hard to replicate as adding or removing "random" lines of code can make it crop up or disappear

So this definitely doesn't appear to be a Cosa problem.

Thanks again for investigating!
« Last Edit: March 10, 2013, 04:18:47 pm by sirhax » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So this definitely doesn't appear to be a Cosa problem.

Thanks again for investigating!
I found a fix: https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC
There has been a lot of discussion about this gcc linker problem. Found it from here: http://nathan.chantrell.net/20120225/an-attiny-based-wireless-temperature-sensor/

Apprently for small programs that linker goes wrong. The fix is to replace the linker.

I actually was able to recreate the problem on my Windows machine after creating a clean installation of Arduino 1.0.3 and working from there.

Hope this lets you work on your real project and not force you to do more testing. Thanks for your effort!

BW: I will have to get back to you on how to make the CosaVWIkey example more efficient. It will right now loop in the interrupt handler while the button is pressed. The fix will be to disable the interrupt and then add a capacitor to the button circuit (much like the reset button on the Arduino). After sending the message the interrupt should be enabled again.

Cheers!
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Wow! Great find!  That was a rather simple fix to a problem that shouldn't be there in the first place.  smiley-neutral  Thank you!

I actually tried modifying the avrdude.conf file as directed by your previous link (http://arduino.cc/forum/index.php?action=printpage;topic=60649.0), but that obviously didn't fix the problem. smiley

As for making the CosaVWIkey example more efficient -- does it actually loop in the interrupt handler routine? Or does it keep calling the interrupt handler in every iteration of the main loop() function while the button is pressed?  Either way, would it be feasible to simply put a:
Code:
while (InterruptPin.is_low()) {
  Watchdog::delay(128);
}
(or similar) either in the interrupt handler function or at the beginning of the main loop()?  Would that keep the interrupt handler from firing multiple times when the button is pressed?
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As for making the CosaVWIkey example more efficient -- does it actually loop in the interrupt handler routine? Or does it keep calling the interrupt handler in every iteration of the main loop() function while the button is pressed?  Either way, would it be feasible to simply put a:
Code:
while (InterruptPin.is_low()) {
  Watchdog::delay(128);
}
(or similar) either in the interrupt handler function or at the beginning of the main loop()?  Would that keep the interrupt handler from firing multiple times when the button is pressed?
The interrupt handler will be called while the pin is low by the processor (not Cosa code). The first thing to do in the interrupt handler will be to turn off further interrupts. This is why I added the counter so that the calls could be observed. Then there is the debouncing to consider. It could be done in software with the loop above. Do not forget to enable the interrupt handler after the loop.

For now the example CosaVWIkey.ino works to show the logic you where after. Anyway I will get back to you with a more efficient version.
Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A new blog posting is now available with a short presentation of the Cosa Virtual Wire Interface (VWI) and Codecs.

http://cosa-arduino.blogspot.se/2013/03/news-virtual-wire-interface.html

Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A new blog posting is now available with a short presentation of the Cosa AnalogPin class and an introduction to event driven programming.

http://cosa-arduino.blogspot.se/2013/03/the-analog-pin-classes-introduction-to.html

Cheers!
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent work and a great read!
Keep it up!  smiley
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A new blog posting is now available with details on how Cosa implements interrupt handling in an object-oriented style.

http://cosa-arduino.blogspot.se/2013/03/object-oriented-interrupt-handling.html

Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A new Cosa blog posting is now available. It presents how reliable messaging may be realized with the Virtual Wire Interface (VWI).

http://cosa-arduino.blogspot.com/2013/03/toward-reliable-virtual-wire-interface.html

Cheers!
« Last Edit: March 27, 2013, 06:14:39 pm by kowalski » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey kowalski,
I tried compiling the CosaVWIreceiver sample for the Arduino Micro board, and it fails with this:
(Note, it compiles fine for the Uno and AtTiny85)

In file included from E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:40,
                 from E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/VWI.hh:37,
                 from CosaVWIreceiver.ino:34:
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Board.hh:52:2: error: #error "Cosa/Board.hh: board not supported"
In file included from E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/VWI.hh:37,
                 from CosaVWIreceiver.ino:34:
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In member function 'volatile uint8_t* Pin::PCIMR()':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:83: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In static member function 'static const uint8_t Pin::MASK(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:93: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In static member function 'static volatile uint8_t* Pin::PIN(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:103: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In static member function 'static volatile uint8_t* Pin::DDR(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:113: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In static member function 'static volatile uint8_t* Pin::PORT(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:123: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In constructor 'Pin::Pin(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:137: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: In static member function 'static bool Pin::read(uint8_t)':
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:231: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh: At global scope:
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:275: error: 'Board' has not been declared
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:275: error: expected `)' before 'pin'
CosaVWIreceiver:107: error: expected `}' at end of input
CosaVWIreceiver:107: error: expected unqualified-id at end of input


Also, a minor discrepancy (if you care) between the comment on line 51 (says pin D9) and the code on line 52 (says D8).  --There's my contribution to the project  smiley-neutral
« Last Edit: March 29, 2013, 07:19:39 pm by sirhax » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi sirhax. Seems like you missed the compile error. Just too many ripple errors after that initial error message. Need to figure out a way to get the Arduino build to stop at once on that error message.
In file included from E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Pins.hh:40,
                 from E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/VWI.hh:37,
                 from CosaVWIreceiver.ino:34:
E:\Portable Apps\arduino-1.0.3\hardware\arduino\cores\arduino/Cosa/Board.hh:52:2: error: #error "Cosa/Board.hh: board not supported"

I haven't yet implemented ATmega32u4 based boards; Micro, Leronardo, etc. Need to implement the CDC/USB drivers. This will take a while as I want them to work together with IOStream and the Event handler. Might do an intermediate solution and reuse some of the Arduino code to get this up and running earlier than planned.

Fixed the comment ;-) It is easy to add review marks in github if you find more.

Cheers!
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply!  I did see the "board not supported" error; I just didn't know if that was by design or not.  smiley-confuse
I will continue to keep an eye on the github commits smiley-wink
« Last Edit: March 29, 2013, 09:58:44 pm by sirhax » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply!  I did see the "board not supported" error; I just didn't know if that was by design or not.  smiley-confuse
I will continue to keep an eye on the github commits smiley-wink
Thanks for your contributions! Even the smallest remark on inconsistency in documentation are of value.

BW: I recently implemented Pin Change Interrupt Handling (InterruptPin class in Pins.hh https://github.com/mikaelpatel/Cosa/blob/master/Cosa/Pins.hh) so that basically any pin can be used to detect change and issue an interrupt. This should be compared to the limited number of pins that may be used as External Interrupt Pins.

This might be of value for your ATtiny85 sketch. I haven't updated the CosaVWIkey.ino example sketch with Pin Change Interrupts instead of the External Interrupt Pin but you can find some example code in the CosaPins.ino https://github.com/mikaelpatel/Cosa/blob/master/examples/Pins/CosaPins/CosaPins.ino

Cheers!
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8620
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi kowalski

I tried to grab doc.zip but got a "Error: blob is too big" error. Don't know if that's something at my end or Git's end.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: 1 2 3 [4] 5 6 ... 31   Go Up
Jump to: