... | ... | @@ -34,25 +34,6 @@ sudo chown root:root /etc/udev/rules.d/49-stlinkv2.rules |
|
|
```
|
|
|
Or you can use `stm32flash` or `openocd` from CLI (the last one is needed to run SBS's script).
|
|
|
|
|
|
**Serial Port**
|
|
|
|
|
|
Once you flashed the program, if you want to see what the board is printing you have to connect to its default serial port. You can do this by using a USB-TTL module attached to the default serial's pins (tipically PA9-PA19) or using the USB port in some newer Discovery boards.
|
|
|
|
|
|
*Windows*
|
|
|
|
|
|
Install PuTTY.
|
|
|
|
|
|
*Linux*
|
|
|
|
|
|
Miosix redirects stdin/stdout to a serial port by default on most boards, so it is important to set up serial ports correctly on your development machine. On most Linux distros serial ports, both the physical ones like /dev/ttyS0 and the USB to serial adapters like /dev/ttyUSB0 are owned by the dialout group, so you need to add your user to that group before you can access them.
|
|
|
|
|
|
```
|
|
|
sudo usermod -a -G dialout `id -un` # Add yourself to the dialout group
|
|
|
```
|
|
|
Note that you may need to reboot your computer before the change takes effect.
|
|
|
|
|
|
Finally, you'll need a program to interact with the serial port, like GNU `screen` or `gtkterm`.
|
|
|
|
|
|
### Discovery Boards
|
|
|
|
|
|
**Flashing**
|
... | ... | @@ -67,28 +48,3 @@ Or, if you prefer, you can use two scripts that you can find in the `scripts\` f |
|
|
uses it to flash the binary file into the connected board.
|
|
|
|
|
|
If the program is not running, power-cycle the board and you'll see it working! |
|
|
|
|
|
**Serial Communication**
|
|
|
|
|
|
To see what's happening inside the board, you can communicate via serial port, either by
|
|
|
using a custom port
|
|
|
|
|
|
```cpp
|
|
|
int fd = open ("/dev/auxtty"); //Needs to be defined in miosix
|
|
|
if(fd > 0){
|
|
|
char message[11];
|
|
|
read(fd, message, 10);
|
|
|
write(fd, message, 10;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Or stdin/stdout, which is redirected on the DEFAULT serial port of that board
|
|
|
|
|
|
```cpp
|
|
|
printf("DEBUG MESSAGE!"); //This will be redirected on the default serial port
|
|
|
```
|
|
|
|
|
|
You can find out more in the [Serial Communication page](../wiki/Serial-Communication).
|
|
|
|
|
|
Having done this, you can communicate via serial port with your board using
|
|
|
a FTDI-USB module and `screen` or `gtkterm` on *Linux* or `Putty` on *Windows*. |