Serial DataAvailable not firing

Hi all,
I wrote this application that connects to a serial device and waits for data packets incoming.
On Mac it works perfectly w/out any issue, but I tried compiling it for Raspberry Pi and the DataAvailable event doesn’t fire.
Have you got an idea? Why could it happen? What should I check? Have you ever got any similar issue?

I have a serial application running on Mac, Linux and win, the same code works perfectly all the time and has done for the last several months of development on an embedded system I have designed.

I am pretty sure there is no issue with DataAvailable in my experience, but as you have a problem that may point to the PI not actually receiving data as you expect and therefore the event can not happen.

I know you will probably have done these things, but its worth checking one more time!

Are you sure you are connected to the correct serial device? I know the ERROR event and LastErrorCode property are not available in Linux.
Is there an issue with setting such as baud rate?
When you Open() are you checking the return for true indicating the port really is open?

It is also possible there is a hardware issue with the serial converter you are using.

I am using the official Raspbian image installed with NOOBS, I have tried both FT232 and Prolific converters without any issues or driver installation.

You may know the following information, but other readers may not.

When I scan the ports on the PI I get this:-

/dev/ttyAMA0, the built in serial port
/dev/ttyUSB0, my USB converter

ttyAMA0 is used by the system as a debug output and by default is used by the system unless you tell it otherwise.

this article describes it perfectly:-
PI Serial

Lastly, are you sure the power supply is up to its job, I have found the PI is very sensitive to this, I now use mine with a 2 amp supply, an iPad charger, on a PI 2 with the official display.

I can not think of any way to intentionally break the serial port as it is a very simple to use class, which is why I would suspect the issue to be elsewhere.

Regards

Mark

ps if you would like me to test your code on my hardware please PM me to sort it out.

You have to set raspberry pi serial setting in the gui or raspi-config

I’ve checked the result of .Open and it’s true.
I’ve tried connecting to my device with the screen command on Linux and it’s all right, I receive Data without problems.

The curious fact is that the same code compiled on Mac works perfectly, but when I compile for Raspberry Pi it doesn’t work.
I’m gonna try another batch of test, I’ll post the results.

Found the problem.
I set the baud rate using the propery Serial1.Baud = 38400, but instead I had to use 12 (Baud38400).

Confusingly when you read it back you get 38400

I use a combobox to show an option to connect, if you place all the entries as per the language reference you only need to select the baud rate and the list index is then the correct value, 12 in the case of 38400.