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.
Did you configure the new GPIO pins (70/71) correctly for CAN operation? Please ensure that CAN function is not duplicated on other pins. Following snip worked for me:
// Setup GPIO pin mux for CAN-A TX/RX and CAN-B TX/RX
GPIO_SetupPinMux(70, GPIO_MUX_CPU1, 5); //GPIO70 - CANRXA
GPIO_SetupPinOptions(70, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinMux(71, GPIO_MUX_CPU1, 5); //GPIO71 - CANTXA
GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_PUSHPULL);
On a different note, eCAN module is only applicable to "older" c2000 devices (2805x and older). 28377D employs the DCAN module.
We are generating code from simulink/matlab, our setup looks a bit different, but here it is for reference.
void init_eCAN_A ( uint16_T bitRatePrescaler, uint16_T timeSeg1, uint16_T timeSeg2, uint16_T sbg, uint16_T sjw, uint16_T sam) { uint32_t ui32RegValue; uint16_t ui16CANCTL; EALLOW; CpuSysRegs.PCLKCR10.bit.CAN_A = 1; GpioCtrlRegs.GPCPUD.bit.GPIO71 = 0; GpioCtrlRegs.GPCGMUX1.bit.GPIO71 = 1; GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 1; GpioCtrlRegs.GPCQSEL1.bit.GPIO70 = 3; GpioCtrlRegs.GPCPUD.bit.GPIO70 = 0; GpioCtrlRegs.GPCGMUX1.bit.GPIO70 = 1; GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 1; EDIS; ui32RegValue = (((uint32_T)((bitRatePrescaler-1) & 0x03C0))<<10)|((timeSeg2-1)<< 12)|((timeSeg1-1)<<8)|((sjw-1)<<6)|((bitRatePrescaler-1) & 0x3F); CANInit(CANA_BASE); CANClkSourceSelect(CANA_BASE, 0); //Set init mode ui16CANCTL = HWREGH(CANA_BASE + CAN_O_CTL); HWREGH(CANA_BASE + CAN_O_CTL) = ui16CANCTL | CAN_CTL_INIT | CAN_CTL_CCE; //Set Bit Timing register HWREGH(CANA_BASE + CAN_O_BTR) = (ui32RegValue & CAN_REG_WORD_MASK); HWREGH(CANA_BASE + CAN_O_BTR + 2) = (ui32RegValue >> 16); // Restore the saved CAN Control register. HWREGH(CANA_BASE + CAN_O_CTL) = ui16CANCTL; HWREGH(CANA_BASE + CAN_O_IP_MUX21) = 0; HWREGH(CANA_BASE + CAN_O_IP_MUX21 + 2) = 0; // Enable the CAN for operation. CANEnable(CANA_BASE); }
Hi Kerwin,
We can look in to this if TI example runs successfully on the customer hardware.
We may then need your model and MATLAB version details for investigation.
Hi guys, for now, we have abandoned our attempts to use simulink to get CAN functional and moved strictly to CCS to remove any potential conflicts.
We attempted to use the 'can_ex1_loopback' from c2000ware, we were able to successfully load the code onto our hardware, but still do not get any activity on the CAN RX/TX lines of the processor, the target being a 176 pin F28377D.
Just to reiterate, we have been able to run both our simulink code and the example code on the launchpads (F28379D) without problems.
Are there any pins or registers on the processor that need to be pulled up/down or configured differently on the 337 pin vs. 176 pin processor? As far as I know they should be software compatible.
Update on progress. We have gotten the loopback test to run sucessfully (we see traffic on the TX pin), but when going to any other configuration we have not seen any CAN traffic.
More description on our setup, we have both eCANA and eCANB going out to galvanically isolated CAN transcievers and connecting to the same CAN-BUS, is there any possibility that the eCAN peripherals may be conflicting if they are not setup correctly?