Here is a (long and detailed) to do list how to make the Nx_WebServer work on STM32N6570-DK card. This is fully tested solution. Following these (my) steps I could run the Nx_WebServer.
Installation
- Open CubeMX.
- Click In Start My Project from MCU section click on Access to Board Selector button,
- Type Board name = N6570.
- Click on STMN6750-DK board.
- Click on Nx_WebServer example in the examples list.
- On the top right click on the Start Project button.
- In the dialog click Open in Cube MX. We need to configure the compiler.
- When the project is generated click on Project Manager tab.
- In Toolchain / IDE dropdown box select STM32IDE. (or your preferred toolchain. This example uses STM32IDE.
- Click on top right Generate Code button.
Compiling.
- The app will open STM32CubeIDE with an Nx_WebServer project.
- Cleat it and build it.
- You will get 1. error: fatal error: rtl8211.h: No such file or directory.
- The error is in Drivers -> BSP: The RTL8211.c and RTL8211.h files are missing. (why? it is an out of box example)
Fixing the missing files error
- In File Explorer open C:\Users\[UserName]\STM32Cube\Repository\STM32Cube_FW_N6_V1.3.0\Drivers\BSP\Components\rtl8211 folder
- You will see the missing files.
- Copy the two files into the C:\Users\l[UserName]STM32Cube\Example\Nx_WebServer\Drivers\BSP\Components\rtl8211 folder.
- Go back to STN32CubeIDE.
- The red x should appear from rtl8211.c file, because it is already on the right folder.
- Recompile the app.
- You should not get any error.
Flashing the app
- STM does not provide sign and flash batch files for you so you should write your own signing and flashing file.
- In Notepad++ (or any text editor) Create a new file with [ProjetRoot]\Flash scripts\SignAndLoad_FSBL.bat name. (Location is important to find the files by the batch file)
off
setlocal
:: Tools
set "CUBEPROGRAMMER_TOOL_PATH=C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin"
:: Paths relative to this script
set "BIN_DIR=%~dp0..\STM32CubeIDE\FSBL\Debug"
set "OUT_DIR=%BIN_DIR%"
:: Input/output filenames
set "FSBL_BIN=%BIN_DIR%\Nx_WebServer_FSBL.bin"
set "FSBL_TRUSTED=%OUT_DIR%\Nx_WebServer_FSBL-trusted.bin"
echo BIN_DIR = %BIN_DIR%
echo FSBL_BIN = %FSBL_BIN%
if not exist "%FSBL_BIN%" (
echo.
echo *** HIBA: Nem találom az FSBL bin fájlt ***
echo "%FSBL_BIN%"
echo.
pause
exit /b 1
)
pushd "%BIN_DIR%"
echo.
echo Signing FSBL for OSPI boot...
"%CUBEPROGRAMMER_TOOL_PATH%\STM32_SigningTool_CLI.exe" ^
-s ^
-bin "%FSBL_BIN%" ^
-nk ^
-of 0x80000000 ^
-t fsbl ^
-o "%FSBL_TRUSTED%" ^
-hv 2.3 ^
-align
echo.
echo Flashing FSBL to OSPI @ 0x70000000...
"%CUBEPROGRAMMER_TOOL_PATH%\STM32_Programmer_CLI.exe" ^
-c port=SWD mode=HOTPLUG AP=1 ^
-el "%CUBEPROGRAMMER_TOOL_PATH%\ExternalLoader\MX66UW1G45G_STM32N6570-DK.stldr" ^
-d "%FSBL_TRUSTED%" 0x70000000
popd
pause
- Unplug the USB cable from dev board.
- Set the BOOT1 switch 1-3 (Right) position.
- Connect the USB-C cable to CN6 connector.
- Now double click on the SignAndLoad.bat file.
- It will sign your app and load it into the flash.
- Unplug USB-C cable.
- Set the BOOT1 switch back 1-2 (Left) position.
- Plug a SD Micro card to the reader. IMPORTANT: without pulled in SD Card you will see a blinking RED led. The app does not detect when you plug the SD card into the socket while the ap is running (No hot plug-in).
- Connect the USB-C cable to CN6.
- Connect an Ethernet cable to RJ-45. A good, tested one (10Mbps). The yellow LED should blink (10Mbps mode).
- Launch a Terminal app (TeraTerm is okay and free) on your PC and select STL-Link's com port (Name is something like this: STMicroelectronics STLink Virtual COM Port) with 11520,8,n,1 and connect to that COM port.
- Click Reset button on dev board.
- After 5-10 seconds later you should see the followings in the Terminal:
Nx_Webserver application started..
Looking for DHCP server ..
STM32 IpAddress: 192.168.1.92 (might be different)
Fx media successfully opened.
HTTP WEB Server successfully started.
Copying web server content
WARNING: The web content is expected to be in the root folder of the SD card, but the app does not copy any file to the SD card, even nobody warns you about that. You have to copy the files.
- Unplug USB-C cable from board.
- Remove the SD card from the board.
- Plug the SD Micro card to a standard SD card adapter.
- Connect the SD card adapter to your PC.
- Copy the About.html and Dashboar.html files and assets folder from C:\Users\[UserName]\STM32Cube\Example\Nx_WebServer\Web_Content folder to the root folder of SD card.
Starting the web server in browser
- Remove the SD card from PC and from the adapter (Remove the SD card safely).
- Unplug the USC-C cable from the board.
- Plug the SD card into the board.
- Connect the USB-C cable to the board.
- Wait until you see the complete welcome messages (see above) in Terminal.
- Type http://[Your IP address from Terminal]/about.html into a browser. IMPORTANT: use the IP address printed by the app to the Terminal app during launching.
- If you did everything right, then you will see a quite fancy web content running on your STM32N6570-DK dev board.
This procedure solved my problem. Do not start writing own rtl8211.c driver. STM provides it in the local repository of your PC if STM32Cube N6 firmware is installed, just the did not mention that.
Good luck,
Louis