Loading...
  Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: Timer Interrupts on Due on: May 29, 2013, 02:33:28 am
Everything is there. Just do a grep (or file search if not on a *nix os).
The source files even have some comments. You should also have the SAM3X8E datasheet at hand too.
2  Products / Arduino Due / Re: Timer Interrupts on Due on: May 28, 2013, 02:49:38 am
If you include #include <Arduino.h> you should have access to them.
The source code can be found in:
arduino-1.5.2\hardware\arduino\sam\system\libsam\include\tc.h
arduino-1.5.2\hardware\arduino\sam\system\libsam\source\tc.c
3  Products / Arduino Due / Re: Timer Interrupts on Due on: May 27, 2013, 03:12:16 pm
Found the bug:
Code:
  TC_Configure(chTC, chNo,
       TC_CMR_TCCLKS_TIMER_CLOCK4 |
       TC_CMR_WAVE |         // Waveform mode
       TC_CMR_WAVSEL_UP_RC | // Counter running up and reset when equals to RC
       TC_CMR_ACPA_SET |     // RA compare sets TIOA
       TC_CMR_ACPC_CLEAR );  // RC compare clears TIOA

I have to set TC_CMR_ACPA_SET and TC_CMR_ACPC_CLEAR to instruct the counter to change the level on PIOA0 when the counter's value has reached RA/RC
4  Products / Arduino Due / Re: Arduino Due and tone() on: May 27, 2013, 03:10:11 pm
I'll answer my own question:
In order to get your square wave out on TIOA you have to set the appropriate bits on the TC Channel Mode Register:
Code:
  TC_Configure(chTC, chNo,
       TC_CMR_TCCLKS_TIMER_CLOCK4 |
       TC_CMR_WAVE |         // Waveform mode
       TC_CMR_WAVSEL_UP_RC | // Counter running up and reset when equals to RC
       TC_CMR_ACPA_SET |     // RA compare sets TIOA
       TC_CMR_ACPC_CLEAR );  // RC compare clears TIOA

This solution is much accurate than using interrupts but it has the drawback that you have to use the pin associated with the TIOA0 signal (on arduino DUE this is pin 2).

Best regards,
Dan.
5  Products / Arduino Due / Re: Timer Interrupts on Due on: May 26, 2013, 12:27:11 pm
Hello everybody.
I am trying to generate a square wave using timer counters but I do not want to use an interrupt, rather I would like to output to go directly to TIOA0. I have the following configuration of the registers
http://paste.ubuntu.com/5703102/

but I get no output on pin 2 of Arduino Due.
What am I missing?

Best regards,
Dan.
6  Products / Arduino Due / Re: Arduino Due and tone() on: May 26, 2013, 05:39:52 am
I have tried to change your code and configure TC0/Ch0 to use the TIOA0 pin as output for the square wave.
I have a piezo connected to Arduino PIN 2 (which, according to the mapping in http://arduino.cc/en/Hacking/PinMappingSAM3X should be PB25).

It seems that I am doing somethig wrong, since I get no output from pin 2.
If I enable the TC0_IRQn interrupt then I can see my handler being called, which means that at least the timer was configured correctly.

Can you please have a look over my code? I must have done something wrong.
http://paste.ubuntu.com/5703102/

I want to eliminate the need for interrupts and manual bit banging on pin 2.

Best regards,
Dan.
7  Products / Arduino Due / Re: Arduino Due Tone example not working on: May 26, 2013, 05:33:11 am
Check this thread too:
http://forum.arduino.cc/index.php?topic=136500.0
8  Products / Arduino Due / Re: i2cdevlib + MS561101BA + due on: April 25, 2013, 12:28:48 am
Thx,
I'll give it a try and keep you posted on the results.
9  Products / Arduino Due / Re: i2cdevlib + MS561101BA + due on: April 18, 2013, 02:02:53 am
Hello,
I have exactly the same setup and facing the same problems. Can you please post a link to the library you have used? What have you changed?

Best regards,
Dan.
10  Products / Arduino Due / Re: I2C Repeated Start on: February 06, 2013, 02:18:30 am
You can find the code attached to one of the posts above.
The name of the attachment is MLX90614_Direct_Access.ino

Feel free to use it in any way you like.
11  Products / Arduino Due / Re: I2C Repeated Start on: February 02, 2013, 05:01:03 pm
Hello,
I use this code to read the temperature from the MLX90614 IR sensor (see attachment).
The sensore has address 0x5A and I read 3 bytes from internal address 0x07.
As you can see in the captured signal, the controller sends 2 ACK and one NACK just before the STOP condition.

I suppose there is something wrong in your code, can you send it to me to have a look? Or share it somewhere on the internet.

Best regards,
Dan.
 
12  Products / Arduino Due / Re: I2C Repeated Start on: January 30, 2013, 09:10:38 am
I have just order a Bus Pirate from a retailer in RO. I'll have it tomorrow and I'll give it a try too.
I have to look closer to this issue.
13  Products / Arduino Due / Re: I2C Repeated Start on: January 30, 2013, 02:32:36 am
Can you please post a screenshot of the output from running your algorithm with numOfBytes=2 ?
14  Products / Arduino Due / Re: I2C Repeated Start on: January 24, 2013, 01:18:34 pm
It's my mistake. Use  WIRE_INTERFACE or  WIRE1_INTERFACE
You can find both defined in variant.h
15  Products / Arduino Due / Re: I2C Repeated Start on: January 24, 2013, 10:59:24 am
The first param is a pointer to a Twi structure denoting the I2C bus that you want to use.
In the case of arduino due there are 2 I2C buses, therefore you can use WIRE_INTERFACE_ID or WIRE1_INTERFACE_ID. Both of them are defined in hardware\arduino\sam\variants\arduino_due_x\variant.h
Pages: [1] 2