注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
worksnfkpynn99的个人空间 https://home.eeworld.com.cn/space-uid-412153.html [收藏] [复制] [分享] [RSS]
日志

IAR5.4+J_link V8调试stm32f103无法到达中断

已有 1425 次阅读2012-4-27 17:05

222.jpg


图片上有文字描述

[code]void Bus_Init(void)
{
//-----------SPI-------------
SPI_InitTypeDef SPI_InitStructure;

RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);

//------------------------------SPI1------------------------------
DISABLE_TP(); //必须先禁能,才能改变MODE
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //两线全双工
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //主
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //8bit
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; //数据捕获于第1个时钟沿
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI1,&SPI_InitStructure);

ENABLE_TP();
SPI_Cmd(SPI1,ENABLE);

//------------------------------SPI2------------------------------

DISABLE_MRF(); //必须先禁能,才能改变MODE
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; //两线全双工
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //主
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //8bit
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; //时钟悬空为低
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; //数据捕获于第1个时钟沿
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;//主频64分步
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; ////高位在前
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI2,&SPI_InitStructure);

ENABLE_MRF();
SPI_Cmd(SPI2,ENABLE);

//--------------I2C--------------
//I2C_Configuration();
// delay_ms(1);

//------------FSMC--------------

LCD_FSMCConfig();
LCD_Init();


//-----------TOUCH-------------

//Read_Ads7843();
/*if(Get_Adjdata()==0)
{
LCD_Clear(WHITE);
LCD_BL_ON();
Touch_Adjust();
}
*/
//------------USB---------------
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
USB_Init();
}[/code]
评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

热门文章