ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Вторник
2 июля
259789 Топик полностью
nanorobot (26.06.2011 19:34 - 19:38, просмотров: 189) ответил koyodza на это что-то совсем плохо, ищите в чём причина. Может, порты неправильно настроены. Осциллограф есть?
зарегистрировался...  
    GPIO_PinRemapConfig(GPIO_Remap_SPI1, ENABLE);  
     
    // Configure GPIOB Pin_3 as SCK1, Pin_5 as MOSI1
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_5;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;    
    GPIO_Init(GPIOB, &GPIO_InitStructure);   
 
    // GPIOB Pin_4 Configure as MISO1           
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
    GPIO_Init(GPIOB, &GPIO_InitStructure);   

    // Configure GPIOB Pin_2 as NSS1     
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &GPIO_InitStructure); 
    GPIO_SetBits(GPIOB, GPIO_Pin_2);