TI中文支持网
TI专业的中文技术问题搜集分享网站

F280025 CAN register 無法初始化

Other Parts Discussed in Thread:C2000WARE

我在設定 CAN_BTR 發現沒有寫入 register ,之後是發現說 // If Init was not set before, then clear it. ,所以是沒有Init 成功。

之後我去register 看他 RAM init 的值都是零 。 之後我有修改 28002x_generic_flash_Lnk.cmd , 是否會影寫入RAM 的位置。

Susan Yang:

您可以直接使用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

,

123 1232:

我嘗試 example code 裡面的範例,同樣的 CAN_BTR 無法寫入 register

,

Susan Yang:

E2E上有和您相同的问题,请您参考下面帖子的回复

e2e.ti.com/…/903387

,

123 1232:

我剛有看過了,我嘗試在 struct CAN_REGSCAN_BTR 裡面直接做寫入動作,可是從 register 裡面看似乎也沒被寫入情況。

,

Susan Yang:

能给出您写入的代码?另外在TRM内有相关说明

This register is only writable if CCE and Init bits in the CAN Control Register are set.

,

123 1232:

我斷點設在寫入BTR之後,CCE and init 都有設1 , 我另外我看 struct 上面值是有確定被寫入的,但我不確定這樣是否會運作??

,

Susan Yang:

我认为这样也是可以的。但还是建议您使用库函数 CAN_setBitRate

赞(0)
未经允许不得转载:TI中文支持网 » F280025 CAN register 無法初始化
分享到: 更多 (0)