Show Posts
Pages: 1 ... 4 5 [6] 7 8 ... 15
76  Products / Arduino Due / Re: Pin protection on Arduino Due on: January 23, 2013, 08:44:43 am
Quote
How do you protect your pins ?
I don't connect them to anything silly.  smiley-wink

Yes like, thinking, planing, think again, (may correct it), wiring it, control it, powering it. But in hurry: wire it, power it (crossing fingers and hope the best), use it or get a new one...

True is the Due cost more than the other boards, the SAM3X is way more sensitive and it's nearly impossible for some beginner to change the µC in an safe way. For the "NO RISK, NO FUN" section would be an UNO with DIP and an USBAsp the best option, on this combination there would not so much tears generate if something went horrible wrong. Change Burn and Ready.
77  Products / Arduino Due / Re: Arduino Due libraries (official and 3rd party) on: January 23, 2013, 04:15:04 am
First release of the RTC Library for the Arduino Due.

2 examples included.

I would call it final for the moment.

And on github: https://github.com/MarkusLange/Arduino-Due-RTC-Library

I hope the library is self explaining.

Markus

Update new library with unixtime and compilertime support

Update Version 1.2 now support for Date & Time in one operation for BKM.

And some changes all in the changelog

Update Version 1.3 now unixtime with timezone support with Example for it, for tevroc

Update Version 1.4 now support for geman timezone with Summertime.

Update Version 1.5 some changes in the Summertime Sketch, and updates at this point only on git

Update Version 1.6 added rtc_clock.timing to detect when the time was set in summer- or wintertime
(mostly helpfully for the german member)

Update Version 1.7 added rtc_clock.date_already_set() to proof if date is allready set, to prevent setting time again for Paul Stoffregen

Update Version 1.8 added rtc_clock.set_clock() to set __Time__,__Date__ in one line fixed bug in unixtime() and summertime() thanks to Paul Stoffregen for the hint
78  Products / Arduino Due / Re: New UTFT Libray with Arduino ARM spport on: January 22, 2013, 11:11:30 am
Would say the new one is faster.
79  Products / Arduino Due / Re: Disabling UART on Due? on: January 16, 2013, 05:31:26 am
I am working with K-line that is similar to yours. My code starts the bit-bang before activating the UART1.
I am using UART0 for debug. This is on a 1284 chip.

Code:
 digitalWrite (TX, HIGH); // makes K-line high 3
  digitalWrite(ledPin,HIGH);
  delay(2000);       // wait for K-line to be clear 3
  digitalWrite (TX, LOW); // makes K-line low  3
  delay(25);
  digitalWrite (TX, HIGH); // makes K-line high  3
  delay(25);        //last delay before first message
  Serial1.begin(10400);


 Also, I think there is a function called Serial.end() to stop serial comms.. I am not positive about it though.

Hi I used this code on the Leonardo for Lin,

Code:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long interval = 250;

//Lin Initailisation
#define linspeed                19200
unsigned long Tbit = 1000000/linspeed;

#define uartlenght                 10

//Tbits Header
#define breakfield                 13
#define breakdelimiter              1
#define breakfieldinterbytespace    2

int frameerrordelay = ((breakfield + breakdelimiter) - uartlenght)*Tbit;
//int frameerrordelay = (breakfield + breakdelimiter + breakfieldinterbytespace) - uartlenght;

#define syncfield                  uartlenght
#define PIDfield                   uartlenght
#define syncfieldPIDinterbytedelay  0
int syncfieldPIDinterbytespace = syncfieldPIDinterbytedelay*Tbit;

//Tbit Response
#define responsedelay               8
int responsespace = responsedelay*Tbit;
#define interbytedelay              0
int interbytespace = interbytedelay*Tbit;

#define numbers  4
byte message[numbers],sending[numbers];
byte linb,sync,PID,checksum;
int n = 0;

void setup() {
  // initialize serial port and LIN:
  Serial.begin(19200);
  Lininit();
  pinMode(13, OUTPUT);
}

void loop() {
  blinking();
  LinReading();
//  LinWriting();
}

void LinReading() {
  LinRead();
  PrintlnLin();
  ClearFrame();
}

void LinWriting() {
  LinWrite(sending);
  Answer();
  delay(1000);
}

void Lininit() {
  Serial1.begin(linspeed);
  pinMode(0,INPUT_PULLUP);
}

void Answer() {
  for (int i=0;i<numbers;i++) {
     sending[i] = n;
  }
  n++;
  n = n % 256;
  Serial.println(n,HEX);
}

void LinRead() {
  if (1<<FE1) {
    delayMicroseconds(frameerrordelay);               //after Frame Error Tbit to Sync Field
    if (Serial1.available() > 0) {
      sync = Serial1.read();
      if (sync != 0x55) {
        sync = 0x00;
      }
      delayMicroseconds(syncfieldPIDinterbytespace);  //Interbyte Space
      if (Serial1.available() > 0) {
        PID = Serial1.read();
      }
      delayMicroseconds(responsespace);               //after PID Tbit space
      for (int i=0;i<numbers;i++) {
        message[i] = Serial1.read();
        if (interbytespace == 0) {                    //Interbyte Space
          delayMicroseconds(1);
        } else {
          delayMicroseconds(interbytespace);
        }
      }
      checksum = Serial1.read();
    }
  } else {
    Serial.println("NO Break");
  }
}

void LinResponse(byte* sending) {
  if (1<<FE1) {
    delayMicroseconds(frameerrordelay);                 //after Frame Error Tbit to Sync Field
    if (Serial1.available() > 0) {
      sync = Serial1.read();
      if (sync == 0x55) {
        delayMicroseconds(syncfieldPIDinterbytespace);  //Interbyte Space
        if (Serial1.available() > 0) {
          PID = Serial1.read();
          if (PID == 0x11) {
            delayMicroseconds(responsespace);           //after PID Tbit space
            for (int i=0;i<numbers;i++) {
              Serial1.write(sending[i]);
              if (interbytespace == 0) {
                delayMicroseconds(1);
              } else {
                delayMicroseconds(interbytespace);
              }
              Serial1.write(MessageCRC(message,0));
            }
          }
        }
      }
    }
  }
}

void LinWrite(byte* sending) {
  Serial1.end();
  pinMode(0,OUTPUT);
  digitalWrite(1, LOW);
  delayMicroseconds(breakfield*Tbit);                 //after Frame Error Tbit to Sync Field
  digitalWrite(1, HIGH);
  delayMicroseconds(breakdelimiter*Tbit);
  Serial1.begin(linspeed);
  Serial1.write(0x55);
  Serial1.write(0x03);
  delayMicroseconds(responsespace);
  for (int i=0;i<numbers;i++) {
    Serial1.write(sending[i]);
    if (interbytespace == 0) {
      delayMicroseconds(1);
    } else {
      delayMicroseconds(interbytespace);
    }
  }
  Serial1.write(MessageCRC(sending,0));
}
 
void PrintlnLin() {
  if(sync != 0) {
//    Serial.print("Break Field   Sync:  ");
//    Serial.print(sync,HEX);
    Serial.print("PID:  ");
    Serial.print(PID & 0x3F,HEX);            //PID without CRC
    Serial.print("   CRC:  ");
    Serial.print(PIDCRC(PID));
    Serial.print("  Message:  ");
    for (int i=0;i<numbers;i++) {
      Serial.print(message[i],HEX);
      Serial.print(";");
    }
    Serial.print("  Checksum:  ");
    Serial.print(checksum,HEX);
    Serial.print("  ChecksumCRC:  ");
    Serial.println(MessageCRC(message,0),HEX);
  }
}

void ClearFrame() {
  sync = 0;
  PID = 0;
  for (int i=0;i<numbers;i++) {
    message[i] = 0;
  }
  checksum = 0;
}

void blinking() {
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;
    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;
    // set the LED with the ledState of the variable:
    digitalWrite(13, ledState);
  }
}

int PIDCRC(int PID) {
  int P0 = ((PID>>0) + (PID>>1) + (PID>>2) + (PID>>4)) & 1;
  int P1 = ~((PID>>1) + (PID>>3) + (PID>>4) + (PID>>5)) & 1;
  return (P0 | (P1<<1));
}

byte MessageCRC(byte* message, uint16_t sum) {
  for (int i=0;i<numbers;i++) {
    sum += message[i];
  }
  while(sum>>8)  // In case adding the carry causes another carry
    sum = (sum&255)+(sum>>8);
  return (~sum);
}

And for the Due I have Isolated and changed the Atmel Framework Examplecode. I will attach it but I have at the moment not the time for tests also I had also to comment out the USART1_Handler in the variant.cpp to let it complie proper.

B.R.
Markus
80  Products / Arduino Due / Re: unconnected SPI performance -- library vs DMA on: January 13, 2013, 11:39:50 am
I added performance results for the DUE's "extended" SPI mode.  For the unconnected tests, the extended mode is faster than the older SPI  API.  See  SPIperf.txt on the git site below

   https://github.com/manitou48/DUEZoo

Hi mantoui,

did you have an standalone version of the "extended" SPI-Lib as an replacement of the "regular" SPI-Lib as an 1 for 1 version to use all the benefits of the DMA support?

Would be very nice, thanks.

Markus
81  Products / Arduino Due / SSL/TLS on Arduino Due on: January 13, 2013, 08:38:56 am
Hello Guys,

I was thinking about SSL connections for the Due because there is more space and speed for that I have searched fot it but I found nothing only some parts about the CyaSSL and integration in LwIP for RTOS, and I have no idea how to integrate it, but this feature would be nice. Think the Due has the power for that.

And all the possibiltys, HTTPS, SSL/TLS for eMail connections and lots more...

Or PolarSSL looks comfortable for it https://github.com/polarssl/polarssl/blob/master/programs/ssl/ssl_mail_client.c
And I see Atmel puts allready some examples from it in the ASF but for the same uC that are worked in the Wifi-Shield.

Depends on this https://polarssl.org/discussions/platform-specific/atmel-microcontroller-wiznet-and-polarssl and this https://www.brainspark.nl/kb/how-to/polarssl-tutorial it should be possible to do this.

B.R.

Markus
82  Products / Arduino Due / Re: Disabling UART on Due? on: January 12, 2013, 05:45:42 pm
Trying to do some ISO-9141 (car ECU) communications, and i need to send a 5-baud start sequence which is done with:

Code:
pinMode(TX0, OUTPUT);
pinMode(RX0, INPUT);

digitalWrite(TX0, HIGH);
....
Serial.begin(10400);

BR
You mean K-Line I think so you have the same Problem I have with L-Line and the USART may you can use an K-Line Transciever and the Lin support from the SAM.
83  Products / Arduino Due / Re: Arduino Due don't work with sketch of Leonardo on: January 10, 2013, 01:53:45 am
Hi guys,

I'm trying to put a sketch that works fine in the Arduino Leonardo but don’t work in the Arduino Due.
Can somebody help me?

Thanks smiley
The Sketch would help to look at it.
84  Products / Arduino Due / Re: Arduino due DS1307 RTC library on: January 07, 2013, 09:52:45 am
We're talking on 2 different things.

I didn't know that the SAM3X has an RTC built in it.
I've tried to connect a DS1307 to the Arduino Due.
That is why I didn't understand how your library can help me with my project.

If there is a RTC built-in, how can I save the time there. is there a way to connect a battery to the SAM3X, like the one connected to a DS1307 circuit?

Thanks.
The SAM3X has connections for an backup-batterie to power the RTC if the "core" is powered of but the Arduino Due doesn't has Pins for that option.

Sorry for that, but this library is only for the build in RTC for an DS1307 you can use any library from the playground or else (so I think) the wire library is allready portet for the Due so they should work.
85  Products / Arduino Due / Re: Arduino due DS1307 RTC library on: January 07, 2013, 08:10:52 am
So how do I set the time on the DS1307?
I want to set it once, and read the time from it.

Btw. there is no DS1307 on the Due Board. the SAM3X has an RTC on Die.

Code:
#include <rtc_clock.h>

// Select the Slowclock source
//RTC_clock rtc_clock(RC);
RTC_clock rtc_clock(XTAL);

char* daynames[]={"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};

void setup() {
  Serial.begin(9600);
  rtc_clock.init();
  rtc_clock.set_time(10"hours", 29"minutes", 9"seconds");                <- this line set the time you set the hours, minutes and seconds with that
  rtc_clock.set_date(22, 10, 2012);
}

void loop() {
  Serial.print("At the third stroke, it will be ");
  Serial.print(rtc_clock.get_hours());                                            <- with rtc_clock.get_hours() you get the hours as an int
  Serial.print(":");                                                                          same for the fowolling minutes and seconds.
  Serial.print(rtc_clock.get_minutes());
  Serial.print(":");
  Serial.println(rtc_clock.get_seconds());
  Serial.print(daynames[rtc_clock.get_day_of_week()-1]);
  Serial.print(": ");
  Serial.print(rtc_clock.get_days());
  Serial.print(".");
  Serial.print(rtc_clock.get_months());
  Serial.print(".");
  Serial.println(rtc_clock.get_years());
}

May I had to set more comments in the sample.
86  Products / Arduino Due / Re: Arduino due DS1307 RTC library on: January 07, 2013, 04:47:16 am
Hi Markus,

I'm using an external XTAL.

I uploaded the Due_Rtc_Simple_Sample once and all worked fine.
When I commented out:

 
Code:
//rtc_clock.set_time(10, 29, 9);
  //rtc_clock.set_date(22, 10, 2012);

The date was 1.1.2007

Am I missing something?

No you missed nothing the 1.1.2007 is the the Resetvalue in the Calenderregister (look at the SAM3X Manuel on page 251) so this Date is set after Powering on. I don't know why this Date is set, but there is nothing wrong if it shown.
87  Products / Arduino Due / Re: Arduino due DS1307 RTC library on: January 07, 2013, 02:03:42 am
Hi,

I've tried using RTClib and DS1307RTC libraries but they aren't compatible with the Arduio Due.
I've found this library, but it doesn't use an external RTC.

Any help?
Hello Liad

Did you have an external crystal?

Witch line did you use?

RTC_clock rtc_clock(RC);
or
RTC_clock rtc_clock(XTAL);

The RTC_clock rtc_clock(RC) should work allways.

Markus
88  Products / Arduino Due / Re: TFT library compatible with Due? on: December 23, 2012, 11:06:46 am
Yes, but you need to get itdb02_32s display and mega shield for it from iteadstudio.com, these sources are compatible with that display and propably only with that display, other than 16bit modes are removed and this library only supports arduino due as I replaced and removed code, instead of just making it compatible with due along others. But here's a library, examples work "as is" with mega pins chosen on utft init..

Oh, one more thing.. You need to apply this patch:
https://github.com/cmaglie/Arduino/commit/74dea07f2c7e977bacf5c61f7e8502609b285dbb

Now it works, sorry missed the patch.

Happy X-Mas
89  Products / Arduino Due / Re: TFT library compatible with Due? on: December 23, 2012, 10:56:03 am
Yeah, the library should be cleaned up.. It's a bit messy.. But this is a great starting point for everyone needing a display for due..

Here's one more thing, when using samples (or doing your own) - you need to change bitmap definitions a bit to make it work.. For example, tux.c in UTFT_Rotate_Bitmap example:

Code:
// Generated by  : ImageConverter 565 v1.0
// Generated from: tux.png
// Time generated: 11.10.2010 22:51:32
// Size          : 2 048 Bytes

//#include <avr/pgmspace.h>

const unsigned int tux[0x400] = {
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE73C, 0x9CD3, 0x9CF3, 0xA514,   // 0x0010 (16)

it should start like this..
comment out #include <avr/pgmspace.h>
and change variable definition to:
const unsigned int varname[size] = {

Seems not working for me only geht an white screen
90  International / Deutsch / Re: Wortuhr Zeitumstellung (Arduino Due) on: December 21, 2012, 12:27:25 pm
Danke für die schnellen hilfreichen Tipps.

Ich hatte es mir schon gedacht, dass das Programm grundlegend anderst geschrieben werden muss:) funktioniert fürs erste jedoch auch so ganz gut smiley

Werde mich demnächst ans neue Programm rantasten.

Das "taktgefühl" hat der Due übrigens gut im Griff... Hatte zeitgleich eine Stoppuhr laufen lassen. Nach 20 Tagen war die Abweichung kleiner als 0.1 Sekunden. Das sind weniger als 2 Sekunden aufs Jahr.

Für jeden weiteren Tip bin ich natürlich sehr dankbar.

maestro_dom

Also ich habe mal die Wortuhr von hier http://www.mathias-wilhelm.de/arduino/projects/text-clock/ auf den Arduino portiert rödelt auf nen TFT vor sich hin. Sketch füge ich mal an. RTC lib findest du hier https://github.com/MarkusLange/Arduino-Due-RTC-Library. Habe das ganze aber auch mal auf ein LCD gewuchtet neben ein paar anderen Anzeigen, hänge ich auch mal an.

Grundsätzlich hat sth77 recht der Due hat dabei langeweile und viel zu viel Speicher übrig ein AtMega328P reicht da völlig.

Markus
Pages: 1 ... 4 5 [6] 7 8 ... 15