Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

HPS/ARM Freeze when reading SDRAM - Cyclone V

Altera_Forum
Honored Contributor II
1,155 Views

Hello, 

I'm trying to execute a code on ARM-A9 that's part of the HPS inside the cyclone v (DE10-Nano) and when I try to access some specific SDRAM address the program freezes (program counter gets stucked), the curious aspect is that the freeze only happen when I read the content of specific addresses like (0xc000282). My code is simple, first I write an image from address 0xc00000 to 0xc4b000 and then I make a loop to read each byte address that represents a pixel, the code that I'm running is this: 

# include <assert.h># include <stdbool.h># include <stdio.h># include <stdlib.h> # include "alt_clock_manager.h"# include "alt_generalpurpose_io.h"# include "alt_globaltmr.h"# include "hwlib.h"# include "socal/alt_gpio.h"# include "socal/hps.h"# include "socal/socal.h"# include "hps_0.h"# include "system_crios.h"# include "mser.h" int main(void) { setup_system(); //mser_init(); while (1) { uint32_t *pt = 0x00C00282; uint32_t content; content = *pt; // IN THIS MOMENT I LOST CONTROL OF THE PROGRAM, THE PC KEEPS FREEZE //uint8_t test = getPixelLevel(641); // PIXEL 641 --> 0x00C00282 delay_us(ALT_MICROSECS_IN_A_SEC/10); } return 0; }  

The auxiliary functions like (setup_system) just make some malloc concerns but nothing special that could break my program flow, and if I try to read other addresses the programs returns the right pixel as I expect. The function that I had used to read the memory was this: 

uint8_t getPixelLevel(uint32_t pixel){ uint32_t *ptr_level = pixel+IMG_OFFSET_ADDR; uint8_t remain = pixel%4; uint32_t mask = (0xff << remain*8); uint32_t content = *ptr_level; uint8_t data = (content & mask) >> remain*8; return data; }  

Does someone has the same problem or know specific rules that I need to follow to read the SDRAM address?
0 Kudos
0 Replies
Reply