MC33771c TPL communication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC33771c TPL communication

249 Views
Miral
Contributor I

The communication works correctly with the MC33771B using a specific implementation and BCC library. I can successfully send commands and receive valid response frames.

However, when I use the same communication code and only replace the BCC library/configuration for the MC33771C, I receive only the echo frame and no valid response from the device.

The SPI/TPL timing, frame format, and hardware connections remain the same. The wake-up sequence and INIT sequence are also implemented.

Has anyone experienced this issue with MC33771C?


bcc_status_t BCC_MCU_TransferTpl(uint8_t drvInstance, uint8_t transBuf[], uint8_t recvBuf[], uint16_t recvTrCnt)

{

uint16_t recvSize;

if(recvTrCnt > 0)

recvSize = (recvTrCnt - 1) * 6U;

else recvSize = 6U;

HAL_SPI_DeInit(&hspi2);

HAL_Delay(2);

HAL_SPI_Init(&hspi2);

memset(recvBuf, 0, sizeof(&recvBuf));

HAL_GPIO_WritePin(CS_TX_GPIO_Port, CS_TX_Pin, GPIO_PIN_RESET); HAL_SPI_Receive_IT(&hspi2, recvBuf, 6);

rxflag = 0;

if(HAL_SPI_Transmit_IT(&hspi1, transBuf, 6) != HAL_OK)

{ HAL_GPIO_WritePin(CS_TX_GPIO_Port, CS_TX_Pin, GPIO_PIN_SET);

return BCC_STATUS_PARAM_RANGE;

}

BCC_MCU_WaitUs(5);

if(spi2_rx_done == 1)

{

HAL_SPI_Receive_IT(&hspi2, recvBuf, recvSize);

spi2_rx_done = 0;

}

HAL_GPIO_WritePin(CS_TX_GPIO_Port, CS_TX_Pin, GPIO_PIN_SET);

return BCC_STATUS_SUCCESS;

}

int MC33771_Init(void)

{

HAL_GPIO_WritePin(EN_GPIO_Port, EN_Pin, GPIO_PIN_RESET);

HAL_Delay(1);

HAL_GPIO_WritePin(EN_GPIO_Port, EN_Pin, GPIO_PIN_SET);

HAL_Delay(10);

g_bccConfig.drvInstance = 0;

g_bccConfig.commMode = BCC_MODE_TPL;

g_bccConfig.devicesCnt = 1;

g_bccConfig.device[0] = BCC_DEVICE_MC33771C;

g_bccConfig.cellCnt[0] = 14;

status = BCC_Init(&g_bccConfig);

if(status != BCC_STATUS_SUCCESS)

{

return (int)status;

}

}

void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)

{

if(hspi->Instance == SPI2)

spi2_rx_done = 1;

}

static void MX_SPI1_Init(void)

{

hspi1.Instance = SPI1;

hspi1.Init.Mode = SPI_MODE_MASTER;

hspi1.Init.Direction = SPI_DIRECTION_2LINES;

hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;

hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;

hspi1.Init.NSS = SPI_NSS_SOFT;

hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;

hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;

if(HAL_SPI_Init(&hspi1) != HAL_OK)

{

Error_Handler();

}

}

static void MX_SPI2_Init(void)

{

hspi2.Instance = SPI2;

hspi2.Init.Mode = SPI_MODE_SLAVE;

hspi2.Init.Direction = SPI_DIRECTION_2LINES_RXONLY;

hspi2.Init.DataSize = SPI_DATASIZE_8BIT;

hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;

hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;

hspi2.Init.NSS = SPI_NSS_HARD_INPUT;

hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi2.Init.TIMode = SPI_TIMODE_DISABLE;

hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi2.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;

if(HAL_SPI_Init(&hspi2) != HAL_OK)

{

Error_Handler();

}

}

Labels (1)
0 Kudos
Reply
3 Replies

201 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Miral,

I need to contact Software engineer for your issue. Please share following information about your project. They always require the information. 

Customer: AARTRONIX INNOVATIONS

End Customer: ? (can be also AARTRONIX INNOVATIONS)

End Application: ?

Country: India

Annual Volume: ?

With Best Regards,

Jozef

0 Kudos
Reply

197 Views
Miral
Contributor I

Customer: AARTRONIX INNOVATIONS

End Customer: AAROHI EMBEDDED SYSTEM PVT LTD 

End Application: UPS Battery backup

Country: India

Annual Volume:1000

0 Kudos
Reply

85 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Miral,

please see below an answer from the application engineer. Please share a scope as requested.

DESCRIPTION

It would really help if the customer could get a scope trace or Saleae output of the transmissions to really see what is going on.  Note that the MC33771B is TPL1 (40-bit) and MC33771C is TPL2 (48-bit).  Also, the customer can reference the MC33771C SDK attached.

With Best Regards,

Jozef

0 Kudos
Reply