4.9. Hardware Abstraction Layer (HAL)

The HAL is used by the MCAF to decouple all knowledge of device-specific hardware registers, via well-known function calls. At this time of writing, the HAL is hand-coded to work with the dsPICDEM® MCLV‑2 Development Board, dsPICDEM® MCHV‑2 Development Board, and dsPICDEM® MCHV‑3 Development Board, but future versions are intended to utilize Microchip’s MPLAB® Code Configurator and MPLAB® Harmony Configurator.

As long as the HAL function names and semantics are preserved, the HAL component can be swapped out and replaced with an alternative implementation.

More information is available in the HAL documentation.

4.9.2. Implementation

4.9.2.1. MCC integration

Prior to MCAF R3, generated code was not integrated with MCC; MCAF provided its own HAL completely.

4.9.2.1.1. MCAF R3

In MCAF R3, the following items have been removed from MCAF and made the responsibility of MCC:

  • Configuration bits
  • Oscillator setup

Some aspects of the MCC system module are still present in MCAF. Both MCC and MCAF code executes; the MCAF code runs later and overrides any settings from MCC. The following areas are handled both by MCC and MCAF:

  • GPIO configuration
  • Interrupt initialization
  • CORCON initialization

This overlap is temporary, and these areas are planned to be shifted fully to MCC.

Other modules such as ADC and PWM are configured solely by MCAF, and will be shifted to MCC in a future version of MCAF.

4.9.2.2. HAL errata

  • MCAF_BootstrapChargeExecute() includes a soft-start sequence intended to slowly turn on duty cycle and reduce gate drive power supply loading in order to charge up bootstrap capacitors. This sequence starts with duty cycles that are too low, and may produce runt pulses with certain gate drivers. (DB_MC-978; Applicability: MCAF R2, R3.)