... | ... | @@ -8,13 +8,16 @@ If you want to visualize the data you read from the sensor on your PC, you can u |
|
|
Everytime you call *TRACE()* in your code, the output data is redirected to the default serial port of the microcontroller. The default serial port for the STM32F407VG microcontroller is the `USART3` (default value set by Miosix), which corresponds to the GPIOs `PB10` (TX) and `PB11` (RX). The baud rate is by default set to `19200`.
|
|
|
|
|
|
In order to read the *TRACE()* output you can use a serial to USB adapter and the connections you need are:
|
|
|
- PB10 (TX) -> adapter RX
|
|
|
- PB11 (RX) -> adapter TX
|
|
|
- PB13 -> adapter CTS
|
|
|
- PB14 -> adapter RST
|
|
|
- GND -> adapter GND
|
|
|
|
|
|
Make sure you connect at least RX, TX and GND pins.
|
|
|
|
|
|
| STM32F407VG | Adapter |
|
|
|
|--------------|---------|
|
|
|
| PB10 (TX) | RX |
|
|
|
| PB11 (RX) | TX |
|
|
|
| PB13 | CTS |
|
|
|
| PB14 | RST |
|
|
|
| GND | GND |
|
|
|
|
|
|
Make sure you connect at least `RX`, `TX` and `GND` pins.
|
|
|
If you want to only receive data you can connect only the RX pin of the adapter (or TX if you only want to send data).
|
|
|
|
|
|
Consider that you should set your serial adapter to work with 3.3 volts, since the microcontroller GPIOs work with this voltage level.
|
... | ... | @@ -24,11 +27,12 @@ You also need a program that is able to read those data from the USB port of you |
|
|
#### Note
|
|
|
Consider that if you are using a different board, it may be possible that its USB connector is also connected to a microcontroller's serial port (i.e. you don't need to connect an external adapter). Just check which serial port is connected to the USB connector (e.g. `USARTX`).
|
|
|
|
|
|
## Writing an entrypoint
|
|
|
## Create your entrypoint
|
|
|
|
|
|
Here we will write an entrypoint that uses the *TRACE()* function in order to send data to the PC.
|
|
|
Here we will write an entrypoint that uses the *TRACE()* function in order to send data to the PC.
|
|
|
In `src/entrypoints` add a file called `hello-skyward`.cpp`.
|
|
|
Inside it you can put your code:
|
|
|
|
|
|
#### hello-skyward.cpp
|
|
|
```cpp
|
|
|
#include <Common.h>
|
|
|
|
... | ... | @@ -47,7 +51,7 @@ int main() |
|
|
return 0;
|
|
|
}
|
|
|
```
|
|
|
#### sbs.conf
|
|
|
## Compile with SBS
|
|
|
You should also add the entrypoint configuration to `sbs.conf`.
|
|
|
|
|
|
First of all we need an `srcfiles` section in which we add the `Debug.cpp` file, on which the *TRACE()* function depends:
|
... | ... | @@ -64,7 +68,7 @@ Moreover the *trace_include* include is needed in order to compile also `Debug.c |
|
|
|
|
|
```config
|
|
|
[hello-skyward]
|
|
|
Type: test
|
|
|
Type: board
|
|
|
BoardId: stm32f407vg_stm32f4discovery
|
|
|
BinName: hello-skyward
|
|
|
Include: %trace-include
|
... | ... | @@ -73,4 +77,4 @@ Main: hello-skyward |
|
|
```
|
|
|
|
|
|
## Run it!
|
|
|
Same as before: build the entrypoint with `python sbs -b test-led-driver` and [flash the binary on the board](Flashing-on-a-Target-Board). |
|
|
\ No newline at end of file |
|
|
Same as before: build the entrypoint with `python sbs -b hello-skyward` and [flash the binary on the board](Flashing-on-a-Target-Board). |
|
|
\ No newline at end of file |