- The device is configured through
SPI using a combination of direct register reads/writes for simple
configurations, and register writes to initiate macros. Macro commands abstract
out the internal device configuration sequence to a simple set of configurations
and simplify the host interaction. The commands reduce complex configurations
into simple writes, avoid computation complexity on the host side and provide
simple status information in response. Macro command is used at multiple places
in bring-up.
- Macro Opcode: Operation code
which informs AFE the operation to be performed. For differential operations of
AFE, different Macro opcode is defined.
Macro
Operand: Operand are values or expressions that is used to perform an operation
in AFE.
- The first SPIPoll, Poll for Bit 0
from Address 0xf0 which indicates if Macro/MCU is ready for a next operation. If
the Poll fails, the MCU is still not ready for new operation and if we run a new
macro operation the MCU can fail to execute.
- Later if Macro ready passes, operand and opcode are loaded.
- After that Macro Done status is polled #SPIPoll 00f0,2,2,04. This is to check if
macro operation is complete.
- After that read check for 0xf0 bit 3 is read to check if macro operation was
executed error free or had error.
- Bring-up can break if any of the
this check fail. The following discusses if macro error and failure happen how
to figure out the error and resolve the issue.
Sample Code
SPIPoll 00f0,0,0,01 //MACRO_READY
SPIWrite 00a3,00,0,7 //MACRO_OPERAND_REG
SPIWrite 00a2,00,0,7 //MACRO_OPERAND_REG
SPIWrite 00a1,00,0,7 //MACRO_OPERAND_REG
SPIWrite 00a0,02,0,7 //MACRO_OPERAND_REG
SPIWrite 0193,01,0,7 //MACRO_OPCODE=0x1;
WAIT 0.001
SPIRead 00f0,2,2 //Read MACRO_DONE=0x1;
SPIPoll 00f0,2,2,04
SPIReadCheck 00f0,3,3,00 //Read MACRO_ERROR=0x0;
SPIRead 00f1,0,7 //Read MACRO_ERROR_OPCODE=0x0;
SPIRead 00f0,4,4 //Read MACRO_ERROR_IN_OPCODE=0x0;
SPIRead 00f0,5,5 //Read MACRO_ERROR_OPCODE_NOT_ALLOWED=0x0;
SPIRead 00f0,6,6 //Read MACRO_ERROR_IN_OPERAND=0x0;
SPIRead 00f0,7,7 //Read MACRO_ERROR_IN_EXECUTION=0x0;
SPIRead 00f3,0,7 //Read MACRO_ERROR_EXTENDED_CODE=0x0;
SPIRead 00f2,0,7 //Read MACRO_ERROR_EXTENDED_CODE=0x0;