SBASAC2 june 2023 AFE43902-Q1 , AFE53902-Q1
PRODUCTION DATA
The state machine converts a temperature input to a PWM output based on the values saved in the thermal foldback profile. The voltage output from the temperature sensor is read by the ADC and converted to an ADC code. There are three X and Y points available to map the ADC codes (X points) to a temperature (Y points). These points can be used to apply linearization to the temperature sensor output. The ADC is 10-bits, so the maximum code is 1023d. Equation 9 calculates the ADC output code based on the voltage input.
This application example uses the 5-V VDD as the ADC reference. Equation 10 calculates the ADC code for a 2.5-V input.
Table 8-6 shows the ADC code to temperature mapping used in this application example. An NTC resistor is used as the temperature sensor. Higher ADC codes correspond to a lower temperature.
ADC CODE | TEMPERATURE |
---|---|
0x000 | 100°C |
0x200 | 50°C |
0x3FF | 0°C |
The PWM frequency is set in the PWM-FREQUENCY SRAM location (SRAM: 0x2E). Table 7-1 defines the codes for each available frequency. There are four X and Y points available to map the temperature (X points) to an output duty cycle (Y points). The PWM duty-cycle output is configured by a 7-bit code. The maximum code is 127d. Equation 11 calculates the duty-cycle:
For a 50% duty cycle, Equation 11 calculates the duty-cycle code as 64d.
Table 8-7 shows the temperature to output duty cycle mapping used in this application example. The profile can have both negative and positive slopes.
TEMPERATURE | OUTPUT DUTY CYCLE (CODE) |
---|---|
20°C | 78% (0x64) |
50°C | 100% (0x7F) |
75°C | 63% (0x51) |
100°C | 0% (0x00) |
Follow these guidelines to setup the registers on the AFE43902-Q1:
REGISTER FIELD NAME | ADDRESS[FIELD] | ADDRESS LOCATION |
---|---|---|
X1-TEMPERATURE | 0x20[10:1] | SRAM |
Y1-TEMPERATURE | 0x21[7:0] | SRAM |
X2-TEMPERATURE | 0x22[10:1] | SRAM |
Y2-TEMPERATURE | 0x23[7:0] | SRAM |
X3-TEMPERATURE | 0x24[10:1] | SRAM |
Y3-TEMPERATURE | 0x25[7:0] | SRAM |
X1-OUTPUT | 0x26[7:0] | SRAM |
Y1-OUTPUT | 0x27[6:0] | SRAM |
X2-OUTPUT | 0x28[7:0] | SRAM |
Y2-OUTPUT | 0x29[6:0] | SRAM |
X3-OUTPUT | 0x2A[7:0] | SRAM |
Y3-OUTPUT | 0x2B[6:0] | SRAM |
X4-OUTPUT | 0x2C[7:0] | SRAM |
Y4-OUTPUT | 0x2D[6:0] | SRAM |
PWM-FREQUENCY | 0x2E[11:7] | SRAM |
DAC-0-VOUT-CMP-CONFIG | 0x15[12:10][4:0] | Register |
DAC-1-VOUT-CMP-CONFIG | 0x03[12:10][4:0] | Register |
COMMON-CONFIG | 0x1F[15:0] | Register |
DEVICE-MODE-CONFIG | 0x25[15:0] | Register |
STATE-MACHINE-CONFIG0 | 0x27[2:0] | Register |
Only the bits listed in the address column of Table 8-8 are saved in NVM and used in the state machine. For example, only bits 12 to 10 and 4 to 0 are saved in NVM for the DAC-x-VOUT-CMP-CONFIG registers.
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, 0x03
//Stop the PWM generator
WRITE COMMON-PWM-TRIG(0x21), 0x00, 0x00
//Set the PWM frequncy (this is the device default)
WRITE PWM-FREQUENCY(SRAM 0x2E), 0x05, 0x80
//Set the thermal foldback profile values
//The PWM duty cycle is a 7-bit value
WRITE X1-TEMPERATURE(SRAM 0x20), 0x00, 0x00
WRITE Y1-TEMPERATURE(SRAM 0x21), 0x00, 0x64
WRITE X2-TEMPERATURE(SRAM 0x22), 0x04, 0x00
WRITE Y2-TEMPERATURE(SRAM 0x23), 0x00, 0x32
WRITE X3-TEMPERATURE(SRAM 0x24), 0x07, 0xFF
WRITE Y3-TEMPERATURE(SRAM 0x25), 0x00, 0x00
WRITE X1-OUTPUT(SRAM 0x26), 0x00, 0x14
WRITE Y1-OUTPUT(SRAM 0x27), 0x03, 0x64
WRITE X2-OUTPUT(SRAM 0x28), 0x00, 0x32
WRITE Y2-OUTPUT(SRAM 0x29), 0x03, 0x7F
WRITE X3-OUTPUT(SRAM 0x2A), 0x00, 0x4B
WRITE Y3-OUTPUT(SRAM 0x2B), 0x02, 0x51
WRITE X4-OUTPUT(SRAM 0x2C), 0x00, 0x64
WRITE Y4-OUTPUT(SRAM 0x2D), 0x00, 0x00
//Set the channel 0 reference to VDD, enable the comparator for ADC mode (this is the device default)
WRITE DAC-0-VOUT-CMP-CONFIG(0x15), 0x04, 0x01
//Power on the ADC channel
WRITE COMMON-CONFIG(0x1F), 0x03, 0xFF
//Set the device mode (this is the device default)
WRITE DEVICE-MODE-CONFIG(0x25), 0x90, 0x00
//Start the state machine
WRITE STATE-MACHINE-CONFIG(0x27), 0x00, 0x03
//Save settings to NVM
WRITE COMMON-TRIGGER(0x20), 0x00, 0x02