--- In , Naveen P N <naveen_pn@y...> wrote: > Hi, > Thanks to all of you for the great help, I'm getting the feeling > that I'm making some progress. But I'm doing something wrong. I > cannot get to turn the EEPROM OFF in CONFIG. > > I'm doing the following: > > 1) Set MODA/MODB both to low on my custom rigged dev board. > 2) Open JBUG11 > Settings> Memory Map > 3) Choose F1 under "common chip defaults" > 4) Enter the SRAM memory map as 8000..FFFF under "External flash > PROM" Since you are (for now) using SRAM in the place of a FLASH device (according to an earlier message you posted), you should not define a range for FLASH at this point. Instead, add a entry to the RAM list like this: External RAM00..FFFF Also, check the range specified for EEPROM. If you are following my earlier suggestion to re-map it to 7E00..7FFF, enter this range in the space provided. Otherwise, specify the appropriate range for the configuration you plan on selecting, or delete it entirely if you choose to set EEON=0 in CONFIG. There are one or two other changes that you need to make, which I will discuss in a moment... > 5) Go to the "General" tab and uncheck "Allow local commands only" > & check "Allow writing to CONFIG". > 6) Reset the board. > 7) Type "R BPROT= 0F" to turn off PTCON (protect config register) > 8) Type "R CONFIG" to turn off EEPROM > 9) Jbug outputs a message to reset the board. > 10) After reset, I give "R CONFIG". > 11) The result is: "103F CONFIG [FF%5]" > 12) The CONFIG register is not setting to FE. The reason you cannot seem to change CONFIG is due to the fact that when you start up the 'F1 in bootstrap mode (which is required in most cases for JBug to work properly) the stored value of CONFIG is mostly ignored; the EEPROM is always enabled, and always mapped to locations $FE00..FFFF. Fortunately, there is a way to overcome this problem. JBug conveniently provides an option to automatically switch the MCU mode after it starts up. This is done by enabling the "Alter HPRIO on reboot?" option under the General tab in the Configuration dialog, along with specifying an appropriate value in the "Byte to send:" entry box to the right. The value you want to put here is $E6, which will: RBOOT[7]=1: Enable the bootstrap ROM at $BF00..$BFFF (JBug expects the bootloader ROM to be in place) SMOD[6]=1: "Special" mode enabled, no register write time limits. MDA[5]=1: Expanded mode enabled, external bus active IRV[4]=0: Internal Read Visibility off, reads from internal HC11 resources do not appear on the external bus. PSEL[3:0]=6: Selects highest priority interrupt. With this setting, you will now be able to change the CONFIG register, and the CONFIG setting you select will be active when you reboot. Furthermore, the external bus will be enabled, allowing you to use JBug to read/write from/to your external RAM (assuming you add the "External RAM00..FFFF" line to the RAM list as I mentioned previously). Two more obscure caveat about the F1: (1). When Special Test mode is enabled (by changing HPRIO.SMOD=1 and HPRIO.MDA=1), a 256-byte chunk of the address space at $FD00.FDFF is effectively removed from the memory map. Reads and writes to these locations will NOT be seen on the external bus! This is generally not a problem, as nothing 'important' (like reset/interrupt vectors) reside in this space. Nonetheless, you should be aware of this caveat should your code grow to a size such that this space would be needed. (2). Another oddity of the Special Test mode is that, like the bootstrap mode, the interrupt vectors are NOT fetched from the usual $FFC0..$FFFF space; rather, they are fetched from $BFC0..$BFFF. When HPRIO.RBOOT=1, the bootloader ROM occupies this space. When you are testing your code to run under JBug, if you are going to use any interrupts you will have to change the interrupt 'pseudo vectors' in RAM. The pseudo-vector setup is discussed in some detail in the HC11 Reference Manual (rev. 6) starting on page 112. A practical example showing how the pseudo-vectors are used can be found in the same manual in the section that describes the timer subsystem. Try searching this document for the word 'pseudo' for additional material. Note that when you switch over your application to run in a 'standalone' mode (MODA=MODB=1 to select normal expanded mode), you will have to modify your code to use the 'normal' HC11 interrupt vector system. As you mentioned that you will be using gcc, I'd suggest you use a #define in conjunction with #ifdef / #ifndef to conditionally include/exclude those portion(s) of code that differ from running in a normal expanded vs. special test environment. To further muddy the waters, there's a third possible configuration you could start up in - you could set MODA=1 and MODB=0 so you START UP in special test mode after reset. When you start up in special test mode, HPRIO.RBOOT=0, so the bootstrap ROM is disabled... but the interrupt vectors are still fetched from $BFC0..$BFFF. In this mode, you'd define a interrupt vector table the same way you would if you were operating in normal expanded mode, but the table would have to be located at $BFC0..$BFFF instead of it's usual spot at $FFC0..$FFFF. The MC68HC11F1 Technical Data document, Section 4, provides a reasonably cogent discussion of the various modes of operation and the consequences of selecting the various modes. I would suggest that you read this section carefully, esp. subsections 4.1-4.3. Good luck, and feel free to ask if you have any more questions. -- Mark |