Hi wujianzhang2002,
Can you please try with the new ioctl commands to set 8M baudrate?
Below codes can be referred.
struct termios2;
ioctl: TCGETS2, TCSETS2
flags to set and clear:
c_cflag &= ~CBAUD;
c_cflag |= BOTHER;
c_cflag |=CLOCAL;
c_ispeed = NEW_SPEED;
c_ospeed = NEW_SPEED;
However a slight deviation might be accepted with respect to hardware limitations based on supported tolerance range, clock parent and divisor.
Please let us know if you still have any issues.
Thanks & Regards,
Sandipan