Comments (7)
From @sandeepmistry on October 8, 2015 15:13
@HanaJin did you make any progress on this?
Unfortunately, I don't have access to the shield, but tried a Wire <-> Wire1 connection, connecting SCL0 to SCL1, SDA0 to SDA1, on my Due with the following sketch based on yours:
#include <Wire.h>
#include <Adafruit_MotorShield.h>
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(100, 2);
unsigned long time1;
unsigned long time2;
void setup() {
Serial.begin(9600);
Wire.begin(0x60);
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);
Serial.println("AFMS begin");
AFMS.begin();
Serial.println("set speed");
myMotor->setSpeed(200);
}
void loop() {
Serial.println("Move two steps MICROSTEP");
time1 = millis();
myMotor->step(2, FORWARD, SINGLE);
time2 = millis();
Serial.print("Time used: ");
Serial.println(time2 - time1);
}
void receiveEvent(int howMany) {
while(Wire.available()) {
char c = Wire.read();
}
}
void requestEvent() {
Wire.write(0x00);
}
It's reporting a time used of 12 or 13ms, so not really seeing any timing issues with Wire1 on the Due now.
@ladyada would someone from Adafruit have time to try out @HanaJin's sketch with the shield and a Due:
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(100, 2);
unsigned long time1;
unsigned long time2;
void setup() {
Serial.begin(9600);
AFMS.begin();
myMotor->setSpeed(200);
}
void loop() {
Serial.println("Move two steps MICROSTEP");
time1 = millis();
myMotor->step(2, FORWARD, SINGLE);
time2 = millis();
Serial.print("Time used: ");
Serial.println(time2-time1);
}
from arduinocore-sam.
From @ladyada on October 8, 2015 21:27
ok dont have this handy but off top of heade - its probably not i2c but rather the delayMicroseconds - is that known good on the Due? does it 'round up'?
from arduinocore-sam.
From @PaulStoffregen on October 8, 2015 23:33
delayMicroseconds was fixed quite some time ago. Originally it was way off. I remember, because it was a lot of trouble for people using OneWire, which I maintain. I believe it was fixed by borrowing Teensy 3.0's code. :)
from arduinocore-sam.
From @PaulStoffregen on October 8, 2015 23:36
Perhaps the slowness is in Serial? It got transmit buffering only very recently. I recommend testing this with the latest hourly build. (which really should be common sense to do before filing any bug report with any open source project...)
from arduinocore-sam.
From @sandeepmistry on October 9, 2015 13:15
@ladyada @PaulStoffregen thanks for the info!
I was testing with the latest SAM core from Github, I think this issue can be closed, but it would be great to confirm with the real shield.
From @HanaJin's post on the Adafruit forum, they were seeing a delay of 7 - 8ms on the Uno and ~2500 - 3300ms on the Due. This was back in Nov 2013.
from arduinocore-sam.
From @HanaJin on October 9, 2015 13:43
@sandeepmistry, can you share the delay number seen with the lastest SAM core?
I tried 1.6.1 release which gave a number of ~1600ms on Due. On my old 1.6.6 nightly build (Sep 10), the number is ~860-1000ms. I also downloaded the lastest nightly build to try out, but was unable to get the same sketch compiled with multiple definitions error.
from arduinocore-sam.
From @sandeepmistry on October 9, 2015 21:2
@HanaJin thanks for the update. Unfortunately I don't have a motor shield to test the Due with, however when I run the first sketch from arduino/Arduino#2669 (comment) (with the Wire1 connected to Wire port on the same Due) I get around 12 - 13 ms.
I was using version 1.0.1 of the Adafruit Motor Shield V2 library installed from the Library Manager, with the Due connected to the Programming Port on my Mac. With a 1.6.6 hourly build from today with the 1.6.4 of the Arduino SAM Boards package, also get 13ms for the same sketch.
from arduinocore-sam.
Related Issues (20)
- No matching function for call to 'HardwareSerial::begin(int, UARTClass::UARTModes)' HOT 1
- Race condition in UARTClass.cpp
- Introduce experimental debug support for Arduino CLI/IDE
- Serial3.setTimeout(...) is not expiring with the rx line always idle.
- Enabling ADC 14, 15 on Due
- If interrupt attached to 2 or more pins of a port, detachInterrupt() doesn't work correctly HOT 1
- Print/Stream API is old. availableForWrite is missing HOT 1
- Serial.readBytesUntil() is either misleading or buggy
- Wire does not play nicely with Adafruit I2C FRAM breakout board HOT 1
- IPAddress missing definition of operator!=()
- adc_set_resolution bug
- adc_configure_trigger bug
- Support for USART2? HOT 1
- HID.sendReport - Stack overflow
- Offset millis count "_dwTickCount" to desired value for runtime retentation from eeprom HOT 2
- _sbrk has no bounds checking HOT 2
- Wire.setWireTimeout() not supported SAM3X
- Insufficient initialization in Serial1.begin()
- No Support for C++ Standard Libraries HOT 1
- Hope to support at least C++14 soon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinocore-sam.