AnsweredAssumed Answered

SD_Card

Question asked by shimon.shimon on Oct 23, 2016
Hi All,

1. I'm writing code for the STM32F042 chip with it's evk i.e. STM32F042K6_NUCLEO.
2. I'm using the IAR program to write it's code, using the supplied example named: SPI_FullDuplex_ComIT. to write into a SD_Card that is connected to that board via: PA5- PA7 to Arduino Shield as a slave.
3. My main problem is that the program is getting to the following lines and I really don't understand how to debug it:
  /* Wait Until PA.12 (Arduino D2) is connected to GND */
  while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_12) == GPIO_PIN_SET) 
  {
    BSP_LED_Toggle(LED3);
    HAL_Delay(100);
  }                                                           
4. Those lines are on the main.c file line 151.
5. Moreover, I've changed a the following lines on the code:
6. Undocumented the following line to configure the it as a master as written on the code: 
/* Commencement this line to use the board as master, if not it is used as slave */
#define MASTER_BOARD
7. Added the following lines before:
#ifdef MASTER_BOARD
  /* Configure PA.12 (Arduino D2) button */
  #define GPIO_SPEED_FREQ_VERY_HIGH 18000000 // The frequency as written on 18MHz Table 63. SPI characteristics page 85.

8. After those changes the program runs with no Errors and Warnings but reaches to the following that is on line 152 on the main.c and stocks over there:
/* Wait Until PA.12 (Arduino D2) is connected to GND */
  while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_12) == GPIO_PIN_SET) 
  {
    BSP_LED_Toggle(LED3);
    HAL_Delay(100);
  } 

9. I can see only the SPI_CLK that runs about 100mSec but there is no SPI communication on those lines.
10. I tried to comment them but it stocked later.
11. I really appreciate any help regarding that problem.

Thanks,
Shimon.

Outcomes