Click here to Skip to main content
15,354,434 members
Home / Discussions / C#
   

C#

 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Member 1549617517-Jan-22 4:04
MemberMember 1549617517-Jan-22 4:04 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Luc Pattyn17-Jan-22 4:16
sitebuilderLuc Pattyn17-Jan-22 4:16 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Sanjay Siwach17-Jan-22 4:46
MemberSanjay Siwach17-Jan-22 4:46 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Luc Pattyn17-Jan-22 5:02
sitebuilderLuc Pattyn17-Jan-22 5:02 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Sanjay Siwach17-Jan-22 5:15
MemberSanjay Siwach17-Jan-22 5:15 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Sanjay Siwach17-Jan-22 5:23
MemberSanjay Siwach17-Jan-22 5:23 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Sanjay Siwach17-Jan-22 9:46
MemberSanjay Siwach17-Jan-22 9:46 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Luc Pattyn17-Jan-22 11:40
sitebuilderLuc Pattyn17-Jan-22 11:40 
Hi,

there is one positive aspect on your last message: it tells us how the LRC is calculated, as an EXOR, biased by 0xAA. That seems reasonable. This info being copy-pasted keeps me suspicious though. I'd rather see a real document, or see a single command (ANY command) getting accepted...

there are many negative aspects: it is not really a specification, there hardly is any text; it is just two examples, the second even incomplete (no LRC value).

And then there is a major problem (which I already mentioned earlier): the version example cannot possibly be correct, I can't explain its length (NUM field) AND now its checksum also seems incorrect.

I wrote a program that takes such a string, converts it to all bytes, then checks length and checksum. I tried with the string given in the example, and with a number of variations thereof (amending the response trying to get a matching length and a matching LRC), and nothing matches. Here is what I obtained:

program_output
versionResponse (from example)
input = %R 0x0C 0x01 UHD-4K 02.10.09 0xC2
bytes =  25 52 0C 01 55 48 44 2D 34 4B 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad NUM; got 12 while expecting 16
Bad LRC; got C2 while expecting D1
--------------------------------------------------------------------------------
versionResponse, length fixed
input = %R 0x10 0x01 UHD-4K 02.10.09 0xC2
bytes =  25 52 10 01 55 48 44 2D 34 4B 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad LRC; got C2 while expecting CD
--------------------------------------------------------------------------------
versionResponse, length fixed+space added
input = %R 0x11 0x01 UHD-4K # 02.10.09 0xC2
bytes =  25 52 11 01 55 48 44 2D 34 4B 20 30 32 2E 31 30 2E 30 39 C2
Found error(s):
Bad LRC; got C2 while expecting EC
--------------------------------------------------------------------------------
versionResponse, hex in version numbers
input = %R 0x0C 0x01 UHD-4K 0x02.0x10.0x09 0xC2
bytes =  25 52 0C 01 55 48 44 2D 34 4B 02 2E 10 2E 09 C2
Found error(s):
Bad NUM; got 12 while expecting 13
Bad LRC; got C2 while expecting C0
--------------------------------------------------------------------------------
versionResponse, hex in version numbers, space added
input = %R 0x0C 0x01 UHD-4K # 0x02.0x10.0x09 0xC2
bytes =  25 52 0C 01 55 48 44 2D 34 4B 20 02 2E 10 2E 09 C2
Found error(s):
Bad NUM; got 12 while expecting 14
Bad LRC; got C2 while expecting E0
--------------------------------------------------------------------------------
versionResponse, hex in version numbers, periods removed
input = %R 0x0C 0x01 UHD-4K # 0x02 0x10 0x09 0xC2
bytes =  25 52 0C 01 55 48 44 2D 34 4B 20 02 10 09 C2
Found error(s):
Bad LRC; got C2 while expecting E0


NB: I am ignoring all spaces in the input string as they were present around hex bytes; however I defined the # sign to represent an actual space, so I was able to force one in the version string, but that did not help.

It is up to you now, the limited information you provided is inconsistent; there is nothing more I can do.

PS: about your statement "I receive what I transmit" (if I understood you correctly). Maybe the device echoes all commands it refuses because they are invalid, e.g. because the checksum still is not what you think it should be. There is a way to make sure: create a program that sends a command with checksum value X=0, wait 1 second, read the result; increment X and repeat until you don't get an echo. If and when that happens, you might have the correct checksum (maybe it is as simple as bias isn't 0xAA but some other constant).
Luc Pattyn [My Articles]
The Windows 11 "taskbar" is disgusting. It should be at the left of the screen, with real icons, with text, progress, etc. They downgraded my developer PC to a bloody iPhone.

GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Member 1549617517-Jan-22 21:51
MemberMember 1549617517-Jan-22 21:51 
GeneralRe: Serial communication between LPC2132 microcontroller and serial interface PC through RS 232 and RJ45 Pin
Luc Pattyn18-Jan-22 2:29
sitebuilderLuc Pattyn18-Jan-22 2:29 
QuestionEasy way programmatically select step by step button. Pin
Member 154938239-Jan-22 2:20
MemberMember 154938239-Jan-22 2:20 
AnswerRe: Easy way programmatically select step by step button. Pin
OriginalGriff9-Jan-22 2:24
mveOriginalGriff9-Jan-22 2:24 
GeneralRe: Easy way programmatically select step by step button. Pin
Member 154938239-Jan-22 2:37
MemberMember 154938239-Jan-22 2:37 
GeneralRe: Easy way programmatically select step by step button. Pin
OriginalGriff9-Jan-22 3:09
mveOriginalGriff9-Jan-22 3:09 
AnswerRe: Easy way programmatically select step by step button. Pin
#realJSOP9-Jan-22 3:15
mva#realJSOP9-Jan-22 3:15 
AnswerRe: Easy way programmatically select step by step button. Pin
Gerry Schmitz9-Jan-22 7:17
mveGerry Schmitz9-Jan-22 7:17 
GeneralRe: Easy way programmatically select step by step button. Pin
OriginalGriff9-Jan-22 9:38
mveOriginalGriff9-Jan-22 9:38 
GeneralRe: Easy way programmatically select step by step button. Pin
Gerry Schmitz9-Jan-22 21:11
mveGerry Schmitz9-Jan-22 21:11 
GeneralRe: Easy way programmatically select step by step button. Pin
OriginalGriff9-Jan-22 21:18
mveOriginalGriff9-Jan-22 21:18 
JokeRe: Easy way programmatically select step by step button. Pin
Richard Deeming9-Jan-22 21:30
mveRichard Deeming9-Jan-22 21:30 
GeneralRe: Easy way programmatically select step by step button. Pin
OriginalGriff9-Jan-22 21:58
mveOriginalGriff9-Jan-22 21:58 
Questionbind a gridview and a listbox to a database Pin
steven_noppe5-Jan-22 2:03
Membersteven_noppe5-Jan-22 2:03 
AnswerRe: bind a gridview and a listbox to a database Pin
Gerry Schmitz5-Jan-22 5:26
mveGerry Schmitz5-Jan-22 5:26 
AnswerRe: bind a gridview and a listbox to a database Pin
RobertSF7-Jan-22 10:47
professionalRobertSF7-Jan-22 10:47 
GeneralRe: bind a gridview and a listbox to a database Pin
steven_noppe11-Jan-22 22:31
Membersteven_noppe11-Jan-22 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.