cancel
Showing results for 
Search instead for 
Did you mean: 

Nx_WebServer example on STM32N6570-DK board

Louie88
Senior II

I tried in use Nx_WebServer factory example written for STM32N6570-DK board. Finally I compiled (without error) and run the project but nothing (except single step) worked.

  • It never got IP address from DHCP.
  • The Green LED is not blinking.
  • With static IP address it does not answer for ping command.
  • The board does not appear in arp -a list.
  • The breakpoint set inside of ETH1_IRQHandler is never hit.
  • The green and yellow LEDS of RJN45 are not blinking
  • The code is running inside the app_thread and wating for events.

What did I wrong?

Louis

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Louie88
Senior II

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
  1. Open CubeMX.
  2. Click In Start My Project from MCU section click on Access to Board Selector button,
  3. Type Board name = N6570.
  4. Click on STMN6750-DK board.
  5. Click on Nx_WebServer example in the examples list.
  6. On the top right click on the Start Project button.
  7. In the dialog click Open in Cube MX. We need to configure the compiler.
  8. When the project is generated click on Project Manager tab.
  9. In Toolchain / IDE dropdown box select STM32IDE. (or your preferred toolchain. This example uses STM32IDE.
  10. Click on top right Generate Code button.
Compiling.
  1. The app will open STM32CubeIDE with an Nx_WebServer project.
  2. Cleat it and build it.
  3. You will get 1. error: fatal error: rtl8211.h: No such file or directory.
  4. 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
  1. In File Explorer open C:\Users\[UserName]\STM32Cube\Repository\STM32Cube_FW_N6_V1.3.0\Drivers\BSP\Components\rtl8211 folder
  2. You will see the missing files.
  3. Copy the two files into the C:\Users\l[UserName]STM32Cube\Example\Nx_WebServer\Drivers\BSP\Components\rtl8211 folder.
  4. Go back to STN32CubeIDE.
  5. The red x should appear from rtl8211.c file, because it is already on the right folder.
  6. Recompile the app.
  7. You should not get any error.
Flashing the app
  1. STM does not provide sign and flash batch files for you so you should write your own signing and flashing file.
  2. 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
  1. Unplug the USB cable from dev board.
  2. Set the BOOT1 switch 1-3 (Right) position.
  3. Connect the USB-C cable to CN6 connector.
  4. Now double click on the SignAndLoad.bat file.
  5. It will sign your app and load it into the flash.
  6. Unplug USB-C cable.
  7. Set the BOOT1 switch back 1-2 (Left) position.
  8. 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).
  9. Connect the USB-C cable to CN6.
  10. Connect an Ethernet cable to RJ-45. A good, tested one (10Mbps). The yellow LED should blink (10Mbps mode).
  11. 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.
  12. Click Reset button on dev board.
  13. 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.
  1. Unplug USB-C cable from board.
  2. Remove the SD card from the board.
  3. Plug the SD Micro card to a standard SD card adapter.
  4. Connect the SD card adapter to your PC.
  5. 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
  1. Remove the SD card from PC and from the adapter (Remove the SD card safely).
  2. Unplug the USC-C cable from the board.
  3. Plug the SD card into the board.
  4. Connect the USB-C cable to the board.
  5. Wait until you see the complete welcome messages (see above) in Terminal.
  6. 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.
  7. 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

 

 

 

 

 

 

 

 

View solution in original post

2 REPLIES 2
Louie88
Senior II

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
  1. Open CubeMX.
  2. Click In Start My Project from MCU section click on Access to Board Selector button,
  3. Type Board name = N6570.
  4. Click on STMN6750-DK board.
  5. Click on Nx_WebServer example in the examples list.
  6. On the top right click on the Start Project button.
  7. In the dialog click Open in Cube MX. We need to configure the compiler.
  8. When the project is generated click on Project Manager tab.
  9. In Toolchain / IDE dropdown box select STM32IDE. (or your preferred toolchain. This example uses STM32IDE.
  10. Click on top right Generate Code button.
Compiling.
  1. The app will open STM32CubeIDE with an Nx_WebServer project.
  2. Cleat it and build it.
  3. You will get 1. error: fatal error: rtl8211.h: No such file or directory.
  4. 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
  1. In File Explorer open C:\Users\[UserName]\STM32Cube\Repository\STM32Cube_FW_N6_V1.3.0\Drivers\BSP\Components\rtl8211 folder
  2. You will see the missing files.
  3. Copy the two files into the C:\Users\l[UserName]STM32Cube\Example\Nx_WebServer\Drivers\BSP\Components\rtl8211 folder.
  4. Go back to STN32CubeIDE.
  5. The red x should appear from rtl8211.c file, because it is already on the right folder.
  6. Recompile the app.
  7. You should not get any error.
Flashing the app
  1. STM does not provide sign and flash batch files for you so you should write your own signing and flashing file.
  2. 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
  1. Unplug the USB cable from dev board.
  2. Set the BOOT1 switch 1-3 (Right) position.
  3. Connect the USB-C cable to CN6 connector.
  4. Now double click on the SignAndLoad.bat file.
  5. It will sign your app and load it into the flash.
  6. Unplug USB-C cable.
  7. Set the BOOT1 switch back 1-2 (Left) position.
  8. 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).
  9. Connect the USB-C cable to CN6.
  10. Connect an Ethernet cable to RJ-45. A good, tested one (10Mbps). The yellow LED should blink (10Mbps mode).
  11. 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.
  12. Click Reset button on dev board.
  13. 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.
  1. Unplug USB-C cable from board.
  2. Remove the SD card from the board.
  3. Plug the SD Micro card to a standard SD card adapter.
  4. Connect the SD card adapter to your PC.
  5. 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
  1. Remove the SD card from PC and from the adapter (Remove the SD card safely).
  2. Unplug the USC-C cable from the board.
  3. Plug the SD card into the board.
  4. Connect the USB-C cable to the board.
  5. Wait until you see the complete welcome messages (see above) in Terminal.
  6. 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.
  7. 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

 

 

 

 

 

 

 

 

Louie88
Senior II

I successfully added controls to enable blinking the red LED controls. I also create a RedLedThred in Nx_WebServer app to blink the red led. Now both LEDs (green+red) can be enabled to blink from website.

20260316-RED-LED-Control.png

However, the memory usage looks very bad:
20260316-High-Memory-Usage.png

Debugging is also a problem. The only way to debug the app to set BOOT1 switch to 1-3 (right) position, do not run the SingAndLoad.bat, but start debugging. This works fine.

If you set BOOT1 switch to 1-3 (right) position, do run the SingAndLoad.bat, set BOOT1 switch back to 1-2 (left) position, cycle the power then the app runs, but starting the debugger reports Failed to start GDB Server error:

20260316-GDB-server-errorl.png

The memory section of the LD file is the factory default:

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
_sstack = _estack - _Min_Stack_Size;

_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */

/* Memories definition RAM was originall 256K */
MEMORY
{
  ROM    (xrw)    : ORIGIN = 0x34180400,   LENGTH = 256K
  RAM    (xrw)    : ORIGIN = 0x341C0000,   LENGTH = 256K
}

/* Sections */
SECTIONS
{
   ...
   ...
}

Any idea, anybody?

Thanks,

Louis