Software SPI 3-wire read register
Like you've been told in the comments, you need to drive the clock line when you're reading from the sensor.
You also need to read data from GPIOD-&gt;IDR instead of GPIOD-&gt;DDR. 
This sensor uses SPI mode 3 and you arent implementing the protocol correctly. The SCLK line should be idle HIGH when you're done writing, like this:

GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;CS);
delay_ms(2);
for(i = 0; i &lt; 8; i++){ //start to transfer the register we want to read
  GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;SCLK);   // setup data
  if(reg &amp; 128){
      GPIOD-&gt;ODR |= (1&lt;&lt;SDIO);
  } else {
    GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;SDIO);
  }
  GPIOD-&gt;ODR |= (1&lt;&lt;SCLK);  // now capture data
  delay_ms(1);
  reg &lt;&lt;= 1;
}

Finally, you're getting 0x00 because you're checking the state of the DDR bit. Since the bit is 0, because you cleared it right before the while loop, this weird statement resData = (0&lt;&lt;0); is always executed and so the function returns 0. You should read from the sensor this way:

resData = 0;
GPIOD-&gt;DDR &amp;= ~(1&lt;&lt;SDIO); //set SDIO as Input
while(k &gt; 0){ //read 8 bit
    delay_ms(1);
    GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;SCLK);  // allow the sensor to setup data
    delay_ms(1);
    GPIOD-&gt;ODR |= (1&lt;&lt;SCLK);  // now capture data
    resData &lt;&lt;= 1;
    resData |= GPIOD-&gt;IDR &amp; (1 &lt;&lt; SDIO) ? 1 : 0;
    k--;
}
return resData;

You arent writing properly to the module and you also have a casting issue in your main code. Look at the changes I've made:

void writeCommand(uint16_t cmd){
  uint8_t i; 
  GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;CS); 
  delay_ms(2); 
  GPIOD-&gt;DDR |= (1&lt;&lt;SDIO); //SDIO as output 
  for(i = 0; i &lt; 16; i++){ //start to transfer the register we want to read 
    GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;SCLK); 
    if(cmd &amp; (1&lt;&lt;15)){ 
      GPIOD-&gt;ODR |= (1&lt;&lt;SDIO); 
    } else { 
      GPIOD-&gt;ODR &amp;= ~(1&lt;&lt;SDIO); 
    }
    delay_ms(1);
    GPIOD-&gt;ODR |= (1&lt;&lt;SCLK); 
    delay_ms(1); 
    cmd &lt;&lt;= 1; 
  } 

  GPIOD-&gt;ODR |= (1&lt;&lt;CS); 
}



You should cast this way:

    write = 0;  // no real need for ORing though
    write_command = ((write | (uint16_t)addr) &lt;&lt; 8) | data;