Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: June 16, 2013, 04:45:32 am

Hi All,

Just for information, I made 2 shields : one is based on SN56HVD234, the other uses MCP2551.
I have run some basic tests and it seems to work fine for both.
Concerning the 5V aspect, I use Zener diode (3.3 or 3.6v) on the Rx pin, and it seems to work fine.


2  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: April 02, 2013, 05:01:10 am
Hello,

First, thank you all for your job, especially Palliser and AdderD !

I checked this topic from time to time and today I started to test the CAN on my Arduino DUE !  smiley

So I make here a first feedback of my first tests, in order to give some information and ask more questions...

First remark, I'm not a Github user, and I don't know how to download the CAN part of the official version, so I used the AdderD's version, which is available in a zip format (thanks).

So I just put the librairy in my directory and started to compile : OK.

About the hardware part, expecially the transceiver. I will also order the same SN65HVD234 as you, but at the right time I have one another kind of transceiver : MCP2551. It is a 5V transceiver, but I wanted to test it. its advantages : it is cheap and available in the "old fashion soldering", I don't know the word ("traversant" in french), I mean that you can easily solder it with you big figers and basic iron.

As it si 5V, of course it's better to put a Zener diode on the CanRx pin. And for the Tx, we hope that the 3.3v signal will be enough.

And the answer is.. yes, it seems to work fine.
With an oscilloscope I checked that 3.3v signal coming out of the Due is well transformed in differential tension.

Now, About first functionnal test.
My first test is the "Example1" delivered with AdderD librairy.
To understand a little bit more what I was sending I set CAN_MSG_DUMMY_DATA at 0.
So then I sent for example "250" from the serial port, and I got a communication with the result :
"CAN message received= 2500000000"

So display may be strange but it seems to work.

But I tried more values and I noticed that it works well only for value under 255... ?
Here is some examples of what I get :
250 => 2500000000
256 => 01000000
257 => 11000000
258 => 21000000
3000 = > 18411000000
65535 => 255255000000
65536=> 00100000

Do you have the same ? isn't it juste a problem of data interpretation or display?
I haven't yet looked insided the code, please give me your opinion about this.
3  Using Arduino / General Electronics / Re: How to protect analog output (current protection) ? on: February 28, 2013, 04:43:33 pm

You can use a series resistor providing the resistor's value is very small in comparison with the impedance you are driving it into. Therefore putting it into an op amp configured as a voltage follower is your best bet.

Ok but then the question is the same for the op amp : it must be able to accept short circuit on its output. Do you suggest AD8031 / AD8032, as MarkT said ?
4  Using Arduino / General Electronics / Re: How to protect analog output (current protection) ? on: February 28, 2013, 11:02:36 am
Thanks for all your answers,


A quick search threw up the AD8031 / AD8032 as possible candidates (and avail in DIP package)
Ok thanks I will consider such a device. I'm not a datasheet expert reader, but I don't often find the information of : does it supports short circuit or not ? When I see the information like "max sink current : 20mA", it doesn't tell me if the device protects itself when short-circuited (by lowering output for example), of it it burns immediatly.

I assume the idea is to protect the DAC from shorts?
If you don't need absolute accuracy (such as an audio application)...
Yes it is for DAC protection, but not for Audio. In my application I need absolute accuracy, that's why I can't use just a resistor


If you need absolute accuracy, you can use a current-limiting resistor on the output of an op-amp buffer, with the resistor inside the feedback loop.  The feedback will maintain low effective output impedance (holding your output voltage) as long as the voltage drop across resistor & op-amp output-stage is not so great that there is not enough voltage left for the load.                 
OK this is interesting... but I don't know much about op-amp. Do you have a small schema? Thanks.

Yes and no. The arduino board have only two state, high (5V) and low(0V). It only plays with the time you're high and low.
No, I mean real analog signals. As I said, it can be from the Arduino Due, or thanks to an external DAC, using for example SPI interface.


Thanks again.
5  Using Arduino / General Electronics / How to protect analog output (current protection) ? on: February 26, 2013, 12:05:21 pm

Hi all,

Thanks to my Arduinos I can generate some real analog values. It can be made through the onboard DAC of the DUE, or with an external DAC like MCP4912.

I am looking for a component to put after the DAC, that does the following job :
- under a certain amount of current (for ex 10mA), the output voltage is exactly the DAC output
- when there is an overload, more than 10mA, the output voltage can deviate from the DAC output to limit current to 10mA
- as soon as load is back to normal, output voltage is back equal to the DAC output
To sum up, from the DAC point of view, there is no overload. this one always outputs its voltage in safe circumstances.

So, what is the best and easy way to do this ? are there integrated circuit for this ? Should I use an operationnal amplifier ?

THanks for your answers.



6  Products / Arduino Due / Re: Connecting an Ethernet PHY to Arduino Due on: January 27, 2013, 05:13:46 pm
Hi all,

First I would like to thank you for all the energy you put is this project , which seems very interesting smiley !

Then I have one simple (maybe stupid) question :

On one hand, we have Arduino Uno which comes with ethernet shield (with W5100) and is able to do some client/server application with ethernet.
On the other hand, we have Arduino Due which indeed has a SAM3X and thus some ethernet capabilities, but no access to these ethernet pins and it also needs another PHYceiver, which means alse another kind of shield (Am I right?)

So my question is... what is wrong with the existing ethernet shield ? Is it a matter of speed ? In what case would we need to use this new extra shield rather the W5100 existing one ?

You may answer with "it depends on your application, the amount of data you want to transfer, etc.", so here is what I would like to do:
Just one client, one server, ethernet connection. The arduino is the server. The client makes requests, which mean "I want information number X". The servers makes the answer, which is just a few characters for each answer. So it's a lot of small requests - answer, maybe a hundred per seconds. It must be able to run for hours without "bugging or overloading"

=> Is this good with the standard "ethernet W5100 shield" ? Or should I follow in more details your developments which aim at using the SAM3X ethernet hardware with a specific PHYceiver?

Thanks for your answer !


7  Products / Arduino Due / Re: Pin protection on Arduino Due on: January 22, 2013, 05:02:15 pm
Hi,

Are there other opinion ?
How do you protect your pins ?

8  Products / Arduino Due / Re: PWM Resolution on: January 15, 2013, 03:28:10 am
Hi all,

On the Arduino Due also you can configure clock divisor, frequency, resolution as you want.
You have to use the real 8-channel PWM, which are available on many pins...

You can do it by directly setting the SAM3X registers, see the raw example I put here :
http://arduino.cc/forum/index.php/topic,142103.msg1070358.html#msg1070358

Or you could use/create a nice librairy which makes some checking and provide nice function name, though I don't know if one already exists at the present time.
9  Products / Arduino Due / Re: Pin protection on Arduino Due on: January 14, 2013, 09:17:22 am
Hi DuaneB,

Indeed on the DAC outputs I will apply the same kind of protection : Zener 3.3V + R1000.

When I read your sentence I understand that this resistor protection would have a "negative effect" on other pins... I don't really see why ! (I mean, for most of the pins).

10  Products / Arduino Due / Re: Due pinout diagram on: January 14, 2013, 04:47:31 am
Hi,

Very nice job this diagram !

I just would like to give my opinion on one thing :
I think you have already discussed this, but I'd prefer to have both peripheral A and B indicated.
To be honest I will print this layout and add some manual (and dirty) writing about periph A/B, so in my opinion it would be better to have it directly on the diagram...

Anyway, thanks a lot for your work!
11  Products / Arduino Due / Pin protection on Arduino Due on: January 14, 2013, 03:22:16 am
Hello,

It seems that the SAM3X is less "robust" than the ATmega2560, and more subject to "accident", as:
- the operating voltage is 3.3V
- max current per pin is.. I don't remember exactly, but about 10ma
- in a general way no voltage outsite [-0.3 3.6V] should be applied

So I would like to use a "standard protection" on most of my pins, and I am interested in how you handle this.
Personally I have considered Zener diode 3.3V + Resistor 1kohm, on each pin.

But I realised that a standard (Zener) diode allows voltage as low as -0.8V, which is less than -0.3V....I suppose this is a problem?
So what do you suggest ?

thanks
12  Using Arduino / Programming Questions / Re: How to program 16-bit pwms in the different Arduino boards ? on: January 13, 2013, 03:13:24 pm
Hello,

Today I ate quite a lot of ATMEL SAM3X datasheet and indeed, after focusing on this PWM subject for a couple of hours, we can do nice programming of PWMs on the Due !!

I diretly configured SAM3X registers, it may be "brutal" and sometimes unappropriate, anyway I put here some draft code, it could help someone :

Code:
    // Let's say we want to configure PWM channel 0, PWML0 which is on pin34 Due board, and corresponds to the port C.2

    // First the peripheral must be activated instead off the general GPIO
    REG_PIOC_PDR = 4;
    // Moreover it's peripheral B (not A), which means we have to change PIO_ABSR[2]
    REG_PIOC_ABSR = REG_PIOC_ABSR | 4;
   
    // Now concerning PWM settings...

    // activation of the clock dedicated to PWM peripheral (id36), which is fifth bit of PMC_PCSR1
    REG_PMC_PCER1 = REG_PMC_PCER1 | 16;
   
    // activation of PWM_ENA register with channel 0
    REG_PWM_ENA = REG_PWM_SR | 1;
   
    // setting the period (which can take any 16 bit value...)
    REG_PWM_CPRD0 = 5000;
    // note : with this 5000 setting, we have thus 1/5000 resol, with a frequency of 16khz, if we use the defaut main clock : that's good
 
    // Finally, setting the duty cycle to the value you want (between 0 and the period, of course)
    REG_PWM_CDTY0 = 1000;
   
    // And here we can check at the oscilloscope that we get a nice PWM on pin 34, with a period of 60usec... nice!
 

Now I have one question :

Why do the PWM pin are indicated on pin number 2 to 13 on arduino boards !! ?
It seems that the 8 true PWM channels are not these ones... for example here I used the channel 0, which can be found on pin 34, 35 and other pins...

And one other interesting remark :
We can actually reach very nice resolution, especially if we use low (or high) pwm commands. For example, the hardware I use with this pwm is highly non linear, and I need to be precise with low duty cycle.
As I don't really care about precise frequency (let's say anything between 8khz and 20khz is fine), I can modify the period as well as the duty cycle.
So, from the duty cycle 1/5000, I can go to 2/5000, but also I can use 1/4990, 1/4900, etc.
And it works well.

Hope this will be usefull for someone.
13  Using Arduino / Programming Questions / Re: How to program 16-bit pwms in the different Arduino boards ? on: January 13, 2013, 06:02:21 am
Hello,

The fastest way would be to read the datasheet. The pwm module is very easy to configure.

Oh, is it really so easy ? Indeed I can't tell as I don't know anything about the Atmel SAM3X. But I've made some research on the forum and it seems that several people have spent some time on it, and it's not so simple to make an easy-to-use librairy. Though you are write I will try to look in more details at the datasheet...  smiley

   You were pointing in the right direction in your first post - 65535 * 30K = faster than a Mega and also faster than a Due.

   As the resolution gets higher, you need much faster PWM Clocks that any of the Arduinos will get you.

   Out of interest, why do you need PWM as opposed to a DAC which does not suffer from the clock limitation ?

Yes I understand this limitation of "frequency*resolution < clock", but first I want to be able to configure PWMs as needed. By default it's 1khz 8bit on the Due, for example I would like 4khz 12bit resolution.
I checked that analogWriteResolution() doesn't change anything concerning this, as expected.

Why PWM ? for at least 2 reasons :
- there are more PWM pins than DAC on an Arduino board... and I need probably about 10 output of this kind
- the hardware I decided to use "after" the Arduino is now designed for receiving a pwm, as it was done using Arduino Mega.
- I reserve the 2 DAC of the Due for some other use ...

14  Using Arduino / Programming Questions / How to program 16-bit pwms in the different Arduino boards ? on: January 11, 2013, 04:28:41 am
Hello,

I currently have an Arduino Mega board and one of my needs is to produce PWM signal at high frequency (for example 30khz), and if possible with 12bits or 16bits resolution. I also plan to buy an Arduino Due to be able to do this and to have more power.

Concerning the PWM frequency, on Arduino Mega this is fine : when modifying TCCRxB register, I change the prescale, thus the frequency. So I can get the 30khz frequency. But concerning the 16-bits PWM, I haven't seen much information, and I don't know if it's possible to have this 16bits (or 10 or 12?) resolution. ( Well now i am pretty sure it's impossibe as I realise that 30k* 65k is about 2ghz... )

As this Mega board is too weak for my project, I thought "ok let's buy the new Arduino Due, with this powerfull Atmel 32 bits microcontroler it's probably easy to get some kind of 12bits PWM at high frequency"
But I get confused. The Atmel documentation of the SAM3X says
Up to 8-channel 16-bit PWM (PWMC) with Complementary Output, Fault Input, 12- bit Dead Time Generator Counter for Motor Control

But when I look at the analogWriteResolution() reference I can read
The Due has the following hardare capabilities:
   12 pins with 8-bit PWM (as the other AVR based boards)
    2 pins with 12-bit DAC (Digital-to-Analog Converter)


Here I talk about PWM pins, not DAC.

So, to sum up :
1) Can Arduino Mega produce PWM with 10 or 12bits resolution? at what frequency ?

2) Can Arduino Due produce PWM with 12 or 16bits resolution? at what frequency? How do we do this?
On Due if I write
Code:
analogWriteResolution(12);
analogWrite(PWMpin, 3017);
Will I really get a PWM with duty cycle 3017/4096 ?
 
Thanks for your answers
15  Using Arduino / Programming Questions / Re: Source code of standard fonction on: October 03, 2012, 01:53:51 pm
Thank you for all your answers,

I understand that I should not try to access directly these variables.

Why would I try to do that ?
For example  If I want to write my own "pseudo micros() function", in order to fulfill my specific requirements. It's just an example.

Concerning this specific time - question, I finished with using directly TCNT0, because I am on a very time-critical program and I realised that I can probably do it with 8bit variables, which saves me a lot of time on these little Arduinos smiley.

But I also ask the question in a more general way, and I thank you for the answers.  smiley-wink

Pages: [1] 2