|
|
View previous topic :: View next topic |
Author |
Message |
labviewman
Joined: 05 Dec 2011 Posts: 11
|
dsPIC33 only sends ID of 0x00 on CAN2 when using ext frame |
Posted: Tue Aug 05, 2014 8:00 am |
|
|
Is there an issue with the CCS compiler being able to correctly compile code to send CAN messages on CAN2 ? I have code that is pretty simple and uses both CAN ports and has identical function calls except CAN2 uses functions for CAN2, but I only get arbID 0x00 on CAN 2 for extended frames....seems to work OK with standard ID (at least with compiler version 4.125).
I just upgraded to the latest compiler version (5.026) yesterday (8/4/2014) in the hopes it would work, but it didn't.
Here is the CAN related code (uC is a 33FJ64GP706A):
Code: |
// high-speed CAN, 125 Kbit/sec
//use 1/2 of the clock frequency on MBTime with a dsPIC33
#define CAN_BRG_PRESCALAR 0
#define CAN_BRG_SYNCH_JUMP_WIDTH 0
#define CAN_BRG_PROPAGATION_TIME 2
#define CAN_BRG_PHASE_SEGMENT_1 7
#define CAN_BRG_SAM 0
#define CAN_BRG_SEG_2_PHASE_TS 1
#define CAN_BRG_PHASE_SEGMENT_2 7
#define CAN_BRG_WAKE_FILTER 0
//cluster CAN bus, single wire, 33.333 Kbps
//use 1/2 of the clock frequency on MBTime with a dsPIC33
#define CAN2_BRG_PRESCALAR 2
#define CAN2_BRG_SYNCH_JUMP_WIDTH 0
#define CAN2_BRG_PROPAGATION_TIME 7
#define CAN2_BRG_PHASE_SEGMENT_1 7
#define CAN2_BRG_SAM 0
#define CAN2_BRG_SEG_2_PHASE_TS 1
#define CAN2_BRG_PHASE_SEGMENT_2 7
#define CAN2_BRG_WAKE_FILTER 0
#define CAN_USE_EXTENDED_ID TRUE
//////////
can_init();
can2_init();
can_set_mode(CAN_OP_CONFIG); //must be in config mode before params can be set
can_enable_b_transfer(0); //buffers used for tx
can_enable_b_transfer(1);
can_enable_b_transfer(2);
can_enable_b_transfer(3);
can_enable_b_transfer(4);
can_enable_b_transfer(5);
can_enable_b_transfer(6);
can_enable_b_transfer(7);
can_set_mode(CAN_OP_NORMAL);
can2_set_mode(CAN_OP_CONFIG); //must be in config mode before params can be set
can2_enable_b_transfer(0); //buffers used for tx
can2_enable_b_transfer(1);
can2_enable_b_transfer(2);
can2_set_mode(CAN_OP_NORMAL);
while(true)
{
can2_putd(0x24c, &data, 8, 3, TRUE, FALSE);
can_putd(0x24c, &data, 8, 3, TRUE, FALSE);
can2_putd(0x24c, &data2, 8, 3, TRUE, FALSE);
can_putd(0x24c, &data2, 8, 3, TRUE, FALSE);
delay_ms(1000);
}
|
What gives? Why do I only get ArbID on CAN2 ???? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
labviewman
Joined: 05 Dec 2011 Posts: 11
|
|
Posted: Tue Aug 05, 2014 6:06 pm |
|
|
Interesting posts...pretty frustrating MicroChip has so many issues, but I read the errata for this micro (33FJ64GP706A) but didn't see anything on ECAN that applied to my observation.
CCS tried the code on a PIC24HJ256GP610 which worked perfectly, so I suspect it's a feature of my micro...strange it's not in the errata. I guess I will end up cutting traces and wire the bus to CAN1 which works fine |
|
|
labviewman
Joined: 05 Dec 2011 Posts: 11
|
|
Posted: Tue Aug 12, 2014 9:39 am |
|
|
Must have been a problem with the CANoe configuration I was using....tested again with CANalyzer and it worked perfectly....weird |
|
|
|
|
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
|