HTCC-AB02S RX2 issue

I’ve been struggling with a strange problem for several days now. I have a soil moisture sensor that sends data through a modbus (RS485 <> TTL) interface. I use a HTCC-AB02s because it has a second serial port. The process is simple, I send a request and get the data from some registers. But whatever I try I only get 7 bytes of data back while I see on my logic analyzer that 11 bytes are received. Does anyone have any suggestions?

    static void prepareTxFrame( uint8_t port )
    	 digitalWrite(GPIO7 , HIGH); // Power up the modbus interface and sensor

       //Send request to modbus sensor
      uint8_t request[] ={0x01,0x03,0x00,0x00,0x00,0x03,0x05,0xCB} ; // Sensor request (first 3 registers)

      for (int n=0; n<8 ; n++)


       //recieve data from modbus sensor
      uint8_t serialBuffer[11] = {0} ;
      int i=0;
     while (Serial1.available()) 
         serialBuffer[i] =  (char);
        appDataSize = 6;
        appData[0] = serialBuffer[3]; //Temp msb
        appData[1] = serialBuffer[4]; //Temp lsb
        appData[2] = serialBuffer[5]; // moister msb
        appData[3] = serialBuffer[6]; // moister lsb
        appData[4] = serialBuffer[7]; // EC msb
        appData[5] = serialBuffer[8]; // EC lsb

    digitalWrite(GPIO7, LOW); // Power down the modbus interface and sensor


we can’t find any problem from your code and your describe。

could you show more details(Connection of pins…ect.)?

Hi jasonXu,

The RS485 interface is connected to pin 29 (RX2) and pin 30 (TX2). Baudrate is set to 9600-8-1-N.


this buffer length is 8.

we have updated the code:


Super, thanks…problem solved.