Cerberus/4.2 SerialPort Parity.Even issue

As I said , no success… The parity bit is still set and interpretated as a non- ascii character. So port.readline does not function…
Is there way to enable the extended range of ascii characters for the readline- function, which retruns a string variable, then the problem might be solved…

Do you really need 7 data bits, not 8?

Yes, the device parameters of the source are fixed…

8 bits should work for you!

switch (linecoding.datatype) {
  case 0x07:
    /* With this configuration a parity (Even or Odd) should be set */
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    break;
  case 0x08:
    if (USART_InitStructure.USART_Parity == USART_Parity_No) {
      USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    } else {
      USART_InitStructure.USART_WordLength = USART_WordLength_9b;
    }
    break;
  default :
    return (FALSE);
  }

Sorry I am lost, I do not understand the code in related with the serialport.readline issue…
Where should I include this code? I looked at Codeplex, but could not find a clou.
Could you please give some explanation on this?

Freeck

That code is a part of stm32 serial port c++ wrapper.
It shows that if you need 7data bits, you should declare 8data bits and parity.

But I tested that setting in my C# application, and does not work… At least when I use the readline function…because the parity value is part of the recieved byte…

I think it’s worth you trying without the Gadgeteer ReadLine function, in case there’s some issues there that are confusing things. Personally, I think ReadLine is something you shouldn’t rely on, and in fact DataRecieved is often more problematic, you can use a polling pattern and your own buffer to achieve the same outcome.

Looks like I have same problem.

Some bytes recived with first bit set to high.

I have to use:
rs232.Initialize(19200,
GT.Interfaces.Serial.SerialParity.Even,
GT.Interfaces.Serial.SerialStopBits.One,
7, /Cerberus do not like 7 ???/
GT.Interfaces.Serial.HardwareFlowControl.NotRequired);

FEZ Cerberus board.

I tried all kind of settings, no succes.

If I connect my sensor to PC is running without problem.

What is solution for this problem? Just put first bit to zero?
Maby use another board? FEZ Spider for example.

Thanks.

Added general solution for all cases in the first post.