
6.2.2 Writing and Reading from AFE4500
• AFE.writeReg(address,data)
– This function can be called to write any register. The parameter “address [8:8]” is considered as the Page.
– Parameter “address [7:0]” is considered as the register address.
– Parameter “data” is the data that will be written to the given register address and page.
• AFE.readReg (address)
– This function can be called to read any register value. The parameter “address [8:8]” is considered as the
Page.
– Parameter “address [7:0]” is considered as the register address.
– The returned value will be the data of the register in the mentioned page.
• Below example shows reading from register 0xC1, modifying only bit 0X42[5:4] (INT_MUX_ADC_RDY_1)
with the value of 2 and then reading back the modified value to register 0x42.
6.2.3 Writing and Reading from bit fields using the bitfield names mentioned in datasheet
• Open the Register Settings tab in the GUI and find the register bit field that need to be modified.
• Simply double click the field to copy it to clipboard.
• Paste the copied data into the script and assign the value.
• An example is shown below showing Write and read from bit fields.
• Note that there is “_” additionally added before the bitfield name while reading the value.
• getValue() function returns the value of the field.
• While doing a raw write using the AFE.writeReg function, the bitfield variables doesn’t get updated. In-order
to update the bitfield names, call function workSpaceWindow.updateRegisterSettingsTab()
Modifying or Creating Own Script
SBAU370 – APRIL 2021
AFE4500 EVM User Guide
29
Copyright © 2021 Texas Instruments Incorporated