... | ... | @@ -10,9 +10,10 @@ the 3 Usarts that Miosix lets you use are configured. |
|
|
| 3 | PB10 | PB11 | PB13 | PB14 |
|
|
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
Standard input and output (`printf()` and `scanf()`) are redirected to the [default USART](#settings).
|
|
|
Standard input and output (`printf()` and `scanf()`) are redirected to the [default USART](#default-usart).
|
|
|
|
|
|
Other serial ports can be used as follows, but they have to be configured first.
|
|
|
```cpp
|
... | ... | @@ -27,8 +28,10 @@ write(fd, 10, buffer); //Write 10 chars |
|
|
```
|
|
|
Pay attention to the baudrate at which the used port is set!
|
|
|
|
|
|
### Settings
|
|
|
The default serial for a certain board is set in `miosix/config/arch/<your_arch>/<your_board>/board_settings.h`
|
|
|
|
|
|
### Default USART
|
|
|
|
|
|
The **default serial** for a certain board is set in `miosix/config/arch/<your_arch>/<your_board>/board_settings.h`
|
|
|
|
|
|
```cpp
|
|
|
const unsigned int defaultSerial=1;
|
... | ... | @@ -37,12 +40,6 @@ const bool defaultSerialFlowctrl=false; //use rts/cts |
|
|
|
|
|
#define SERIAL_1_DMA //use the DMA
|
|
|
```
|
|
|
For the f407vg board, there's also another serial port that can be opened:
|
|
|
```cpp
|
|
|
//#define AUX_SERIAL "auxtty" UNCOMMENT THIS TO OPEN THE SERIAL
|
|
|
const unsigned int auxSerialSpeed=9600;
|
|
|
const bool auxSerialFlowctrl=false;
|
|
|
```
|
|
|
|
|
|
The default serial port is opened in the *IRQBspInit()* method
|
|
|
inside `miosix/arch/<your arch>/<your board>/interfaces-impl/bsp.cpp`
|
... | ... | @@ -53,7 +50,16 @@ inside `miosix/arch/<your arch>/<your board>/interfaces-impl/bsp.cpp` |
|
|
defaultSerialFlowctrl ? STM32Serial::RTSCTS : STM32Serial::NOFLOWCTRL)));
|
|
|
```
|
|
|
|
|
|
While the other serial ports are opened in the *bspInit2()* method of the same file.
|
|
|
### Auxtty USART
|
|
|
For the f407vg board, there's also **another serial port** that can be opened:
|
|
|
```cpp
|
|
|
//#define AUX_SERIAL "auxtty" UNCOMMENT THIS TO OPEN THE SERIAL
|
|
|
const unsigned int auxSerialSpeed=9600;
|
|
|
const bool auxSerialFlowctrl=false;
|
|
|
```
|
|
|
|
|
|
This port is opened in the *bspInit2()* method
|
|
|
inside `miosix/arch/<your arch>/<your board>/interfaces-impl/bsp.cpp`
|
|
|
```cpp
|
|
|
void bspInit2()
|
|
|
{
|
... | ... | |