mc-Things
mc-Products => mc-Module => Topic started by: kristofferis on July 06, 2016, 12:25:41 pm
-
I am testing some simple Uart.write
This is what I want to send
t1.txt="Hello" but I also need to add 0xFF 0xFF 0xFF at the end.
So this is what I did
Dim test As String
test = "t1.txt=\x22Hello\x22"
serial.Write(test)
serial.Write(0xff)
serial.Write(0xff)
serial.Write(0xff)
But every time I run this code the device freezes and i receive the error message "Can't read the data from the device."
I debugged it and the problem seems to be right after doing the first Write.
I tested it also like this
serial.Write(0x74)
serial.Write(0x31)
serial.Write(0x2e)
serial.Write(0x74)
serial.Write(0x78)
serial.Write(0x74)
serial.Write(0x3d)
serial.Write(0x22)
serial.Write(0x48)
serial.Write(0x65)
serial.Write(0x6c)
serial.Write(0x6c)
serial.Write(0x6f)
serial.Write(0x22)
serial.Write(0xff)
serial.Write(0xff)
serial.Write(0xff)
But same thing happens with same error message as above.
I am using the latest version of all software/firmware
-
I have been able to reproduce this problem. I will get to the bottom of it and let you know.
-
Thanks Abe.
It's good that you could reproduce it, that makes the troubleshooting so much easier.
-
We have tracked this issue and has been resolved. You will have a solution in the next version of mcStudio. Meanwhile if you can create a string like so "\xFF\xFF\xFF" and use that instead of individual bytes, you should be able to work around this issue.
The problem is specifically in the byte write overload. The string write works fine.
-
Ahh great work and fast as usual.
Thanks for the workaround :)
-
I have tried the workaround and also now with the new version writing byte but there seems to be problem with the 0xff
It's like the receiving part does not get that byte and if I send 0xff to mcModule it does not receive it, or at least it does not show in the Read function.
This is what i tried to send to mcModule
0x65 0x00 0x08 0x01 0xff 0xff 0xff
but i only received
0x65 0x00 0x08 0x01
-
This is a bug will be fixed on the next release. 0xFF gets incorrectly interpreted as -1 which is an error code. If you use anything but 0xFF it should work though.
-
Great that this will be solved, yes it seems that every thing else is working but in my case I need to send three 0xFF to notify the receiving part that my command is done.
So I have to wait for the fix :)
-
I have now verified that the new version solved this issue.
I could now both read and write to Uart
-
Thanks for working this one through. I purchased one of those touchscreens you are using and I can see that this issue is related. The touch screen looks really good.
-
Ahh nice, yeah now it's possible to both send and receive commands from the touchscreen.
I have a module that updates the screen every minute and it has been running all night.