Problem with http web server when running simultaneously with uart communication

Hi,

I'm developing an application running on LPC4088 and using Keil SDK.

At the moment, I have a WebSever with web pages stored on a SD Card and an UART communication between the board and a PC.

In order to develop the WebSever I started from the example "HTTP Web Server" from keil.

The Uart Communication is based on a task which gets characters using interrupt and decode the received message.

In the follow the code that I wrote for UART management task:

 

void myBluetoothUSART_callback(uint32_t event)
{
  uint32_t mask;
  mask = ARM_USART_EVENT_RECEIVE_COMPLETE;  

  if (event & mask) {
    /* Success: Wakeup Thread */
    osSignalSet(tid_Thread_Bluetooth, 0x01);
  }
}

int Init_Thread_Bluetooth (void) {
  tid_Thread_Bluetooth = osThreadCreate (osThread(Thread_Bluetooth), NULL);
  if (!tid_Thread_Bluetooth) return(-1);
  
  return(0);
}

/* CMSIS-RTOS Thread - UART command thread */
void Thread_Bluetooth(const void* args)
{
	uint8_t data;
	osEvent event;
	
    /*Initialize the USART driver */
    btUSARTdrv->Initialize(myBluetoothUSART_callback);
    /*Power up the USART peripheral */
    btUSARTdrv->PowerControl(ARM_POWER_FULL);
    /*Configure the USART to 4800 Bits/sec */
    btUSARTdrv->Control(ARM_USART_MODE_ASYNCHRONOUS |
                    ARM_USART_DATA_BITS_8 |
                    ARM_USART_PARITY_NONE |
                    ARM_USART_STOP_BITS_1 |
                    ARM_USART_FLOW_CONTROL_NONE, 115200);
     
    /* Enable Receiver and Transmitter lines */
    btUSARTdrv->Control (ARM_USART_CONTROL_TX, 1);
    btUSARTdrv->Control (ARM_USART_CONTROL_RX, 1);
	
    while (1)
    {
		btUSARTdrv->Receive(&data, 1);
		osSignalWait(0x01, osWaitForever);
		/* Decode received message */
		BluetoothManagement_ReceivedMessage(data);
	}
}

If I try to comunicate with the boad with WebServer all is OK if the UART Task doesn't receive message.

When I start to send message (about 10 bytes every 200ms) from PC to board via the UART2 after a while I can't communicate with the WebServer. In particular when I try to get information from the WebServer, I receive the error 404: 

  • Error 404 - Not Found
    The requested URL was not found on this server.

Using debug I found that the problem is that It is not possible to access to the SDCard resource:

  • The function fopen returns 0
  • The function ffind returns fsAccessDenied

Furthermore, the File System Window shows that SDCard is NOT INITIALIZED and NOT MOUNTED. Obviously, the Media was OK before.

Do you have an idea about the reason of this behaviour?

Could someone help me to understand what's wrong?

Thank's a lot.

Giovanni.

More questions in this forum