XE167FH MultiCAN problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10003
Level 1
Level 1
It's first time I use the XE167FH MCU. I'm evaluating XE167FH kit.

The first thing I did was using DAVE. I initialized CAN0 at pins P2.6 and P2.5. Tried sending extended frames at 1 Mbps and it worked fine.
Figure below shows pulses on Tx pin.
1336.attach


My next step was to remap CAN0 pins to P11.0 and P11.1. I kept MO settings the same as first time.
I changed 2 lines:
P2_IOCR05 = 0x00A0; ----> P11_IOCR01 = 0x00A0;
CAN_NPCR0 = 0x0003; ----> CAN_NPCR0 = 0x0005;

Now CAN doesn't send any data. At the same time I observe this on Tx pin:
1335.attach

One more thing. If I configure BOTH P2.5 and P11.1 to be can transmitting pin, they both provide valid CAN Tx signals as on the first figure.
What am I doing wrong? Is there any thing else I should configure to swap CAN pins?

Thanks.
0 Likes
7 Replies
Not applicable
What am I doing wrong? Is there any thing else I should configure to swap CAN pins?

All attempts to modify them are
ignored.if not used the (SET mask 0x40) see the bitpos ....
CCE Bit 6 rw "Configuration Change Enable bit" in the NCRx Register.
Can you post the part of the code ?
Greetings Holger.
See Node x Control Register.
0 Likes
User10003
Level 1
Level 1
That's the initialization. It seems to be fine with NCR0 mask 0x0040.

void CAN_vInit(void)
{
MCAN_KSCCFG = 0x0003; // load Kernel State Configuration Register Âêëþ÷àåì can ìîäóëü
_nop_(); // one cycle delay
_nop_(); // one cycle delay
/// - the CAN module clock = 40,00 MHz
CAN_FDRL = 0x43FF; // load Fractional Divider Register
while(CAN_PANCTRL & CAN_PANCTR_BUSY){ }; //// êîìàíäà ðàáîòû ñî ñïèñêîì âûïîëíåíà

CAN_NCR0 = 0x0041; // ïðåðûâàíèÿ ðàçðåøåíû

// P11_IOCR01 = 0x00A0; //TXD = P11.1
// CAN_NPCR0 = 0x0005; // RXD = P11.0

P2_IOCR05 = 0x00A0; //set direction register
CAN_NPCR0 = 0x0003; // load node0 port control register

CAN_NBTR0L = 0x2F41; // 1 ÌÃö

SetListCommand(0x0101,0x0002); // MO1 for list 1 (Node 0)

/// -----------------------------------------------------------------------
/// Configuration of Message Object 1: Tx, Node 0 ïåðåäà÷à
/// -----------------------------------------------------------------------
CAN_MOCTR1H = 0x0EA8; // load MO1 control register high
CAN_MOCTR1L = 0x0000; // load MO1 control register low

CAN_MOAR1H = 0x630C; // identifier 29-bit
CAN_MOAR1L = 0x000D; // load MO1 arbitration register low

/// Configuration of Message Object 1 Data:
CAN_MODATA1HH = 0x0A0A; //;0x556
CAN_MODATA1HL = 0x0A0A; // data MSG_CNT in XC2000
CAN_MODATA1LH = 0x0A0A;
CAN_MODATA1LL = 0x0A0A; // load MO1 Data Bytes(DB1 & DB0)

CAN_MOAMR1H = 0x3FFF; // load MO1 acceptance mask register high
CAN_MOAMR1L = 0xFFFF; // load MO1 acceptance mask register low

CAN_MOFCR1H = 0x0800; // load MO1 function control register high
CAN_MOFCR1L = 0x0000; // load MO1 function control register low


CAN_NCR0 &= ~ (uword) 0x0041; // reset INIT and CCE


CAN_PANCTRL = 0x01; // CAN Node initialization command
while(CAN_PANCTRL & CAN_PANCTR_BUSY){ };// wait until Panel has finished


} // End of function CAN_vInit


I just can't understand, why both P2.5 and P11.1 work and P2.5 itself works, but P11.1 doesn't work when set as Tx pin.
Do you have any sample initialization code? Can you post it here?

Thanks.
0 Likes
Not applicable
Later i can post some Code, but lets analyse special this Port-Muxer problem step,by step...
Here is to check out the Ports TX- Class A,B,C --SubClass A0,B0,C0.... and the Respective Node for the internal '''Muxer that i routed to the final Pins--PORT-I/O.
First possible error Source can be the wrong Pin-Node Register you are storing on your mask 0x40 or 0x41
So the Pin is not finaly routed throgh the Chip.or the Transcreiver Logic Encoder/Decoder is not routed. A,B,C Group-Switch-Matrix)Buff-Gate)--Outputdriver-->PIN

See this Sample Picture wich i made for my derivate. 1349.attach
You must check your Datasheet exact for your Derivate,and the Shematic of corse, and the final-PCB Pins,
0 Likes
Not applicable
1350.attach
Can you check out the 0x40 mask with your es_special derivate & Datasheet.

CCE Bit 6 rw "Configuration Change Enable bit" in the NCRx Register.
Tip: This triggers the BOFF Status in your Irq-routine. Bus on Bus off ect. Like the old NE2000 Chip for Ethernet..during configuration.
During config the Bus must be off-line, See bit Zero of Mask 0x41, In Reset this bit is set. to run the Bus-engine-State-engine it mus be Cleard-to Zero.
And Bit 6 must be the CCE (Config-Change enable )write Enable trigger set to Zero.
0 Likes
Not applicable
See here is a Pull-Up involved.
I am checking the XE167FH Datasheet, but it takes a while for me.



Next step is to check if your Tranceiver is enabled, or slit-mode set, or som pin is cross-talking via the alternate-at-port-Resistor(i post a photo of this two resitors later), that you get
this gap'___' signal on your TEK-Scope.
What else can ths be ???
.I hope you find the 1 of thousend needle in a bunch of reasons why it has this problem.
Or in the XE167FH Headerfile, 0x8000, 0x0080 ect. the switch-mux-'port-mask is wrong. Thats i had with the NXP derivate.

Greetings Holger.



void CAN_vInit_Node0(void)
{
/// -----------------------------------------------------------------------
/// Configuration of CAN Node 0:
/// -----------------------------------------------------------------------
/// General Configuration of the Node 0:
/// - set INIT and CCE
CAN_NCR0 = 0x0041; // load node 0 control register SUSEN=1
/// Configuration of the used CAN Port Pins: I/O PIN Configuration for CAN 1
CAN_NPCR0 = 0x0002; // P2.0 Rx = receive input C NO LOOP BACK
/// Configuration of the used CAN Port Pins: I/O PIN Configuration for CAN 1
P2_IOCR00 = 0x0020; // P2.0 as input (pull up)
P2_IOCR01 = 0x0090; // P2.1 as output (ALT1, push pull)
/// Configuration of the Node 0 Baud Rate:
/// - required baud rate = 500,000 kbaud
CAN_NBTR0L = BAUD_0500_000_WITH_MHZ_75; // Set Baud Rate of Node 0 at 500
kbaud at 75 MHz
/// -----------------------------------------------------------------------
/// Configuration of the CAN Message Object List Structure:
/// -----------------------------------------------------------------------
/// Allocate MOs for list 1/Node0:
SetListCommand(1, 11, CAN_INIT_LIST);
SetListCommand(1, 12, CAN_INIT_LIST);
} //End of CAN_vInit_Node0]
0 Likes
Not applicable
.

I just can't understand, why both P2.5 and P11.1 work and P2.5 itself works, but P11.1 doesn't work when set as Tx pin.
Do you have any sample initialization code? Can you post it here?

Thanks.

Link:
http://www.mikrocontroller.net/topic/366101#new
See the third entry with the Alternate Fuction Reg. Pull-Up.

And the Link for Chinese Lib

And Link to Datasheet for XE167FH.
0 Likes
User18538
Level 1
Level 1
I am currently busy with the SAF-XE167FH-200F100LAB and the CAN communication. I have no problems with the TXD = P11.1 pin and RXD = P11.0. Runs smoothly.:)
0 Likes