Can you Tell me a simple Code for Read/Write and Open the Serial-Port (UART) with RLP C Code ?
In C# it is to Slow. I Need 100000 Baud with 8 Data Bits, 2 Stop-Bits and Even Parity.
I don’t know of anything simple, and a product would be useful ie Panda etc. If you are up for a challenge download this package
Then use uart.c as a template and make whatever changes you need. You will also need the user handbook for the rest of the information you will need ie setting up regs…
EDIT: I don’t understand what you mean by C# is slow, when it comes to baud rates whatever baud you set, you get, with whatever language you use.
Good luck! & Welcome!
I believe Obi meant that .NET has MAX baud you can set. For example, for I2C it allows 400KHz MAX, while the protocol is well defined for up to 5MHz now and actual useful speed is 1MHz. Now if you’re working with device like Hydra, which runs 200MHz ARM9 CPU, there’s no reason why I should be bounded with 400KHz.
Please check this example: http://www.tinyclr.com/codeshare/entry/219
I noticed in your managed code you have this:
private SerialPort serialPort = new SerialPort(“COM3”, 9600, Parity.None, 8, StopBits.One);
And in the RLP
/* UART definitions, now UART 2 (COM3) is selected */
Does that managed SerialPort object do some of the setup for you? (Similar to the Analog stuff you helped me with)
@ mhectorgato - You got that right
Creating the managed SerialPort object, does all the parameter settings and baudrate prescaler settings for you. No need to figure it out from the DOCs, GHI already did
I know they are busy with so many other things … so I wish GHI would put this on their todo list: make more RLPExt helpers (like the GPIO ones) for RLP.
I will do this when I’m retired in about 35 years
I looked the Sample Codes and come not to my Target.
In C#:
SerialPort serialPort = new SerialPort(“COM2”, 100000, Parity.Even, 8, StopBits.Two);
The Port Opens fine and Now i call from C# the RLP Function int Read(unsigned int *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
it should Read from SerialPort, that Object i give as Argument , in an internal Buffer that was allocated before.
Is a little Way to do that without using Interrupts or Registers?
In Arduino i will write in C (8N1): (is only a Sample here, that is what i mean with Simple)
Serial2.begin(100000);
if (Serial2.available() ) {
int incomingByte = Serial2.read();
}
This should help http://www.tinyclr.com/codeshare/entry/490