Pages: [1]   Go Down
Author Topic: Using Procyon AVRLib in the Arduino IDE  (Read 1254 times)
0 Members and 1 Guest are viewing this topic.
Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello there, I would like to add the Procyoon AVRLib to my IDE. I tried putting the whole thing in lib/targets/ardunio, I tried in the libraries and I tried just putting the files I wanted in my sketch's directory. But to no avail. I'm sure it's something stupid I'm missing. Any pointers?
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It should be possible in any of those ways, I think.  What happens when you try it?
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I've gotten all the net stuff (and what it relies on) to compile using the "in sketch" method. However only using the Makefile. The IDE seems to try to compile the .cpp's as C instead of c++ (at least it's pretty much the same error I get when I replicate this in the Makefile). Still, it's not perfect, serial seems to be broken, doesn't send/receive anything. Even though I took care of removing all the uart stuff and replacing it by the Serial object). The timer classes are probably going to be an issue. So right now the biggest problem is avoiding wiring and avrlib to conflict; and I only have a small part of avrlib. Any pointers there?
« Last Edit: September 11, 2007, 03:05:05 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What errors do you get when you try to compile things in the IDE?  Or are you happy using the Makefile?

When you say that serial's broken, what code are you running?
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Makefile is fine for now, that's what I use normally. Right now I only wished I knew why the program makes the µC crash. As for serial I'm using Wiring's library.

EDIT: Here's the code.
As you can see in the setup there are a few Serial sends which never appears (sometimes just a few char return). Also atm the LED never ends up flashing. Like if the setup failed or the uC crashed when setting up Serial
« Last Edit: September 11, 2007, 07:56:05 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, didn't anyone work on an ENC28J60 drivers for the Arduino? If so, is it available anywhere? Maybe it could help?
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My first guess is that you're running out of RAM because of all the strings you've got in the code.  Can you try commenting out everything but setup() and loop() and trying it again?
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well that helped a lot! I moved all of the strings to inline progmem with PSTR. Very neat, albeit it seems a little unreliable... stuff like this happen:

Code:
printString(PSTR("Uptime: ")); delay(2);
Serial.print(millis()); delay(2);
printString(PSTR("ms")); delay(2);
Show as :
Code:
: 1848ask :
and some just don't print.

printString looks like such
Code:
void printString(const char *data)
{
    char ch;

    for (;;) {
        ch = pgm_read_byte( data++ );
        if ( !ch ) return;
            Serial.print(ch);
    }
}

I've tried delaying by 8xNOPs (1/2µS) to no avail.

But hey, at least there is progress hehe smiley
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Weird.  Does the serial communication work reliably with the same hardware but different sketches?
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as I can tell, yes it is. There's some really... really... weird stuff. In my regDump function, none of the douzen serial strings are sent... I'll dig deeper I guess :/
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

GOT IT! I had two functions, one for print and one for println... well the first, called printString, was conflicting with wiring's printString. GCC never complained because wiring.h was not included in the files with the strings functions! FEW :o

Totally out of subject, but is there a way to know the ram specs? Such as how much is free, etc. The mega168 doesn't have JTAG (not that I have the cable), debugWire seems quiet complicated (no 2$ parallel hack) and simulavr doesn't support the mega168 as far as I could see and test. The only option I can see is AVRStudio. But running VMWare all the time seems like a bad idea, not to mention having to replicate the environment under two totally different platforms. And I've seen reviews saying it didn't run under Wine. What does that leave us with for debugging? :/
« Last Edit: September 12, 2007, 05:04:29 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure.  I think someone posted a sketch with a function that would calculate how much RAM you had free (by trying to allocate more and more memory until it failed, I think).  If you find a good approach, that would be awesome.
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's exactly the approach I was going to take. It would be sufficient for basic debugging at least.

I wrote this but it didn't seem to work:
Code:
char b[2048] = "a";
unsigned int i = 0;
Serial.println();
for (i = 1; 1; i++) {
      Serial.print(i); Serial.print(" "); delay(100);
      b[i] = 255;
}


I looked a little for the sketch and didn't find anything, was it posted on the forum?
« Last Edit: September 12, 2007, 06:46:37 pm by xSmurf » Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Pages: [1]   Go Up
Jump to: