Loading...
  Show Posts
Pages: [1] 2 3 4
1  Products / Arduino Due / Re: Due generating Synchronous PWM on: June 10, 2013, 12:57:50 pm
it not really using syncronous channels as the data sheet states / you are just using both outputs of the same channel .. `
(i didnt need dead time .. but easy to add.. )

in anyevent  here is a chunk of code that sets up TWO seperate channels (two differnt duty cycles )
if you want to just use channel outputs 5H & 5L  rip out the "syncronous" stuff (channel 0 & channel 4)
(ALSO .. i didnt need dead time .. but easy to add.. )

Code:
void
PWM_setup ()
{
//PWM config
  pmc_enable_periph_clk (ID_PWM);

  PWMC_DisableChannel (PWM, PWM_CHANNEL_4);
  PWMC_DisableChannel (PWM, PWM_CHANNEL_5);
  PWMC_DisableChannel (PWM, PWM_CHANNEL_0);

  PWMC_ConfigureClocks (pwm_clk, 0, VARIANT_MCK);

  int ulPin = 8;
  // Setup PWM for this pin {theta1}
  PIO_Configure (g_APinDescription[ulPin].pPort,
g_APinDescription[ulPin].ulPinType,
g_APinDescription[ulPin].ulPin,
g_APinDescription[ulPin].ulPinConfiguration);
  ulPin = 9;
  // Setup PWM for this pin  {thetaRB}
  PIO_Configure (g_APinDescription[ulPin].pPort,
g_APinDescription[ulPin].ulPinType,
g_APinDescription[ulPin].ulPin,
g_APinDescription[ulPin].ulPinConfiguration);
  //**pin44        {theta2}
  PIO_Configure (g_APinC19RE_Description.pPort,
g_APinC19RE_Description.ulPinType,
g_APinC19RE_Description.ulPin,
g_APinC19RE_Description.ulPinConfiguration);

  PWMC_ConfigureSyncChannel (PWM,
     PWM_SCM_SYNC4 | PWM_SCM_SYNC5 | PWM_SCM_SYNC0
     , PWM_SCM_UPDM_MODE1, 0, 0);

  PWMC_SetPeriod (PWM, PWM_CHANNEL_4, pwm_period);
  PWMC_SetPeriod (PWM, PWM_CHANNEL_5, pwm_period);

  PWMC_ConfigureChannel (PWM, PWM_CHANNEL_4, PWM_CMR_CPRE_CLKA, 0,
PWM_CMR_CPOL);
  PWMC_SetDutyCycle (PWM, PWM_CHANNEL_4, pwm_dutyRS);
  PWMC_SetDutyCycle (PWM, PWM_CHANNEL_5, pwm_duty1);

  PWMC_SetPeriod (PWM, PWM_CHANNEL_0, pwm_period);
  PWMC_SetDutyCycle (PWM, PWM_CHANNEL_0, pwm_duty1);
  PWMC_ConfigureChannel (PWM, PWM_CHANNEL_0, PWM_CMR_CPRE_CLKA, 0, 0);

  PWM->PWM_OOV = PWM_OSSUPD_OSSUPH5;
  PWMC_SetSyncChannelUpdatePeriod (PWM, 1);


  PWMC_ConfigureComparisonUnit (PWM, PWM_CHANNEL_5, 1, 1);
  PWMC_ConfigureComparisonUnit (PWM, PWM_CHANNEL_4, 1, 1);
  PWMC_ConfigureEventLineMode (PWM, 0, PWM_ELMR_CSEL5 | PWM_ELMR_CSEL4);
  PWMC_SetSyncChannelUpdateUnlock (PWM);

  PWMC_EnableChannel (PWM, PWM_CHANNEL_0);
  PWMC_SetSyncChannelUpdateUnlock (PWM);
}
2  Using Arduino / Storage / Re: Compact Flash Interface? on: June 03, 2013, 02:36:54 am
like http://www.ebay.ca/itm/Dual-CF-to-2-5-Hard-Drive-HD-IDE-Interface-Adapter-/321097747053?pt=LH_DefaultDomain_0&hash=item4ac2eaca6d this ?
3  Using Arduino / Storage / Re: extra RAM on Arduino Due on: May 31, 2013, 02:34:56 am
I built an external sram device with XC9536XL ($1) and a 4MBytes large SRAM chip. You need 11 wires to control the memory (8data+3bit control). With bigger cpld (more pins) you can access an "unlimited" size of sram. It has got an auto increment feature thus a rd/wr to the device automatically increments the sram's address.
[snip]

i looked at a similar method but it requires to much processor intervention
- using SPI/USART with PDC/DMA should get up to 4MBytes/sec with very little processor intervention ...

my chunks are 4096bytes occuring once every 5ms (and faster if i can make other improvements)
so low processor over head is very important to me ..
4  Products / Arduino Due / Re: has anyone used USART1 as spi sucessfully ? on: May 30, 2013, 08:45:35 am
Oh yes, sorry I was thinking an external protocol. You can't use the DMAC?

for one application yes/ suppose so ..
looks more complicated than the PDC (& which i've used already  ... )
hmmm ...

but fot the other application / I can't because i would like to use the spi for SD card access
(using the USART as a fifo gateway to store data in an external memory)
5  Products / Arduino Due / Re: has anyone used USART1 as spi sucessfully ? on: May 30, 2013, 07:47:46 am

Why does it need a USART, if the USART is in SPI mode what's the difference?

as stated:
the two SPI peripherals can not use PDC, USART(1-4) in spi mode CAN use the PDC

Other chips of the same family spi periphieral can use the PDC ...
 why they don`t on the SAM3x8 .. no idea
..
6  Using Arduino / Storage / Re: extra RAM on Arduino Due on: May 30, 2013, 04:08:36 am
thoughput oon SPI is great but the latency is killing me...
I'm generating ~30-40megBytes / min  & having the occasional long latency really mucks up my data

I've purchaced a fpga+ram board(ebay) to make a 32Megabyte spi buffer
-- but my verilog/VHDL coding skills are 10years rusty ...   

Also looking at the same fpga SPI buffer to exchange data between the DUE & Raspberry-PI (two masters...) with no droped datas
 
7  Products / Arduino Due / has anyone used USART1 as spi sucessfully ? on: May 30, 2013, 02:43:03 am
the reason i'm asking is :
i want to use a PDC, which can be used with the USART & not with spi0/1


I'm guessing i have to modify pins in variants.cpp for digital outputs for the strange selection of pins
(A11-A16)

code so far:
Quote
void setup_spi()
{
    USART_SetTransmitterEnabled(USART1, FALSE);
    USART_DisableIt( USART1, 0xffff) ;
    USART_Configure(USART1,US_MR_USART_MODE_SPI_MASTER,  4100000, VARIANT_MCK);
    USART_SetTransmitterEnabled(USART1, TRUE);
    pmc_enable_periph_clk (ID_USART1); 
  
}
int spiout (void * buffer, uint32_t bufSize)
{
    USART_WriteBuffer(USART1,buffer,bufSize);
return usedSensorWidth;
}

8  Using Arduino / Sensors / Re: Using a Sony ILX751A Linear CCD with any arduino. on: April 29, 2013, 01:54:48 pm
uhh.. no ...


Code:
sample = analogRead(vout); 
blocks on the order of microseconds ... (l00ks like the mega can do 13us if prog correctly default is 100us)
Code:
Serial.println(sample); 
blocks on the order of milliseconds at 9600baud...

 use a scope & trigger a digital i/o to flip hi/lo & you will see your duty cycle ...
    i'll guess .1% dutycycle
9  Community / Exhibition / Gallery / Slitscan Camera on: April 29, 2013, 01:57:07 am

Done & with samples .. small partial schematic(just the sensor) & partial code ( droped the sd card & TFT)
http://ralph.ca/?p=707
this camera could also be used (modify the software) to run as a finishing line camera
10  Using Arduino / Sensors / Re: Using a Sony ILX751A Linear CCD with any arduino. on: April 29, 2013, 01:22:52 am
datasheet for the ILX751A asks for a clk dutycycle of 40-60%  ..
i don't see that happening with that code ..
11  Products / Arduino Due / Re: SPI across two Arduino DUE's on: April 19, 2013, 03:04:29 am
any luck on slave mode ?

i'm looking to connect a DUE (slave)to a RaspberryPi(master) .. 
and spi has only been implemented on the Pi as master so i figured the Due would be a easier modification ....
 sigh .. time to dig into some data sheets & libs ...
12  Products / Arduino Due / Re: speed of analogRead on: April 03, 2013, 01:45:05 pm
a few comments
the 1Msps is for one channel under very specific conditions
  if you switch channels there is a lag (you will have to look up the details in the data sheet)

IMO best way is to program the PDC with timing generated by the PWM .. with resonable sample code from atmel 
but that will not help you trying to read 80 samples .....

(i'm running at 500,000 samples / sec on one channel, in bursts of ~2k (roughly 4ms/collection ~ pause for 3ms, repeat )

can't comment on the USB , but writing to a SD card "can" be fast  (i'm writing ~500kb/sec),
you need buffer space for sd card lag
13  Using Arduino / Sensors / Re: Using a Sony ILX751A Linear CCD with any arduino. on: March 24, 2013, 03:27:19 pm
these Sony devices have a very simple clocking stucture to follow (as opposed to the National part i was mucking with)

there are really only the 3 steps
pulse low on ROG (once)
pulse on CLK , sample  the data  - repeat 2087 times ....
pause (! found the comment in the data sheet - integreation time is 10ms ! )
and repeat ....
use a scope to check that you have the correct polarities ...

not sure about the MEGA but it appears that you should beable to use the transistor buffer shown in the data sheet so easy to connect ( need clamp diodes for the DUE)
data will look like a stream of 10 bit numbers .... relative to the total amount of light .... 
with junk data at the begining & at the end 
14  Using Arduino / Sensors / Re: Using a Sony ILX751A Linear CCD with any arduino. on: March 23, 2013, 10:21:40 am
follow up :
i've just had 'limited' success in driving the ILX551A ,
very little change programming change from the other chip (upd3799cy)
& i save myself two pins

no data collection as yet but i can see the output change on the scope
whoo hooo !!

it requires VERY little light (i'm up to 200lines per sec ) & still get resonable responce in a medium dark room on a cloudy day ...
& it appears as the native output is close to max 3.5 volts -- so if i clamp it i may beable to feed the arduino direcly (probably have to buffer it but makes life easier ..... )
have to wait till monday  to get sockets , clamping diodes , & assorted other things ... 
15  Using Arduino / Sensors / Re: synthesise a circuit on arduino on: March 20, 2013, 03:38:23 pm
huh?
  simple answer - no

 complex answer -
you write a program & run it on a processor
could you "adc", take the root, "dac" it out  ..yes..

will it work like the circuit ... not likely
will it be a synthisised version of a spice deck .. no

Pages: [1] 2 3 4