I am using the launchpad to prototype a UDP based real time data monitoring system.
The launchpad is being fed with 16 bytes through the SSI0 interface every 100 microseconds. SSI is running at speed of 7.5MHz clock.
SSI0 generates an interrupt upon receiving the data and it sets a status flag =1.
Once ISR is finished, the main while loop has a if statement that checks if status ==1 and then proceeds to send the udp packet consisting of data received on the SSI0 interface.
void udp_initialize(void){ udp_pcb = udp_new(); IP4_ADDR(&server_ip, 192, 168, 1, 27); IP4_ADDR(&local_ip, 192, 168, 1, 32); udp_bind(udp_pcb, &local_ip, 2222); p = pbuf_alloc(PBUF_TRANSPORT, sizeof(g_ulDataRx0), PBUF_RAM); udp_connect(udp_pcb, &server_ip, 2222); udp_recv(udp_pcb, recvCallback, NULL); }
Above code is used to initialize the udp pcb and other required stuff.
if(status==1){ memcpy(p->payload, g_ulDataRx0, sizeof(g_ulDataRx0)); udp_send(udp_pcb, p); pbuf_free(p); //send(); status=0; } WatchdogReloadSet(WATCHDOG0_BASE, watchdogInterval);
Above code is running inside the main while loop.
The following code is for the SSI0IntHandler.
void SSI0IntHandler(void) { SSIIntClear(SSI0_BASE, SSI_RXFF); int i=0; volatile uint32_t bytes[4]; for (i=0; i<NUM_SSI_DATA; i++){ SSIDataGet(SSI0_BASE, &g_ulDataRx0[i]); bytes[0] = (g_ulDataRx0[i] & 0x000000FF) << 24u; bytes[1] = (g_ulDataRx0[i] & 0x0000FF00) << 8u; bytes[2] = (g_ulDataRx0[i] & 0x00FF0000) >> 8u; bytes[3] = (g_ulDataRx0[i] & 0xFF000000) >> 24; g_ulDataRx0[i] = bytes[0] | bytes[1] | bytes[2] | bytes[3]; } status=1; //send(); //For loop to send out data on the UART for debug. // for (i=0; i<NUM_SSI_DATA; i++){ // UARTprintf("%x\n", g_ulDataRx0[i]); // } SSIIntEnable(SSI0_BASE, SSI_RXFF); }
The problem I am facing is, once the microcontroller resets, the UDP stream is perfectly running at ~8Mbps but suddenly after sometime there is a drop in throughput. At some point it completely stops the transmission but after 4 - 5 seconds it again starts pumping at ~3-4Mbps.
The following screenshot should make the problem more clearly visible.
So, I am trying to figure out what is causing this. I expect it to transmit data in real time using whatever bandwidth it requires.
If it is necessary, I will post some more of the relevant code.