SparkFun Forums 

Where electronics enthusiasts find answers.

User avatar
By tyler.r
#220502
Hey all,

I'm currently building a program for a custom Artemis board that uses the same pins as the SFE Armteis Nano for its UART communication. However, when I run the following code, the test string is written to the terminal (Serial0) when the intended function is for the code to write to Serial1. I've verified in our design schematics that Serial1_TX and Serial1_RX are mapped to the correct pins for Serial1, rather than Serial0. Any help would be greatly appreciated.
Code: Select all
#include "mbed.h"

#define MAXIMUM_BUFFER_SIZE             32

BufferedSerial uart1(SERIAL1_TX, SERIAL1_RX, 57600);

// main() runs in its own thread in the OS
int main()
{
    ThisThread::sleep_for(5s);

    uart1.set_blocking(true);
    uart1.set_format(
        /* bits */ 8,
        /* parity */ BufferedSerial::None,
        /* stop bit */ 1
    );

    char bufr[MAXIMUM_BUFFER_SIZE] = "test string\n";

    uart1.write(bufr, sizeof(bufr));
    ThisThread::sleep_for(100ms);

    uart1.read(bufr, sizeof(bufr));

    while (true) {

    }
}
Thanks,

Tyler
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum