Show Posts
Pages: 1 ... 15 16 [17] 18
241  Forum 2005-2010 (read only) / Exhibition / Re: New oscilloscope for arduino (linux-only for now) on: November 01, 2009, 03:54:45 am
hey Alvaro, the way I understand your project but i could be wrong:
- free Running-mode ADC totally independent of the way you'll transfer the samples to a computer via USB
- a specific arduino sketch to capture the ADC samples via ISR management so the samples are stored inside arduino local memory
- a special fast transfer protocol to send samples from local arduino memory to a computer via USB
- miror protocol on the computer able to decode protocol then display nicely on the screen a scope like
so there are 4 distincts modules.

I was asking you about high sampling frequency because my project involves tuning non-linear parametric oscillators via arduino control so I need to have a scope view of a phenomae which is periodic. This means I can have have low ADC resolution and high frequency time synchronize many captures then average mean the samples to increase bits precision by software. Please note this would not be feasible if the visualize scope signal is non-peridoic or rapidly changing shape through short time.

Not easy to explain by mail plus i'm not englihs native. I'm using my arduino as special frequency generator to control different PWM outputs connected to mosfet-drivers and other electro-magnetci components,.... On the other hand, i wish to scope monitor specific voltages from my electro-magnetic oscilator device to perform parametric tuning. This means but i don't know if it is feasible: I need to trigger the free-running ADC on the same phase of my oscillator so then, I can integrate in phase & get more scope sample definition.

242  Forum 2005-2010 (read only) / Exhibition / Re: New oscilloscope for arduino (linux-only for now) on: October 30, 2009, 10:55:54 pm
Max sampling speed is maximum ADC sampling speed in Free Running Mode - which is 13 ADC clock cycles + 1 for the self-trigger. If you use the max. prescaler (128) you get an ADC clock speed of 125KHz. This makes about 9Ksamples/second. Doubles whenever you divide the prescaler by two (meaning a prescaler of 64 will give you almost 18ksamples/s). See page 254 of ATMEGA datasheet for more details.

The current resolution is 8-bit, but can easily be increased to 10-bit, if needed.
What is max ADC clock speed can I set on arduino boards in Free Running-mode and what would be then the associated bit resolution ?

What is best method to download then display the fastest sampled stream to a Macintosh with either a duamilanove board or mega board which i'm using in my projects ?

243  Forum 2005-2010 (read only) / Exhibition / Re: New oscilloscope for arduino (linux-only for now) on: October 30, 2009, 01:32:03 pm
Hi Alvaro,

What arduino board are you using ?
Can you explain self-trigger ADC ?
What is max sampling speed and how many quatize bits precision do you get ?
244  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Xmega on: December 25, 2009, 12:12:47 am
I mean that you might run into a situation where "atXMega support was added to gcc version 4.5, but gcc versions higher than 4.3 have a bug in the C++ compiler that prevents the Arduino xxx feature from working."  For example, the 4.3.2 compiler currently used in arduino seems to have a C++ specific bug in PROGMEM datatypes.  In that case, there is an easy workaround and PROGMEM isn't widely used anyway, but it's not hard to imagine a more serious issues (there WAS one that cause some version scrambling; I don't remember the details.  I don't think you can currently use gcc 4.4.x with arduino...)
Do you then recommend I stick for the moment with my mega board + arduino IDE and wait a while before engaging into ATXmega board & associated SDK ?
P.S. Merry Christmas smiley-wink
245  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Xmega on: December 23, 2009, 08:22:15 am
The Arduino Source for Mac is already an XCode project, and compiled pretty cleanly last time I tried...
Could you give precise link & instructions on how I dowload teh ful XCode project from arduino web server ?

Right now, I've developped a specific java GUI (jar application generated by XCode & ant) which communicate both ways with my Mega board using RXTXcomm.jar for USB management. When I modify my sketch, I compile then download. After, i run from Mac OS the GUI jar application hence outside of IDE context. Do you think it would be easy to slightly modify the arduino IDE so I can from same shell compile & download my sketch but also run my specific GUI ?

I'm not sure why you'd want to use Arduino instead of "your favorite editor" in conjunction with avr-gcc, avr-g++, and avrdude, which are the tools that Arduino IDE uses to do most of the work.  (I suppose to make it easier for others to use it, eh?)
My actual strategy is not clear because i'm in steep learning curve, discovering java, XCode, arduino sketch development being the only part i'm more confident but I don't have any experience with AVR studio or other SDK in general even outside of arduino context. I'm really more plug & play in the Mac spirit.

The most likely roadblock is to find to you need a new version of avr-gcc/etc tools that have other problems withthe rest of the arduino environment.
Do you mean i'll run into many problems & issues in trying to get  running on my Mac the ATXmega128A3 board being developped by my friend in another country?
246  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Xmega on: December 23, 2009, 03:34:08 am
hey westfw,

I remember you've a Mac, isn't ?

Maybe you can understand & help me go through where it talk about XCode so does this mean I could generate myself an Arduino IDE & slightly modifiy it, add a button to launch my own java application, add submenu to interact with my partner's Xmega board,... via java programming ?


I've discovered lately XCode & java but would appreciate any support if really it is not complex to make a personalized arduino IDE in case you use XCode on Mac.

Thank you in advance, Albert

247  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Xmega on: December 21, 2009, 10:26:49 pm
One of my partner is considering to develop a ATXmega128A3 board for our projects but he has PC, I've Macintosh.

Since ATXmega shares same instructions set as AVR family except the ports numbering are different & specific, can you tell me if it would be difficult, feasible for me to modify arduino 15 IDE & associated lib to get TOOLS>BOARD>XMEGA available running on my Mac hence not use AVR Studio ?

Any insights, advices, suggestions, critics would be appreciated !
248  Forum 2005-2010 (read only) / Frequently-Asked Questions / Xmega on: December 19, 2009, 11:22:52 pm
Do you know if arduino company plans to develop a borad based on ATXmega128A3 which has very enhanced features (multiple DAC, many timers mode, 32MHz, AVR instructions compatible...)
249  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: December 24, 2009, 02:53:53 am
I don't understand
and I get 584128.
, what does it mean 584218 ?
250  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: October 27, 2009, 11:00:43 pm
hey Circuitsville,

it took me a while to understand timers but then, it is a peace of cake to generate any PWM frequency from a few Hz up to hundreds of KHz or even more.

Here is another example showing the basic timer programmation (from post #5 to the end of thread):

please note you can have different ways to generate same frequency by playing with clock scaling, using a 8bit or 16bit Atmega timer along with TOP value but each way might have not same PW resolution.
251  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: October 26, 2009, 11:09:57 pm
About the first example, then you might want to try
- PWM, Phase & frequency correct
- PWM, Phase correct
because I gave you the code for fast PWM which goes higher freq but is less jitter stable.

For Fast PWM and OCR1A=3, timer1 frequency=16MHz/(1+TOP)=16MHz/3

For PWM phase and/or frequency correct, timer1 frequency is 16MHz/(2*TOP). Since your initial sofwtare controlled code was producing 2,667 MHz, you could choose OCR1A=TOP=2 in order to get 4MHz and setting OCR1B=1 to get 50% PWM. The phase and/or frequency correct does not provide maximum frequency but does provide very stable jitter due to its counting up-down timer construction.

Anyway, we're clearly pushing the limits of Atmega toggling outputs frequency  smiley-wink

In any case, you need good external fast drivers otherwise signal distorsion will occur.

252  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: October 22, 2009, 10:08:57 pm
The timer output to arduino pin mapping is different on Mega vs Diecimila; the signal shows up on pin 10 of the Diecimila.  Once I corrected for that I did indeed get 5.33MHz on pin 10.
Glad it worked on your side.  smiley-wink

Yes about pin, there are a bit different depending diecemila / duamilanove or mega eventhough the core sketch I gave you works on both.

I suggest you try my second sketch to find out ultimate case of 8 MHz on pin9 of diecemila instead of pin 11 of mega.

This is very useful doc from mem arduino member

Not a square wave, though; high for twice as long as it is low.
I'm sure you know this already but to not create confusion, the timers really work at correct frequencies but what happens is the arduino drivers and/or Atmega drivers are not enough fast to generate sharp PW waves. You might want to plug an external fast speed driver IC then you'll get nice waveform on your scope.

253  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: October 18, 2009, 02:17:59 am
Here is the sketch for a mega board or duamilove, don't know which you have but I have both which should generate 5.333MHz on Pin12
#include <util/delay_basic.h>

int outputPsuB = 12;  // Timer1-B

void setup()
// outputs via timer1
  pinMode(outputPsuB, OUTPUT);  // select Pin as ch-B

  TCCR1A = B00100011; // Fast PWM change at OCR1A
  TCCR1B = B11001;  // System clock
  OCR1A = 2; // 5.333 MHz
  OCR1B = 1; // 50% PWM

void loop()
// do what ever you want with full 100% CPU

If it works on your scope, you might then try OCR1A=5 and should get your initial case of 2.667MHz and choose different PW via OCR1B value from 0 to OCR1A !

This other sketch should give 8MHz toggling on Pin11 but only 50%PW that cannot be changed
#include <util/delay_basic.h>

int outputPsuA = 11;  // Timer1-A

void setup()
// outputs via timer1
  pinMode(outputPsuA, OUTPUT);  // select Pin as ch-A

  TCCR1A = B01000011; // Fast PWM change at OCR1A
  TCCR1B = B11001;  // System clock
  OCR1A = 0; // 8 MHz

void loop()
// do what ever you want with full 100% CPU

There are many other possibilities if you have a mega board
254  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: October 18, 2009, 12:07:30 am
  while (1) {
    PORTD |= 0x8;
    PORTD &= ~0x8;

on the same board runs at 2.667MHz.  (This does produce the minimal sbi/cbi/rjmp loop that you'd expect, BTW.)
(so that's about a 20x penalty for the arduino library code; sounds about right: the overhead of abstracting IO to "pin number" is pretty substantial: a subroutine call, lookup table to get the port, another lookup table to get the bit, a third to check whether analogWrite is in use, and then less efficient instructions to access the port "indirectly")

I don't know if this is of any interest but i've lately figure out how to generate fast PWM, phase correct PWM using 8bits and 16 bits timers hence freeing CPU for my project.

Could be wrong but if setting a timer in fast PWM mode and TOP=OCRnA=2, you can reach max frequency of 16MHz/(1+TOP) hence 5.333MHz and OCRnB=1. There seems to be a specific auto-toggling mode in the timer providing a 50% PWM at 8MHz.

The advantage is ultra fast PWM and freeing CPU.

The disavantage is only limited timers in duamilanove, a bit more on mega so if one needs many pins fast toggling, the quoted method is the best.
255  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Maximum pin toggle speed on: June 16, 2009, 11:53:51 am
Many many many thanks westfw.

I've tried & benchmarked delay_loop_1 and delay_loop_2 per your explanation in the other thread. Works fine as you predicted: 3N cycles for delay_loop_1 and 4 cycles for delay_loop_2.

I don't know if it is important but it seems delay_loop_1(0) or delay_loop_2(0) do not work giving extremely long return time but that is OK for my application which forces a non-negative value to not blow up my MOSFET.

It is really interesting to note that for(i=0;i<n;i++) NOP will give average 7 cycles per iteration if i UNSIGNED but average 8 cycles per iteration if i SIGNED as you mentionned.

Anyway, calling x unsigned or signed delay_loop_x(n) gives same running time plus I really save a lot of timing hence i'll be able to go PWM higher precision than using for(i=0;i<n;i++) NOP.

Amicalement, Albert
Pages: 1 ... 15 16 [17] 18