Attached to this article is a python 3 script to generate the I2C command arrays for a CP2114-B02 device.
This script interprets the following commands to construct the command byte-array.
In addition to these commands, the command list must begin with one of the following sequence identifiers:
Note - only one sequence can be generated at a time with this script. If all three sequences are needed, they will need to be generated individually, then appended together into one large byte array.
Here is an example image of the script running:
The left panel is the 'input' field, where commands are typed. The right panel is the 'output' field, where the byte array is generated. The byte array is refreshed any time return/enter are pressed in the input field.
The bottom panel is for any errors that may arise.
As an example, this is the input text required to generate a configuration for the CS42L55 codec:
RESET_SEQUENCE setGPIO(0, 4) delay_us(250) delay_us(250) delay_us(250) delay_us(250) setGPIO(1, 4) delay_us(1) write_stop(0x94, [0x00, 0x99]) write_stop(0x94, [0x2E, 0x30]) write_stop(0x94, [0xB2, 0x07, 0xFD, 0xF8, 0xDC, 0xF8, 0x6C]) write_stop(0x94, [0x3A, 0xF8]) write_stop(0x94, [0xBC, 0xD3, 0x23, 0x81, 0x46]) write_stop(0x94, [0x00, 0x00]) write_stop(0x94, [0x03, 0x0A]) write_stop(0x94, [0x84, 0x02, 0x09]) write_stop(0x94, [0x06, 0x20]) write_stop(0x94, [0x2A, 0x00]) write_stop(0x94, [0x9A, 0xC4, 0xC4, 0xC4, 0xC4]) write_stop(0x94, [0x02, 0x08]) delay_ms(75) write_stop(0x94, [0x9A, 0x7A, 0x00, 0x00])
This generates the following binary array:
F9 6E 00 47 04 64 FA 64 FA 64 FA 64 FA 47 84 64 01 57 03 94 00 99 50 57 03 94 2E 30 50 57 08 94 B2 07 FD F8 DC F8 6C 50 57 03 94 3A F8 50 57 06 94 BC D3 23 81 46 50 57 03 94 00 00 50 57 03 94 03 0A 50 57 04 94 84 02 09 50 57 03 94 06 20 50 57 03 94 2A 00 50 57 06 94 9A C4 C4 C4 C4 50 57 03 94 02 08 50 44 4B 57 05 94 9A 7A 00 00 50 00
Syntax errors will be displayed in the bottom panel:
Note, the first version of this script, attached to the article, had bugs that created invalid outputs. The fixed script is attached as cp2114_b02_commandGenerator_FIXED.zip. In this version the escape key is used to evaluate the input and generate the output.
How to measure the power consumption of CPT112S with energy profiler ？
Sometimes we need to monitor the power consumption of CPT112S simply. The energy profiler in Simplicity Studio is a practical tool for energy consumption measurement, however, the CPT112S does not support energy profiler.
In fact, we can use an EFM8 or EFM32 STK and makes it working under low power mode to minimize the effect on the final result, such as EM4. And then power the CPT112S board with VMCU of the STK board.
For example, use the EFM32ZG STK to measure the power consumption of CPT112S, the power consumption can be monitored within energy profiler as below.
This method also can be applied to other device in need.