Serial port on pins 17 and 18 not working

15 Aug 2011

I am having problems in getting to work the Serial port on pins 17/18 (UART3). I'm using this test program. I can see with a scope activity on pins 26 & 28 but not on p17.

  1. include "mbed.h"

Serial aux1 (p17,p18); Serial aux2 (p26,p25); Serial aux3 (p28,p27);

int main() { while (1) { aux1.putc(0xAA); nothing on pin 17 aux2.putc(0xAA); pin 26 OK aux3.putc(0xAA); pin 28 OK wait_ms(10); scope sync } }

Any suggestions?.

Thanks in advance

Jaime

15 Aug 2011

Try calling them P0_26 (p18) and P0_25 (p17) instead, I don't know if it'll work, but could be.

Lerche

15 Aug 2011

Hi Jaime,

I remember I had problem with p13, p14 and I solve it like that, but I have not use p17 and p18. So try this:

Serial aux1(p13, p14);

int main() {

...

aux1.baud(115200);

aux1.format(8, Serial::None, 1);

...

}

Regards, Stas

15 Aug 2011

Thanks Lerche & Stas for your input. I tried both ways and unfortunately the problem is still there. /media/uploads/jchait/serial1.cpp

15 Sep 2011

I've got some troubles as well.

I've designed a board with those pins connected to a GSM module. unfortunately those pins doesn't seem to talk with the module.

Simon or Chris, would you guys know anything about this?

Thanks

15 Sep 2011

Okay, this compiles, but haven't got time to check if it works:

#include "mbed.h"

DigitalOut myled(LED1);
Serial serial(p17, p18);



int main() {
    LPC_PINCON->PINSEL1 |= (0x3C0000); // - Here you would set the pins as the fourth "type" in PINSEL register. I.e. Pins 17 & 18 as UART. 
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

Hope this works, I'll check tomorrow.

Lerche

15 Sep 2011

I tried to put a jumper on the p17 to p18, and writing to it through PCserial. It seems to work fine with the LPC_PINCON->PINSEL1 |= (0x3C0000); fix.

Lerche

21 Oct 2011

FWIW, I got p17, p18 working fine earlier this week with this program that echoes data between the two serial peripherals:

#include "mbed.h"

// Program to use the  mbed as a serial bridge
//

Serial pc(USBTX, USBRX); // tx, rx
Serial dev(p17, p18);

void recvPC() {
    while (pc.readable()) {
        dev.putc(pc.getc());
    }
}

void recvDev() {
    while (dev.readable()) {
        pc.putc(dev.getc());
    }
}

int main() {
    // PC serial     
    pc.baud(115200);
    
    // Device serial 
    dev.baud(4800); // iGPS-500

    while(1) {
        recvDev();
        recvPC();
    }
}