Problems with serial communication

I have implemented a new serial data transfer protocol in our 8051 system (80C552).

I tryed to write the received characters immediately back to the terminal with the following commands:

	ucrs232_buffer[ucrec_count] = S0BUF;
	S0BUF = ucrs232_buffer[ucrec_count];
This two command lines are performed in the ISR. I wrote 16 chars and got back 13 completly different ones.

If I send a message from the 80C51 to the terminal its correct! Also the command from the terminal is correct.

What can be the reason for this wrong reception?

Parents
  • Hi Christian,
    what is your SIO baud rate?
    There may be problem with SIO interrupt priority and corrupted terminal's STOP bits (especially for lower buad rates).

    1. Compare both SIO settings.
    2. Set serial interrupt to the highest priority as sole owner of the priority.
    3. Maybe can help insertion of "short" delay between your two S0BUF lines for example (up to 1/2 STOP bit time which depends on your serial ISR length till S0BUF "actions" - It is necessary to tune it)

    	ucrs232_buffer[ucrec_count] = S0BUF;
            /* delay here */
    	S0BUF = ucrs232_buffer[ucrec_count];
    
    Vaclav

Reply
  • Hi Christian,
    what is your SIO baud rate?
    There may be problem with SIO interrupt priority and corrupted terminal's STOP bits (especially for lower buad rates).

    1. Compare both SIO settings.
    2. Set serial interrupt to the highest priority as sole owner of the priority.
    3. Maybe can help insertion of "short" delay between your two S0BUF lines for example (up to 1/2 STOP bit time which depends on your serial ISR length till S0BUF "actions" - It is necessary to tune it)

    	ucrs232_buffer[ucrec_count] = S0BUF;
            /* delay here */
    	S0BUF = ucrs232_buffer[ucrec_count];
    
    Vaclav

Children
More questions in this forum