2024-12-20 05:12 AM
Hi,
I am using the STM32H7S78-DK board along with STM32CubeIDE for programming. My goal is to configure Ethernet and enable UART4 for debugging purposes. However, I am facing issues with the memory configuration file `STM32H7S7L8HXH_RAMxspi1_ROMxspi2.ld`.
Here is the scenario:
1. I have configured Ethernet GPIOs according to the datasheet and implemented the UDP server example from the reference link: STM32 ETHENRET UDP SERVER
2. When I enable UART4 for debugging with `STM32H7S7L8HXH_RAMxspi1_ROMxspi2.ld`, UART4 does not work.
3. If I disable the Ethernet functionality and use the default linker script `STM32H7S7L8HXH_default.ld`, UART4 works as expected. However, the Ethernet configuration is crucial for my project.
4. When I use `STM32H7S7L8HXH_default.ld` with both Ethernet and UART4, the build fails with a "RAM Overflow" error:
- Error: "region RAM' overflowed by 17160 bytes"
Questions:
1. How can I configure UART4 to work with `STM32H7S7L8HXH_RAMxspi1_ROMxspi2.ld`?
2. Could you guide me on resolving the RAM overflow issue to make Ethernet work properly while retaining UART4 functionality for debugging?
Here I also attached my Project,
Thank you for your assistance.
/Mehul
2024-12-21 05:06 PM
> How can I configure UART4 to work with `STM32H7S7L8HXH_RAMxspi1_ROMxspi2.ld`?
Just configure the UART. This should not require any change in the .ld file.
Verify that there's no pin conflict between ETH and UART4.
2024-12-22 11:17 PM
Hi @Pavel A. ,
No there is no pin conflict between ETH and UART4.
Here I attached screenshots of both configuration.
Please look at this also,
I am encountering errors when I enable Ethernet and UART4.
Could you help me troubleshoot and resolve this issue.
Description Resource Path Location Type
Ethernet_Appli.elf section `.text' will not fit in region `FLASH' Ethernet_Appli C/C++ Problem
make: *** [makefile:68: Ethernet_Appli.elf] Error 1 Ethernet_Appli C/C++ Problem
region `FLASH' overflowed by 36567 bytes Ethernet_Appli C/C++ Problem
I think fixing this error will resolve my problem.
/Mehul
2024-12-24 02:47 AM - edited 2024-12-25 04:34 AM
Hi @Pavel A. ,
I hope you're doing well.
Currently, I can successfully print UART4 logs on the Docklight tool by following the steps outlined in the readme file of the example.
To configure STM32CubeIDE Debug Configuration, you must do the following :
1. Upload the template XIP
2. Add the adequate external loader (MX66UW1G45G_STM32H7S78-DK.stldr file) in Project->Debugger Configuration
3. Add in the startup the template_XIP_Boot in Project->Debugger Configuration
4. Move up the application in the startup
However, I am still unable to receive the udp_receive_callback. Below is the code snippet I am working with:
void udp_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
{
struct pbuf *txBuf;
/* Get the IP of the Client */
// char *remoteIP = ipaddr_ntoa(addr);
printf("udp_receive_callback receive \n\r");
char buf[256];
int len = sprintf (buf,"Hello %s From UDP SERVER\n", (char*)p->payload);
/* allocate pbuf from RAM*/
txBuf = pbuf_alloc(PBUF_TRANSPORT,len, PBUF_RAM);
/* copy the data into the buffer */
pbuf_take(txBuf, buf, len);
/* Connect to the remote client */
udp_connect(upcb, addr, port);
/* Send a Reply to the Client */
udp_send(upcb, txBuf);
/* free the UDP connection, so we can accept new clients */
udp_disconnect(upcb);
/* Free the p_tx buffer */
pbuf_free(txBuf);
/* Free the p buffer */
pbuf_free(p);
}
void udpServer_init(void)
{
// UDP Control Block structure
struct udp_pcb *upcb;
err_t err;
printf("udpServer_init\n\r");
upcb = udp_new();
ip_addr_t myIPADDR;
IP_ADDR4(&myIPADDR, 192, 168, 0, 123);
err = udp_bind(upcb, &myIPADDR, 7); // 7 is the server UDP port
if(err == ERR_OK)
{
printf("udp_receive_callback init \n\r");
udp_recv(upcb, udp_receive_callback, NULL);
}
else
{
udp_remove(upcb);
}
}
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MPU Configuration--------------------------------------------------------*/
MPU_Config();
/* Enable the CPU Cache */
/* Enable I-Cache---------------------------------------------------------*/
SCB_EnableICache();
/* Enable D-Cache---------------------------------------------------------*/
SCB_EnableDCache();
/* MCU Configuration--------------------------------------------------------*/
/* Update SystemCoreClock variable according to RCC registers values. */
SystemCoreClockUpdate();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_FLASH_Init();
MX_UART4_Init();
MX_LWIP_Init();
/* USER CODE BEGIN 2 */
printf("Hello_STM32 from printf function!\n\r");
udpServer_init();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
MX_LWIP_Process();
// UART_Print("Hello from STM32!\n\r");
// printf("Hello_STM32!\n\r");
// HAL_GPIO_TogglePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin);
// HAL_Delay(100);
}
/* USER CODE END 3 */
}
Looking forward to your insights.
Thanks & Regards,
Mehul