serial vs fdserial
bnikkel
Posts: 104
in Propeller 1
hello again, so i have a working program that uses fdserial at 9600baud, but im wondering if it wouldn't be better to switch to serial?
I only send in one direction at a time so half duplex, I believe fdserial uses another Cog does serial do the same? also are there and speed differences? or other issues? thanks for any help.
I only send in one direction at a time so half duplex, I believe fdserial uses another Cog does serial do the same? also are there and speed differences? or other issues? thanks for any help.
Comments
FDS uses assembly for speed so it can transmit at higher baud rates. Simple Serial is able to send and receive bytes using Spin, so it's not as fast. 9600 is fine. I have done 19.2K by trimming the fat out of the Simple Serial TX and RX routines.
Serial is good if you have a process that only sends data with no response or very few. It can also be used if you are creating your own cog process that will process the data on it's own.
In most cases I find myself using fdserial as I don't want to be waiting for data and hold up my main process.
Mike
The driver checks each pin for a start bit and if it sees one it triggers the serial read function for that pin.
There are 7 cogs and you are only using 3 so I don't see the problem here.
I have that Nextion display, is it only displaying results or do you have buttons defined as well. You could switch it to serial to save a cog then.
Mike
Spin2cpp generates ugly looking C code that nobody would write that way but because it's coming from spin turn out that way.
There still may be an issue with this as lets say both serial interfaces start sending data at the same time. The program will likely miss one or the others data as it is single thread and monitoring multiple pins. Once the start bit is received that's it. It has to process that byte of data before looking at the other pin. There is no way for the process to tell one serial interface to not send until now otherwise the code needs to be changed such that it sends out a start code before the other starts sending it's data.
The ADC should be able to be poled by one cog as the values are held in registers until you read them unless your using interrupts.
Mike
https://www.parallax.com/downloads/elev-8-flight-controller-firmware. In the archive find
Serial_4x.h
Serial_4x.cpp
Serial_4x_driver
Interesting to me is that Jason converted Wayne Meretsky’s versión, which is quite different from Tim Moore’s original that Jim linked to above or from the versions modified by myself and others that are referenced in the credits. Wayne did a complete rewrite that is plainly more amenable to c, in the way it defines the buffers externally and avoids a lot of the initialization patches.
This is incorrect. The four-port object PASM module monitors the status of its eight pins, four inputs and four outputs, in a round robin and uses CNT to determine when to clock the next bit in or out for each pin. At 80 MHz the P1 is fast enough to do this at 115K baud for all four ports. The data are clocked into and out of Hub RAM buffers, where slower C or Spin code can deal with things in a less timely fashion.