This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RAM read on 51822

Hi. Faced with a strange situation. Example. All look good when I read code area:

void ex1 (void)
{
 uint32_t *addr_out;
 uint32_t i,word;
 
   addr_out=(uint32_t *)0x0000000UL;
	
	 for (i=0;i<5;i++,addr_out++)
	    {
        word=*addr_out;
				NRF_LOG_INFO("addr %x, word %x\r\n",(uint32_t )addr_out, word );
	    }
    NRF_LOG_INFO("OK\r\n");
    NRF_LOG_FLUSH();
}	




int main(void)
{
  uint32_t err_code;
   
    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);
    ex1();
    
	  while(1)
		{
			
		}
}

But if I set RAM area I get the HardFault ... :(

addr_out=(uint32_t *)0x2000000UL;

What am I doing wrong?

Parents
  • Sorry, I missing zero in example. In real code look like this:

    addr_out=(uint32_t *)&data_db;
    

    data is a structure with some variables like this:

    typedef struct
    {
        uint8_t a [4];                     
        uint8_t b [8];           
        uint8_t d [16]; 
        uint8_t c [4];                
                                                            
    } data;	
    static  data  data_db[10];
    

    and data_db address somewhere in 0x2000023e. Code in topic was born during the study of this problem :)

Reply
  • Sorry, I missing zero in example. In real code look like this:

    addr_out=(uint32_t *)&data_db;
    

    data is a structure with some variables like this:

    typedef struct
    {
        uint8_t a [4];                     
        uint8_t b [8];           
        uint8_t d [16]; 
        uint8_t c [4];                
                                                            
    } data;	
    static  data  data_db[10];
    

    and data_db address somewhere in 0x2000023e. Code in topic was born during the study of this problem :)

Children
No Data
Related