Hi all, i've a really strange issue with a DALLAS DS89C430 full 8051 compatible chip. I've an app. with external program memory, and external sram (both 70ns acccess time, clock is 25mhz). When i compile my code with C51 7.1 or 7.5, everithing work, i can see a led blinking, i can see chars coming out from the UART0, filling SBUF0, but everytime in my source code i use something like *p++ , or a=tab[5], it don't work, or better, strange chars are read out, not the cortrect one. If i put in the same socket a DS87C520, slower but similar chip, WITH THE SAME CODE, everything works correctly. Anyway, i don't think is a memory access issue, since i've measured with the scope, the memories give data correctly inside the PSEN time. So, seems an op codes compatibility issue, or a bad adressing, or even, a wrong place adressing. I would be happy even for some suggestion, Infinite thanks. Angelo
Have you tried it in the simulator? Single-step it, and watch your pointer - to be sure that it's really pointing where you want.
thanks, i vill bring the projenct on uvision
If i put in the same socket a DS87C520, slower but similar chip, WITH THE SAME CODE, everything works correctly That's a very strong hint that, your olliscope work notwithstanding, the problem is indeed a hardware issue --- after all, you changed nothing but hardware, and it started to work. The most likely explanation is memory access timing. Check your memory timing setup (some DS chips support "wait states" for XRAM accesses, which may have been configured incorrectly) very carefully, and make sure your quartz oscillator has the right frequency, and all processor clock scalers are what you think they should be.
thanks all for the support, anyway, i'm still in trouble, the pointers to constant seems wrong. This is the state of things i see now, and the tests i've done: 1) first, i run code in the simulator, as andrew kindly suggest it work. Aniway, my pointers problem remain in the chip. 2) my digital osscilloscope HP54201, using cursors said: PSEN HIGH SIDE = 80nsec, PSEN LOW SIDE = 80nsec. My flash memory 29F040 and my SRAM are both 70nsec access time. I suppose It could be fast enough. 3) code from flash is read correctly, since the led blink, i suppose the fetch for code is read correctly. 4) i've done a test to read write and print out in SBUF0 some xdata unsigned char variables. I've compiled in LARGE model. I suppose memory test is right, since i can write and read back variables. 5) when i refer to constants, there is still the problem. I've printed out in SBUF0 the value of a constant pointer, i get completely strange values: printf (pp); a='0'+ (((unsigned int)pp >> 12) & 0x000F); b='0'+ (((unsigned int)pp >> 8) & 0x000F); c='0'+ (((unsigned int)pp >> 4) & 0x000F); d='0'+ ((unsigned int)pp & 0x000F); e='\n'; pp is mapped here CODE 05DCH 003DH UNIT ?CO?HWTEST i get from serial : {=< (99 7B 3D 3C) It seems that i have just the lower byte good, .... Hans-Bernard, Tomorrow i will go down with the clock from 25 to 4 Mhz. Anyway it's sound strange since, as reported, flash and sram seems working fine. I will let you know the progress. Many thanks again for kindly interest. angelo
hi again, saturday morning, some progress, put up a 4Mhz clock. As i was quite sure, nothing change. Pointer don't work. About the poiter value (sorry for previous message, i was wrong using code pointer, now i set it as xdata pointer in the code), tha value now id "0140h", correct, just at the start of the XDATA section into ram (seen in the m51 file). So I'm pointing to the right place. But printf function still don't work. So seems there is no problem for the circuit around. I've put up again a DS87C520, it work just fine. I'm starting to think that maybe there is some problem with the optimization... i really don't know what other toest to do... i'me really wandering whi none else has met same issues with DS89C43/40/50 series.
Optimization problems are quite easy to rule out: look at the assembler listing, or at the disassembly window in uVision, and you'll see exactly what machine instructions your C code actually was compiled into. Since your circuit works with one cpu, but not with the other, another thing you should check very carefully is what difference there are, between these chips. They may be not quite as compatible as you think they are.
thanks Hans for follwing the issue. Yes, when i disassemble the p++ instruction, i see that keil compiler use IILDX library function. Inside this function DPH and DPL are used, and probably the issue is here, but stil is not clear for me. I will contact keil directly, to clarify the reason the code don't work on this chip. Angelo
"Since your circuit works with one cpu, but not with the other, another thing you should check very carefully is what difference there are, between these chips. They may be not quite as compatible as you think they are." eg, the MOVC instruction might be broken on one of them: http://www.8052.com/forum/read.phtml?id=81721
andrew, infinte thanks. Now, after 2 weeks of coming crazy, i've hardly learned an ipoprtant thing about microcontrollers: always read the errata before choosing one. The workoround for me will be to choose the DS 89C420, since i always work from external ram. Thanks again, Angelo