Too much traffic on serial ? (WiFi + Music + SerCam)

Hi,
I’m currently using a Raptor with some serial modules (according to the layout attached)

  • WiFi RS21 Module
  • Music Module
  • SerCam Module

It seems that there’s a conflict between those devices because SerCam keeps throwing me an error which is coming from here :

 data, int offset, int count)
{
	do
	{
		int num = _serialPort.Read(data, offset, count);
		offset += num;
		count -= num;
		if (num == 0)
		{
			_serialPort.DiscardInBuffer();
			break;
		}
		Thread.Sleep(1);
	}
	while (count > 0);
	if (count != 0) // <-- here
		throw new Exception(); // <-- here
}

Even, if I try to comment these two lines, the problem is in ReadFrameBuffer which tries to analyze the image (0xFFD8 at the begining and 0xFFD9 at the end) and fails.

Some few stuffs:

  • I have nothing on T
  • WiFi is on socket 1

Thanks for your help,

Nathanael

Hi Nathaniel

This can’t be “serial” being swamped. The SPI connection is what is used for the WiFi and the Music module, not a “serial” connection (U or K socket) like the camera

Have you tried to just create a Sercam module project and capture images that you don’t get the same error?

Have you modified a Gadgeteer driver before? If not, there’s a document on doing so https://www.ghielectronics.com/docs/226/extending-and-modifying-gadgeteering-drivers

I would then add debugging to that section of code and see what the values of offset and count are at the point where it’s likely failed (the break).

Hi,
I’m back with the same problem, this time on a Spider kit :slight_smile:
The setup is quite simple :
-Wifi on 6 or 9
-Sercam on 4,8 or 11
-Multicolor LED on 14
(I’ve tried every combination for Wifi and Sercam)

[quote]A first chance exception of type ‘System.Exception’ occurred in GTM.GHIElectronics.SerialCameraL1.dll
#### Exception System.Exception - 0x00000000 (7) ####
#### Message:
#### Gadgeteer.Modules.GHIElectronics.SerialCameraL1::ReadBytes [IP: 002f] ####
#### Gadgeteer.Modules.GHIElectronics.SerialCameraL1::ReadFrameBuffer [IP: 006b] ####
#### Gadgeteer.Modules.GHIElectronics.SerialCameraL1::UpdateStreaming [IP: 003a] ####
A first chance exception of type ‘System.Exception’ occurred in GTM.GHIElectronics.SerialCameraL1.dll[/quote]

When there’s no Wifi chip, no exception is thrown

Any idea, anyone can reproduce this ?

This same thing is happening to me on a Cobra II Wifi with sercam and motion-sensor.

I am calling the startstreaming from within the motionsensed event. I am thinking that there is some threading stuff in this?? :think:

@ njbuch -

we fixed on G400 4.3

But in G120 and other devices, it maybe later

Sounds good that you fixed it! Could you explain the fix for this in more detail? And in what situations it actually occurs. We are having a problem where it seems that the serial communications with wifi are interrupted by a second serial communication device. I thought that it might be related to this issue.

“mabye later” I’m assuming that a fix for G120 is coming as well?

/John

@ John Karbin -

We added a fifo buffer so data from serial won’t be lost on G400.
I just checked on G120, there is a fifo already, but it may not big enough while accessing network.

@ Dat - That sounds interesting. We are returning a jquery page. The application also has a RFID serial reader (not the ghi module) that is a serial device. When polling the webpage over WIFI, and RFID happends at the same time, messages can get cut.

Is there any way to increase the buffer size?

What is the baud rate on your RFID? How many bytes is the string?

@ Gus - We have tested 115200 and 9600, no difference. The size of the jquery string can vary alot. It does not seem to happend only when large pages are sent, but when the wifi communication and RFID communication happend at the same time.

I was asking how many bytes are sent from the reader on the serial port. Anyway, this thread includes the music module and things are completely different if this is the case. This is what I suggest, use the latest SDK (to be announced today) and then start a new thread with details about your own project and components are you using.

@ Gus - Ok, will do.