Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: potentiometer, where to put noise filtering capacitor, on multiplexer sheild on: August 10, 2014, 07:05:10 am
had any luck with reducing the noise?
2  Products / Arduino Due / Re: some questions on due pwm on: August 01, 2014, 04:50:32 am
btw.. one very simple solution to your problem would be to just leave PWM and do everything using GPIO. using direct access to the hardware registers is extremely fast (write upto 32 pins in a single instruction!) and also writing your own timing loop (i'm even talking stacking NOPs here) might yield minimum jitter on your output pulses. if your program isn't supposed to do anything else, this may be a fine solution..
3  Products / Arduino Due / USART SPI on: August 01, 2014, 04:37:41 am
Has anybody succesfully tried to use the Due's SPI mode on the USARTs? I'm really curious about the speeds which it is able to support. specifies it can go upto MCK/6, which sounds good enough. although i think there's always a stop bit in there?
4  Products / Arduino Due / Re: Sending Multiple Bytes with SPI.Transfer using Arduino Due on: August 01, 2014, 04:15:35 am
the loop you describe should be fine.. omission of the SPI.transfer() 's third parameter is implicitly SPI_LAST. just forget about while loops, for loops can do everything while loops can and more.. and they are typically less programmer error prone.
5  Products / Arduino Due / Re: some questions on due pwm on: August 01, 2014, 04:12:44 am
i have an 16 channel PWM program running in interrupt @ 50 kHz. this takes about 10% CPU. but this is all internally generated data.. what doors wants is a program that responds to an input.. to be honest i don't know the interrupt latency at all.

but one more thing that is important for doors is PWM enable. is it some kind of masking or does it actually trigger the pwm to enable at that very moment? if it is masking, then the required delay is logical. there may be another way to trigger pwm.. although i don't know it (sorry). the SAM3X user guide is your friend, i guess.
6  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?
7  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;
8  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.

9  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:
10  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!

11  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.

12  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..

13  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
14  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..
15  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..
Pages: [1] 2