Hello tevin_wang,
The information you posted on the link above only works on the Galilelo Gen1, because on the Gen2 they changed some of its hardware, so i will post the correct code to write on serial from linux bellow:
cd /sys/class/gpio
echo -n "28" > export
echo -n "32" > export
echo -n "45" > export
cd gpio28
echo -n "out" > direction
echo -n "0" > value
cd gpio32
echo -n "out" > direction
echo -n "1" > value
cd gpio45
echo -n "out" > direction
echo -n "1" > value
stty -F /dev/ttyS0 9600 //change to the baud rate you want to use
echo -n "value" > dev/ttyS0 //change value for what you want to write
cat /dev/ttyS0 //read from UART
There is just one detail, whatever you write using echo -n "value" > dev/ttyS0 will be written in ASCII code so make sure you are using the correct ASCII characters.
Regards,
Peter.