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-22 11:56 AM
@Mz.1 Yes, here is a project without FreeRTOS. But it is for a different STM32.