Target Board for RX65Nを使用して、スマートコンフィグレータを使ってI2Cにてデバイスをつないでいます。
下記の通りのメイン側プログラムを記述しました。
ところが、R_Config_RIIC0_Master_Sendのところで、マスターからI2Cでデータを送信していますが、
全く、I2C接続データにI2Cクロックもデータも出てきません。
プログラムは、r_Config_RIIC0_callback_transmitendまで行っておらず、
while(i2c_transmit_end_flg != 1);のところで止まっています。
r_Config_RIIC0_transmit_interruptの割込みはきており、割込みは起きていますが、TE0の割込みまで行っておらず
止まっています。
何か作り方間違っているのか、どなたかご指導願えたら嬉しいです。
宜しくお願い致します。
メイン側プログラム
#define SLAVE_ADD (0x0e)
#define CNTL1 (0x1b)
#define CNTL1_PC1_ACT (1 << 7)
#include "r_smc_entry.h"extern uint8_t timer0_flg;extern uint8_t i2c_transmit_end_flg;extern uint8_t i2c_receiv_end_flg;volatile uint8_t tx_buf[3];volatile uint8_t rx_buf[3];void main(void){ tx_buf[0] = CNTL1; tx_buf[1] = CNTL1_PC1_ACT; i2c_transmit_end_flg = 0; R_Config_RIIC0_Start(); R_Config_RIIC0_Master_Send(SLAVE_ADD, (uint8_t *)tx_buf, 2U); while(i2c_transmit_end_flg != 1); timer0_flg = 0; R_Config_TMR0_Start(); while(timer0_flg != 1); R_Config_TMR0_Stop(); timer0_flg = 0;
while(1);}
Config_RIICO_User.cの修正内容
volatile uint8_t i2c_transmit_end_flg;
/************************************************************************************************************************ Function Name: r_Config_RIIC0_callback_transmitend* Description : This function is a callback function when RIIC0 finishes transmission* Arguments : None* Return Value : None***********************************************************************************************************************/
static void r_Config_RIIC0_callback_transmitend(void){ /* Start user code for r_Config_RIIC0_callback_transmitend. Do not edit comment generated here */ i2c_transmit_end_flg = 1; /* End user code. Do not edit comment generated here */}
ちなみに、スマートコンフィグレータのConfig_RIICO設定画面は、上記です。
これでソース生成しています。