-->
Page 2 of 4

Re: Serial byte output prints two bytes after it reaches 0x7

PostPosted: Wed Jan 04, 2017 11:23 am
by SwiCago
Could the issue be signed vs unsigned?
Found this online, where someone had a similar issue.
Code: Select all    byte unsignedByte( int val ) { return (byte)( val > 127 ? val - 256 : val ); }

Might give it a go and see if that fixes the issue.

Re: Serial byte output prints two bytes after it reaches 0x7

PostPosted: Wed Jan 04, 2017 11:31 am
by martinayotte
Could be on the Putty side, but not on ESP side otherwise my python script would have shown the issue.
I'm not using Putty, but how the capture is been done ?
What is interesting is the fact that the capture shows 2 bytes for each one received.

Re: Serial byte output prints two bytes after it reaches 0x7

PostPosted: Wed Jan 04, 2017 11:33 am
by DAFlippers
Also note that you are not seeing 00 either. Your sequence is going 7F C280 ... C2BF C380... C3BF which is strange.

David

Re: Serial byte output prints two bytes after it reaches 0x7

PostPosted: Wed Jan 04, 2017 11:37 am
by SwiCago
martinayotte wrote:Could be on the Putty side, but not on ESP side otherwise my python script would have shown the issue.
I'm not using Putty, but how the capture is been done ?
What is interesting is the fact that the capture shows 2 bytes for each one received.

I will look at this again. STrange that my YUN did not show this issue, nor the original device it is simulating. The output of the ESP should match the original device, but if the bytes above 7F are being mangles on esp-01, then it will never work. I do have an oscilloscope that can do serial analyzation, just didn't feel like hooking it up.


DAFlippers wrote:Also note that you are not seeing 00 either. Your sequence is going 7F C280 ... C2BF C380... C3BF which is strange.

David


It doesn't show 0x00, because that dump was done when I did
Serial.write(i);
and not
Serial.write((uint8_t) i);
which is from what I read has to be done in order to get 0x00 to print.