Transmitting Data Over Uart - Bosch XDK110 Getting Started

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

Extension Bus Advanced Guide | XDK110

3.3 Transmitting data over UART

Now that all configuration and initialization is done, data can be transmitted via UART as shown in Code 11. For that, a
function which takes a buffer holding the data and the buffer length can be build, as shown in Code 11.
Code 11. UART data transmit function
void
UartDataWrite(uint8_t* buffer,
uint32_t
writeTimeout = UINT32_MAX;
UARTTransceiver_WriteData(&UartTransceiverInstance,buffer, bufferLength, writeTimeout);
}
The function simply calls
UartTransceiverInstance
operation.
It is recommended to wrap the writing function, since only the data buffer itself and the buffer length can vary.
An example on how to transmit data with it is shown in Code 12, please note that for a working data transmission a
secondary device using UART need to be attached to the Extension Bus of the XDK.
Code 12. UART writing example
void appInitSystem(void
// all other initialization and preparation code here
uint8_t
buffer[] = "Hello";
uint32_t
bufferLength = sizeof(buffer)/sizeof(uint8_t);
UartDataWrite(buffer,bufferLength);
}
Simply a buffer is declared within the string
UartDataWrite()
function
uint32_t
UARTTransceiver_WriteData()
variable holding all UART related information as well as a predefined timeout for the write
* CmdProcessorHandle,
Hello
. The size of this buffer is dynamically calculated and passed to the
to transmit the passed data. 

bufferLength){
, which takes the passed buffer and buffer length and the
uint32_t
param2){
13 24
|

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents