Dani Carbonell
New member
Hi, this is my first post.
I want to control a chain of x5 DRV8860 with SPI using a Teensy 4.1.
The problem is that the drivers limit speed is at 200kHz and I don't manage to make the Teensy SPI clock slower than 1Mhz (minimum speed at the specification)
I have done the same experiment with an ESP32 and verified that the DRV8860 works as expected at 200kHz but not at 1Mhz.
Here is the code:
Thanks!
Dani
I want to control a chain of x5 DRV8860 with SPI using a Teensy 4.1.
The problem is that the drivers limit speed is at 200kHz and I don't manage to make the Teensy SPI clock slower than 1Mhz (minimum speed at the specification)
- Is there a way to achive my purpose without having to use Bitbanging and blocking other time critical tasks?
I have done the same experiment with an ESP32 and verified that the DRV8860 works as expected at 200kHz but not at 1Mhz.
Here is the code:
Code:
#include "Arduino.h"
#include <SPI.h>
SPISettings settingsA(200000, MSBFIRST, SPI_MODE0);
const uint16_t DRV8860_LATCH_PIN = 38;
void setup() {
pinMode(DRV8860_LATCH_PIN, OUTPUT);
SPI1.begin();
SPI1.setMOSI(26);
SPI1.setSCK(27);
//SPI1.setClockDivider(SPI_CLOCK_DIV32);
}
void loop() {
SPI1.beginTransaction(settingsA);
digitalWrite (DRV8860_LATCH_PIN, LOW);
SPI1.transfer(0b01010101);
digitalWrite (DRV8860_LATCH_PIN, HIGH);
SPI1.endTransaction();
delay(500);
SPI1.beginTransaction(settingsA);
digitalWrite (DRV8860_LATCH_PIN, LOW);
SPI1.transfer(0b10101010);
digitalWrite (DRV8860_LATCH_PIN, HIGH);
SPI1.endTransaction();
delay(500);
}
Thanks!
Dani