我在設定 CAN_BTR 發現沒有寫入 register ,之後是發現說 // If Init was not set before, then clear it. ,所以是沒有Init 成功。
之後我去register 看他 RAM init 的值都是零 。 之後我有修改 28002x_generic_flash_Lnk.cmd , 是否會影寫入RAM 的位置。
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.
我在設定 CAN_BTR 發現沒有寫入 register ,之後是發現說 // If Init was not set before, then clear it. ,所以是沒有Init 成功。
之後我去register 看他 RAM init 的值都是零 。 之後我有修改 28002x_generic_flash_Lnk.cmd , 是否會影寫入RAM 的位置。
您可以直接使用driverlib库内的
//*****************************************************************************
//
//! Sets the CAN Bit Timing based on requested Bit Rate.
//!
//! \param base is the base address of the CAN controller.
//! \param clock is the CAN module clock frequency before the bit rate
//! prescaler (Hertz)
//! \param bitRate is the desired bit rate (bits/sec)
//! \param bitTime is the number of time quanta per bit required for desired
//! bit time (Tq) and must be in the range from 8 to 25
//!
//! This function sets the CAN bit timing values for the bit rate passed in the
//! \e bitRate and \e bitTime parameters based on the \e clock parameter. The
//! CAN bit clock is calculated to be an average timing value that should work
//! for most systems. If tighter timing requirements are needed, then the
//! CAN_setBitTiming() function is available for full customization of all of
//! the CAN bit timing values.
//!
//! \note The CANBTR register values calculated by the function CAN_setBitRate
//! may not be suitable for your network parameters. If this is the case
//! and you have computed the correct values for your network, you could
//! directly write those parameters in CANBTR register using the
//! function CAN_setBitTiming.
//!
//! \return None.
//
//*****************************************************************************
extern void
CAN_setBitRate(uint32_t base, uint32_t clock, uint32_t bitRate,
uint16_t bitTime);
您可以参考例程 C2000Ware_3_03_00_00\driverlib\f28002x\examples\can