Integrating an analog magnetic sensor in MCSDK 6.1.2 generated project
Hi everyone,
I am currently working on implementing an FOC algorithm based on a single analog linear hall effect sensor (DRV5055). This sensor will be used to measure the angle of the rotor. The control\inverter board that I am using is the B-G431-ESC1 which don't have an extra analog pin but there is a potentiometer which I have removed and used that pin as my ADC input from the DRV5055. The sensorless algorithm runs good on this board but since my application requires very low speed operation so I want to implement this analog sensor. Also this sensor have a high bandwidth so this can operate both at low speeds and high speeds. I have tested the hardware the sensor provides reading from 1600 to 2400 in 12 bit ADC value maybe because the magnet on the shaft is not strong enough or the sensor has low sensitivity. Now about integrating the analog sensor:
I plan to do it this way:
>>>Create a project with hall effect sensors (3 sensors spaced at 60) from the MCSDK.
>>>Bring that project in cubeide and then modify the hall_speed_pos_fdbk.c and hall_speed_pos_fdbk.h files so they provide the angles calculated from the analog sensor instead of the combination of 3 hall effect sensors.
>>>Also I want to call the ADC conversion every systick interrupt just after the MC_Scheduler() is called, as my speed loop rate is around 2KHz, the ADC value is also calculated at 2KHz.
While the idea seems to be possible (to me), I want to get some expert opinions on this way of doing this also some advice would be great on what would be the most efficient way of doing the programming like how to play with the handles and the functions so the rest of the code don't break. I would be really thankful if someone can let me know if there is some other better way of doing this. Also, why STMicroelectronics not include the Hall effect analog sensor in the SDK? I heard that they have a confidential version of the SDK where they have implemented this analog sensor, does anyone have any idea about that?
