Giter Site home page Giter Site logo

Comments (7)

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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.

agdl avatar agdl commented on July 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.