Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Boardcore
Wiki
Serial Communication
Changes
Page history
New page
Templates
Clone repository
[USART] added example of TRACE usage
authored
4 years ago
by
Luca Conterio
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Serial-Communication.md
+37
-1
37 additions, 1 deletion
Serial-Communication.md
with
37 additions
and
1 deletion
Serial-Communication.md
View page @
20d1ca0e
...
...
@@ -80,4 +80,40 @@ For the *f407vg* board, there's also another serial port, called **auxtty**: you
//#define AUX_SERIAL "auxtty" UNCOMMENT THIS TO OPEN THE SERIAL
const
unsigned
int
auxSerialSpeed
=
9600
;
const
bool
auxSerialFlowctrl
=
false
;
```
\ No newline at end of file
```
### Example
Usage of
*TRACE()*
in order to send data to the PC.
##### test-serial.cpp
```
cpp
#include
<Common.h>
using
namespace
miosix
;
int
main
()
{
int
i
=
0
;
while
(
true
)
{
TRACE
(
"%d : Serial is working!
\n
"
,
i
);
Thread
::
sleep
(
1000
);
i
++
;
}
return
0
;
}
```
##### sbs.conf
You should also add the following configuration to
`sbs.conf`
.
```
config
[
test
-
serial
]
Type
:
test
BoardId
: *
your
-
board
-
id
*
# e.g. stm32f407vg_stm32f4discovery
BinName
:
test
-
serial
Include
: %
shared
Defines
: -
DDEBUG
Main
:
test
-
serial
```
The
*-DDEBUG*
define is necessary in order for the
*TRACE()*
macro to act as a normal
*printf()*
.
Moreover the
*shared*
include is needed in order to compile also
`Debug.cpp`
, on which the
*TRACE()*
macro depends.
\ No newline at end of file
This diff is collapsed.
Click to expand it.