Hi, you might need to insert csync() before continuous memory access, like while (1) { *pnt = val1; csync(); val2 = *ptr; csync(); //*ptr = val2; } --- TG > BF532, I made my own board. Boot from SPI. > I'm new to BF. > In C, I can write to external SRAM, but not read. In > Assembly, I can > read & write. What did I possibly do or not do that > create this > problem? Below is code in C & Assembly that I use to > test the read & > write. > Thanks. > ================================= > > tmp = *pEBIU_AMGCTL; > *pEBIU_AMGCTL = tmp | 0xE; //enable all AMS banks > *pEBIU_AMBCTL1 = 0x2F422F42; > > pnt = (unsigned short *)0x2035A5A0; //ams3 > ptr = (unsigned short *)0x202A5A50; //ams2 > > val1=0x5A5A; > val2=0xA5A5; > while (1) > { > *pnt = val1; > val2 = *ptr; > //*ptr = val2; > } > > I checked it with a logic analyzer, only write > showed up, it never > read (AMS2 stay high, AOE stay high; if I comment > out the read, the > result was EXACTLY the same on logic analyzer; > meaning AMS3 & AWE > high period & low period were the same). > > It weird that write was perfectly fine; address, > control signals, > data were correct. > > Then I tried it in assembly, both read & write were > OK. > p0.l = lo(EBIU_AMGCTL); > p0.h = hi(EBIU_AMGCTL); > r0 = [p0]; > > r1.l = 0xE; > r1.h = 0x0; > r0 = r0 | r1; > [p0] = r0; > p0.l = lo(EBIU_AMBCTL1); > p0.h = hi(EBIU_AMBCTL1); > r0.l = lo(0x22422242); > r0.h = hi(0x22422242); > [p0] = r0; > > p0.l = 0xAAAA; > p0.h = 0x2030; > > r3.l = 0xAAAA; > r3.h = 0x5555; > ures: > w[p0] = r3.l; > ssync; > w[p0] = r3.h; > ssync; > jump ures; > > ===================================== > > _____________________________________ > Note: If you do a simple "reply" with your email > client, only the author of this message will receive > your answer. You need to do a "reply all" if you > want your answer to be distributed to the entire > group. > > _____________________________________ > About this discussion group: > > To Join: Send an email to > To Post: Send an email to > > To Leave: Send an email to > Archives: http://groups.yahoo.com/group/adsp > > Other Groups: http://www.dsprelated.com/groups.php3 > > Yahoo! Groups Links > ----------------------------- Yahoo!_Messenger6.0 ɦ쪺YɳqT@ɡAߧYUsI http://tw.messenger.yahoo.com/ |