I have an Adafruit Motor shield v2 which was altered per adafruit for 3v logic so as to be compatible with the Due. I downloaded their Motor Shield V2 arduino library, built and uploaded the DCMotorTest sketch from an external PC using ver 1.5.6-r2 of the ide with the modified Bossac. (I've also used the UDOO iMX6 Debian with arduino IDE with the same results below) The adafruit DCMotorTest sketch writes "tick", "tock" and "tech" to the serial monitor port with 5 sec, 5 sec and 1 sec intervals after them. I'm seeing 30 sec intervals after "tick" and "tock while after "tech" is the expected 1 sec. The DC motor on M1 is suspose to speed up and down and reverse direction, but it only runs at a constant rate and its output pulse modulation is unchanged. The sketch controls the DC Motor via the i2c, however putting a scope on the SDA and SCL pins showed no data with both pins static at 0v DC. A Due clear and Reset (via pins) brings both pins up to 3.3v. I get the same results (no i2c data) with the Motor shield removed. It appears that the i2c is not working. What is the best way to test it? Preferablly by using my scope as I have no other components to interface to it. Thanks,
I now believe that this is due to the lack of pull-up resistors on SCL1 and SDA1 See http://forum.arduino.cc/index.php?PHPSESSID=ub3kncqamgqcttapvrgmu4kv65&topic=223513.0 I will confirm once I get some resistors
Hmm that is interesting what is the difference between yours and mine? After reading your message I immediately installed the adafruit Motor Shield on UDoo. Loaded the DC Motor Test and plugged in external power for the Motor. It accelerates and decelerates the DC Motor as programmed. Is there something that I can check for you to help determine what is the difference between our two setups? Mike
Mike: There's some controversy over the existence of SCL1, SDA1 pull-up resistors. Is it possible for you to temporarily put something like a 10k+ resistor between SCL1 and ground? If your's still works then it seems your line is being pulled-up. My SCL1 and SDA1 float high (3v) after a clear-reset (vis jumper pins) but drop down (and stay low) to 0 v once I run DCMotorTest. If you don't feel comfortable doing that, I'll be able to pick-up a couple of pull-up resistors to pull mine up to 3v and see if mine works. Maybe I have a bad UDOO
Mike: Do you have the newer Motor Shield V2? Did you modify it per Adafruit's instructions for 3v logic? I added pull-ups and I am seeing data now on SCL1 and SDA1, however its still not talking to my motor shield
Yes I do have the newer Motor Shield V2 and it has been modified for 3V logic (cut 5V connection/solder 3V logic select). No pullup resistors required. Also soldered on stacking headers so that additional boards can be added on top (great for test points). I will try to dig out the Oscilloscope today and take a closer look.
It sounds like I have exactly the same, including the stacking headers. Unfortunately, I don't see any signals on SCL1, SDA1 (next to AREF) unless I use 1k pull-ups to 3v. Did you make any modifications to the software (wire.h, adafruit libs, ...)? Also, are you programming the embedded Due from an external PC, or from the embedded iMX6? Thanks for your help.
Well I'm not happy with what happened while testing. The motor test was running on the UDOO and all of a sudden it stopped dead. The SCL1 and SDA1 lines were still pulsing but the PWM chip on the Shield wasn't responding. Reset, reprogram nothing seemed to bring it back. So removed the shield from UDOO and installed it on Arduino Due board. What! The motor shield isn't working on it either. Reset, remove power nothing would get that shield working again. Out of desperation to see if the Arduino Due board worked I loaded the Example Blink program. Blinky, Blinky of the LED so all is good. Upload the DC Motor Test program again and it now works. Do the same thing on the UDOO, load the Blink program and check for flash. All okay. Reload the DC Motor Test and it starts running okay. Leave it for awhile and the shield stops working again after about 7 minutes. It appears that something with the software is crashing whether it is on the UDOO or an Arduino Due board. Need to do more testing to try to narrow down what is causing the crash. The strange thing is it does something to the PWM chip on the shield otherwise it would have worked when removed from the UDOO and installed on the Arduino Due board. Already spent about 4 hours today on this so need to take a break from it. Note the Motor Shield has 10K pull up resistors to VCC of the shield which are shown on the schematics at the link below. The 3V logic mod changes VCC from 5V to 3V. The Motor Shield labels are SCL and SDA which are the same pins on Arduino Due or UDOO labeled SCL1 and SDA1. http://learn.adafruit.com/assets/9536 All Arduino programming done with external PC with version 1.5.6r2. This is not what I had expected to happen. I obviously never ran the test program long enough for the trouble to appear.
I saw the 10k pull-ups earlier today. I get I2C1 signals without Motor shield when I add my own pull-ups and I know now not to add them with the Motor shield in place. I read on the Arduino forum that the wire library is not fully implemented yet for the Due. I don't know if that's related. Although I'm sorry to hear you're having problems too, it gives me a little hope that my hardware is still good. I don't have a second controller (arduino Due) to test it on, but I'll try to document what I see with my UDOO + Motor shield tonight
Probably not going to help you guys at all, and depending on what sort of motors you're driving this might not work, but I've largely given up on motor "shields" for arduino and have completely switched to using TB6612FNG-based setups. these are REALLY small little chip (you can get them on carrier boards as well from sparkfun or pololu) setups to do motor driving. Pretty simple to use too, but they require a bit of wiring up. They work off 5V though, so you'll need to use something like a level shifter or something to make them work with the Udoo.
It certainly looks like a wire library problem but can't say for sure. Just that the problem definitely exists on the Arduino Due board and the UDOO. Which is good in some way, at least it isn't just UDOO. That means more people will experience the same problem and perhaps the Arduino folks will find a fix. Thanks for the reference mkopack will take a look at that TB6612FNG. I don't mind wiring at all having spent over 30 years wiring stuff up to support my electronics habit.
I may have to switch too. I had to do a lot of resetting clearing and complete power removal before I got any I2C data to the Motor shield With no motor attached I see a constant periodic stream of I2C data to the motor shield. The serial monitor displays: 'tick', 'tock', 'tech', over and over without interruption. With an external 9v supply, but still no motor attached, I see modulated 9v go from 0%, to 100%, to 0% and then nothing thereafter. I was expecting the modulation voltage to reverse, didn't happen. If I hook up the DC motor everything freezes-up and the motor modulation seems to be left in some fixed random state. This is probably due to noise for which I could filter out with caps on the motor. However, noise isn't causing the problem above. It may be related to the wire lib not being complete for Due yet. I look through the code and report if I every get this working...
Yes please do let us know what you find if anything. I discovered the same thing with the motor modulation sometimes it just takes off wildly or just stops dead. If I find anything else will report back here. The same thing happens with the Arduino Due board so there must be other people with the same problem. I read somewhere that the Wire library for Due is broken but thought it was an old post. Will have to search again to see where this is at.
This post on the Adafruit Forum sort of lays this problem to rest. The Arduino Due Wire library is suspected as cause of these problems. https://www.adafruit.com/forums/viewtopic.php?f=31&t=52111&p=263373#p263373 Perhaps a new Topic needs to be opened. How do we get the Arduino Wire Library fixed? Or perhaps I should a have taken the money spent on the Motor Shield and invested in a C Programming course.
I'm going to try the ATMEL Software Framework (ASF) Here's some documentation for the twi interface library http://asf.atmel.com/docs/latest/sam3x/html/group__sam__drivers__twi__group.html Since ATMEL makes the SAM3X8 in the Due we may have better luck using their twi code instead of Arduino wire. However, I do not know if others are having the same problems when using the ASF. The first thing I would try in the twi_probe() to see if it reports the Motor Shield on the I2C. To set-up ASF will not be easy. My PC from which I upload Due code is Linux Mint Debian. I've used, and am very happy with, Eclipse for other software development. There is an ARM plugin here: http://sourceforge.net/projects/gnuarmeclipse/. I believe it uses the same tool chain that the Ardunio IDE uses. I read elsewhere that you can set-up a custom Eclipse tool to use the UDOO version of Bossac to upload your code from the Eclipse IDE. Getting all of the above to work is the challenge, but it looks like one may end up with a more profession development environment.
That twi interface library definitely looks like a good direction. Update here or start a new thread. I'm sure a lot of people are interested using I2C and want a stable method of access to this feature of the SAM3X8.
Hi, I have currently written a set of functions handling the adafruit motor shield v2 for DC-motors using the twi interface in ASF and compiled it under linux and uploaded it to my Arduine Due/UDOO. I have a standard setup of a UDOO Quad and a adafruit shield stack on top of it. It took a while to sort out the PCA9685 interface and how the board was designed to get it working, but now it works I'm happy to share if anyone wants to, it consists of three c/h files because I need to reuse some of the stuff to other things in my project Cheers, Tomas
Any solution? I am facing the same issue. Motor is moving in constant speed. I have modified the AF v 2 shield to 3 v logic level. Anything else to be done? Regards Apurba K Saha
This is resolved.compile the code in arduino 1.6.3. There is no patch available for arduino 1.6.3, so I manually reset the CPU as explained in udoo guide(installing arduino ide) and compiled the code from my windows machine.
This is resolved.compile the code in arduino 1.6.3. There is no patch available for arduino 1.6.3, so I manually reset the CPU as explained in udoo guide(installing arduino ide) and compiled the code from my windows machine.