Show Posts
Pages: [1]
1  Products / Arduino Due / How to read the electrical characteristics on: January 01, 2013, 09:15:57 am
Hello,
in the "simple audio player thread" a user speaks of 15 mA max. I looked up the datasheet and this is where I need some explanation. On page 1389 there are the "Absolute Maximum Ratings". I think the Due is in a LQFP (how many leads btw?), more importantly there are about 100 mA specified for all I/O lines. On page 1391 however there are also maximum ratings but they don't excel 24 mA. Furthermore the pins are splitted in groups, what's the reason for that and what does "Relaxed Mode" mean? To page 1421: Do I get it right, when saying that "Current Consumption" does not mean the current that is available on the pin?
The actual "hardware problem" what got me thinking is, that I hooked up some standard LEDs that, require about 20 mA and I'm afraid to hurt my Due by not being capable of reading the datasheet in the right way. I hope one can help me with that.

Greetings
decrux
2  Products / Arduino Due / Re: Do not follow Simple Audio Player example - DAC0 now non-functional on DUE on: December 31, 2012, 11:59:08 am
I once read that the Due DAC's highest voltage is about 2.55 V, with 8 Ohm I get about 318 mA. Isn't that already too high for the uC?
Possible options: 318 mA are no problem or it isn't 8 Ohm because the impedance depends on the frequency.
Another related question: If 8 Ohm Speakers work without a resistor, is it then possible to use 4 Ohm Speakers and simply add a 4 Ohm resistor? I'm hoping for appropriate help smiley

Greetings
decrux
3  Products / Arduino Due / Re: Arduino Due Benchmark - Newton Approximation for Pi on: December 25, 2012, 11:26:46 am
Cool project,
maybe adding something that measures the RAM in use would enrich your benchmark.
Greetings
4  Products / Arduino Due / Re: Debouncing button with sam3x registers on: December 25, 2012, 09:04:17 am
Well I simply replaced
PIOB->PIO_DIFSR |= 1<<26 would become:
g_APinDescription[22].pPort -> PIO_DIFSR |= g_APinDescription[22].ulPin;

in my code example for debouncing posted above and the button was debounced.

1 second is what I get by putting DIV = (2¹⁴ - 1) and not 255 in Tdiv_slclk = 2*(DIV+1)*Tslow_clock , see datasheet page 669. The DIVi are the single bits in DIV. slow clock frequency is by default 32 kHz. datasheet page 277. Also T = 1/f etc.

Greetings
5  Products / Arduino Due / Re: AttachInterrupt won't work on Pin 26 on: December 25, 2012, 08:56:57 am
Arduino Reference only speaks of reading Input state, but digitalRead() is working on another pin quite well. With an atmega32 the "pin status register" was read but here I found another approach.
Code:
extern int digitalRead( uint32_t ulPin )
{
if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN )
    {
        return LOW ;
    }

if ( PIO_Get( g_APinDescription[ulPin].pPort, PIO_INPUT, g_APinDescription[ulPin].ulPin ) == 1 )
    {
        return HIGH ;
    }

return LOW ;
}
If instead of using digitalRead(13) I use
Code:
PIO_Get( g_APinDescription[13].pPort, PIO_OUTPUT_0, g_APinDescription[13].ulPin )
it works. Funny that digitalRead works on some pins(Output) and on others not. Could someone try to verify the attachInterrupt function for pin 26?

It has something to do with PIO_PDSR and PIO_ODSR but I still don't know why the PIO_PDSR doesn't return the state value of the pin, when configured as OUTPUT.

Have a look at PIO_GET() in pio.c:

Code:
extern uint32_t PIO_Get( Pio* pPio, const EPioType dwType, const uint32_t dwMask )
{
    uint32_t dwReg ;

    if ( (dwType == PIO_OUTPUT_0) || (dwType == PIO_OUTPUT_1) )
    {
        dwReg = pPio->PIO_ODSR ;
    }
    else
    {
        dwReg = pPio->PIO_PDSR ;
    }

    if ( (dwReg & dwMask) == 0 )
    {
        return 0 ;
    }
    else
    {
        return 1 ;
    }
}
6  Products / Arduino Due / Re: Debouncing button with sam3x registers on: December 24, 2012, 09:19:42 pm
Thank you for your answer. How I understood it: g_APinDescription[] is an array of PinDescription structures (from the Arduino.h). PIO_SODR is the Set Output Data Register.
"DIV: Slow Clock Divider Selection for Debouncing
Tdiv_slclk = 2*(DIV+1)*Tslow_clock." from datasheet page 669
with a slow clock frequency of 32 kHz etc.
Your code example is working perfectly.
7  Products / Arduino Due / Re: AttachInterrupt won't work on Pin 26 on: December 24, 2012, 08:29:33 pm
Problem 2:
The following code isn't switching the LED on. Suggestions?

Code:
void setup() {
  pinMode(13, OUTPUT);
  pinMode(11, OUTPUT);
  digitalWrite(11, HIGH);
  digitalWrite(13, LOW); // LED off
  digitalWrite(13, digitalRead(11)); // LED on?
}

void loop() {

}
8  Products / Arduino Due / Re: Debouncing button with sam3x registers on: December 24, 2012, 07:03:07 pm
Hello,
I figured it out myself. For those interested:

Code:
/* PB26 is digital Pin 22, view Datasheet page 647 */
pinMode(22, INPUT);
digitalWrite(22, HIGH); // Pullup
attachInterrupt(22, myInterruptServiceRoutine, FALLING);
REG_PIOB_IFER |= 1<<26; // Input Filter Enable Register
PIOB->PIO_DIFSR |= 1<<26; // Debouncing Input Filter Select Register
PIOB->PIO_SCDR |= 0xff; // Slow Clock Divider Register

But I would rather use the digital Pin names instead of the Port Pins. Ideas?

Greetings
decrux
9  Products / Arduino Due / AttachInterrupt won't work on Pin 26 on: December 24, 2012, 06:53:18 pm
Hello,
Pins 22,23,24 do recognize Interrupts. Pin 26 doesn't. Is this a bug?
Greetings
decrux

Code:
  pinMode(26, INPUT);
  digitalWrite(26, HIGH);
attachInterrupt(26, increment, FALLING);
10  Products / Arduino Due / Debouncing button with sam3x registers on: December 24, 2012, 07:13:54 am
Hi,
I saw in the datasheet that there is a possibility to debounce by setting the right registers.since i don't know how to access registers yet I must ask again on how to do this. And no,I don't want to use debouncing software nor using a capacitor.
Thanks in advance
Decrux
11  Using Arduino / Displays / Re: LCD with Arduino Due on: December 23, 2012, 06:46:33 pm
Hello,
thank you for your reply! What I have tested is the following: Initialize manually in the setup() for 8 bit Mode, then using the Liquid Crystal Library. This works. Maybe it would even work in 4 bit Mode if I knew how to initialize the display for that mode(not in the datasheet).
The SPI library I'm using is also referring to the Liquid Crystal Library for writing on the display, so the .print() etc functions are not the problem, neither is the display. The issue has to be the intialization, but where to find the procedure and how to adapt it to 4 bit mode?

EDIT: initializing manually looks like this:
Code:
pinMode(16, OUTPUT); pinMode(15, OUTPUT); pinMode(14, OUTPUT);
pinMode(9, OUTPUT); pinMode(8, OUTPUT); pinMode(7, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(4, OUTPUT); pinMode(3, OUTPUT); pinMode(2, OUTPUT);

digitalWrite(14, LOW);
delay(1000);
digitalWrite(16, LOW); digitalWrite(15, LOW);
digitalWrite(9, LOW); digitalWrite(8, LOW); digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, LOW); digitalWrite(3, LOW); digitalWrite(2, HIGH);
digitalWrite(14, HIGH);
delay(1000);
digitalWrite(14, LOW);
delay(1000);
to be continued...

12  Using Arduino / Displays / Re: LCD with Arduino Due on: December 23, 2012, 02:15:23 pm
SPI is working now. All I had to do was to read the documentation of the library.

Question: How to modify existing LiquidCrystal Library to get EA DOGM163 working with 3.3 V in 8 bit oder 4 bit mode?
13  Products / Arduino Due / Accessing Ports and Pins on Arduino Due on: December 23, 2012, 09:05:10 am
Hello there,
in addition to my post "LCD with Arduino Due"(maybe you can have a look at it too) in the Displays forum, I have a question about accessing pins. With atmega32 I could do things like "DDRD |= 1 << PD3;" Are there similar possibilities for the sam3x? I read a little bit in the datasheet about PIO and "thousands" of registers. I came across the PIO_Get(...) function located in the pio.c which says
"Returns 1 if one or more PIO of the given Pin instance currently have
 * a high level; otherwise returns 0.
"
How can i interprete that?
My initiate idea was to put all necessary pins in one union and then accessing it via a Bitmask like:
Code:
union UnionOfPins {PORTA:1; PORTB:2; PORTA:3...; int myPort} myUnionOfPins; myUnionOfPins.myPort = 0xff;
In other words I want to define my own Port or at least use the already defined Ports.
One code example with getting a LED to blink with/(preferably)without using Arduino functions would already help quite a lot I think!

Why do I ask? Because my code looks like this:
Quote
pinMode(16, OUTPUT); pinMode(15, OUTPUT); pinMode(14, OUTPUT);
pinMode(9, OUTPUT); pinMode(8, OUTPUT); pinMode(7, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(4, OUTPUT); pinMode(3, OUTPUT); pinMode(2, OUTPUT);

digitalWrite(14, LOW);
delay(1000);
digitalWrite(16, LOW); digitalWrite(15, LOW);
digitalWrite(9, LOW); digitalWrite(8, LOW); digitalWrite(7, HIGH); digitalWrite(6, HIGH); digitalWrite(5, HIGH); digitalWrite(4, LOW); digitalWrite(3, LOW); digitalWrite(2,
...
14  Using Arduino / Displays / Re: LCD with Arduino Due on: December 22, 2012, 08:29:43 pm
UPDATE: Standard Initialisation for 3.3V in 8 bit Mode on Page 7 in the Datasheet posted above is working. Finally i can see a blinking cursor. I'm very happy right now(took me one day to get to a cursor) smiley.
BUT why is the SPI library failing? Why can't I get it to work in 4 Bit mode like posted in the playground?

Help appreciated smiley

EDIT: Initializing the display manually(without library) in 8 bit Mode and then using the LiquidCrystal-library is working. SPI still fails me though.

Greetings
decrux
15  Using Arduino / Displays / LCD with Arduino Due on: December 22, 2012, 01:14:55 pm
Hello there,
I'm new to this forum and I hope that this is the right board for my question. I'm trying to get the LCD module EA DOGM163W-A working on my new(also first) Arduino Due. I tried wiring it up in 4 Pin Mode like suggested in the Playground, I also attempted to access the module in SPI(4 wire) mode. For SPI mode i used the library provided here: http://code.google.com/p/doglcd/ (someone here in the forums made it). I built the circuit on a breadboard by looking in the datasheet: http://www.lcd-module.de/eng/pdf/doma/dog-me.pdf You can have a look on my attachment! Comment: I am using 100 nF capacitors. 5 parallel = 0.5 uF and one single capacitor 0.1 uF like mentioned in the datasheet.
So my question is "simple": How do I get it to work? I could try to test with 5 V, but I'm afraid of hurting my Due. I'm in big despair!
Greetings
decrux

Photo
http://s1.directupload.net/file/d/3112/von3aepe_jpg.htm
Pages: [1]