PMSM FOC Hall sensor input for custom GPIO pin configurations

Hello Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for one of my PMSM control using FOC with Hall sensor for my custom board with TI F280049C and TI DRV8350 board. My custom board have fixed Hall sensor input cofigured at GPIO29, GPIO30,GPIO31. Below are my quires.
  1. As these example have Hall sensor input captured using ECAP module. How to change GPIO for Hall sensor input in same model using ECAP?
  2. How to check hall commutation sequence in model simulation and in hardware?
  3. As above example uses DRV8305, I need to use DRV8350,what changes need to do in model?
Awaiting for valuable response.
Thanks.

Answers (1)

Hi Bhagyesh,
1.ECAP inputs in F20049C are fed by Input X-BAR. Hence you can route any GPIO to eCAP inputs.
In order to change eCAP inputs:
Go to Hardare Implementation>target hardware resources> Input X-BAR and edit the Input X-BAR feeding the eCAP Inputs.
2.In order to validate the commutation sequence, you can pass the global data store called "GlobalHallState" used in the model through the SCI Transmit block. You can visualise the signal in the host model and validate the sequence.
You can also run the following offset calculation example https://www.mathworks.com/help/ti-c2000/ug/Hall-Offset-calibration-example.html to calculate the Hall offset and to validate the sequence.
3.You may need to change the inverter parameters in the initialisation script. You should confirm the following fields of the structure inverter in the initialisation script:
  • V_dc : DC link voltage
  • Rds_on: Rds_on of the mosfet used
  • Rshunt: Shunt resistance used to sense the phase current.
You should also check for the compatibility between the board and the inverter. Ensure Correct ePWMs , ADC channels are used to interface the DRV8350 with the F280049 boards.
There is a enable pin which enables the inverter using a GPIO. Ensure you use the correct GPIO to enable the inverter.
You can check the following paths to change the required settings.
  • ePWMs: mcb_pmsm_foc_hall_f28379d/Current Control/Inverter/Code Generation
  • ADC channels: mcb_pmsm_foc_hall_f28379d/Current Control/Sensor Driver Blocks/Sensor Driver Blocks (codegen)
  • DRV enable GPIO: mcb_pmsm_foc_hall_f28379d/Hardware Init/Variant Subsystem/Code Generation/DRV Enable
Hope this helps,
Thanks,
Mukul

Asked:

on 29 Jun 2025

Answered:

on 9 Feb 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!