I don't get any response via lazserial1.ReadDataI thought that LazSerial is event based, and that you should check for data in OnRxData? I do not use LazSerial so take this with a grain of salt. If you want direct synchronous control (nice for use in communication threads), then you should check out https://wiki.freepascal.org/Synapse.
If there is someone who understands the subject and can give me a hand, I would appreciate it.I do understand the topic (implemented SocketCAN with freepascal) but you do not give much info. Anyway, you should check for 2 things. First is to use simple terminal and see if you get expected response when you send manual commands. Second is to check if you use both Arduino IDE monitoring and your Lazarus app at the same time on the same port. If that is the case, kill Arduino IDE and try again.
I thought that LazSerial is event based, and that you should check for data in OnRxData?Although I take the data from the RxData event the error and the problem remains the same.I understand that just one line in the event avoids many of the lines seen in the code I shared... but if I want to take the value of a response frame... I find it easier to handle the .ReadData this way...
then you should check out https://wiki.freepascal.org/Synapse.I'll give this a review...
I do understand the topic (implemented SocketCAN with freepascal) but you do not give much info.When I say someone who understands the subject, I mean the subject I am working on and with the tools I am working on... I am aware that there are many other ways of working on this... as there are also those who like to work with sockets and those without.
First is to use simple terminal and see if you get expected response when you send manual commands.For that I use Stnterm and everything is perfect.
Second is to check if you use both Arduino IDE monitoring and your Lazarus app at the same time on the same port. If that is the case, kill Arduino IDE and try again.The monitoring of the communication with an external tool between my software that uses the obdlink and the fiat cluster is correct as shown above... I just can't get the response frame to read Lazserial.ReadData
I have the Obdlink configured with the "ATSPC" protocol, which is the one that corresponds to the protocol that I am using USER2 CAN ID 11 bits, 50 kbaud.Can you verify that Lazserial is working at 50 kbaud? This is not a standard baud, and afaics Lazserial only supports standard baud rates.
8<-----
It is as if the STN1100 or the serial component had some configuration that I am missing in order to receive the frames through the Lazserial serial component.
If I understood you well and you're trying to use asynchrnous component as simple synchronous lib, then it might be the reason for the unexpected behaviour. That's why I suggested Synaser from Synapse lib, which is much more suitable for such use (very simple example can be found at https://wiki.freepascal.org/Arduino#Minimal_Lazarus_Synaser_serial_example).QuoteI thought that LazSerial is event based, and that you should check for data in OnRxData?Although I take the data from the RxData event the error and the problem remains the same.I understand that just one line in the event avoids many of the lines seen in the code I shared... but if I want to take the value of a response frame... I find it easier to handle the .ReadData this way...
The truth is that what I am doing is not a complicated application and it does quite simple things, I already have the same thing working perfectly in other protocols. It is this protocol that is giving me work and makes me think that I may be missing some additional configuration and it is being overlooked.It seams that you are just starting with serial communication in FPC/LAZ, and you don't know yet where the problem is and what is it that you're doing wrong. If I was in your place, besides following forum suggestions, I would first decide if I need async or sync lib (I prefer separate communication threads so my choice is always sync lib like SynaSer), write the simplest 2-way communication test app using virtual serial ports (or 2 computers) where 2 instances of my app are both senders and receivers, and then play until all the basics are conquered.
Good, then you know that everything works and that just FPC/LAZ side is bugging you.QuoteFirst is to use simple terminal and see if you get expected response when you send manual commands.For that I use Stnterm and everything is perfect.
50 kbaud is the speed on CAN side of the adapter, which is quite different from the serial side of the adapter and is not related since commands from serial terminal already work without problems. OP probably has some serial commands or gui settings which select the desired CAN speed of the adapter.I have the Obdlink configured with the "ATSPC" protocol, which is the one that corresponds to the protocol that I am using USER2 CAN ID 11 bits, 50 kbaud.Can you verify that Lazserial is working at 50 kbaud? This is not a standard baud, and afaics Lazserial only supports standard baud rates.
8<-----
It is as if the STN1100 or the serial component had some configuration that I am missing in order to receive the frames through the Lazserial serial component.