2023-11-15 03:10 AM - edited 2023-11-20 05:08 AM
Hi,
I'm using STM32H743ZI with STM32CubeMX 6.9.2 and STM32CubeIDE 1.13.1.
I added new STM32 project using the CubeIDE GUI - selected the STM32H743ZI device and automatically the project was generated, I opend the IOC file and enabled the ETH + LWIP options and that's it.
I added to my main function the below code from google:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* Enable I-Cache---------------------------------------------------------*/
SCB_EnableICache();
/* Enable D-Cache---------------------------------------------------------*/
SCB_EnableDCache();
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_LWIP_Init();
/* USER CODE BEGIN 2 */
const char* message = "Hello UDP message!\n\r";
ip_addr_t PC_IPADDR;
IP_ADDR4(&PC_IPADDR, 192, 168, 2, 10);
struct udp_pcb* my_udp = udp_new();
udp_connect(my_udp, &PC_IPADDR, 55151);
struct pbuf* udp_buffer = NULL;
/* Infinite loop */
for (;;) {
/* !! PBUF_RAM is critical for correct operation !! */
udp_buffer = pbuf_alloc(PBUF_TRANSPORT, strlen(message), PBUF_RAM);
if (udp_buffer != NULL) {
memcpy(udp_buffer->payload, message, strlen(message));
udp_send(my_udp, udp_buffer);
pbuf_free(udp_buffer);
}
}
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
opened Wireshark to see the messages - and nothing:
IOC file is here - https://fastupload.io/o9rIZHW6XnOZWzQ/file (failed to attach the file here from some reason)
this simple code worked in earlier versions of CubeMX...
pls help! thank you :)
2023-11-17 07:48 AM
Hi,
just to promote this topic. We just use also an H7 with the same Version of Cube MX and also has Problems to run simple Code. In our case, we suspect a problem with the LAN transceiver. This does not seem to be forwarding the uC response. Do you in the meantime a solution?
BR
2023-11-17 10:08 AM - edited 2023-11-17 10:08 AM
> we suspect a problem with the LAN transceiver.
So, is it custom hardware? Which LAN transceiver, is there documentation for it?
Have you tried to make a prototype/mock-up on a well known eval. board with a well known PHY, such as Nucleo-H743?
2023-11-18 11:19 PM - edited 2023-11-18 11:28 PM
@adamski - hey
no in my case it is not the LAN transceiver, because when I used an old version of CubeMX - it works perfectly...
2023-11-18 11:21 PM
@Pavel A. - in my case it is not the LAN transceiver for sure.
did you take a look on the IOC file I attached?
this is probably a configuration issue, and I can find what exactly...
2023-11-21 06:02 AM - edited 2023-11-22 01:38 AM
Hi,
@Pavel A. We are using the same PHY as at the Nucleo -> LAN8742. And also almost the same circuit. However, custom hardware. Why I say "it is because of the PHY" is because when I ping the device I see a response from the H7 on the bus. I can measure it at the PHY at pin 16, 17, 18. I only see the answer when I ping the correct IP. I therefore assume that something went wrong with the configuration of the PHY.
Although I have checked the HW, I cannot rule out a HW error.
I was only able to partially test my SW configuration on the Nucleo. We use the H743IIK6 and the H743ZIT6 is installed on the nucleo. However, the configuration ran on the nucleo without bigger problems.
@Mz.1 Have you measured the response pins with an oscilloscope? RMII_TXD0 and RMII_TXD1. Can you measure the response to a ping?
BR
2023-11-21 02:55 PM
@adamski Please see these ETH examples aligned with the current STM32H7 HAL library:
https://github.com/stm32-hotspot/STM32H7-LwIP-Examples
(still not bug-free but at least matching the current STM32H7 HAL library version).
Please begin with one of these examples and make it work, before Cube-generating from scratch.
2023-11-22 01:42 AM
@Pavel A. Since I already got it to work on the Nucleo from skretch and I measure on my HW responses on the correct pins the example project will not be able to help me.
How can I debug the LAN8742? Can I read any registers?
2023-11-22 02:44 AM
@Pavel A. - do you have an example of LWIP project without FREERTOS that works?
2023-11-22 02:56 AM - edited 2023-11-22 02:57 AM
@Mz.1 You just have to follow the instructions and ignore everything with FreeRTOS.
https://youtu.be/sQ3rgQNGKV4?si=LHnRRIPJAhOjEP6T