Post Go back to editing

Missing The Mark for Ending of a Measurement Loop

Category: Hardware
Product Number: emStat pico

Hello

I try to control emstat pico module with stm32 processor. When I check the capturing data, I recognized that there is no '*\n" command in the recording data. Do you what it can be reason for that?

Here is the recorded data, "e\nM0007\nPda8061B74u;ba8030F9Dn,12,28\n", '\0' <repeats 62 times>

Parents Reply
  • Exactly, for example here is my receive call back function,

    UART3 is for emstatpico and STM32 communication; UART2 is for STM32 to PC communication.

    uint8_t RXData[100];

    uint8_t temp_counter = 0;

    uint8_t buffer[100];

    uint8_t RXBuff[100];

    uint16_t mCounter = 0;

    void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

    {

    int i = 0;

    int j = 0;

    int start = -1;

    int end = -1;

    if (huart == &huart3) {

    HAL_UART_Transmit(&huart2, RXData, 1, 1000);

    RXBuff[mCounter++] = RXData[0];

    }

    // Find the start and end indices of the data

    for (i = 0; i < strlen(RXBuff); i++) {

    if (RXBuff[i] == 'P') {

    start = i;

    break;

    }

    }

    for(i = start; i < strlen(RXBuff); i++) {

    if (RXBuff[i] == '\n') {

    end = i;

    break;

    }

    }

    // Copy the data to the buffer

    if (start != -1 && end != -1) {

    for (i = start; i <= end; i++) {

    buffer[j++] = RXBuff[i];

    }

    for(int temp = 0; temp < 100 ; temp++) RXBuff[temp] = 0;

    mCounter = 0;

    buffer[j] = '\0';

    }

    HAL_UART_Receive_IT(&huart3, RXData, 1);

    }

Children