SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By sudha4u
#180736
Hi
I purchased the product "Thermal Printer: COM-10438(TTL device)". Model: CSN-A2-T
Am trying to integrate the device with my development board. After configuring the serial port when ever i send commands to the printer to initialize or print it prints unreadable characters(characters from code page:PC437 are been printed).
I tried to change the character set, still unreadable characters are been printed.
Please help with some useful info how i can get readable characters printed.
Last edited by sudha4u on Sun Mar 29, 2015 9:37 pm, edited 1 time in total.
By sudha4u
#180740
My development board supports upto 6 UARTS. Am trying to configure Thermal printer on UART4.
Below is the UART register dump:
[ 0.503134] baud = 19200, parity = n, bits = 8, flow = n
[ 0.503139] set baud: 19200
[ 0.503147] c_cflag = 0x00000cbe, c_iflag = 0x00000000,c_oflag =0x00000000, c_lflag = 0x00000000
[ 0.503147] c_ispeed = 0, c_ospeed = 0
[ 0.503192] Uart name = OMAP UART4
[ 0.503200] ier = 0x00000000,lcr = 0x00000013, mcr = 0x00000001, fcr = 0x00000061,efr = 0x00000000
[ 0.503208] dll = 0x000000c0, dlh = 0x00000000, mdr1 = 0x00000003, scr = 0x00000080, wer = 0x00000000
[ 0.503213] Uart_Port line = 4
[ 0.503219] irq = 77, fifosize= 64, state= 0
[ 0.503225] tx_buf_size = 0

Please let me know what should be the serial port configuration settings for Thermal Printer to intergrate on to a development board.
By Valen
#180747
Explain more about your development board, specifically which one it is. And how the serial ports communicate electrically to the printer. The data you provided is not specific about this enough. Is it RS-232 based on +-12 volt, or based on 0-5v TTL signals?
By sudha4u
#180801
The characters been printed are from the code page PC437 which belongs to languages like chinese,japanes,arabic, thai etc.
Is there any way to find out whats the default character set supported by the device(Model: CSN-A2-T).
Note: If i do a test print from proper English characters are printed.
20150330_152517-1.jpg
You do not have the required permissions to view the files attached to this post.
By Valen
#180802
The manual has a list of escape sequence codes. One of which is needed to change between international character sets: ESC R n , where n is a number between 0 and 13. Check the manual for which countries have which number. Tried that yet?
By sudha4u
#180808
For your information am trying to initialize and set the commands through Linux bash environment. Referring the tutorial --> http://tronixstuff.com/2011/07/08/tutor ... -printer//
Below are the commands i used to initialize the thermal printer from Linux bash:
stty -F /dev/ttyO4 19200 --> to set baud rate
echo -e "\x1B" > /dev/ttyO4
echo -e "\x40" > /dev/ttyO4 --> Initialize (ESC @)
echo -e "\x1B" > /dev/ttyO4
echo -e "\x37" > /dev/ttyO4 --> print setting
echo -e "\x50" > /dev/ttyO4 --> heating dots
echo -e "\xFF" > /dev/ttyO4 --> heating interval (ESC 7 80 255)
echo -e "\x18" > /dev/ttyO4
echo -e "\x35" > /dev/ttyO4 --> print density
echo -e "\x0A" > /dev/ttyO4 --> Line feed (LF)

echo -e "\x1B" > /dev/ttyO4
echo -e "\x52" > /dev/ttyO4
echo -e "\x30" > /dev/ttyO4 --> character set to 0:USA (ESC R 0)
echo -e "\x0A" > /dev/ttyO4

If the above procedure is not exact way of initializing the thermal printer form Linux bash environment, please let me know how to initialize thermal printer from bash.
By sudha4u
#180846
Finally problem got resolved.
Issue: Problem is due to the RS232 to TTL converter been used between the board and the printer resulted in double conversion of UART signals.
Once the converter hardware is removed, with above commands the printer output is proper and readable.

Thanks for your support.