at91rm9200, usart, linux, lost bytes

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

darko
Posts: 3
Joined: Sat Dec 02, 2006 3:48 pm

at91rm9200, usart, linux, lost bytes

Thu Dec 07, 2006 11:08 am

hi
i'm new in this, so maybe my problem can be easily solved with your help.

description of the system: we made our own board based on at91rm9200dk, with 2.6.11 linux appropriately patched. for toolchain i used buildroot and uclibc. smart card reader (gemplus) connects through serial connection (rs232), so in linux kernel code (asm/arch/at91rm9200dk.h) i enabled all usarts (by default just two of them are enabled). we use usart2. i made no other change in linux kernel code regarding usarts. small user space test application initializes and uses serial port for communication with smart card reader (9600, 8-n-1). pins that usart2 uses (rxd2, txd2) are not used for anything else. user space test application is ported from original version for pc (x386, linux).

problem is this: from time to time (always somewhere in first 2 sec) the whole byte in reader's response is lost. i didn't check what comes through line to kernel, i just checked data that comes to user space, so it can be lost anywhere on the way. i made small statistics what is lost:
- 50% - bytes with value 0x00, on different positions in answer
- 25% - first byte in answer (always 0x24)
- 25% - the rest (all other byte values).
for experiment i put usleep(2200) after receiving full message and it helped a bit - now byte is lost somewhere in first 5 sec and more messages are exchanged before it happens.

i use the same reader and program (original version) on pc/linux host and it works without any problem.

i would appreciate if someone can help in any way. thanks in advance.
darko
dipl.inž. elektrotehnike, elektronika
darko
Posts: 3
Joined: Sat Dec 02, 2006 3:48 pm

solution

Fri Dec 29, 2006 3:16 pm

i found out what was the problem, maybe it can be useful for someone.
part of the code for smart card reader initializes and opens serial port and when compiled with gnu libc it does it with one stop bit, but with uclibc with two stop bits.
i didn't go deeper into the problem to find out what's really happening, why and how; forcing one stop bit was enough to solve the problem.
darko
dipl.inž. elektrotehnike, elektronika

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 3 guests