cancel
Showing results for 
Search instead for 
Did you mean: 

ST67W611M1 http Server stucks after a while

Dimitris_Kara
Associate II

Hello, I am using the x-nucleo-67W61M1 and the supported STM32N6 nucleo and I run the HTTPS Server application. The sample works well. I want to transfer loads of data and I do it through cJSON. I understand that i need to set a different get command and add an if statement in the HTTP_process_response that will handle the request and it will respond accordingly. I have set also a script in Matlab that does continuous gets and after a while i see that the STM is stuck and is no longer responding (I have the LEDs toggling in a different RTOS task) the log when that happens is:

[ERROR] [114031] [HTTP_00000001] (w61_at_net.c:441) W61_AT_SetExecute: W61_STATUS_TIMEOUT. It can lead to unexpected behavior.
[ERROR] [114031] [HTTP_00000001] (httpserver.c:524) [1] *****> SEND ERROR <*****
[ERROR] [116031] [HTTP_00000001] (w61_at_net.c:351) W61_AT_SetExecute: W61_STATUS_TIMEOUT. It can lead to unexpected behavior.
[ERROR] [118033] [defaultTask] (w61_at_net.c:1130) W61_Net_GetSocketInformation: W61_STATUS_TIMEOUT (no response). It can lead to unexpected behavior

 Creation of temporary thread to process an incoming HTTP request : 2
[ERROR] [119037] [HTTP_00000002] (httpserver.c:446) No data read on the socket, closing the socket
[ERROR] [120033] [HTTP_00000001] (w61_at_net.c:351) W61_AT_SetExecute: W61_STATUS_TIMEOUT. It can lead to unexpected behavior.

My code inside the http_process_response is:

  else if(response == DATA_STATE){
		  cJSON_Hooks hooks =
		  {
			.malloc_fn = pvPortMalloc,
			.free_fn = vPortFree,
		  };
		  cJSON_InitHooks(&hooks);

		  cJSON *root = cJSON_CreateObject();
				{
					cJSON *skills = cJSON_CreateArray();
					cJSON_AddItemToObject(root, "segments", skills);

					for(int i = 0; i < 1; i++){
cJSON *segment = cJSON_CreateObject();
cJSON_AddItemToArray(skills, segment);
cJSON_AddItemToObject(segment, "v1", cJSON_CreateString("3112"));
cJSON_AddItemToObject(segment, "v2", cJSON_CreateString("3113"));
cJSON_AddItemToObject(segment, "v3", cJSON_CreateString("3114"));
cJSON_AddItemToObject(segment, "v4", cJSON_CreateString("3115"));
cJSON_AddItemToObject(segment, "v5", cJSON_CreateString("3116"));
cJSON_AddItemToObject(segment, "v6", cJSON_CreateString("3117"));
cJSON_AddItemToObject(segment, "v7", cJSON_CreateString("3118"));
cJSON_AddItemToObject(segment, "v8", cJSON_CreateString("3119"));
cJSON_AddItemToObject(segment, "v9", cJSON_CreateString("3120"));
cJSON_AddItemToObject(segment, "v10", cJSON_CreateString("3121"));
cJSON_AddItemToObject(segment, "v11", cJSON_CreateString("3122"));
cJSON_AddItemToObject(segment, "v12", cJSON_CreateString("3123"));
cJSON_AddItemToObject(segment, "t1", cJSON_CreateString("3110"));
cJSON_AddItemToObject(segment, "t2", cJSON_CreateString("3111"));
cJSON_AddItemToObject(segment, "t3", cJSON_CreateString("3112"));
cJSON_AddItemToObject(segment, "t4", cJSON_CreateString("3113"));
cJSON_AddItemToObject(segment, "t5", cJSON_CreateString("3114"));
cJSON_AddItemToObject(segment, "t6", cJSON_CreateString("3115"));
cJSON_AddItemToObject(segment, "t7", cJSON_CreateString("3116"));
cJSON_AddItemToObject(segment, "t8", cJSON_CreateString("3117"));
cJSON_AddItemToObject(segment, "t9", cJSON_CreateString("3118"));
cJSON_AddItemToObject(segment, "t10", cJSON_CreateString("3119"));
					}
					}
char *ret = cJSON_PrintUnformatted(root);
cJSON_Delete(root);
snprintf(&response_template[strlen(response_template)], sizeof(response_template) - strlen(response_template),"Content-Length: %" PRIu32 "\r\n\r\n%s", (uint32_t)strlen(ret), ret);
currentResponse++;
response_data = response_template;
  }

I think there is something going with the memory management, because when I change the response_template size to 1024 (or more but after 2048 it freezes in the first callback)  it shows more of the data that wouldn't fit normally, but seems to fails more. also changing the HTTP_CHILD_TASK_STACK_SIZE seemed to affect it. I have increased the total heap of the RTOS and the specific heap of the task.

Another question I have is how can i send the data inn multiple steps, that may be the solution to my problem.

Any help is welcome,

Thanks in advance

0 REPLIES 0