<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Handling External RAM in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140618#M2510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;You are sort of right but PPage is emulated on&amp;nbsp;PORTK when the EMK bit is set in the MODE register.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Therefore what I are doing in thery should work. but PORTK(PPAGE) never gets a 0x10 (my ram address)set on it. Yet data is put into the memory and stored there while the system is running.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Dec 2006 04:03:58 GMT</pubDate>
    <dc:creator>NZ_Design</dc:creator>
    <dc:date>2006-12-20T04:03:58Z</dc:date>
    <item>
      <title>Handling External RAM</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140616#M2508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;How well does CW handle external RAM on the MC9S12DP256 processor.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This processor only has a PPage registor on dpage therefor code and ram are handled by the same register. I have used the ICC compiler for my code in the past and it didnt handle external RAM at all. I therefore had to do special code to deal with it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define pLocation 0x4003&lt;/DIV&gt;&lt;DIV&gt;#define newpage 0x10&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;coldpage = PORTK;&lt;/DIV&gt;&lt;DIV&gt;PORTK = newpage;&lt;/DIV&gt;&lt;DIV&gt;asm("nop"); // as PORTK requires an extra clock cycle to change correctly&lt;/DIV&gt;&lt;DIV&gt;*(int*)pLocation := 34;&lt;/DIV&gt;&lt;DIV&gt;PORTK = cOldPage;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;in the code worrier I have decleared the RAM as such&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_10 = NO_INIT&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x104000 TO 0x107FFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_11 = READ_WRITE 0x114000 TO 0x117FFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_12 = READ_WRITE 0x124000 TO 0x127FFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_13 = READ_WRITE 0x134000 TO 0x137FFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_14 = READ_WRITE 0x144000 TO 0x147FFF;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;BATTERY_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO PAGE_11,PAGE_12,PAGE_13,PAGE_14,PAGE_15,PAGE_16,PAGE_17,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PAGE_18,PAGE_19,PAGE_1A,PAGE_1B,PAGE_1C,PAGE_1D,PAGE_1E,PAGE_1F;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PROGRAM_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO PAGE_10;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#pragma DATA_SEG BATTERY_RAM&amp;nbsp;&lt;BR /&gt;&amp;nbsp;uchar pLocation;&lt;/DIV&gt;&lt;DIV&gt;#pragma DATA_SEG DEFAULT&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;pLocation = 34;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am ok while the system is runnung but as soon as I turn the unit off the value is lost. The external memory is battery backed and it is working. As I can load my old Image craft code and it is stored.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do I need to modify the datapage.c file so as when dealling with code it works on PORTK rather than the ppage register.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Dec 2006 10:23:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140616#M2508</guid>
      <dc:creator>NZ_Design</dc:creator>
      <dc:date>2006-12-19T10:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Handling External RAM</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140617#M2509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; CodeWarrior for HCS12DP256 is accessing paged data or constant through PPAGE only.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; It does not use PORTK at all.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; If you wish to use PORTK to access external RAM, you have to write low level functions (or macros), which are accessing&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; paged variable through PORTK and access the variables through the function.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Dec 2006 17:00:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140617#M2509</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-12-19T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Handling External RAM</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140618#M2510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;You are sort of right but PPage is emulated on&amp;nbsp;PORTK when the EMK bit is set in the MODE register.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Therefore what I are doing in thery should work. but PORTK(PPAGE) never gets a 0x10 (my ram address)set on it. Yet data is put into the memory and stored there while the system is running.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2006 04:03:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140618#M2510</guid>
      <dc:creator>NZ_Design</dc:creator>
      <dc:date>2006-12-20T04:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Handling External RAM</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140619#M2511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;How do I do a macro then so as I dont have to declear my variables as fixed addresses etc. As if I have to do that then it is a wast of time me changing the code over to CW.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2006 09:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140619#M2511</guid>
      <dc:creator>NZ_Design</dc:creator>
      <dc:date>2006-12-20T09:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Handling External RAM</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140620#M2512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Some things here are not clear to me.&lt;BR /&gt;If EMK is set, then PORTK is not in the memory map.&lt;BR /&gt;So what effect should "PORTK = newpage;" have in this case? Should this be "PPAGE= newpage;"?&lt;BR /&gt;Also is it possible to use the 0x4000..0x7FFF area for memory expansion? Reading the description in S12MMCV4.pdf, "4.3.2 Extended Address (XAB19:14) and ECS Signal Functionality" chapter&lt;BR /&gt;&lt;PRE&gt;
system is addressing within the physical Program Page
Window address space ($8000–$BFFF) and is in an expanded mode. When addressing anywhere else
within the physical address space (outside of the paging space), the XAB19:14 signals will be assigned a
constant value based upon the physical address space selected.
&lt;/PRE&gt;&lt;BR /&gt;So this sounds to me as if you would get a fixed "$3E" page whenever you do an access in the 0x4000..0x7FFF window (or as in your prm, to "0x104000 TO 0x107FFF"), should this be "0x108000 TO 0x10BFFF" in the prm instead? Anyway, this is not my area, I really might be just totally wrong.&lt;BR /&gt;&lt;BR /&gt;Can you show the code you expect to get the compiler generate when it does access "pLocation"?&lt;BR /&gt;&lt;BR /&gt;Also, when accessing paged data, you have to tell the compiler which page register to use.&lt;BR /&gt;To use PPAGE:&lt;BR /&gt;#pragma DATA_SEG __PPAGE_SEG BATTERY_RAM.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Handling-External-RAM/m-p/140620#M2512</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2020-10-29T08:41:23Z</dc:date>
    </item>
  </channel>
</rss>

