This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ79616EVM-021: BQ79616 EVM: Not receiving any message on UART

Part Number: BQ79616EVM-021
Other Parts Discussed in Thread: BQ79616

I have bq79616EVM board which I am trying to interface with a microcontroller through UART.

I am following the procedure given in datasheet as follows:


First a wake pulse of 2.5ms is sent which successfully wakes up the board.

The current consumption is slightly increased and the on-board LED lights up.


Then I am sending auto addressing commands and at the end wait for a response from the board. The problem is I am not getting any responses from the board.

  /* Initialize for UART_PAL */
  UART_Init(&uart_instance, UART_PAL_CONFIG);

  uint8_t cmd[] = {0xD0, 0x03, 0x4c, 0x00, 0xFC, 0x24};

  uint8_t cmdSetAutoAdd[] = {0xD0, 0x03, 0x09, 0x01, 0x0F, 0x74};

  uint8_t cmdSetAdd[] = {0xD0, 0x03, 0x06, 0x00, 0xCB, 0x44};

  uint8_t cmdSetStack[] = {0xD0, 0x03, 0x08, 0x02, 0x4e, 0xe5};

  uint8_t cmdSetBase[] = {0xD0, 0x03, 0x08, 0x01, 0x0e, 0xe4};

//  uint8_t cmd1[] = {0xC0, 0x05, 0x68, 0x10, 0x02, 0x29};
  uint8_t cmd1[] = {0xC0, 0x03, 0x4c, 0x1, 0x39, 0x24};

  UART_SendDataBlocking(&uart_instance, (uint8_t *) cmd, 6, TIMEOUT);
  while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);

  UART_SendDataBlocking(&uart_instance, (uint8_t *) cmdSetAutoAdd, 6, TIMEOUT);
   while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);

   UART_SendDataBlocking(&uart_instance, (uint8_t *) cmdSetAdd, 6, TIMEOUT);
    while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);

    UART_SendDataBlocking(&uart_instance, (uint8_t *) cmdSetStack, 6, TIMEOUT);
     while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);

     UART_SendDataBlocking(&uart_instance, (uint8_t *) cmdSetBase, 6, TIMEOUT);
      while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);

  UART_SendDataBlocking(&uart_instance, (uint8_t *) cmd1, 6, TIMEOUT);
  while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);


  while(UART_GetTransmitStatus(&uart_instance, &bytesRemaining)== STATUS_BUSY);
    /* Send a welcome message */
//  UART_SendDataBlocking(&uart_instance, (uint8_t *)welcomeMsg, strlen(welcomeMsg), TIMEOUT);

  /* Infinite loop:
   *     - Receive data from user
   *     - Echo the received data back
   */
  while(1)
  {
      /* Receive and store data byte by byte until new line character is received,
       * or the buffer becomes full (256 characters received)
       */
      UART_ReceiveData(&uart_instance, buffer, 1U);
      /* Wait for transfer to be completed */
      while(UART_GetReceiveStatus(&uart_instance, &bytesRemaining) == STATUS_BUSY);

    }

the code is stuck at UART_GetReceiveStatus, i dont receive anything from EVM board, for safety i tested this code with terminal software and i can see the baud rate is 1mbps and data received is correct also i send back data from terminal i receive same data in firmware end.

I dont have doubt on firmware part if some sequence is missing or crc error in packet. 

is there something that is missing in code?  what is led state meaning on EVM ? its in active mode right ?

  • Hi S,

    We will get back to you by tomorrow.

    Regards,

    Taylor

  • Hi,

    The sequence you shared looks good to me, I have below questions

    1) Why are you calling 'UART_GetTransmitStatus' API twice to send the broadcast read command

    2) Does 'UART_ReceiveData' expect newline at the end of the UART data, BQ79616 sends only the response data, no newline will be added at the end. Can you try to probe the UART lines using logic analyzer / oscilloscope to see if there is any data on the RX line of the MCU.

    I see you are sending the broadcast read command, can you also try sending the single device read command with device-id 0.

    Thanks,

    Ravi

  • 1) Why are you calling 'UART_GetTransmitStatus' API twice to send the broadcast read command

    2) Does 'UART_ReceiveData' expect newline at the end of the UART data, BQ79616 sends only the response data, no newline will be added at the end. Can you try to probe the UART lines using logic analyzer / oscilloscope to see if there is any data on the RX line of the MCU.

    I see you are sending the broadcast read command, can you also try sending the single device read command with device-id 0.

    1. Well its bug in SDK so i have call it twice else i get error message immediately

    2. i just wanna see data ON buffer its not that i want \r\n, something that need to received in buffer. Yes i have checked DATA on CRO, the problem is solved with Single read command. BUT its not complete solution,

    uint8_t cmdSetBase[] = { 0x90, 0, 0x03, 0x08, 0x01, 0xd2, 0x1d };


    The problem still exist, I can SEE data on TX line on CRO, but i am getting a frame error on MCU ( as per our datasheet its due to stop bit), i have no idea which end is problem,

    heres what i have tried, I have set MCU settings for UART as, 1Mbps 8-N-1, and i am  not receiving anything on MCU,
    1. i tried checking MCU code with terminal software, i can send and receive data with same settings

    2. i can see RX and TX line on CRO and both line show some data on both line

    3. its something at receiver end by i cant figure out

  • Hi,

    When you try with terminal software, can you check what data you see on the CRO (I suggest you use logic analyzer), do you see the newline sent from the terminal at the end ( usually from terminal software when you press enter newline will be appended to the data ).

    From the code comments I highlighted in your code you shared, it looks like 'UART_ReceiveData' blocks until newline is received.

    Can you check the implementation of 'UART_ReceiveData' , does it expect newline, and please check if you are seeing any error returned from this API.

    Regards,

    Ravi

  • SO it was DRIVER related error, we re wrote the driver and now we can see data from BQ79616