usb msc code with FreeRtos gives error in vPortEnterCritical.

Hi ,

     I am trying to create a project with USB MSC using FreeRTOS. I have referred the examples "usb_msc" & "usbd_ble_uart_freertos_example" and created a project. I am not using CDC class. I am only using MSC class in my project. I am trying to communicate with an external flash chip and my spi drivers have some routines which include vTaskDelay function in read and write spi. Without RTOS my code works fine and I am able to communicate with the spi chip and create file system on it. While testing the code with FREERTOS, I am getting error inside vPortEnterCritical function and the code gets hanged in 

configASSERT( ( SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk ) == 0 );

I am not sure what is causing this issue. Can anyone please help?? I have attached my main.c here to check if any errors are there. Need some help on it as this task is critical and of high priority.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "nrf.h"
#include "app_error.h"
#include "ble.h"
#include "ble_hci.h"
#include "ble_srv_common.h"
#include "ble_advdata.h"
#include "ble_advertising.h"
#include "ble_bas.h"
#include "ble_dis.h"
#include "ble_conn_params.h"
#include "sensorsim.h"
#include "nrf_sdh.h"
#include "nrf_sdh_soc.h"
#include "nrf_sdh_ble.h"
#include "nrf_sdh_freertos.h"
#include "app_timer.h"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks & Regards,

Snehal.