Show Posts
Pages: 1 2 3 [4] 5 6 ... 343
46  International / Deutsch / Re: Hilfe zu Motorcontroller MC33926 on: June 05, 2014, 08:31:01 am
Quote
1 pro Motor ? mmhh, also alles was ich bis jetzt im INET gelesen habe,
war das man bei einem Motor der links/rechts dreht 4 nehmen soll.

Korrekt, wenn Du den Motor links und rechts drehen lassen willst, ist die Sache etwas komplizierter, dann kommt die von Dir gefundene Schaltung zum Tragen. Bei immer gleicher Polarität ist eine Diode ausreichend.
47  International / Deutsch / Re: SPI-Schnittstelle in ISR nutzen? on: June 05, 2014, 06:36:19 am
Quote
Das lesen über SPI wollte ich jetzt in die ISR integrieren damit der Arduino weiterschlafen kann.

Der Arduino kann nicht schlafen, wenn er eine ISR abarbeiten muss, das sind ja auch Prozessoranweisungen.

Quote
Im Internet hab ich gelesen, dass eine Kommunikation über SPI in der ISR nicht möglich ist?!

Das ist falsch, im Gegenteil ist die SPI-Schnittstelle die einzige serielle Verbindung des Arduinos, die gefahrlos innerhalb einer ISR angesteuert werden kann, da sie für ihre Funktionalität nicht auf Interrupts angewiesen ist.

Quote
Meine Idee wäre jetzt das Lesen des Registers ohne SPI-Schnittstelle zu machen indem man einfach den Timer nutzt und sich die nötigen Signale quasi selber „bastelt“. Kann das funktionieren oder ist das vom Timing her zu kompliziert?

Das hingegen funktioniert nicht, da für die Timer Interrupts notwendig sind und diese innerhalb des ISR deaktiviert sind. Wenn Du es so lösen willst, musst Du so vorgehen, wie Serenifly es beschrieben hat (Flag setzen und in loop() darauf reagieren).
48  International / Deutsch / Re: Google Protocoll Buffers zur Kommunikation zwischen Flash-Anwendung und Arduino on: June 04, 2014, 11:09:31 am
Google's Protocol Buffers ist nicht ein Kommunikationsprotokol, sondern ein Serialisierungsformat.

Welchen CommandMessenger hast Du verwendet? Link dazu wäre nicht übertrieben.

Welche Art von Nachricht möchtest Du übertragen?

Was meinst Du mit "Flash Anwendung"? Willst Du eine Adobe Air-Anwendung mit dem Arduino kommunizieren lassen?

Quote
Wenn ich das richtig verstehe, müsste ich einen Puffer anlegen und im loop alle Daten mit Serial.read() in den Puffer schreiben.

Mit Puffern solltest Du auf dem Arduino vorsichtig sein. Du bist Dir bewusst, dass Du von einem Gerät sprichst, das gerade mal 8kB (Mega2560) Speicher (RAM) hat? Wenn Du das serialisierte Paket in einen Puffer liest, dort analysierst und wieder in einer Struktur ablegst, bist Du schnell soweit, dass Du den Speicher komplett belegst. Dann wirst Du plötzlich ein eigenartiges Verhalten vom Arduino bekommen und nicht viel Freude am Resultat haben.

Ein Mikrokontroller wie der Arduino muss anders programmiert werden als ein PC. Er hat viel weniger RAM zur Verfügung, keine MMU (Memory Management Unit) und somit eine nicht sehr gemütliches Speicherbelegungsverhalten.

Erkläre uns, was Du erreichen willst und nicht, wie Du es erreichen willst. Wir können Dir dann vielleicht einen besseren Rat geben, was Du verwenden sollst. Google Protocol Buffers ist für die Kommnikation Browser<->Server gedacht (in erster Linie) und nicht für die Kommunikation mit einem Mikrokontroller.
49  Topics / Device Hacking / Re: Controlling Automower on: June 04, 2014, 10:53:46 am
Quote
The other command was used in the bridge example and I use it in another sketch as well without issues.

That was the case with the print() calls without the F() macro too. Just because it works for some time doesn't mean that it cannot be responsible for the problems after running a while. You're using the String class and that class fragments the available memory after some time. Once there isn't enough memory to fulfill the next allocation request, the program starts to react unpredictably.

Quote
Status returns 14392 instead of 56.

Provide the whole 5 bytes of output (best is to post it in hexadecimal format) not just a single part of it.

Also please post the current code you're working with, I guess you changed some stuff in the meantime.

Quote
Btw. is there a code way to restart the sketch?

Sure there is, but you should get the code to run reliably and not to restart it every other second.

Quote
Do you expect issues withe the compare functions I use?

Do you mean the "memcmp()" function? No, that works very well.
50  Using Arduino / Project Guidance / Re: Need help in Communication protocol.. on: June 04, 2014, 10:16:02 am
No, you don't have to remove the whole communication because then it wouldn't be a server anymore. Remove the while() loop and move the of the sending code inside the if block. That way the server only sends a response if the client sent it's data.
51  International / Deutsch / Re: Hilfe zu Motorcontroller MC33926 on: June 04, 2014, 08:38:22 am
Du brauchst nur eine Freilaufdiode pro Motor. Diese wird parallel zum Motor in Sperr-Richtung (Kathode an Plus, Anode an Minus) eingesetzt.
Der Motor enthält relevante Induktivitäten (Spulen), die einen Anlaufstrom speichern und ihn beim Ausschalten wieder abgeben. Dieser zurückfliessende Strom wird über die Dioden verbraten, bevor er in der Schaltung Schaden anrichten kann.
52  Using Arduino / Networking, Protocols, and Devices / Re: Strange i2c (twi) failure with Arduino Yun <--> TinyAVR on: June 04, 2014, 08:27:47 am
Quote
Would you recommend any particular tools for better understanding memory usage, such as Visual Studio or Eclipse's debugging capabilities (that I am speculating them to have)? I've just used Atmel Studio

Eclipse and least of all Visual Studio will give you any additional debugging functionality. They're designed to develop software for PCs, not microcontrollers. You might get a bit more support from Atmel Studio than you get from the Arduino IDE but on the Arduino you're usually limited to the serial debugging.

Quote
I am still a bit confused why it's so bad to use String instead of string (character array) in an event handler - is this more important  if I'm short on RAM?

You are short on RAM on the Arduino. An UNO has 2kB of RAM while the Leonardo/Yun offers 2.5kB of it. Both sizes are ridiculous compared to today's PCs so you have to take special care for it. The String class is designed after implementations for PCs and therefore takes use of dynamic allocation of memory for it's internal buffers. A PC has a coprocessor specifically designed for such kind of memory handling (MMU, Memory Management Unit) but microcontrollers as the ATmega series doesn't offer such luxury stuff. So if you use the String class the available memory on the Arduino gets fragmented in no time and sooner or later a memory allocation fails. When this happens things start to get strange, the behavior might change randomly.
If you use C-style strings (character arrays), you, the programmer, take care to reserve enough memory for the task. This is usually done without using dynamic memory allocation calls (malloc(), free()), so the used memory stays as compact as possible and especially the usage is much more static and predictable.
53  Using Arduino / Networking, Protocols, and Devices / Re: Due won't write I2C data when slave on: June 04, 2014, 03:40:46 am
Quote
Hopefully the Wire library gets updated and can behave more like the ATMega version.

That probably won't be possible because you're using a non-standard behavior of the ATmega hardware which is completely undocumented for the Wire library (because it's not intended to work that way) and probably will never be supported by that software. Even in a multi-master I2C setup the masters are not expected to be slaves at the same time, this is not part of the I2C standard. Although that may work with some hardware it's not really clever to use I2C that way, communication will never be reliable, so if you use it be prepared for the communication to fail. You may have to add some mechanism to your protocol to detect such situation and retransmit if they occur.
54  Using Arduino / Networking, Protocols, and Devices / Re: I2C Communication mode between Arduino Ethernet and EVAL-ADAU1701MINIZ on: June 04, 2014, 03:29:11 am
Does that mean you have no open questions? I'm asking because the only question you asked in the first post is answered by yourself. BTW, if you still have open questions, we're still missing the link to the hardware you're using.
55  International / Deutsch / Re: Hilfe zu Motorcontroller MC33926 on: May 30, 2014, 12:41:11 pm
Wenn D1 schon HIGH war, nützt das nichts, weil ja der Status nicht verändert wurde. Den restlichen Code sehen wir nicht, also können wir nicht sagen, ob das was nützen kann. Versuche doch mal:

Code:
digitalWrite(D1_PWM, HIGH);
delay(1);
digitalWrite(D1_PWM, LOW);

Bringt das was?

Ich hätte den Status von EN geändert, aber der ist bei Dir fest auf 5V verdrahtet.
56  Using Arduino / Networking, Protocols, and Devices / Re: Strange i2c (twi) failure with Arduino Yun <--> TinyAVR on: May 30, 2014, 12:35:22 pm
Quote
To be clear, the receive event handler is an event handler and not an interrupt handler (or called inside an interrupt handler), right? I understand that I shouldn't have a lot going on in there but it's not the same level of urgency as an interrupt vector, right?

It's an event handler and is called from an interrupt handler in interrupt context. In a microcontroller and interrupt is not directly related to urgency but just how the hardware handles things. Almost anything called by a hardware event is called in interrupt context (on the Arduino there is one exception: the serial receive event which is called from the main loop).

Quote
Is there any reference example you'd recommend on achieving the same intent as my handler code without doing serial communication inside it?

I don't have an example at hand but just set a flag variable (take care to declare it "volatile") and react on that in the main loop() routine, there you can print to the serial interface without any problems. You got to the same conclusion and that's how it's done.

Quote
I've removed any calls to serial comm in the event handler, instead using a flag & buffer to do it in loop(). I know that I could use a string instead of a String in the handler but I'd rather be lazy and quick than parsimonious but deal with null terminators. I am interested in any better way of doing this that isn't vulnerable to losing an incoming string because the buffer hasn't been cleared in loop() yet.

You didn't tell us what other things you do in the loop (the sketch seems to be not complete), so it's hard to direct you the right way. How fast is the Tiny sending it's data? Does that happen faster than what one loop() run needs? If this is the case use multiple buffers to hold the data items you get from the tiny or use a ring buffer with several  position pointers. There are many different ways to do this but first I would try to get rid of that String class. What kind of data is the Tiny transferring? Do you know how many bytes that are?

57  Using Arduino / Networking, Protocols, and Devices / Re: APDS-9930 Proximity Sensor I2C on: May 30, 2014, 12:13:51 pm
According to page 17 of the datasheet, the first byte transferred is the lower byte and the second is the higher byte of a word. Your code does return it the other way around.
58  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Uno with Ethernet Shield: query_time: could not connect to server on: May 30, 2014, 12:00:59 pm
From dev.twitter.com:

Quote
This is an important notice for developers still using HTTP plaintext connections. On January 14th, 2014, connections to api.twitter.com will be restricted to TLS/SSL connections only.

The Arduino platform doesn't support SSL transport encryption, so you cannot twitter directly from the Arduino, you need some kind of relay/proxy (either a PC connected to the Internet or a server which does that task).
59  Using Arduino / Networking, Protocols, and Devices / Re: how to save arduino data through internet... on: May 30, 2014, 11:54:47 am
Take a look at the examples of the Ethernet library or provide more detailed information about what you want to achieve.
60  Using Arduino / Networking, Protocols, and Devices / Re: Due won't write I2C data when slave on: May 30, 2014, 11:52:24 am
Quote
I have things setup in a multi master environment.

That mode is not supported by the Wire library.

Quote
All of the Uno's work as expected.

Because you don't really do a multi master mode but just let any one of the Arduinos act as a master for a while. You do that by using a "design flaw" of the Wire implementation for the ATmega processors, in that if you use the beginTransaction() calls, it automatically switches to the master mode until a endTransaction() is called. That's not documented and therefor not supported so it doesn't surprise me that it doesn't work on the Due.

Quote
The code on the Uno's works exactly the same, they assume the role of master and send out the data, but the Due does nothing.

Because on the Due there is a difference between master and slave mode and the hardware is either in one or the other mode but not in both almost simultaneously as it can be on the ATmegas.

A real multi master mode is a complex thing to do, I would try to avoid it if ever possible because you seldom get it to run reliably.

Please explain what you try to achieve, maybe we can give you a hint how to do that with using that mixed master/slave hack.
Pages: 1 2 3 [4] 5 6 ... 343