BOOSTXL-DRV8323RS: Motor Control With Jetson Orin Nano

Part Number: BOOSTXL-DRV8323RS

Tool/software:

I have been going through the Universal motor control labs and I can get my motor to spin in levels 1-3.  In level 4, it either  will not spin the shaft or if I tinker with the variables in the first defined motor, the Teknic_M2310PLN04K, it spins at a high speed and then throws an over-current fault. My end game is to try and send PWM signals to the DRV-8323RS from a Jetson Orin Nano to spin my motor.  However, I am having a lot of trouble getting the level 4 in the universal motor control to work.  I know it has something to do with my parameters, but I am not very experienced and am trying to learn and I can't really see the forest from the trees.  My thought was that if I could get the level 4 to work and then just run the motor at different speeds manually manipulating the variables, then I could possibly immitate what the code is doing in the lab in some code on the Jetson Orin Nano to send the correct PWM signals to control the motor how I want to.  

1. How can I get this level 4 to work?  

      - I have gotten it to work before, but I can not remember how I did it.  And I know once you have the correct motor parameters you can manipulate the acceleration and speed to make the motor go at different speeds. 

2. Is it possible to send pwm signals through SPI to the DRV-8323 from a Jetson Orin Nano and control the motor in a similar way that my F280025C is doing?  

   I am trying to do this in the simplest way possible.  It seems as though these motor control labs do a lot of extra stuff that is maybe not needed to cover a variety of motors and applications.  All I want to do is control the speed and direction of a motor and then gradually learn how I can use the hall sensor as well.  But one step at a time. From my understanding all motor control is at its very simplest is PWM frequencies. Correct? That is to just do a simple spin of a motor.  I know there is a lot more complicated things to a motor.  Any help to get me unstuck would be greatly appreciated. Thanks

This is the data sheet to my motor
MotorDatasheet.pdf


And these are the motor parameters of which some I tweaked in the code.  

#if (USER_MOTOR1 == Teknic_M2310PLN04K)
// the motor type
#define USER_MOTOR1_TYPE MOTOR_TYPE_PM

// the number of pole pairs of the motor
#define USER_MOTOR1_NUM_POLE_PAIRS (4)

// the rotor resistance value of the motor, in Ohm
#define USER_MOTOR1_Rr_Ohm (NULL)

// the stator resistance value of the motor, in Ohm
// #define USER_MOTOR1_Rs_Ohm (0.393955578f)
#define USER_MOTOR1_Rs_Ohm (241.748993f)

// the stator inductance value of the motor in the direct direction, in H
// #define USER_MOTOR1_Ls_d_H (0.000190442806f)
#define USER_MOTOR1_Ls_d_H (0.00339763635f)

// the stator inductance value of the motor in the quadrature direction, in H
// #define USER_MOTOR1_Ls_q_H (0.000190442806f)
#define USER_MOTOR1_Ls_q_H (0.00339763635f)

// the rated flux value of the motor, in V/Hz
// #define USER_MOTOR1_RATED_FLUX_VpHz (0.0399353318f)
#define USER_MOTOR1_RATED_FLUX_VpHz (14.037569f)

// the Id rated current value of the motor, in A. Induction motors only
#define USER_MOTOR1_MAGNETIZING_CURRENT_A (NULL)

// the maximum current value for stator resistance (R_s) identification, in A
#define USER_MOTOR1_RES_EST_CURRENT_A (1.5f)

// the maximum current value to use for stator inductance identification, in A
#define USER_MOTOR1_IND_EST_CURRENT_A (-1.0f)

// the maximum current value of the motor, in A
#define USER_MOTOR1_MAX_CURRENT_A (6.6f)

// the R/L excitation frequency for motor parameters identification, in Hz
#define USER_MOTOR1_FLUX_EXC_FREQ_Hz (60.0f)

// the inertia that describes the amount of mass, in Kg.m2
#define USER_MOTOR1_INERTIA_Kgm2 (7.06154e-06)

// the rated voltage of the motor, V
// #define USER_MOTOR1_RATED_VOLTAGE_V (24.0f) // V
#define USER_MOTOR1_RATED_VOLTAGE_V (48.0f) // V

// the minimum rotation frequency if the motor (Hz)
#define USER_MOTOR1_FREQ_MIN_Hz (9.0f) // Hz

// the maximum/base rotation frequency of the motor (Hz)
#define USER_MOTOR1_FREQ_MAX_Hz (600.0f) // Hz

// V/f Profile Parameters for open-loop in build level 2
// the low frequency f_low of V/f profile, in Hz,
// set to 10% of rated motor frequency
#define USER_MOTOR1_FREQ_LOW_Hz (5.0f) // Hz

// the high frequency f_high of V/f profile, in Hz,
// set to 100% of rated motor frequency
#define USER_MOTOR1_FREQ_HIGH_Hz (400.0f) // Hz

// the minimum voltage V_min of V/f profile,
// the value is suggested to set to 15% of rated motor voltage, in Volt.
#define USER_MOTOR1_VOLT_MIN_V (1.0f) // Volt

// the maximum voltage, V_max of V/f profile,
// the value is suggested to set to 100% of rated motor voltage, in Volt
// #define USER_MOTOR1_VOLT_MAX_V (24.0f) // Volt
#define USER_MOTOR1_VOLT_MAX_V (48.0f) // Volt

// the current increasing delta value for running the motor with force open-loop , in A
#define USER_MOTOR1_FORCE_DELTA_A (0.05f) // A

// the current increasing delta value for motor rotor alignment, in A
#define USER_MOTOR1_ALIGN_DELTA_A (0.01f) // A

// the current for running the motor with force open-loop or startup, in A
#define USER_MOTOR1_FLUX_CURRENT_A (0.5f) // A

// the current for motor rotor alignment, in A
#define USER_MOTOR1_ALIGN_CURRENT_A (1.5f) // A

// the current for start to run motor with closed-loop when the speed is
// lower than the startup setting speed, in A
#define USER_MOTOR1_STARTUP_CURRENT_A (3.5f) // A

// the current for running the motor with torque control mode when start the motor, in A.
#define USER_MOTOR1_TORQUE_CURRENT_A (3.0f) // A

// the over-current threshold for the motor, in A.
// The value can be set to 50%~300% of the rated current of the motor
#define USER_MOTOR1_OVER_CURRENT_A (7.5f) // A

// the speed threshold for start the motor, in Hz
#define USER_MOTOR1_SPEED_START_Hz (35.0f) // Hz

// the speed threshold for running the motor with force open-loop, in Hz
#define USER_MOTOR1_SPEED_FORCE_Hz (30.0f) // Hz

// the acceleration for start the motor, in Hz/s.
#define USER_MOTOR1_ACCEL_START_Hzps (10.0f) // Hz/s

// the maximum acceleration for running the motor, in Hz/s
#define USER_MOTOR1_ACCEL_MAX_Hzps (20.0f) // Hz/s

// the speed threshold for running the motor with flying start mode, in Hz
#define USER_MOTOR1_SPEED_FS_Hz (3.0f) // Hz

// the current for motor brake, in A.
#define USER_MOTOR1_BRAKE_CURRENT_A (1.0f) // A

// the duration time for motor brake, in 5ms time base
#define USER_MOTOR1_BRAKE_TIME_DELAY (12000U) // 60s/5ms