cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6 ETH cant send packets

AlexCatze
Associate II

Hi. I have a  NUCLEO-N657X0-Q board with MB1854B. Yes, exactly nucleo, not discovery one. Im trying to recreate RTSP example fron discovery board.

 

As netxduo from cubemx is kinda buggy, i manually added it along with other necessary middlewares from github repo. After configuring all peripherals according to VENC RTSP example for disco board on video side and UDP ECHO Server example for nucleo board, i copied application files from VENC RTSP example.

Application starts but fails to get IP by dhcp. I have tripple-checked all the things. ETH configuration and driver are correct for my board and my PHY(lan8742). ETH is inited without errors, memories for descriptors and buffers are marked as non-cached in MPU. Pin assignment also correct. Netxduo creates DHCP packets and descriptors for them. Then _nx_driver_packet_send is triggered. But i checked with my oscilloscope TX lines on the RMII interface, and there are no activity. 

I also checked, UDP Echo example works on this board fine. So hardware isnt a problem.

 

Are there other things to check or some guide, how to create from scratch project for stm32n6 with ethernet/netxduo support? 

5 REPLIES 5

Im not sure how this is related to my issue. I have nothing to receive still.

 

Also i found that after netxduo calls HAL_ETH_Transmit_IT, there are no eth interrupts after it(im not sure if it should be). 

Eth interrupt is enabled and it happens two times on boot (right after invoking HAL_ETH_Start_IT) and when I plug/unplug ethernet cable.

STackPointer64
ST Employee

Hello @AlexCatze,

Could you please answer the following questions to help me better understand the issue?

  • Have you tried capturing the network traffic using Wireshark?
  • Was there an ARP announcement packet sent?
  • Are you certain your DHCP server is functioning correctly?
  • Have you tried assigning a static IP address if DHCP failed to acquire one? If yes, did the application work?
  • Is your application running under an RTOS?
  • Have you compared your NetXduo configuration with the UDP Echo example? Tools like Meld (Linux) or WinMerge (Windows) can help compare files line by line.

The more details you provide about your configuration, debugging steps, and investigations, the better I can assist you in resolving the issue.

Best regards,

 

To improve visibility of answered topics, please click Accept as Solution on the reply that resolved your issue or answered your question.

Hello.

Yes, ofcourse.

  • Have you tried capturing the network traffic using Wireshark?

Yes, I did. Both, connecting directly to PC network interface with no filters, and connecting PC and N6 to the same network with filter my MAC address in wireshark. In both scenarios, with faulty project, there were no packets. And in both scenarios but with example from repo there were DHCP packets.

  • Was there an ARP announcement packet sent?

No. N6 sends no packets. Btw, there no communication from N6 to PHY chip on the RMII`s TX lines at all. In the same time, PHY tries to communicate with N6 on the RX lines.

  • Are you certain your DHCP server is functioning correctly?

Yes. If i will use example from github "as is" - it will work perfectly in the same enviroment.


  • Is your application running under an RTOS?

Yes. Im using ThreadX(Azrtos) from the same repo.


  • Have you compared your NetXduo configuration with the UDP Echo example? Tools like Meld (Linux) or WinMerge (Windows) can help compare files line by line.

 Yes, i did. But i did it manually. Example is FSBL-only project, but my project is secure application. Also, looks like example was created using different version of CubeMX, so fragments of code with the same logic are different(different lines order, variable names, etc). And my project have some additional things (VENC, DCMIPP, I2C). So comparing line-by line them will show a lot of differences.

 

The more details you provide about your configuration, debugging steps, and investigations, the better I can assist you in resolving the issue.


There are a lot of tests done by me and a ton of information gathered. But i think, the most important is:

- DHCPclient/Netxduo successfully creates packet in the TX buffer and points descriptor to it.

- HAL_ETH_Transmit_IT is invoked next. 

- There are no ETH interrupt after HAL_ETH_Transmit_IT call. But generally, ETH interrupts are working(unplugging cable causes interrupt).

- There are no activity on TX lines at all.

 

I can share project with You. Also i will try to recreate bare minimum project from scratch, making notes about all steps. And check if issue will be there.

 

Hi. Recreated this project on the last (1.19.0) version of CubeIDE with the last FW package(1.2.0). Issue is still here.

 

Steps that I used to create project:

Spoiler

1) Create project (FSBL+SecApp+ExtMemLoader) for N6 Nucleo board
2) Configure XSPI and LRUN

Connectivity
XSPIM (Enable FSBL and ExtMem)
Mode: Direct
XSPI2 (Enable FSBL and ExtMem)
Mode: Octo SPI
Port: Port2 Octo
Chip Select Override: NCS1 Port2
Parameter Settings
Fifo Threshold: 4
Memory Mode: Diasble
Memory Type: Macronix
Memory Size: 32GBit
Chip Select High Time Cycle: 2
Free Running Clock: Disable
Clock Mode: Low
Wrap Size: Not supported
Clock Prescaler: 0
Sample Shift: None
Delay Hold Quarter Cycle: Enable
Chip Select Boundary: None
Maximum Transfer: 0
Refresh Rate: 0
Memory Select: NCS1
Switching Duration Clock: 0
Middleware and Sofrware Packs
EXTMEM_MANAGER (Enable FSBL and ExtMem)
Activate External Memory Manager: Enabled
Boot usecase
Boot
Select boot code generation: Enabled
Selection of the boot system: Load and run
Header size: 0x400
LRUN source
select the source memory: Memory 1
source address offset: 0x00100000
source code size: 0x00100000
LRUN destination
selection of the memory: Internal Memory
destination address: 0x34000000
Memory 1
Select driver
Select the memory driver: EXTMEM_NOR_SFDP
Configuration
Memory Instance: XSPI2
Number of memory data line: EXTMEM_LINK_CONFIG_1LINE
EXTMEM_LOADER (Enable ExtMem)
Activate External Memory Loader: Enabled
External Memory Loader
select the memory: Memory 1
select the target IDE/Tool: Selected Toolchain
Target Memory Parameters
Loader name: Patched N6 Loader
Number of sectors: 1024
Sector size: 0x00010000
Page size: 0x1000
Program Page Timeout: 10000
Erase Sector Timeout: 6000

3) Replace new EXTMEM middlewares with older ones. Because older ones works, but new not. Also apply fix from https://community.st.com/t5/stm32-mcus/how-to-debug-stm32n6-using-stm32cubeide/ta-p/800547
4) Setup debug according to https://community.st.com/t5/stm32-mcus/how-to-debug-stm32n6-using-stm32cubeide/ta-p/800547
5) Drop threadx to project
6) Integrate threadx to project

Add includes:
/threadx/common/inc
/threadx/ports/cortex_m55/gnu/inc

Add sources:
/threadx/common/src
/threadx/ports/cortex_m55/gnu/src

Remove default interrupt handlers:

HardFault_Handler
UsageFault_Handler
SVC_Handler
PendSV_Handler
SysTick_Handler
SecureFault_Handler

Make HAL use TIM6 as timer instead of SysTick

Add _vectors to startup_stm32n657x0hxq.s

Add __RAM_segment_used_end__ to linker script

Add tx_kernel_enter() to main

Add app_threadx.c with sample code(blink)

Move (copy from middleware folder and mark as excluded from build) _tx_initialize_low_level to Core/Src. And adjust SYSTEM_CLOCK in it.

Define TX_SINGLE_MODE_SECURE both for C and ASM

7) Drop netxduo and phy driver to project
8) Enable ETH and integrate NetXDuo.

Add includes:
/lan8742
/netxduo/addons/dhcp
/netxduo/common/inc
/netxduo/common/drivers/ethernet
/netxduo/ports/cortex_m55/gnu/inc
/netxduo/tsn/inc

Add sources:
/lan8742
/netxduo/addons/dhcp
/netxduo/common/src
/netxduo/common/drivers/ethernet
/netxduo/common/drivers/ethernet/lan8742
/netxduo/tsn/src

Define NX_INCLUDE_USER_DEFINE_FILE and TX_INCLUDE_USER_DEFINE_FILE

Remove app_threadx.c added for test

Add instead of it proper AZURE_RTOS and NetXDuo folders. Add them to src/inc

Add tx_user.h

Enable ETH in ioc configurator

Set Rx Buffers Length to 1536

Move MDIO/MDC to PG11/PF4 pins

Enale ETH interrupt and set its priority to 7

Enable USART1 and set it to PE5/PE6

Add PUTCHAR_PROTOTYPE to main.c

Add following lines to HAL_ETH_MspInit
__HAL_RCC_ETH1MAC_CLK_ENABLE();
__HAL_RCC_ETH1TX_CLK_ENABLE();
__HAL_RCC_ETH1RX_CLK_ENABLE();

Change eth_handle to heth1

Add tcp_sec and nx_data to linkerscript

Configurre MPU to protect noncacheable(nx pool) and ETH registers

I will also add project sources to this post.

 

Btw, doing this I found another "funny" issue. I tested this project on two of my N6 nucleo boards. On one of them, project works "like expected" - it goes to DHCP, tries to send dhcp discovery, but there are no TX activity.

 

On the second board nx_dhcp_create returns NX_CALLER_ERROR. I spent some time and found that _tx_thread_system_state equals TX_INITIALIZE_IN_PROGRESS at the time  when my thread starts. But thread starts after _tx_initialize_kernel_enter sets _tx_thread_system_state  to TX_INITIALIZE_IS_FINISHED. Looks like coherency issue(what?). I disabled D-Cache and this issue have gone(what???). And this issue always happens on one board with cache enabled, and never happens on other.