Show Posts
Pages: 1 [2] 3 4 ... 34
16  Products / Arduino Due / Re: some performance related questions on: February 07, 2014, 07:33:31 pm
Just to prove the above point:

Code:
int testrom(){
  int r=0;
  for(int x=1;x<=1000000;x++){r*=x;r--;}
  return r;
}

int testram() __attribute__ ((section(".ramfunc")));
int testram() {
  int r=0;
  for(int x=1;x<=1000000;x++){r*=x;r--;}
  return r;
}


void setup() {

  Serial.begin(115200);
}

void loop() {

  long t,r;
  t=micros();
  r=testrom();
  t=micros()-t;
  Serial.print("Result: ");Serial.println(r);
  Serial.print("Time ROM: ");Serial.println(t);
  t=micros();
  r=testram();
  t=micros()-t;
  Serial.print("Result: ");Serial.println(r);
  Serial.print("Time RAM: ");Serial.println(t);
 
 
}

Code:
Result: -1628288769
Time ROM: 107012
Result: -1628288769
Time RAM: 131112

The ram function is over 20% slower.
17  Products / Arduino Due / Re: Data loss when sending to native USB port (SerialUSB) on: January 21, 2014, 06:10:15 am
I'd already made a branch, I just forgot to say smiley It's here:

https://github.com/stimmer/Arduino/tree/ide-1.5.x-usb-fast
18  Products / Arduino Due / Re: VGA library - now with TV output on: January 09, 2014, 06:54:15 pm
Nothing significant has changed in the latest release except for a bug fix to the clear method.

Sometimes the monitor guesses the wrong mode from the input signal - it's impossible to get the timings exactly right. Experimenting with setMonitorFreqRange and setSyncPolarity might help trick the monitor into showing 320x240 properly.
19  Products / Arduino Due / Re: VGA library - now with TV output on: January 08, 2014, 01:39:00 pm
The library doesn't support 4-bit modes. I can't think of an easy way of doing them in a way the hardware supports.

However, I just tried the library in a very low resolution mode (256x150) and it worked! This should only use 37.5k, so double buffering ought to be possible, if you can accept a resolution that low.

It's difficult to make a full 8-bit-accurate DAC with standard resistors. It's quite easy to get 5 or 6 bits accuracy though. You could try the PAL/NTSC TV out circuit for this (it is just a simple 6 bit DAC). There might be a problem with driving all 3 colours, you might find the impedance is too low and the picture ends up too dark. You can only experiment and find out for yourself.
20  Products / Arduino Due / Re: VGA library - now with TV output on: January 06, 2014, 05:48:11 pm
320x240 colour mode takes about 76k, 800x600 mono is about 60k. There really isn't enough memory for double-buffering so I am not likely to add it to the library.
21  Products / Arduino Due / Re: Data loss when sending to native USB port (SerialUSB) on: January 04, 2014, 10:05:56 pm
This is an updated version of the alternative USB serial code. This fixes one of the problems I was having with the receive_test benchmark and fixes a memory corruption bug.
22  Products / Arduino Due / Re: Lost Bytes when reading Serial1 when receiving also data via native USB port on: January 03, 2014, 02:27:06 pm
Firstly you should call serialUSB.begin(0) in setup - this won't change anything because the method is currently empty, but that could change in future.

Please try your code with my alternative USB serial code here:
http://forum.arduino.cc/index.php?topic=143871.msg1280899#msg1280899
Note this code also suffers from data loss, but under different circumstances. It may work for you, it may not.
23  Community / Exhibition / Gallery / Re: The VideoBlaster Hi Resolution TVout platform on: December 17, 2013, 08:31:05 am
Impressive work smiley

When I tried this a few years back, the trick I used for colour was to use Timer1 in PWM mode with TOP=3 (for divide by 4):
Code:
  TCCR1A=0b00000010;
  TCCR1B=0b00011001;
  OCR1A=1;OCR1B=2; // experiment with 3 too
  ICR1=3;
In the circuit you need to mix pins 9 and 10 into your output signal (I used small capacitors for this)
Then by doing this:
Code:
TCCR1A= (phase << 4) | 0b00000010;
you can get 8 different colour phases, and black (the other 7 values just look funky) in just 1 line of code smiley-grin
24  Products / Arduino Due / Re: VGA output on: December 11, 2013, 08:01:37 pm
Look at the VGA library thread (in my sig). NTSC is supported, but the bandwidth for NTSC is actually nearer 6MHz, so needs a sample frequency over 12MHz to generate (I use 14MHz). And as the VGA colour mode is half-resolution I use 14MHz for that too. So the bandwidth is the same, but as NTSC is a more complex signal it actually takes much more out of the Due, not less. (VGA can be done with DMA alone, but NTSC requires processing as well to do the mathematics).
25  Products / Arduino Due / Re: Arduino due / ppm on: December 06, 2013, 09:47:30 am
Thanks for the message, I've had a go at altering my previous timer code to do something similar to what you are asking. It's only a small change smiley

Try this: put an LED+resistor from pin 2 to GND and run this sketch. The LED should light for 0.5 seconds then extinguish for 0.5, 1.5, 2.5 ... seconds in sequence (so total time is 1,2,3... seconds) for 7 blinks then repeat.

Code:
// timer is clocked at 42MHz, so 42 ticks per us
uint32_t periods[]={1000000*42,2000000*42,3000000*42,4000000*42,5000000*42,6000000*42,7000000*42};
uint32_t num_periods=7;

void TC0_Handler()
{
    long dummy=REG_TC0_SR0; // vital - reading this clears some flag
                            // otherwise you get infinite interrupts
    static int i=0;
    REG_TC0_RC0=periods[i++];
    if (i>=num_periods)i=0;
}

void setup(){
  pinMode(2,OUTPUT);    // port B pin 25  
  analogWrite(2,255);   // sets up some other registers I haven't worked out yet
  REG_PIOB_PDR = 1<<25; // disable PIO, enable peripheral
  REG_PIOB_ABSR= 1<<25; // select peripheral B
  REG_TC0_WPMR=0x54494D00; // enable write to registers
//REG_TC0_CMR0=0b00000000000010011100010000000000; // set channel mode register (see datasheet)
  REG_TC0_CMR0=0b00000000000001101100010000000000; // alternative CMR for inverted output
  REG_TC0_RC0=100000000; // counter period
  REG_TC0_CCR0=0b101;    // start counter
  REG_TC0_IER0=0b00010000; // enable interrupt on counter=rc
  REG_TC0_IDR0=0b11101111; // disable other interrupts
  
  REG_TC0_RA0=500000*42;  // PWM value - 500000us

  NVIC_EnableIRQ(TC0_IRQn); // enable TC0 interrupts
}

void loop(){
  // you can safely write to the periods[] array here, eg
  // periods[0]=1000*map(analogRead(0),0,1023,1000*42,7000*42);
}

Does this look like what you are trying to do? If so, you should be able to get the exact signal you need just by changing the timings in the REG_TC0_RA0 line and the periods[] array (these can be adjusted at run-time safely)
26  Products / Arduino Due / Re: VGA library - now with TV output on: November 17, 2013, 12:51:44 pm
There are a couple of problems with getting DueVGA to output 12-bit colour: firstly because of the way the DMA and external memory interface work it would mean using 16 bits for each pixel. The second problem is lack of memory - there would only be enough memory for a resolution of about 240x160 at 12/16bpp.

How were you intending to connect the two? It may be possible to use the Due to generate the VGA timing signals for tha camera, and possibly generate some graphic overlay. It would be hard to capture the frame into the Due (because of lack of memory) but may be possible at low resolution / grayscale.
27  Products / Arduino Due / Re: Pin 4 not ACTUALLY connected to both PA29 and PC26 on: November 12, 2013, 06:14:05 am
use int testPin = 87; to control A29
28  Products / Arduino Due / Re: Printf in Arduino Due on: November 10, 2013, 09:21:12 pm
It may be that printf is buffering until it gets a newline, like it does on Linux. Try printf("Test\n"); instead.
29  Development / Other Software Development / Re: Calling pinMode from within a class that has its own version... on: October 18, 2013, 06:19:53 pm
Have you tried ::pinMode(...); ?
30  Products / Arduino Due / Re: Why runtime function address is off by 1 w.r.t. elf disassembly? on: October 05, 2013, 03:24:20 pm
On ARM the last bit in the address on a jump tells the processor whether the instructions are in ARM (32-bit) or Thumb (16-bit) format. The SAM3X only supports Thumb so the last bit in a jump address should always be 1.
Pages: 1 [2] 3 4 ... 34