In any case of the floppy interface used 5v TTL as the electrical interface, it would comply with LVTTL switching levels.At the outputs of the debug board, the logical unit is 3.3v, and the FDD interface uses 5v, which means that you need to connect FDD to the “5v tolerant” pins. To find them, just open the datasheet of the STM32L152RBT6 controller, which is installed on STM32L-DISCOVERY and see the table with the name "... pin definitions". If in the column “I / O structure” stands “FT” (five-volt tolerant) it means that you can safely submit 5c per pin.
An input voltage of 2.0 volts and a low voltage of 0.8 volts.This means that 3.3v is enough for us to supply a logical unit.
An output high voltage of 2.4 volts.
Step = LOW
Delay (1mS)
Step = HIGH
#include "stm32l1xx.h" #include "stm32l1xx_rcc.h" #define DIR GPIO_Pin_1 // 18 // PA1 #define STEP GPIO_Pin_2 // 20 // PA2 void delay_ms(uint32_t delay) { TIM6->PSC = 2096; TIM6->ARR = delay; TIM6->EGR |= TIM_EGR_UG; TIM6->CR1 |= TIM_CR1_CEN|TIM_CR1_OPM; while ( (TIM6->CR1 & TIM_CR1_CEN) != 0); } void InitPeriph() { GPIO_InitTypeDef GPIOConfig; GPIOConfig.GPIO_Speed = GPIO_Speed_40MHz; GPIOConfig.GPIO_Mode = GPIO_Mode_OUT; GPIOConfig.GPIO_OType = GPIO_OType_PP; GPIOConfig.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIOConfig.GPIO_Pin = DIR | STEP; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE); GPIO_Init(GPIOA,&GPIOConfig); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6,ENABLE); } void move() { GPIO_ResetBits(GPIOA,STEP); delay_ms(1); GPIO_SetBits(GPIOA,STEP); } int main() { int i; InitPeriph(); for(;;) { GPIO_ResetBits(GPIOA,DIR); for(i=0;i<100;i++) { move(); } delay_ms(1000); GPIO_SetBits(GPIOA,DIR); for(i=0;i<100;i++) { move(); } delay_ms(2500); } }
Source: https://habr.com/ru/post/221023/
All Articles