Other Parts Discussed in Thread: USB-PD-CHG-EVM-01, TPS25751
Tool/software:
Dear all,
I am facing an issue with a custom charger board in which the device does not switch to 'APP' mode.
Below is the schematic along with the code snippet which handles this part.The below SW snippet works with the 'USB-PD-CHG-EVM-01' (with a different slave address of course).
SW:
[...]
#define I2C_SLAVE_ADDR 0x44 #define I2C_SLAVE_ADDR_PATCH 0x46
static void tps_StartPatching(void) { uint8_t data_frame[6]; char cmd_frame[5]; data_frame[0] = (uint8_t)gSizeFullFlashArray; data_frame[1] = (uint8_t)(gSizeFullFlashArray >> 8); data_frame[2] = (uint8_t)(gSizeFullFlashArray >> 16); data_frame[3] = (uint8_t)(gSizeFullFlashArray >> 24); data_frame[4] = I2C_SLAVE_ADDR_PATCH; data_frame[5] = 0x32; cmd_frame[0] = 4; cmd_frame[1] = 'P'; cmd_frame[2] = 'B'; cmd_frame[3] = 'M'; cmd_frame[4] = 's'; if (tps_WriteCommand(&cmd_frame[0], &data_frame[0], sizeof(data_frame))) { HAL_Delay(10); // Allow TPS to process the task command uint8_t *patch = (uint8_t *)(uint32_t)&tps25750x_fullFlash_i2c_array[0]; uint32_t chunks = (uint32_t)(gSizeFullFlashArray / PATCH_CHUNK_SIZE); HAL_StatusTypeDef result = HAL_ERROR; for (int i = 0; i < chunks; i++) { result = HAL_I2C_Mem_Write(g_PowerM.i2c, I2C_SLAVE_ADDR_PATCH, TPS_DATA_REG, sizeof(uint8_t), &patch[i * PATCH_CHUNK_SIZE], PATCH_CHUNK_SIZE, 30000); if (result != HAL_OK) { return; } } if (result == HAL_OK) { g_PowerM.i2c_address = I2C_SLAVE_ADDR_PATCH; HAL_Delay(10); tps_ResetDataPointer(); g_PowerM.patched = true; g_PowerM.offset = 0; } } }
[...]
'tps_WriteCommand' is accepted by device but when the actual patch is sent, the slave address, previously set in 'PBMs' is NAKed.
HW: the board is used only in sink mode.
Looking forward to hearing news from you.
Best Regards
Cosmin,