View previous topic :: View next topic |
Author |
Message |
sergio1234
Joined: 06 Jan 2006 Posts: 17 Location: Argentina
|
ECAN Interrupts w PCWH |
Posted: Thu Jan 19, 2006 5:17 pm |
|
|
We are working with the pcwh v3.241 and the CCS's CAN Bus development Kit
We are developing CAN applications w/ PIC 18f2580/18f4580 family w/ECAN modules (enhanced CAN)
We don't find any information, neither any driver, neither any header file to be able to use interrupts from ECAN in mode 1 and mode 2 w/CCS compiler (only mode 0)
do anybody have some example to work with ECAN interrupts in mode 1 and mode 2?
Thanks for your help
Sergio (from Argentina) |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Wed Jan 25, 2006 2:24 pm |
|
|
Greetings,
If I remember correctly, the other modes available with the ECAN version are enhanced legacy w/ device net and FIFO mode. There are no functions/methods provided in the CCS CAN library to enable these modes. You must manually setup the registers. The best source of information is the data sheet. The available interrupts are listed as well as what registers to set. Setting up test code for the interrupts are straightforward (see any example using INT_RDA, etc; #INT_CANRX0 basic interrupt on frame received). The interrupts are defined in the device header file (18f4580.h). The data sheet defines each interrupt (the header file only lists them). I have only used the legacy mode with the 18f4585 (same ECAN module). If the legacy mode works correctly, it should not take much experimentation to get either of the two other modes to work.
Cheers |
|
|
sergio1234
Joined: 06 Jan 2006 Posts: 17 Location: Argentina
|
|
Posted: Mon Jan 30, 2006 9:56 am |
|
|
Hi JMA
Thanks for your answer
In the last versions of the PCWH, CCS has functions to work in the two extended mode of the ECAN module (can-18f4580.c & can-18f4580.h)
For example:
can_set_functional_mode for Set the 3 modes (0, 1 & 2)
can_enable_b_receiver - enables buffer as receiver
below I detail all the functions of this driver
Regrettably, I didn't find anything, on the CCS's documentation, that tells me how to enable and work (with CCS's PCWH) with the ECAN new sources of interruption in mode 1 and 2
Sergio
Here the description of CAN-18F4580.c driver
/////////////////////////////////////////////////////////////////////////
//// can-18F4580.c ////
//// CAN Library routines for Microchip's PIC18Cxx8 and 18Fxx8 line ////
//// ////
//// This library provides the following functions: ////
//// (for more information on these functions see the comment ////
//// header above each function) ////
//// ////
//// can_init - Configures the PIC18F4580 CAN peripheral* ////
//// ////
//// can_set_baud - Sets the baud rate control registers* ////
//// ////
//// can_set_mode - Sets the CAN module into a specific mode* ////
//// ////
//// can_set_functional_mode - Sets the function mode ////
//// ////
//// can_set_id - Sets the standard and extended ID* ////
//// ////
//// can_set_extended_id - Sets only extended ID ////
//// ////
//// can_set_standard_id - Sets only standard ID ////
//// ////
//// can_get_id - Gets the standard and extended ID* ////
//// ////
//// can_get_extended_id - Gets only extended ID ////
//// ////
//// can_get_standard_id - Gets only standard ID ////
//// ////
//// can_putd - Sends a message/request with specified ID* ////
//// ////
//// can_getd - Returns specifid message/request and ID* ////
//// ////
//// can_kbhit - Returns true if there is data in one of the* ////
//// receive buffers ////
//// ////
//// can_tbe - Returns true if the transmit buffer is ready to ////
//// send more data* ////
//// ////
//// can_abort - Aborts all pending transmissions* ////
//// ////
//// can_enable_b_transfer - enables buffer as transmitter ////
//// ////
//// can_enable_b_receiver - enables buffer as receiver ////
//// ////
//// can_enable_rtr - enables transmit buffer as Auto-rtr ////
//// ////
//// can_disable_rtr - disables transmit buffer as Auto-rtr ////
//// ////
//// can_load_rtr - loads an Auto-rtr buffer with data ////
//// ////
//// can_enable_filter - enables one of 15 filters ////
//// ////
//// can_disable_filter - disables one of the 15 filters ////
//// ////
//// can_associate_filter_to_buffer - associates a filter with ////
//// a receive buffer ////
//// ////
//// can_associate_filter_to_mask - associates a filter with a ////
//// mask ////
//// ////
//// can_fifo_getd - retrive data in FIFO mode (2) ////
//// ////
//// can_t0_putd ////
//// can_t1_putd ////
//// can_t2_putd ////
//// can_b0_putd ////
//// can_b1_putd ////
//// can_b2_putd ////
//// can_b3_putd ////
//// can_b4_putd ////
//// can_b5_putd ////
//// can_b6_putd ////
//// can_b7_putd - place data in a specific buffer ////
//// ////
//// PIN_B3 is CANRX, and PIN_B2 is CANTX. You will need a CAN ////
//// transeiver to connect these pins to CANH and CANL bus lines. ////
//// ////
//// CCS provides an example, ex_can.c, which shows how to use this ////
//// library. ////
//// ////
//// * Designates functions that work in legacy mode ////
//// ////
///////////////////////////////////////////////////////////////////////// |
|
|
|