AnsweredAssumed Answered

Reading and writing from SDRAM with STM32F756xx

Question asked by programmer.newuser on Sep 30, 2015
Latest reply on Oct 1, 2015 by programmer.newuser
Hi I am trying to read and write data to the SDRAM. I have used the HAL drivers available on the STM website (STM32Cube_FW_F7_V1.0.0\Projects\STM32756G_EVAL\Examples\FMC\FMC_SDRAM). I can successufully write the data but I am not able to read the data if I try reading it later. These are the functions I use for writing and reading the data:



void write_Landmark()
{
uint32_t address = uwIndex_lm;                SDRAM_Write32(LANDMARK_START_ADR+address,lm_head->landmark_index);
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+address+0));    // I get the data I write here fine
address = address +4;
SDRAM_WriteFloat(LANDMARK_START_ADR+address,lm_head->pos_x);
address = address +4;
SDRAM_WriteFloat(LANDMARK_START_ADR+address,lm_head->pos_y);
address = address +4;
SDRAM_WriteFloat(LANDMARK_START_ADR+address,lm_head->pos_theta);
address = address +4;
SDRAM_Write32(LANDMARK_START_ADR+address,lm_head->jump_point);
address = address +4;  SDRAM_Write32(LANDMARK_START_ADR+address,lm_head->landmark_detected);
address = address +4;   SDRAM_Write32(LANDMARK_START_ADR+address,lm_head->landmark_corrected);
address = address +4;
SDRAM_WriteFloat(LANDMARK_START_ADR+address,lm_head->hall_angle);
address = address +4;
SDRAM_WriteFloat(LANDMARK_START_ADR+address,lm_head->hall_distance);
address = address +4;
SDRAM_Write32(LANDMARK_START_ADR+address,lm_head->on_curve);
address = address +4;
uwIndex_lm = address;
}

void read_Landmark()
{
for(int i = 0 ; i < uwIndex_lm; i=i+40)
{
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+i+0));   // I reprint the data and I get '65535' as output which is the default value, not what I wrote
printf("%f \t",SDRAM_ReadFloat(LANDMARK_START_ADR+i+4));
printf("%f \t",SDRAM_ReadFloat(LANDMARK_START_ADR+i+8));
printf("%f \t",SDRAM_ReadFloat(LANDMARK_START_ADR+i+12));
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+i+16));
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+i+20));
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+i+24));
printf("%f \t",SDRAM_ReadFloat(LANDMARK_START_ADR+i+28));
printf("%f \t",SDRAM_ReadFloat(LANDMARK_START_ADR+i+32));
printf("%i \t",SDRAM_Read32(LANDMARK_START_ADR+i+36));
printf("\n\r");
}
}

I usd the exact code in the library for configurationn of SDRAM. Just for some more clarity:

#define SDRAM_Write32(address, value)     (*(__IO uint32_t *) (SDRAM_START_ADR + (address)) = (value))
#define SDRAM_START_ADR                    ((uint32_t)0xC0000000)
#define LANDMARK_START_ADR              ((uint32_t)0x0800)



I would be very grateful for any help.Thank you!


Outcomes