|
|
View previous topic :: View next topic |
Author |
Message |
dhia_fishingman
Joined: 24 Aug 2012 Posts: 4
|
Establish communication LIN |
Posted: Fri Aug 24, 2012 2:39 pm |
|
|
I am trying to develop a code of communication with a card via the LIN bus. I use a card development EasyPIC V7 with a PIC 18F45K22. I tried several methods of communication based on the examples given with the compiler version 4.108. I have a lot of problem with the PIC using the compiler especially RS232. I want to know if there is a code that allows me to communicate via the LIN bus (which is tested functional with 18F45K22) and if there is a method to determine whether the communication is established between the target board and the PIC. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sat Aug 25, 2012 2:48 am |
|
|
Quote: | I have a lot of problem with the PIC using the compiler especially RS232. |
Have you got your PIC to communicate with a PC via RS232?
(You can use the CCS supplied code EX_STR.C for this)
Quote: | and if there is a method to determine whether the communication is established between the target board and the PIC. |
Since LIN is a one wire bus you may be able to tap into it and see ALL the signal traffic on a PC.
Mike
EDIT If you are using RC oscillators, you may have to capture your signals with a 'scope, then send to a PC for analysis.
CCS supplies master and slave LINbus code which SHOULD work. If it does not, complain to CCS. |
|
|
dhia_fishingman
Joined: 24 Aug 2012 Posts: 4
|
|
Posted: Fri Aug 31, 2012 2:00 pm |
|
|
Hi,
I tested the example code of RS232 (ex_RS232_485) and it does not work with my board. i tested the function bkbhit and it have a problem. But if i test another compiler (MikroC) the board works fine.
Did someone test the code Ex_LINBUS_Master with the PIC 18F45K22?
My project is to communicate with a card that integrates the bus LIN (transceiver TJA1028). So I bought a development board that integrates the 18F45K22 and MCP2021 transceiver. 18F45K22 sends the data via RS232 and MCP2021 is connected directly with the card (TJA1028).
The constructor of the target board has given me information communications described in the attached file. Is that you can tell me how I should proceed (eg frame I have sent via RS232, ...)
Thank you for helping me because this project is very important and I am very pressing.
Many Thanks
Code: | LIN_description_file ;
LIN_protocol_version = "2.0" ;
LIN_language_version = "2.0" ;
LIN_speed = 19.000 kbps ;
Nodes {
Master:INV,5.0000 ms,0.0000 ms ;
Slaves:DCDC;
}
Signals {
POWER_ON_OFF_DCDC:2,0x0,INV,DCDC;
RSTDRI_DCDC:1,0x0,INV,DCDC;
LVDC_Setpoint_Request:7,0x1E,INV,DCDC;
Speed_Presence:1,0x0,INV,DCDC;
MES_LV_DCDC:8,0xFF,DCDC,INV;
MES_I_DCDC:8,0xFF,DCDC,INV;
TEMP_SMI_DCDC:8,0xFF,DCDC,INV;
TEMP_COM_DCDC:8,0xFF,DCDC,INV;
MES_I_IN_DCDC:8,0xFF,DCDC,INV;
MaxCurrentAvailable:8,0xFF,DCDC,INV;
MES_HV_DCDC:10,0x3FF,DCDC,INV;
DCDC_Response_Error:1,0x0,DCDC,INV;
AUTODIAG_INFO:1,0x0,DCDC,INV;
Autodiag_Flt:1,0x0,DCDC,INV;
DCDC_STATE:1,0x0,DCDC,INV;
DCDC_DIAG_1:16,0x00,DCDC,INV;
DCDC_DIAG_2:8,0x00,DCDC,INV;
DCDC_DIAG_3:8,0x00,DCDC,INV;
DCDC_DIAG_4:16,0x00,DCDC,INV;
DCDC_DIAG_5:8,0x00,DCDC,INV;
}
Diagnostic_signals {
MasterReqB0:8,0;
MasterReqB1:8,0;
MasterReqB2:8,0;
MasterReqB3:8,0;
MasterReqB4:8,0;
MasterReqB5:8,0;
MasterReqB6:8,0;
MasterReqB7:8,0;
SlaveRespB0:8,0;
SlaveRespB1:8,0;
SlaveRespB2:8,0;
SlaveRespB3:8,0;
SlaveRespB4:8,0;
SlaveRespB5:8,0;
SlaveRespB6:8,0;
SlaveRespB7:8,0;
}
Frames {
INV_LINPEC_R_01:0x1B,INV,8{
POWER_ON_OFF_DCDC,0;
RSTDRI_DCDC,2;
LVDC_Setpoint_Request,3;
Speed_Presence,10;
}
DCDC_LINPEC_R_01:0x1C,DCDC,8{
MES_LV_DCDC,0;
MES_I_DCDC,8;
TEMP_SMI_DCDC,16;
TEMP_COM_DCDC,24;
MES_I_IN_DCDC,32;
MaxCurrentAvailable,40;
MES_HV_DCDC,48;
DCDC_Response_Error,58;
}
DCDC_LINPEC_R_02:0x20,DCDC,8{
AUTODIAG_INFO,0;
Autodiag_Flt,1;
DCDC_STATE,2;
DCDC_DIAG_1,8;
DCDC_DIAG_2,24;
DCDC_DIAG_3,32;
DCDC_DIAG_4,40;
DCDC_DIAG_5,56;
}
}
Diagnostic_frames {
MasterReq : 60 {
MasterReqB0,0;
MasterReqB1,8;
MasterReqB2,16;
MasterReqB3,24;
MasterReqB4,32;
MasterReqB5,40;
MasterReqB6,48;
MasterReqB7,56;
}
SlaveResp : 61 {
SlaveRespB0,0;
SlaveRespB1,8;
SlaveRespB2,16;
SlaveRespB3,24;
SlaveRespB4,32;
SlaveRespB5,40;
SlaveRespB6,48;
SlaveRespB7,56;
}
}
Schedule_tables {
NormalSession {
INV_LINPEC_R_01 delay 10.0000 ms ;
DCDC_LINPEC_R_01 delay 10.0000 ms ;
DCDC_LINPEC_R_02 delay 80.0000 ms ;
}
}
Signal_encoding_types {
POWER_ON_OFF_DCDC_type {
logical_value,0x00,"unavailable value" ;
logical_value,0x01,"Power_off" ;
logical_value,0x02,"Power_on" ;
logical_value,0x03,"not used" ;
}
RSTDRI_DCDC_type {
logical_value,0x00,"no reset" ;
logical_value,0x01,"reset" ;
}
LVDC_Setpoint_Request_type {
logical_value,0x1E,"unavailable" ;
physical_value,0,80,0.0500,12.0000,"V" ;
}
Speed_Presence_type {
logical_value,0x00,"Null Speed" ;
logical_value,0x01,"Speed present" ;
}
MES_LV_DCDC_type {
physical_value,0,160,0.1000,4.0000,"V" ;
logical_value,0xFF,"unavailable" ;
}
MES_I_DCDC_type {
physical_value,0,254,1.0000,0.0000,"A" ;
logical_value,0xFF,"unavailable" ;
}
TEMP_SMI_DCDC_type {
physical_value,0,240,1.0000,-40.0000,"°C" ;
logical_value,0xFF,"unavailable" ;
}
TEMP_COM_DCDC_type {
physical_value,0,240,1.0000,-40.0000,"°C" ;
logical_value,0xFF,"unavailable" ;
}
MES_I_IN_DCDC_type {
physical_value,0,254,1.0000,0.0000,"A" ;
logical_value,0xFF,"unavailable" ;
}
MaxCurrentAvailable_type {
physical_value,0,254,1.0000,0.0000,"A" ;
logical_value,0xFF,"unavailable" ;
}
MES_HV_DCDC_type {
physical_value,0,1000,0.5000,0.0000,"V" ;
logical_value,0x3FF,"unavailable" ;
}
DCDC_Response_Error_type {
logical_value,0x00,"no error" ;
logical_value,0x01,"error" ;
}
AUTODIAG_INFO_type {
logical_value,0x00,"Autoset non effectue" ;
logical_value,0x01,"Autoset effectue" ;
}
Autodiag_Flt_type {
logical_value,0x00,"No Autodiag Fault" ;
logical_value,0x01,"Autodiag Fault present" ;
}
DCDC_STATE_type {
logical_value,0x00,"dcdc off" ;
logical_value,0x01,"dcdc on" ;
}
DCDC_DIAG_1_type {
logical_value,0x00,"unavailable" ;
physical_value,0,65535,1.0000,0.0000 ;
}
DCDC_DIAG_2_type {
logical_value,0x00,"unavailable" ;
physical_value,0,255,1.0000,0.0000 ;
}
DCDC_DIAG_3_type {
logical_value,0x00,"unavailable" ;
physical_value,0,255,1.0000,0.0000 ;
}
DCDC_DIAG_4_type {
logical_value,0x00,"unavailable" ;
physical_value,0,65535,1.0000,0.0000 ;
}
DCDC_DIAG_5_type {
logical_value,0x00,"unavailable" ;
physical_value,0,255,1.0000,0.0000 ;
}
}
Signal_representation {
POWER_ON_OFF_DCDC_type:POWER_ON_OFF_DCDC;
RSTDRI_DCDC_type:RSTDRI_DCDC;
LVDC_Setpoint_Request_type:LVDC_Setpoint_Request;
Speed_Presence_type:Speed_Presence;
MES_LV_DCDC_type:MES_LV_DCDC;
MES_I_DCDC_type:MES_I_DCDC;
TEMP_SMI_DCDC_type:TEMP_SMI_DCDC;
TEMP_COM_DCDC_type:TEMP_COM_DCDC;
MES_I_IN_DCDC_type:MES_I_IN_DCDC;
MaxCurrentAvailable_type:MaxCurrentAvailable;
MES_HV_DCDC_type:MES_HV_DCDC;
DCDC_Response_Error_type:DCDC_Response_Error;
AUTODIAG_INFO_type:AUTODIAG_INFO;
Autodiag_Flt_type:Autodiag_Flt;
DCDC_STATE_type:DCDC_STATE;
DCDC_DIAG_1_type:DCDC_DIAG_1;
DCDC_DIAG_2_type:DCDC_DIAG_2;
DCDC_DIAG_3_type:DCDC_DIAG_3;
DCDC_DIAG_4_type:DCDC_DIAG_4;
DCDC_DIAG_5_type:DCDC_DIAG_5;
}
|
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Fri Aug 31, 2012 2:20 pm |
|
|
Work on the KISS principal.
If your board doesn't work with a simple RS232 link then LIN won't work.
Get the basics to work first, then proceed.
I use custom built boards all the time with few problems.
If RS232 on your board (with your chosen chip) does not work with CCS but does with another compiler, then complain to CCS
Mike |
|
|
dhia_fishingman
Joined: 24 Aug 2012 Posts: 4
|
|
Posted: Sun Sep 02, 2012 5:04 am |
|
|
Hi,
I have noticed that the CCS compiler with version 4.108 has a problem with the 18F45K22. Against, what interests me most is to know if the compiler integrates a good library for LIN. If the compiler has a good library which is tested functional I can change the PIC with which I work. Otherwise is what you advise me another way to react.
Thanks |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|