Z-UNO UART at 115200bps

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
codi78
Posts: 1
Joined: 11 Jan 2017 23:58

Re: Z-UNO UART at 115200bps

Post by codi78 »

Hi,

I have a the same problem with 19200bps Z-Uno can not get correct all bytes
from a Victron Energy Solar Charger that will dump each second some status values.

Anything I can do or help with?
When could get these mentioned DMA version?

Michael
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Z-UNO UART at 115200bps

Post by PoltoS »

Please give it a try on 2.0.8. Now DMA is used for UART - works perfectly even at 115.2kbps

viewtopic.php?f=3427&t=24573
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Z-UNO UART at 115200bps

Post by PoltoS »

Have you tried the new 2.0.8?
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-UNO UART at 115200bps

Post by droll »

I am using the UART (Serial0) configured to 115200 bauds to log events. I am observing that about 50% of the events (= receiving bytes) are dropped with revision 2.0.8 compared to revision 2.0.7 (installed mid of December 2016). Since I log just events I can use one of the external interrupts introduced with 2.0.8, but this solution will of course not work if a real serial communication is required.
It would be good to know more about the way the UART is served by the DMA in revision 2.0.8 (e.g. what is the available buffer size, in which situation is the DMA not activated, etc).
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-UNO UART at 115200bps

Post by p0lyg0n1 »

I missed something, but I don't understand how do you log events? Do you log them from Z-Uno? If you use UART0 to output there is no differences between 2.0.7 and 2.0.8. It works sequently byte by byte. DMA is using only for input data. Input buffer is 64 bytes long. It's cyclic. So, if you write 65 bytes before next loop with Serial.read inside it will rewrite itself. Anyway, I can help you with this problem if you can it reproduce and give me code that reproduces that problem.
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-UNO UART at 115200bps

Post by droll »

The UART input (RX) of the Z-Uno is used to monitor events (pulses) generated by an external device. During a pulse the signal voltage is dropped from 5V to 0V for a few micro seconds. If the signal is connected to the the serial input the pulse generates a start bit; the UART registers a byte.
There are about 30-200 pulses generated per minute. And the input buffer is read multiple times per second. So there should be no overflow. However the number of detected pulses (= registered input data bytes) is different between revision 2.0.7 and 2.0.8.
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-UNO UART at 115200bps

Post by p0lyg0n1 »

In this case I need a sample of your code.
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-UNO UART at 115200bps

Post by droll »

I tried to create a simplified example using the USB attached serial interface, however without any success for the moment. Either the USB attached serial interface behave different than the serial interface 0 and 1, or it is something with my application that is wrong. I need to investigate further ...

One thing I found however is that the input buffer seems be only 16 bytes, which is substantially smaller than the 64 bytes indicated above by "p0lyg0n1". This can be demonstrated with the following program:

Code: Select all

void setup() {
	Serial.begin(115200);
}

void loop() {
	while (Serial.available()) {
		int inByte = Serial.read();
		Serial.print(char(inByte));
	}
	Serial.flush();
	delay(100);
}
Just open the serial monitor of the Arduino IDE and enter character strings. These strings are immediately returned by the program. If a 15 character string is entered all characters are returned. If a 16 character string is entered nothing is returned. And for a 17 character string one character is returned. I conclude that the serial buffer has therefor only 16 bytes.

Concerning the missing received bytes I will dig deeper into this issue ...
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-UNO UART at 115200bps

Post by p0lyg0n1 »

Don't do it with USB;) At this moment only Serial0/Serial1 use DMA for input.
Post Reply