2

Author Topic: Axon2 and Hello World  (Read 1269 times)

0 Members and 1 Guest are viewing this topic.

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Axon2 and Hello World
« on: April 04, 2011, 11:51:27 AM »
I have a question regarding the output of basic "Hello World" program and the Axon2.

I  run a program where there is a simple rprintf("Hello World") command, which the output set to USB. I can read the numerous Hello World lines on Hyperterminal just fine, however every couple of seconds something seems to glitch. For example, the glitches look like:

Hello WośHello World
Hello WorldHello World

What is happening here? It seems to me like the Axon is chopping up part of the message and restarting anew.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: Axon2 and Hello World
« Reply #1 on: April 04, 2011, 02:17:20 PM »
Are you using WebbotLib? If so what version?
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Re: Axon2 and Hello World
« Reply #2 on: April 04, 2011, 02:36:51 PM »
I am using webbotlib version 1.30.

Edited to add: Am I using the wrong version?
« Last Edit: April 05, 2011, 02:16:11 PM by Aberg098 »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon2 and Hello World
« Reply #3 on: April 07, 2011, 08:16:21 PM »
Is there any other code running other than that rprintf?

Also, are the LEDs flashing? It could be that your Axon battery is low, causing it to reset, thereby causing that glitch.

Does that glitch constantly happen, or just once during power up?

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Re: Axon2 and Hello World
« Reply #4 on: April 11, 2011, 11:00:27 AM »
Hello Admin,

There is no other code running, literally just printing hello world. The battery is fully charged and the errors occur at random, not at power-up. I am just leaving the AxonII on, and leaving it on for a while.  I can't comment on frequency or amount of errors because I haven't counted them.

What I do see, is that scrolling through hyperterminal after maybe 5 minutes, I get some errors as I have described below.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Axon2 and Hello World
« Reply #5 on: April 11, 2011, 03:46:17 PM »
Does the LED flash during the error?

Tell us about your battery.

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Re: Axon2 and Hello World
« Reply #6 on: April 12, 2011, 12:38:01 PM »
Just to clarify the code part:
Code: [Select]
#include "hardware.h"

// Initialise the hardware
void appInitHardware(void) {
initHardware();
}

// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}

// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {

// -------- Start Switch/Button-------
// Switch/Button - see switch.h

// To test if it is pressed then
if(SWITCH_pressed(&button)){
// pressed
}

// To test if it is released then
if(SWITCH_released(&button)){
// released
}
// -------- End   Switch/Button-------

// -------- Start Marquee-------
// Marquee - see 'segled.h'
// Before using the Marquee you need to redirect rprintf to write to it
// This can be done using
Writer old = rprintfInit(marqueeGetWriter(&marquee));

// All rprintf output will then be sent to the marquee but will not
// display until an end-of-line eg "\n" has been sent. Example:-
// rprintf("Hello World\n");

// If the endDelay is non-zero then the marquee will scroll
// forever or until you call: marqueeStop(&marquee);

// If the endDelay is zero then the marquee will stop once
// the entire line has been shown ('one-shot' mode)

// In 'one-shot' mode then you may want to make sure that
// a previous line has finished before you display a second line.
// This can be done as follows:-
marqueeSetEndDelay(&marquee,0); // Make sure we are in one-shot mode
if(marqueeIsActive(&marquee)==FALSE){
     if(loopCount==1){
      rprintf("HELLO WORLD\n");
     }else{
rprintf("Loop=%u\n",(unsigned)loopCount); // Put the loop count
     }
}

// Restore rprintf back to its previous location
rprintfInit(old);
// -------- End   Marquee-------
rprintf("Hello World\n");
return 0;
}
I have also made sure to be using the latest versions of project designer and webbotlib.

As for the LED, it stays nice and shiny red all the time. It's hard for me to spot the errors since the messages are outputted very quickly. The 7-segment displays a loop counter I think. For example, loop49823, loop61574 and so on.

I have a few different batteries: Right now I am using a 1000 mAh 9.6V Ni-cad. I am trying out some 1400mAh Li-ions. I have used a simple square "D" cell battery in the past. What would the batteries have to do with this?


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: Axon2 and Hello World
« Reply #7 on: April 13, 2011, 12:34:03 PM »
Hmmm, the only time I've seen funnies is using other terminal emulators. For example: I've been using RealTerm for a while and if you keep hitting it repeatedly at 115200 baud then it just hangs. Spent ages checking my code only to discover it was the terminal emulator to blame - and everything worked fine with other emulators. Not sure what baud rate you are using. Have you tried it at slower speeds?

If all else fails then send me your whole project (ie everything needed to compile) so that I can compile it and take a look.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline garrettg84

  • Robot Overlord
  • ****
  • Posts: 187
  • Helpful? 8
  • Armchair Roboticist Extraordinaire
Re: Axon2 and Hello World
« Reply #8 on: April 13, 2011, 12:40:00 PM »
Do the libs use/implement a serial queue/buffer? Could the queue/buffer be wrapping if the axon can generate the 'hello world's faster than the serial can transmit?

*edit: axon, not arduino
« Last Edit: April 13, 2011, 01:12:47 PM by garrettg84 »
-garrett

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Re: Axon2 and Hello World
« Reply #9 on: April 13, 2011, 01:00:57 PM »
Well, to answer to the last few comments.
  • I have tried reading the AxonII output using Matlab instead of Hyperterminal and notice the same type of errors.
  • The baud rate is default AxonII (115200 from memory). I haven't tried lowering the baud rate, chiefly because I am unsure how.
  • I have not yet implemented a counter in Matlab to get an idea of the actual frequency at which the "Hello World" output, but I plan on doing it to get an idea
  • In a similar vein, I want to get a counter going to get an idea of the error percentage
  • I am also trying different batteries to see if this makes a difference


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,150
  • Helpful? 109
Re: Axon2 and Hello World
« Reply #10 on: April 13, 2011, 01:33:28 PM »
Well rather than spending your time to come up with stats on how often you are getting glitches - then send me your code so that I can find out whats causing the glitches (or at least say 'works for me so must be your set up'.

@garretg84 WebbotLib allows you to use buffers (of whatever size you like, including zero). And 'no' its not an overlap issue as the lib traps all of that ie it waits until there is space in the buffer. But thanks for the input.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here

data_list