ModBus TCP use std\net Socket. ModBus RTU use SerialPort from serial lib or std\net Socket for RTU over TCP. mb_read_rtu (1,0,7,mb_fucntion.r_coils,serial) -> Read state of coils 0-6 from device '1' ...
TCP, USART and USB-CDC Modbus RTU Master and Slave library for STM32 microcontrollers based on Cube HAL and FreeRTOS. Includes multiple examples for popular development boards including BluePill, ...