Other Parts Discussed in Thread: CONTROLSUITE
Tool/software: Code Composer Studio
Hi all.
I want use the CANB from CPU2. I started from a working code for CPU1 and modified it for dual core applications (ControlSuite library).
The CPU1 initializes the system and the GPIO, then assign the peripheral to the CPU2 as follow:
// Main function
int main(void)
{
// struct PCLKCR10_BITS CPUSEL8_conn;
// Initialize System Control
InitSysCtrl();
InitGpio();
GPIO_SetupPinMux(17, GPIO_MUX_CPU2, 2); //GPIO10 - CANRXB
GPIO_SetupPinOptions(17, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinMux(12, GPIO_MUX_CPU2, 2); //GPIO8 - CANTXB
GPIO_SetupPinOptions(12, GPIO_OUTPUT, GPIO_PUSHPULL);
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
/*
* Transfer ownership of CAN BUS to CPU02
* CPU control. Defines the owner
* 0: Connected to CPU1
* 1: Connected to CPU2
*/
EALLOW;
DevCfgRegs.CPUSEL8.bit.CAN_B = 1; //CPU2 is the owner
EDIS;
while(1){;}
The CPU2 configure the CAN bus device and use it. Hereafter is reported the CPU2 init code.
int main(void)
{
uint32_t status;
InitSysCtrl(); // Initialize System Control and clock
DINT; // Disable CPU interrupts
InitPieCtrl(); // Initialize PIE control registers to their default state.
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
InitPieVectTable();
// uses CANB
CANInit(CANB_BASE);
//-------------------
// CANClkSourceSelect(CANB_BASE, SOURCE);
// select the SOURCE input as follow:
//! 0 - Selected CPU SYSCLKOUT (CPU1.Sysclk or CPU2.Sysclk)
//! (default at reset) \n
//! 1 - External Oscillator (OSC) clock (direct from X1/X2) \n
//! 2 - AUXCLKIN = GPIOn(GPIO19)
CANClkSourceSelect(CANB_BASE, 0); // 500kHz CAN-Clock
CANBitRateSet(CANB_BASE, 200000000, 500000);
//
// Power up the CAN bus
//
EALLOW;
CpuSysRegs.PCLKCR10.bit.CAN_B = 1;
EDIS;
(… configure packets and transmit/receive.)
From examples, reference manual and datasheet I cannot understand why I cannot communicate with it. The test is executed with a LaunchPad - F28379D development kit.
Thanks,
Luigi