10 years, 9 months ago.  This question has been closed. Reason: Fixed

UART2&3 Receive Problem

I'm working with the LPC4088 Quick Start board. I'm struggling receiving characters on UART2 and 3 though I can get UART4 to work perfectly. I have cut down my application to these few lines to demonstrate the problem. I have linked the transmit and receive pins on the ports, this code works but if you swap PORT to uart2 or 3 it fails. Any ideas?

  1. include "mbed.h"

DigitalOut myled(LED1); Serial PORT( P5_4, P5_3 ); uart4 Serial PORT( P4_22, P4_23 ); uart2 Serial PORT( P0_0, P0_1 ); uart3 Serial PC( USBTX, USBRX ); int main() {

PORT.baud( 9600 ); PC.baud(9600);

while(1) { myled = 0; wait(0.1); myled = 1; wait(0.1); PORT.putc(PC.getc()); PC.putc( PORT.getc()); } }

Question relating to:

The mbed-enabled LPC4088 QuickStart Board from Embedded Artists is a easy to use ARM Cortex-M4 rapid prototyping board in a standard through hole DIP package (44-pin), targeted at high-performance as …

1 Answer

10 years, 9 months ago.

I assume you know that uart2 is available on the Xbee connector.

I have tested connected uart4 to uart3 (or uart2) instead of connecting these to uart0 (which is normally used for console output) and this works well. See application below.

snippet

#include "mbed.h"

DigitalOut myled(LED1); 

// uart4 
Serial PORT1( P5_4, P5_3 ); // p37, p31
// uart3 
Serial PORT2( P0_0, P0_1 ); // p9, p10
// uart2 
//Serial PORT2( P4_22, P4_23 ); // Xbee connector pins 3 and 2


int main() {
    char d1 = 0;
    char d2 = 0;
    
    PORT1.baud( 9600 ); 
    PORT2.baud( 9600 ); 

    while (1) {
                
        myled = 0; 
        wait(0.1); 
        myled = 1; 
        wait(0.1);         
        
        PORT1.putc(d1);
        d2 = PORT2.getc();    
        
        if (d1 != d2) break;
        
        d1++;
        
        PORT2.putc(d1);
        d2 = PORT1.getc();
        
        if (d1 != d2) break;

        d1++;               
        
    } while (0);
  
    printf("FAIL\n");
    
    while(1) { 
        myled = 0; 
        wait(0.1); 
        myled = 1; 
        wait(1); 
    } 
    
}

Accepted Answer

Mmm, strange this test program works fine. There must be some interaction with some other part of my larger application.

posted by Tim Exton-McGuinness 31 Jan 2014