2014-01-14 12:16 AM
Hello,
I can't get SPI3 on pins (PB3, PB4. PB5) working. On the scope I checked that SPI clock is running. But still I can't read MX25L6406E flash ID. Functions that handles flash commands are checked and is working on STM32F2.Here below is my SPI3 configuration:RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, ENABLE); //SPI SCK GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure); //SPI MOSIGPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);//SPI MISOGPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);/* Configure FLASH_CS Control */GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;GPIO_Init(GPIOC, &GPIO_InitStructure); FL_CS_OFF; /* SPI configuration -------------------------------------------------------*/ SPI_I2S_DeInit(SPI3); SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;SPI_InitStructure.SPI_CRCPolynomial = 7;SPI_Init(SPI3, &SPI_InitStructure); SPI_Cmd(SPI3, ENABLE);2014-01-14 12:26 AM
> On the scope I checked that SPI clock is running.
Did you check also CS, MOSI and MISO? JW2014-01-14 03:55 AM
Problem solved. I did not disabled TRACE_IO in the KEIL IDE file STM32DBG.INI. This pin is JTDO / TRACESWO PB3. This is the same pin dedicated for SPI clock. I checked before disabling TRACE_IO that there were no clock.
2014-06-09 09:32 PM
Hi stail,
Please tell me how to disable TRACE_IO and config file STM32DBG.iniThanks,2014-06-10 06:56 AM
I guess you'd look at the script, or a Configuration Wizard view, or simply not use the script, and perhaps disable the trace in the ''Trace'' pane of the Debugger Configuration/Setting