Tool/software:
Hi,
We are currently using the DRV8243-Q1 SPI(S) variant (DRV8243SQDGQRQ1) connected to the seeeduino xiao nrf52840 board.
The nSLEEP pin is always pulled high in the hardware and DRFOFF, EN/IN1, and PH/IN2 are not connected to the Seeduino Xiao board. We are aiming to have the DRV8243 in PH/EN mode and control based on SPI commands.
Attaching our current code to drive the DRV8243 to have the following states and the hardware connection:
1) OUT1 as low and OUT2 as High with SPI_IN register's bits S_DRVOFF,S_EN_IN1,S_PH_IN2-> 010 and
2) OUT1 as high and OUT2 as low with SPI_IN register's bits S_DRVOFF,S_EN_IN1,S_PH_IN2-> 011
Not able to get the desired outputs in the OUT1 and OUT2 lines despite the CLK, CS, and MOSI lines transferring the data bits to the appropriate register address. We were able to read the device ID as 32h for the DRV8243S-Q1 device from the DEVICE_ID register (Address = 00h) if using SPI_MODE0.
We got a decimal value of 129 from the FAULT_SUMMARY Register (Address = 01h) [reset = 40h] even when writing to command register [write8(0x08, 0b10000000);]
Could you please help in reviewing the code and let me know if I am missing anything?
#include <SPI.h> #include <Adafruit_TinyUSB.h> // for Serial #include <Arduino.h> #include <Wire.h> #include "DRV8243.h" DRV8243 hbridge; void setup() { Serial.begin(115200); hbridge.begin(); } void loop() { //PH/EN state to have outonelow_outtwohigh int seconds = 50; hbridge.outonelow_outtwohigh(seconds); hbridge.drive_nocurrent(); delay(5000); seconds = 5; hbridge.outonehigh_outtwolow(seconds); hbridge.drive_nocurrent(); delay(1000); }
Thanks for your help.