Sending data via UART
응답
15. 7. 10 오전 7:09 as a reply to Wang Ben.
Dear Chris,

This is the initialization:
    // configures Pin B9 = U1_TX as output
    GPIO_handleInfo_t info;
    info.port = gpioPortB;
    info.bitIndex = 9;
    info.magicWord = GPIO_HANDLE_MAGIC_WORD;
    GPIO_init(&info, GPIO_DIRECTION_OUTPUT, GPIO_STATE_OFF);
    // initializes UART1
    CMU_ClockEnable(cmuClock_UART1, true);
    SER_init_t init;
    init.hwType = SER_HWTYPE_UART;
    init.hwDevicePort = SER_UART1;
    init.protocol = SER_UART_PROTOCOL;
    init.baudRate = 115200;
    //init.hasHwFlowControl = 0;
    init.txBuf_p = (uint8_t*)&serialTxBuffer;
    init.txBufSize = sizeof(serialTxBuffer);
    init.rxBuf_p = (uint8_t*)&serialRxBuffer;
    init.rxBufSize = sizeof(serialRxBuffer);
    init.parity = SER_PARITY_NONE;
    init.dataBits = SER_DATABITS_8;
    init.stopBits = SER_STOPBITS_ONE;
    init.routeLocation = SER_ROUTE_LOCATION2;
    init.txCallback = NULL;
    init.rxCallback = NULL;
    SER_device_t serialDevice;
    SER_serialInit(&serialDevice, &init);

And you send data with:
    SER_serialWrite(&serialDevice, NULL, &data, (uint32_t)strlen(data));

I hope I could help.

Bye,

Jürgen
 
0 (0 투표)
Sending data via UART
응답
15. 7. 10 오전 7:46 as a reply to Jürgen Schuster.
Dear Jürgen,

thank you for your fast response!

I have the same problem with your code that I have with my own...
SER_serialInit always gives back SER_UNREACHABLE and I can't figure out why.
Have you ever had that error?

Best regards, Chris
 
0 (0 투표)
Sending data via UART
응답
15. 7. 10 오전 9:10 as a reply to Wang Ben.
Dear Chris,

Oh, the documentation says that this return is fatal and should never happen! I never had this error, so you might report BCDS this problem as mentioned?

Best regards,

Jürgen
 
0 (0 투표)
Sending data via UART
응답
15. 7. 13 오전 1:03 as a reply to Jürgen Schuster.
Dear Jürgen,

I just copied my code to a new project and everything worked fine...I have no idea why it is working now, but at least I can go on with my work.

Thank you for your help!

Best regards,
Chris
0 (0 투표)
Sending data via UART
응답
15. 7. 14 오전 8:10 as a reply to Wang Ben.
Dear Jürgen,

actually I came across the problem of getting "2 (SER_RESOURCE)" as return from any SER_serialWrite or SER_serialRead function and I can not figure out why. My buffers should be big enough and I have tested that the Arduino I am using for sending/receiving is working properly...

Do you have a working example project for me?

Thank you for your help!

Best regards,
Chris
0 (0 투표)