Support for Nano BLE33 and Sense

Thanks - I have not had a chance to look at Marc’s code yet.

Being not too familiar with the default setup of the BLE33 - My worry is that by default the analogWrite commands are defaulted to Start Synced and are not synced at all when called individually. To ensure Center Aligned pulses and that they are grouped together I am using the nrf library calls - again the PWM is done by a 4x4 setup meaning it can drive 4 independent groups of up to 4 signals - these signals will have the same PWM pulse width but each can have separate duty cycles. The PWM cycle is calculated by a 16Mhz clock rate with a divider to allow 8Mhz,4Mhz,2Mhz,1Mhz,500khz, 250khz,125Khz clock rates and a TOP_Value for the group to which the PWM counts up to and down to zero (ie a 1Mhz clock rate and a TOP_value of 100 would count up to 100 and down to zero for a total pulse width of 200ms). Each duty cycle value is converted to the range to 0 of the TOP_value and the output is turned on when the counter rises above the duty cycle value on the way up to the TOP_value and Off again when it passes below the duty cycle value on the way counting down to zero.

To do this - I created a reference to an extern Call in the hardware_api.h file to a subroutine in my main sketch. I then commented out the analogWrite commands in the ble33_mcu.cpp file and added the call to my subroutine.

My code is running - I am using a PWM clock rate of 4Mhz with a Top_Value of 99 which equates to a PWM Pulse Length of 49.5 mSec (20202 Hz) and I am executing the FOC calls at this rate. I am seeing the following
loopFOC call requires about 735 uSecs on the BLE33
motorMove call requires about 670uSes on the BLE33

Currently I get really smooth and quiet operation down to about 1 Rad/s and then it will not operate below this - I will continue to adjust parameters and experiment. I am using an AS5600 on I2C.

My target requirement is a motor that can run in the range of 30RPM to 300RPM. I would also like to have silent operation so I am looking at having am PWM frequency in the 20K range and my goal would be to run the FOC routines at this frequency - which appears doable at this point.

A question and comments

  • I tried Open Loop and really overheated the board and motor. I tried to add the ohms value of the motor to the motor call (with the Pole Pairs parameter) but it appears this is not supported in this branch - Can I set this as parameter value to that open loop can limit the drive voltage?
  • As a side note I tried reading the currents but found the calls are blocking and this really eats processing time. Again I turned to Nordic calls to perform this in the background using the chips, their DMA, and interrupts but I have not implement the tie in to the current read functions yet. I will do this over the next few days.

Thanks again and Regards