FEZmini - DataReceived events not firing on COM1 when USB not connected

I have a device sending bursts of bytes into FEZ COM1.

To prove they are being received I switch the onboard LED ON on entry to the SerialPort.DataReceived event handler, and OFF on exit. Image1 shows the incoming bytes (blue trace) and the output on pin 8 of SDexp (green trace), which corresponds to the LED. The DataReceived event can be seen to fire at least once per burst of bytes, as anticipated.

This is with the FEZmini powered over USB from the PC I’ve been developing on.

BUT, if I remove the USB cable and power the FEZ at the 5-9V input (regulated 5V generated from a battery), the DataReceived event fires only once (Image2). More often than not it doesn’t fire at all.

There have been NO code changes between these two observations, and I can go backwards and forwards between USB and non-USB power and reproduce the events fire / events don’t fire (or only fire once) conditions every time.

Furthermore, if I power up from USB (DataReceived events fire as anticipated) then connect my alternative source of 5V, then disconnect USB, the events continue to fire as desired.

But if I power up from my alternative source of 5V (DataReceived events don’t fire) then connect USB, then disconnect my alternative source of 5V, the events remain absent.

Again, I stress, NO code changes between the working and non-working states.

So it looks to me like the FEZ detects USB connection if present at power up, and configures the system in such a way that COM1 DataReceived events fire, but if USB is not detected at startup, then COM1 DataReceived events do not fire.

Is there a solution to this problem? I want my application to fly in a RC plane, but don’t want to have to send my laptop up with it :o).

Open port then set event after it is open. Check your code for this.

Welcome to the community.

Thanks for swift reply Gus… especially as it’s Saturday!

But sadly, this doesn’t fix the problem.

Still works when powered up via USB, doesn’t work when powered with 5V at the 5-9V input.

(When I say it “doesn’t work”, I have verified that my code is running… just not receiving DataReceived events.)

Any other ideas?

Firmware info from MFDeploy, if that helps…

ClrInfo.clrVersion: 4.1.2821.0
ClrInfo.clrVendorInfo: Microsoft Copyright © Microsoft Corporation. All rig
ClrInfo.targetFrameworkVersion: 4.1.2821.0
SolutionReleaseInfo.solutionVersion: 4.1.8.0
SolutionReleaseInfo.solutionVendorInfo: GHI Electronics, LLC
SoftwareVersion.BuildDate: Dec 22 2011
SoftwareVersion.CompilerVersion: 410561

Apologies Gus… Your fix HAS worked.

Finger trouble… after I applied your mod I must have failed to deploy.

Now works just the same, battery or USB.

THANK YOU!

Glad you got it to work. Enjoy!