This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi expert,
We are modifying example project "cm_common_config_c28x.c" to pass control of CAN peripheral to CPU2 and we are targeting to let CPU2 use CANB. We configured like this but seems not success. (CPU2 CANB initialization failed).
1. Do we offer any example show case of how to assign peripheral from CPU1 to CPU2 correctly? It seems using differnent API against passing peripheral to CM core.
2. Could you let us know if we did it correctly? If not, could you help us to do it right? (As shown below)
#ifdef CANB // // Configuring the GPIOs for CAN B. // GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXB); GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXB); // // Allocate Shared Peripheral CAN B to the CM Side. // //SysCtl_allocateSharedPeripheral(SYSCTL_PALLOCATE_CAN_B,0x1U); SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL8_CAN,1,SYSCTL_CPUSEL_CPU2); #endif
Thanks
Sheldon
Hi Sheldon,
Let me answer the post differently and let me know if this makes sense:
As best practice, first disable the peripheral clock for a module before assigning module allocation in step# 1.
Best regards,
Joseph
Hi Joseph,
Here is my feedback on your answer:
Sure, we are using this API in CPU1 to do the asignment. But this API can only be passed with parameter "SYSCTL_CPUSEL8_CAN" which didn't specify which CAN moduel is targeted (CANA or CANB).
We are using example project "can_ex5_transmit_receive.c" on CPU2, and all the peripherals are enabled here with the API you mentioned. In this case, CANA's register and be written in CPU2 while CANB can not.
Now, My cusotmer and I can both reproduce this issue based on tiny modification on TI example project. And this issue only happens on CANB, not CANA. So we don't have any idea of what to do next.
I can send you this test program to you through TI drive. They can be easily reproduced on TI LP. Could you help us get the answer?
Thanks
Sheldon
Hi Sheldon,
Sorry for the late response.I think the issue in customer's code is that in the function call SysCtl_selectCPUForPeripheral(), the 2nd argument is '1'. It should be '2' so it will properly allocate CANB to CPU2. Here is the simplified code that i tried out based from what you sent:
In CPU1, try this basic code in order to allocate CANB to CPU2:
// // Initialize device clock and peripherals // Device_init() has the function Device_enableAllPeripherals() that turns on clock for all peripherals including CANA and CANB Device_init(); // // Configuring the GPIOs for CAN B. // GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXB); GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXB); //SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_CANB); // // Allocate Shared Peripheral CAN B to the CM Side. // SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL8_CAN,2,SYSCTL_CPUSEL_CPU2); : :
In CPU2, try this basic code to configure CANB:
// // Initialize device clock and peripherals // Device_init(); // // Initialize the CAN controller // CAN_initModule(CANB_BASE); // // Set up the CAN bus bit rate to 500kHz // Refer to the Driver Library User Guide for information on how to set // tighter timing control. Additionally, consult the device data sheet // for more information about the CAN module clocking. // CAN_setBitRate(CANB_BASE, DEVICE_SYSCLK_FREQ, 500000, 20); : :
Let me know if this works.
Regards,
Joseph