The UCD3138 family provides an automatic ALERT response. If the Alert address is sent by the master and the UCD has its ALERT line active, the PMBus hardware will try to send its address. If it wins the arbitration, it will clear its alert line. If PEC_ENA and TX_PEC are set, it will send an address following the PEC.
TX_PEC is also used to automatically send a PEC at the end of read messages. The standard PMBus firmware used in many EVMs sets the TX_PEC when sending out the last bytes of the message.
However TX_PEC is automatically cleared at the end of the message, after the PEC has been sent. So to make sure that it is still set, it is necessary to set it again in the read_wait_for_EOM function which is called after the end of the message. Note there will be a short time between when the TX_PEC bit is cleared by the hardware and then set again by the firmware. If an Alert address is put on the bus during this interval, the PMBus hardware will provide the address twice, instead of an address and a PEC.
It's also a good idea to put in a set of TX_PEC in the pmbus_idle handler, where the idle handler detects that the bus is idle and nothing is happening. This can help deal with the situation when a read message is ended by the master before it is finished. It can also be put in anywhere in the PMBus firmware where an unexpected status is found and the firmware goes to idle mode.