Software for hardware testing

A project log for Brushless Actuator (Arduino-Compatible)

Ardunio-Compatible M0/Zero/SAMD21 with FET Driver, MOSFETs, Absolute Magnetic Encoder, USB and RS485 comms. ~$US50

Paul GouldPaul Gould 07/05/2020 at 16:052 Comments

Bootloader programmed using the SEGGER J-FLASH with the BIN file from Sparkfun SAMD21 Dev board bootloader. I will have to create my own custom one in the future. This will require using ATMEL studio which I do not like to use.

After bootloader is programmed it can be seen as a USB port in the Arduino IDE. Set the board type to Sparkfun SAMD21 Dev and select the detected USB. The variants file has to be modified to disable the SER5 handler.

Test software runs the following

Features left to test

Full operation test

On-board magnetic encoder reads the diametric magnet connected to the motor shaft. Motor position is controlled from the USB using Saddle sinusoidal control. Vital information displayed on the OLED display.


Paul Gould wrote 10/02/2020 at 10:33 point

The following code sets the DRV8305 to three PWM signal

reg =7; // The register of the DRV8305 to write to

data_write = 0x29F; // The data to write into the register 

//set the CS Low

SPI.transfer( 0x00 + (reg<<3) + ((data_write & 0x0700)>>8) );

SPI.transfer( data_write & 0x00FF );

//set CS to High

Hope this helps

  Are you sure? yes | no

krisshellman1 wrote 10/02/2020 at 02:49 point

How did you program the DRV8305 spi registers?

  Are you sure? yes | no