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 SD卡读写 影响 WIFI功能 该如何解决

Other Parts Discussed in Thread: CC3220SF

我现在使用的是CC3220SF,想实现的功能是,通过传感器采集数据,然后通过CC3220SF作为 tcp的客户端传送给服务器,同时把数据保存到SD卡里,使用了FreeRTOS作为操作系统。

单独使用网络和单独保存数据的功能分开写,都可以正常工作,但是一旦两个线程一起运行的时候,sd卡正常,但是网络的部分就会出错,从sl_start开始就不能成功,返回值是 -2005。 请问这个问题该如何解决呢

  • 需要跟开发team讨论下,有更新会po上来
  • 谢谢,期待您的解答
  • 这两个操作理应不会互相影响。在调用sl_start之前有没有收到报错信息,比如SimpleLinkFatalErrorEventHandler?或者说在调用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");

  • 我尝试了一下,确实这两个任务不会相互影响,是在设定一个外部中断的时候产生的错误,具体原因我还再继续探索。感谢!