Show Posts
Pages: [1]
1  Products / Arduino Due / Arduino Due Port Manipulation on: April 16, 2013, 06:40:54 pm
how can i set port C as input on arduino due? I want to read input from eight pins at the same time.
I have tried this but it does not seem to work:
Code:
    REG_PIOC_ODR = 0x3fc;
    REG_PIOC_PER = 0x3fc;
    int pixelData = REG_PIOC_PDSR >> 2;
2  Products / Arduino Due / Re: Port manipulation PINx commands with Arduino Due ? on: April 15, 2013, 08:10:30 pm

the reading is easy:

eg.

 unsigned long int input_data = REG_PIOC_PDSR;

reads the C -port (32 bit wide)  and all the bits simultaneously to input_data variable and fast ,
and I've tested A, B, C and D ports  by changing bit states ((work ok with Arduino Due),

but then encountered problems when tried writing in the same way with command eg.

 REG_PIOC_ODSR = 0xFF; 

which should change all bits 0-15  simultanously to 1, look at my post earlier today, where test results are reported,

BR,
Seppo

How did you read port C? I tried this but it does not work:
Code:
    REG_PIOC_ODR = 0x3fc;
    REG_PIOC_PER = 0x3fc;
    int pixelData = REG_PIOC_PDSR >> 2;
3  Products / Arduino Due / Re: Synchronous Port Manipulation on Due on: April 15, 2013, 07:44:52 pm
You're almost there - what you have to do is use REG_PIOC_OWER and REG_PIOC_OWDR to mask off which pins you want to alter before writing REG_PIOC_ODSR to change them - the other bits will stay as outputs and stay unchanged.
REG_PIOC_OWER = 0x000003FC ;     REG_PIOC_OWDR = 0x000FF000 ;  lets you change 2-9 leaving 12-19 unchanged
REG_PIOC_OWER = 0x000FF000 ;     REG_PIOC_OWDR = 0x000003FC ;  lets you change 12-19 leaving 2-9 unchanged

how can i do the same thing but instead of setting them as output, use them as input?
I have tried this but it does not seem to work
Code:
    REG_PIOC_ODR = 0x3fc;
    REG_PIOC_PER = 0x3fc;
    int pixelData = REG_PIOC_PDSR >> 2;
4  Products / Arduino Due / Re: Arduino Due Access Port on: April 10, 2013, 10:23:48 pm
Does anyone know how to enable input on the port?
5  Products / Arduino Due / Re: Multiple PWM Outputs with Unique Frequencies on: March 20, 2013, 11:07:12 am
I have been using the pmc but i cannot get a clean square wave on higher frequencies, how can i use the PMW to generate 21MHz?
6  Products / Arduino Due / Re: Programmable Clock Output Programming (Arduino Due) on: March 19, 2013, 09:27:32 am
Thanks! I can get the right frequency but the signal does not seem to be a clean square wave. Do you know how to fix that?
7  Products / Arduino Due / Programmable Clock Output Programming (Arduino Due) on: March 18, 2013, 04:16:57 pm
I am trying to generate a clock output (pulse) on the CANRX pin of the Due but no luck.
Here is my code:
Code:
pmc_set_writeprotect(false);
        pmc_switch_pck_to_mainck(0,4);
        pmc_enable_pck(PIO_PA1B_PCK0);       
8  Products / Arduino Due / Re: Multiple PWM Outputs with Unique Frequencies on: March 18, 2013, 02:27:12 pm
Okay, I finally came up with a clean alternate approach for setting up PWM frequencies from within a sketch, for up to two unique frequencies.  The trick is to utilize the two PWM clocks (CLKA & CLKB) provided by the SAM3X8E chip.

I wrote and enclosed a library (pwm01.h).  It includes 4 user functions to:  1) setup PWM resolution, 2) setup PWM pin, frequency & pick clock, 3) write duty cycle, and 4) stop PWM.  See example code for usage:

The pwm01.h library and example code were tested in IDE 1.5.1r2.  Additional notes on this library:
- Applies to Arduino-Due board, PWM pins 6, 7, 8 & 9.

Do you know how use that to get higher frequencies like 25MHz?
9  Products / Arduino Due / Re: Arduino Due Clock output on: March 17, 2013, 10:47:28 pm
Any example code of setting that up?
10  Products / Arduino Due / Re: Arduino Due Clock output on: March 17, 2013, 10:00:29 pm
I finally found out that this:
I don't exactly know, but you should definitely take a look at this: http://asf.atmel.com/docs/latest/sam3x/html/group__sam__drivers__pwm__group.html
cannot work for me because am using the Arduino IDE. Do you know of anything else? Everything i tried cannot go above 150kHz frequency.
11  Products / Arduino Due / Re: Arduino Due Clock output on: March 14, 2013, 02:07:29 pm
I don't exactly know, but you should definitely take a look at this: http://asf.atmel.com/docs/latest/sam3x/html/group__sam__drivers__pwm__group.html

Thanks a lot! I am going to try that.
12  Products / Arduino Due / Re: Arduino Due Clock output on: March 14, 2013, 12:10:27 pm
i tried using the PWM signal but i could not adjust the frequency. Do you know how to change it?
13  Products / Arduino Due / Arduino Due Clock output on: March 14, 2013, 11:36:40 am
Does anybody know how to generate a clock signal on an digital pin of an Arduino Due?
like a CPU clock. I am trying to communicate to a OV3640 but i have to give it a 24 MHz clock signal. I was wondering if there was a way to generate that using the CPU clock of the Due.
14  Using Arduino / Programming Questions / Re: Arduino Due Clock output on: March 14, 2013, 11:32:07 am
like a CPU clock. I am trying to communicate to a OV3640 but i have to give it a 24 MHz clock signal. I was wondering if there was a way to generate that using the CPU clock of the Due.
15  Using Arduino / Programming Questions / Arduino Due Clock output on: March 12, 2013, 11:54:21 am
Does anybody know how to generate a clock signal on an digital pin of an Arduino Due?
Pages: [1]