Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: some questions on due pwm on: July 26, 2014, 12:16:50 pm
i would not do this in the main loop.. the due has functionality to generate interrupts for every input pin. attachInterrupt() does that for you. it works on any GPIO pin.

by controlling PWM duty cycle you can also turn it off (dutycycle = 0). you can do this in the PWM interrupt handler to set this for the next period.

in short, use interrupts.. everywhere.

for level shifting you use a voltage divider followed by an amplifier?
2  Products / Arduino Due / Re: Sending Multiple Bytes with SPI.Transfer using Arduino Due on: July 26, 2014, 11:58:34 am
your code example will transmit everything serially. a byte will be sent out and the transfer() function will wait until it receives an a response.

the easiest thing to do is keep using these SPI.transfer() calls and just serialize your 12 bit data to a buffer (a load of bytes). then just transfer all the bytes one by one.

such serialization code will look something like this

uint8_t bytes[24];
uint16_t twelvebit[16];

//... fill twelvebit with meaningful stuff..

int j = 0;
// 16 12-bit words -> 24 bytes
for (int i=0; i<16; i+=2)
  bytes[j++] = twelvebit[i] >> 4;
  bytes[j] = (twelvebit[i] & 15)<<4;
  bytes[j++] |= twelvebit[i+1] >> 8;
  bytes[j++] = twelvebit[i+1] & 255;
3  Products / Arduino Due / Re: some questions on due pwm on: July 22, 2014, 06:09:58 am
The SAM3X is a true PWM powerhouse. I can get 14 PWM channels at high speed (dozens of kHz) with 8 bit. No problem. The highest speed you can get at 8 bit is 330 kHz afaik. And pulses can be extremely short (1 MCU clockcycle if necessary). You can increase frequency if you sacrifice PWM resolution. 7 bit will yield 660 kHz, for instance.

You can do PWM with the true PWM pins, but also with the TC pins. Complementary PWM is very powerful. Deadtime can be set independently basically creating twice the amount of independent PWM, although resolution gets halved. But then you have at least 22 independent PWMs. Maybe more.. but I forgot if TC could also do complementary mode (i thought it could). What I know for sure is that TC uses half the MCU clock.. so only 42 MHz instead of 84.

PWMH7 is only present on the SAM3 217 pin package and the DUE only has 144 pins. And PIO_PC20B_PWMH4 is not even connected. to the pins.. oh well. still enough of these buggers.

That a pin starts reducing very slowly smells like it's being set to high impedance to me. That means it's configured as an input, not as an output. You might have to call PIO_Configure() for that pin.. Also, it's probably better to configure the duty cycle from a TC / PWM interrupt as this can be done completely bumpless.

The SAM3X is an amazing piece of hardware.

4  Products / Arduino Due / Re: Problems making project for Sam3X8E‏ on: July 22, 2014, 05:30:55 am
hhhm, that tutorial looks interesting. the error message looks pretty cryptic and looks like gcc  messed up when printing it..
i recently did the makefile thing myself, totally isolated from this tutorial posted here. it's not as generalized as what i see here, but easier to understand (no fiddling script) and might work for you when you adapt it to use your own code.
some info:
5  Products / Arduino Due / My life with the Due, part due on: July 12, 2014, 06:03:43 am
hi guys,

updated my blog a little bit with recent findings on the Due/SAM3X. for instance, DMAC, PDC, digitalWrite replacement, and how to get 30 PWM pins..

have fun!

6  Products / Arduino Due / Re: How to use more than 3 slaves on Due spi? on: July 12, 2014, 06:01:22 am
It is possible using different pins, but settings like word size, speed, etc will not be automatically changed when chip select is changed. this only works on pins 4,10,52. like others say, if you'd like to have more of this, you can hook up a demux like Palliser says.

7  Products / Arduino Due / Re: DUE ethernet performance on W5200 with SPI and SPI+DMA on: July 05, 2014, 05:38:17 am
great code! i will be using this to read from an adc at 50kHz.. yielding about 1.2 Mbps traffic up and 600 kbps down. which should be peanuts compared to what you guys are doing with ethernet.

one question: can we use multiple dma streams at the same time? i see the code may need to be a bit extended? can the sam3x do this at all? typically, in a complex embedded system, there are multiple devices on the same SPI bus..

8  Using Arduino / Displays / Re: LCD display with ILI9341 driver on Arduino on: June 23, 2014, 03:52:45 pm
ah, nevermind. read the ILI9341 datasheet and it seems there's no hardware assistance whatsoever except vertical scrolling, haha smiley
9  Using Arduino / Displays / Re: LCD display with ILI9341 driver on Arduino on: June 23, 2014, 03:20:53 pm
i didn't read this entire thread, as it's huge.. but from what i scanned and the code i saw, this ILI9341 is completely software-driven. meaning all pixels have to be pushed from the MCU side.. does anyone know if it can do more? it would be ideal if it had some hardware for doing a simple block-copy, without having to pump pixels from the MCU..
10  Products / Arduino Due / Re: Change the Sine wave frequency on: May 27, 2014, 01:46:38 pm
i see you ditched the arduino analogWrite() and so on.. congrats. i'm also using less and less of that.

if you want something else as 2,4,6,8, etc (integers) try looking up "fixed point arithmetic". just reserve a couple of bits behind the comma. this may be a nice place to start..
11  Products / Arduino Due / Re: Our Life With The Due on: April 11, 2014, 02:57:11 am
Hhmm.. I thought I did use the pinMode().. Will check again, when I get round to it..
12  Products / Arduino Due / Our Life With The Due on: April 10, 2014, 03:21:46 pm
Just a little blog post dealing with our recent Arduino Due experiences..

Hope you enjoy it. And if there is any expert that can tell me why GPIO pin 53 is always high?
13  Products / Arduino Due / Re: INPUT_PULLUP on: March 15, 2014, 08:52:36 am
reading this i gather that a bigger pull-up resistor might lower the registered voltage and hence it might not be seen as high anymore. it's logical.

..but then it might be nice to consider using external pull-up resistors on the DUE..
14  Products / Arduino Due / INPUT_PULLUP on: March 15, 2014, 08:16:38 am
A project I made (originally for AVR based Arduino) uses INPUT_PULLUP mode on some of the digital pins to read out of tactile switch. On the UNO, this works fine. On the DUE, it's unstable somehow. When the switch is open and my hand comes close to the wire there's a square wave instead of a constant value.

I read that the DUE the pull-up resistors have higher impedance, but how can that cause this?

15  Products / Arduino Due / Re: DUE PWM Frequency on: March 14, 2014, 03:15:26 pm
the AVR has so-called "accurate PWM mode" to facilitate this h-bridge control (pulse is always centered around a unique determined point in the PWM period). it seems the Due's SAM has what Atmel call "complementary" mode. this is only available on the four PWM pins. the other pins are called TC (Timer/Counter) and do not feature complementary mode.

btw. . changing TC_FREQUENCY does not  mess up delay() or micros(). i'm a happy man smiley

Pages: [1] 2