Master Thesis
V1.0
Research and Design of Sensor Node for NMSD Treatment
|
This file contains useful documentation closely related to dbprint. More...
Go to the source code of this file.
This file contains useful documentation closely related to dbprint.
DeBugPrint is a homebrew minimal low-level println/printf replacement. It can be used to to print text/values to uart without a lot of external libraries. The end goal was to use no external libraries (with methods like itoa
) apart from the ones specific to the microcontroller.
These files have been made with Doxygen comments above all methods to generate documentation. A combination of Doxygen-specific tags (preceded with an @
symbol) and markdown syntax are supported to generate, for example, HTML-files.
In the file debug_dbprint.h
dbprint UART functionality can be enabled/disabled with the definition #define DEBUG_DBPRINT
. If it's value is 0
, all dbprint functionality is disabled.
#include debug_dbprint.h
#if DEBUG_DBPRINT == 1 // DEBUG_DBPRINT
<your source code dbprint statements go here>
#endif // DEBUG_DBPRINT
VCOM is an on-board (SLSTK3400A) UART to USB converter alongside the Segger J-Link debugger, connected with microcontroller pins PA0
(RX) and PF2
(TX). This converter can then be used with Putty or another serial port program.
dbprint_INIT(USART1, 4, true, false);
dbprint
functionality, the following settings are used:The Energy profiler in Simplicity Studio seems to use VCOM somehow, change to using an external UART adapter if both the energy profiler and UART debugging are necessary at the same time!
If the energy profiler was used and the code functionality was switched, physically re-plug the board to make sure VCOM UART starts working again!
Location | #0 | #1 | #2 | #3 | #4 | #5 | #6 |
---|---|---|---|---|---|---|---|
US0_RX | PE11 | PC10 | PE12 | PB08 | PC01 | PC01 | |
US0_TX | PE10 | PE13 | PB07 | PC00 | PC00 | ||
US1_RX | PC01 | PD06 | PD06 | PA00 | PC02 | ||
US1_TX | PC00 | PD07 | PD07 | PF02 | PC01 |
VCOM:
PA0
PF2
The volatile
type indicates to the compiler that the data is not normal memory, and could change at unexpected times. Hardware registers are often volatile, and so are variables which get changed in interrupts.
0b1111
= 0xF
)0b1111 1111
= 0xFF
)Type | Alias | Size | Minimum value | Maximum value |
---|---|---|---|---|
uint8_t | unsigned char | 1 byte | 0 | 255 (0xFF ) |
uint16_t | unsigned short | 2 bytes | 0 | 65 535 (0xFFFF ) |
uint32_t | unsigned int | 4 bytes | 0 | 4 294 967 295 (0xFFFF FFFF ) |
int8_t | signed char | 1 byte | -128 | 127 |
int16_t | signed short | 2 bytes | -32 768 | 32 767 |
int32_t | signed int | 4 bytes | -2 147 483 648 | 2 147 483 647 |
Definition in file dbprint_documentation.h.