[[ファームウェア関数一覧>ファームウェア関数一覧#n7b42187]] *CAN_Init [#r91bb04c] #contents **ヘッダ宣言 [#zb0adb30] **関数プロトタイプ [#tb8dbac7] uint8_t CAN_Init(CAN_InitTypeDef* CAN_InitStruct) **動作 [#d12c16eb] -CAN周辺回路を初期化します **引数 [#h476d710] - '''stm32f10x_can.h'''で定義されている構造体です。 typedef struct { FunctionnalState CAN_TTCM; FunctionnalState CAN_ABOM; FunctionnalState CAN_AWUM; FunctionnalState CAN_NART; FunctionnalState CAN_RFLM; FunctionnalState CAN_TXFP; uint8_t CAN_Mode; uint8_t CAN_SJW; uint8_t CAN_BS1; uint8_t CAN_BS2; uint16_t CAN_Prescaler; } CAN_InitTypeDef; --CAN_TTCM&br; TTCM((time triggered communication mode))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_TTCM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_TTCM,notitle) &br; --CAN_ABOM&br; ABOM((automatic bus-off management))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_ABOM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_ABOM,notitle) &br; --CAN_AWUM&br; AWUM((automatic wake-up mode))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_AWUM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_AWUM,notitle) &br; --CAN_NART&br; NART((no-automatic retransmission mode))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_AWUM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_NART,notitle) &br; --CAN_RFLM&br; RFLM((Receive Fifo Locked mode))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_AWUM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_RFLM,notitle) &br; --CAN_TXFP&br; TXFP((the transmit FIFO priority))使用の有効・無効化を指定します。&br; &br; |CENTER:CAN_AWUM|CENTER:説明|h |ENABLE|有効| |DISABLE|無効| #include(Macro/CAN_TXFP,notitle) &br; --CAN_Mode CANの運用モードを設定します。&br; &br; |CENTER:CAN_Mode|CENTER:説明|h |CAN_Mode_Normal|CAN hardware operates in normal mode| |CAN_Mode_Silent|CAN hardware operates in silent mode| |CAN_Mode_LoopBack|CAN hardware operates in loop back mode| |CAN_Mode_Silent_LoopBack|CAN hardware operates in loop back combined with silent mode| #include(Macro/CAN_Mode,notitle) &br; --CAN_SJW&br; CAN_SJW configures the maximum number of time quanta the CAN hardware is allowed to lengthen or shorten a bit to perform resynchronization.&br; &br; |CENTER:CAN_SJW Description|CENTER:説明|h |CAN_SJW_1tq|Resynchronization Jump Width=1 time quantum| |CAN_SJW_2tq|Resynchronization Jump Width= 2 time quantum| |CAN_SJW_3tq|Resynchronization Jump Width= 3 time quantum| |CAN_SJW_4tq|Resynchronization Jump Width= 4 time quantum| #include(Macro/CAN_SJW,notitle) &br; --CAN_BS1&br; CAN_BS1 configures the number of time quanta in Bit Segment 1.&br; &br; |CENTER:CAN_BS1|CENTER:説明|h |CAN_BS1_1tq|Bit Segment 1= 1 time quantum| |CAN_BS1_2tq|Bit Segment 1= 2 time quantum| |CAN_BS1_3tq|Bit Segment 1= 3 time quantum| |CAN_BS1_4tq|Bit Segment 1= 4 time quantum| |CAN_BS1_5tq|Bit Segment 1= 5 time quantum| |CAN_BS1_6tq|Bit Segment 1= 6 time quantum| |CAN_BS1_7tq|Bit Segment 1= 7 time quantum| |CAN_BS1_8tq|Bit Segment 1= 8 time quantum| |CAN_BS1_9tq|Bit Segment 1= 9 time quantum| |CAN_BS1_10tq|Bit Segment 1= 10 time quantum| |CAN_BS1_11tq|Bit Segment 1= 11 time quantum| |CAN_BS1_12tq|Bit Segment 1= 12 time quantum| |CAN_BS1_13tq|Bit Segment 1= 13 time quantum| |CAN_BS1_14tq|Bit Segment 1= 14 time quantum| |CAN_BS1_15tq|Bit Segment 1= 15 time quantum| |CAN_BS1_16tq|Bit Segment 1= 16 time quantum| #include(Macro/CAN_BS1,notitle) &br; --CAN_BS2&br; CAN_BS2 configures the number of time quanta in Bit Segment 2.&br; &br; |CENTER:CAN_BS2|CENTER:説明|h |CAN_BS2_1tq|Bit Segment 2= 1 time quantum| |CAN_BS2_2tq|Bit Segment 2= 2 time quantum| |CAN_BS2_3tq|Bit Segment 2= 3 time quantum| |CAN_BS2_4tq|Bit Segment 2= 4 time quantum| |CAN_BS2_5tq|Bit Segment 2= 5 time quantum| |CAN_BS2_6tq|Bit Segment 2= 6 time quantum| |CAN_BS2_7tq|Bit Segment 2= 7 time quantum| |CAN_BS2_8tq|Bit Segment 2= 8 time quantum| #include(Macro/CAN_BS2,notitle) &br; --CAN_Prescaler&br; CAN_Prescaler configures the length of a time quantum.&br; 設定できる値は1から1024までの間です。&br; **戻り値 [#s1d5ae95] -CAN_Init&br; &br; |CENTER:CAN_Init|CENTER:説明|h |CANINITFAILED|初期化に失敗しました| |CANINITOK|初期化に成功しました| #include(Macro/CAN_Init,notitle) **場所 [#nb1ba73e] **呼び出し関数 [#r4d4dfba] -無し **サンプル [#za99025b] /* Initialize the CAN as 1Mb/s in normal mode, receive FIFO locked: */ CAN_InitTypeDef CAN_InitStructure; CAN_InitStructure.CAN_TTCM = DISABLE; CAN_InitStructure.CAN_ABOM = DISABLE; CAN_InitStructure.CAN_AWUM = DISABLE; CAN_InitStructure.CAN_NART = DISABLE; CAN_InitStructure.CAN_RFLM = ENABLE; CAN_InitStructure.CAN_TXFP = DISABLE; CAN_InitStructure.CAN_Mode = CAN_Mode_Normal; CAN_InitStructure.CAN_BS1 = CAN_BS1_4tq; CAN_InitStructure.CAN_BS2 = CAN_BS2_3tq; CAN_InitStructure.CAN_Prescaler = 0; CAN_Init(&CAN_InitStructure); **参照 [#td68aa82] -