Home New Help Edit

mbedメモ


mbed5.7のドキュメント(5.6以降)
https://os.mbed.com/docs/v5.7/reference/index.html

mbed OS5.5までのドキュメント
Advanced Tutorial
Advanced Tutorial、5.6以降に無い(2018-2-28時点)


Thread

v5.7 2018-03-11
NUCLEO_F767ZZI
切替は5msec毎

IOパタパタ

v5.7
NUCLEO_F767ZZI
6MHz(74nsec+92nsec)

コンフィグ

5.5だけど
https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/config_system/


NUCLEO-F767ZI

NUCLEO-F767ZI

informantionに「 blue/white or green/white」を使えと書いてある。そのピンはPinNames.hで定義済み。

ST-LINKピン接続

STLK_RX <- USART3_TX <- PD8
STLINK_TX -> USART3_RX ->PD9

ピン


PinNames.h
#ifdef MBED_CONF_TARGET_STDIO_UART_TX STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX, #else STDIO_UART_TX = PD_8, #endif #ifdef MBED_CONF_TARGET_STDIO_UART_RX STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX, #else STDIO_UART_RX = PD_9, #endif SERIAL_TX = STDIO_UART_TX, // Virtual Com Port SERIAL_RX = STDIO_UART_RX, // Virtual Com Port USBTX = STDIO_UART_TX, // Virtual Com Port USBRX = STDIO_UART_RX, // Virtual Com Port

PeripheralPins.c

USBDevice_Serial

ver5.7 web
テンプレート:USBDevice Serial com port example.
プロジェクト:STM32_USB_Device_Serial
どこにつながるんじゃ
ドライバ?

// Virtual USB Serial port USBSerial usb_serial; usb_serial.printf("I am a virtual serial port: %d\r\n", i++);

Print_PC

ver5.7
テンプレート:Print on PC example.
プロジェクト:STM32_Print_PC

COM50 <- デバイスマネージャで確認
9600-8-n-1で接続
動いた

printf("This program runs since %d seconds.\n", i++);
コメント読むと、ボーレートとか変えたい場合は、Serialオブジェクトを定義しろと書いてある
If you want to change the baudrate for example, you have to redeclare the serial object in your code: Serial pc(SERIAL_TX, SERIAL_RX); Then, you can modify the baudrate and print like this: pc.baud(115200); pc.printf("Hello World !\n");

Compile Macro定義したがポート変更出来なかった
MBED_CONF_TARGET_STDIO_UART_TX=PC_10
定義は出来てるんだが、PinNames.hに影響していないかんじ
https://os.mbed.com/users/mbed_official/code/mbed-dev/file/default/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F767xI/TARGET_NUCLEO_F767ZI/PinNames.h/


jsonもやったがうまくいかん
{ "target_overrides": { "*": { "platform.stdio-baud-rate": 115200, "platform.default-serial-baud-rate": 115200 } } }
これで出来た。
#include "mbed.h" //------------------------------------ // Hyperterminal configuration // 9600 bauds, 8-bit data, no parity //------------------------------------ //Serial pc(PD_5, PD_6); Serial pc(STDIO_UART_TX, STDIO_UART_RX,115200); DigitalOut myled(LED1); int main() { int i = 1; pc.printf("PC Hello World !\n"); printf("stdio Hello World !\n"); while(1) { wait(1); pc.printf("pc This program runs since %d seconds.\n", i++); printf("stdio This program runs since %d seconds.\n", i++); myled = !myled; } }

Nucleo_printf

v5.7
テンプレート:Display a message on PC using UART
プロジェクト:Nucleo_printf

Serial pc(SERIAL_TX, SERIAL_RX); pc.printf("Hello World !\n");

TCP server over ethernet

v5.7

Basic HTTP server example The target IP address is 'xx.x.xx.xx' accept yy.yy.yy.yy:55212 accept yy.yy.yy.yy:55211

Network

Network Socket

Ethernet.connect()

v5.7

接続するまでブロック
別スレッド動かすとconnect出来ないっぽい。


NUCLEO-F767ZIでping通らない

2018-06-13

mbed-os-5.7.6

STM32のハードウェアチェックサム生成のバグらしい
Arch Max - Network works fine except ping
No Ping Response

Wiresharkで見ると、pingレスポンス返しているけど、チェックサムエラーになっている。

対策
mbed-osのソースいじってCLIでビルド。
下記定義を0にする。
mbed-os\features\FEATURE_LWIP\lwip-interface\lwip\src\include\lwip\opt.h(2083): #define CHECKSUM_GEN_ICMP 1



end.

Home New Help Edit
2023-03-24 09:22:18 32400