SLASFA1 july 2023 AFE539F1-Q1
PRODUCTION DATA
Use VDD (5 V) as reference with gain 1 × to achieve an input range of (VDD/3) = 1.67 V, using Table 7-1. With a bus voltage of 48 V and ADC input range of 1.67 V, the external attenuation required is 28.74. Therefore, the attenuation resistors can be chosen as RA = 100 kΩ and RB = 3.6 kΩ. To limit the power dissipation to 50 W, the effective load resistance (RL-eff) is calculated as (VBUS2/P) = 46.08 Ω. That means a minimum duty-cycle of (RL/RL-eff ) = 10.85% is required. In a 7-bit scale, 10.85% corresponds to 13.89d. The required function coefficient, K can be calculated using Equation 4 to be 443.6d (0x01BC).
The PWM output pin is an open drain output. The PWM output pin must be pulled up to the desired IO voltage using an external resistor. The PWM frequency is set in the PWM-FREQUENCY SRAM location (SRAM: 0x23). Table 7-2 defines the codes for each available frequency. This example uses a PWM frequency of 3.052 kHz. Set the maximum and minimum PWM duty cycles limits in the MAX-OUTPUT and MIN-OUTPUT SRAM locations. The PWM duty cycle output is configured by a 7-bit code. The maximum code is 127d. 127d sets the PWM duty cycle to 100%. Table 7-3 provides more details about PWM duty cycle computation in AFE539F1-Q1.
Follow these guidelines to setup the registers on AFE539F1-Q1:
REGISTER FIELD NAME | ADDRESS[FIELD] | ADDRESS LOCATION |
---|---|---|
MAX-OUTPUT | 0x20[6:0] | SRAM |
MIN-OUTPUT | 0x21[6:0] | SRAM |
FUNCTION-COEFFICIENT | 0x22[15:0] | SRAM |
PWM-FREQUENCY | 0x23[4:0] | SRAM |
REF-GAIN-CONFIG | 0x15[12:10][4:0] | Register |
COMMON-CONFIG | 0x1F[15:0] | Register |
STATE-MACHINE-CONFIG0 | 0x27[2:0] | Register |
The pseudocode for this application example is as follows:
//SYNTAX: WRITE <REGISTER NAME(Hex Code)>, <MSB DATA>, <LSB DATA>
//Stop the state machine
WRITE STATE-MACHINE-CONFIG0(0x27), 0x00, 0x01
//Stop the PWM generator
WRITE COMMON-PWM-TRIG(0x21), 0x00, 0x00
//Set the PWM frequncy to 3.052 kHz
WRITE PWM-FREQUENCY(SRAM 0x23), 0x00, 0x07
//Set the maximim and minimum PWM duty cycles
WRITE MAX-OUTPUT(SRAM 0x20), 0x00, 0x7F
WRITE MIN-OUTPUT(SRAM 0x21), 0x00, 0x00
//Set the function coefficient (K)
WRITE FUNCTION-COEFFICIENT(SRAM 0x22), 0x01, 0xBC
//Set the ADC reference to VDD (this is the device default)
WRITE REF-GAIN-CONFIG(0x15), 0x04, 0x01
//Power on ADC
WRITE COMMON-CONFIG(0x1F), 0x03, 0xFF
//Start the state machine
WRITE STATE-MACHINE-CONFIG0(0x27), 0x00, 0x03
//Save settings to NVM
WRITE COMMON-TRIGGER(0x20), 0x00, 0x02
//Pull the VREF/MODE pin high to enter standalone mode