我现在使用的是CC3220SF,想实现的功能是,通过传感器采集数据,然后通过CC3220SF作为 tcp的客户端传送给服务器,同时把数据保存到SD卡里,使用了FreeRTOS作为操作系统。
单独使用网络和单独保存数据的功能分开写,都可以正常工作,但是一旦两个线程一起运行的时候,sd卡正常,但是网络的部分就会出错,从sl_start开始就不能成功,返回值是 -2005。 请问这个问题该如何解决呢
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我现在使用的是CC3220SF,想实现的功能是,通过传感器采集数据,然后通过CC3220SF作为 tcp的客户端传送给服务器,同时把数据保存到SD卡里,使用了FreeRTOS作为操作系统。
单独使用网络和单独保存数据的功能分开写,都可以正常工作,但是一旦两个线程一起运行的时候,sd卡正常,但是网络的部分就会出错,从sl_start开始就不能成功,返回值是 -2005。 请问这个问题该如何解决呢
关于这个报错的函数,请问哪个例程可以参考呢?这个我没有怎么用过。一下是在调用sl_start()前的一些设置,也都是仿照例程中的。
Display_printf(display, 0, 0, "start wlanThread"); wlan1: /* Start the SimpleLink Host */ pthread_attr_init(&pAttrs_spawn); priParam.sched_priority = SPAWN_TASK_PRIORITY; status = pthread_attr_setschedparam(&pAttrs_spawn, &priParam); status |= pthread_attr_setstacksize(&pAttrs_spawn, TASK_STACK_SIZE); status = pthread_create(&spawn_thread, &pAttrs_spawn, sl_Task, NULL); if(status) { // printError("Task create failed\t try again", status); Display_printf(display, 0, 0, "Task create failed\t try again"); goto wlan1; } wlan2: /* Turn NWP on - initialize the device*/ mode = sl_Start(0, 0, 0);
下面是SD卡的初始化部分,同样也是和例程中的类似:
/* Call driver init functions */ SDFatFS_init(); /* add_device() should be called once and is used for all media types */ add_device(fatfsPrefix, _MSA, ffcio_open, ffcio_close, ffcio_read, ffcio_write, ffcio_lseek, ffcio_unlink, ffcio_rename); /* Initialize real-time clock */ // clock_settime(CLOCK_REALTIME, &ts); /* Mount and register the SD Card */ sdfatfsHandle = SDFatFS_open(Board_SDFatFS0, 0); if (sdfatfsHandle == NULL) { Display_printf(display, 0, 0, "Error starting the SD card\n"); while (1); } else { Display_printf(display, 0, 0, "Drive %u is mounted\n", 0); } dst = fopen(fileName,"a+"); if (dst==NULL) { Display_printf(display, 0, 0,"file open failed %s",fileName); while(1); } else { Display_printf(display, 0, 0,"file open successfully %s",fileName); } Display_printf(display, 0, 0, "start sd thread");