2021-08-29 05:13 PM
Hello?
I'm use STM32F103 RCT6 SPI3 with EEPROM.
But When I use IAR Debug. can't read or Write. because no have clk
Without IAR Debug
// SPI3 Config /////////////////////////////////////////////////////////////////
void SPI3_Config(void){
SPI_InitTypeDef SPI_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
SPI_Cmd(SPI3, DISABLE);
SPI_I2S_DeInit(SPI3);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SPI3, ENABLE); // STM32F103하고 SPI3로 EEPROM 연결해서 DEBUG시 CLK 신호가 없어서 Remap 해야�?�.
// SCK MOSI
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
// MISO
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; // GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
// CS
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// SPI configuration -------------------------------------------------------
//KSH SPI_I2S_DeInit(SPI3);
EEPROM_CS_HIGH();
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_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; //SPI_BaudRatePrescaler_4
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI3, &SPI_InitStructure);
SPI_Cmd(SPI3, ENABLE);
}
How Can I use EEPROM with Debug mode.?
Thank you~
2021-08-29 06:32 PM
PB3 is the SWO pin (as well as SPI3_SCK). Possible the debugger is messing with this manually. It's possible the IDE has a switch to disable it.
Your schematic is misleading/off. Some pin labels don't line up with what they're connected to on the top and bottom sides.
2021-08-29 06:55 PM
Hello? Thank you your reply.
I try remap ....
GPIO_Remap_SWJ_NoJTRST
GPIO_Remap_SWJ_JTAGDisable
GPIO_Remap_SPI3
But Same(debug mode. no have CLK).
:sad_but_relieved_face:
2021-08-29 09:12 PM
This isn't something you can fix from within your code. As I said, it will be an IDE project/debug setting. It will depend on what specifically you're using to debug the board. I don't use IAR, but I would expect it's somewhere in project settings, or debug configuration settings.
One possible solution:
https://forum.segger.com/index.php/Thread/2203-SOLVED-Disable-SWV-SWO-on-j-link-IAR-EWARM-STM32F4xx/