<?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: On reset processor behaves differently in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169018#M6113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added all the code in ".cfg" into my ".c" file before initialising hardware. But still it is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my ".cfg" file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;ResetHalt&lt;/P&gt;&lt;P&gt;Delay 200&lt;/P&gt;&lt;P&gt;Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set VBR to the beginning of what will be SDRAM&lt;/P&gt;&lt;P&gt;; VBR is an absolute CPU register&lt;/P&gt;&lt;P&gt;; SDRAM is at 0x00000000+0x0400000&lt;/P&gt;&lt;P&gt;writecontrolreg 0x0801 0x00000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set RAMBAR = 0x20000001&lt;/P&gt;&lt;P&gt;; RAMBAR is an absolute CPU register&lt;/P&gt;&lt;P&gt;; This is the location of the internal 64k of SRAM on the chip&lt;/P&gt;&lt;P&gt;writecontrolreg 0x0C05 0x20000001&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set PAR_SDRAM to allow SDRAM signals to be enabled&lt;/P&gt;&lt;P&gt;writemem.b 0x40100046 0x3F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set PAR_AD to allow 32-bit SDRAM if the exteranl boot device is 16-bits&lt;/P&gt;&lt;P&gt;writemem.b 0x40100040 0xE1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Turn off WCR&lt;/P&gt;&lt;P&gt;writemem.w 0x40140000 &amp;nbsp;0x0000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 1MB ASRAM on CS1 at 0x30000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x4000008C &amp;nbsp; 0x3000 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSAR1&lt;/P&gt;&lt;P&gt;writemem.l 0x40000090 &amp;nbsp; 0x000F0001 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSMR1&lt;/P&gt;&lt;P&gt;writemem.w 0x40000096 &amp;nbsp; 0x3D20 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSCR1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 2MB FLASH on CS0 at 0xFFE00000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x40000080 &amp;nbsp; 0xFFE0 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSAR0&lt;/P&gt;&lt;P&gt;writemem.l 0x40000084 &amp;nbsp; 0x001F0001 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSMR0&lt;/P&gt;&lt;P&gt;writemem.w 0x4000008A &amp;nbsp; 0x1980 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSCR0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;delay 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 16 MB SDRAM&lt;/P&gt;&lt;P&gt;; Like the 5307 and 5407 Cadre 3 boards, this board uses DCR,DACR, DMR to access SDRAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x40000040 &amp;nbsp; 0x0446 &amp;nbsp; &amp;nbsp; ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 &amp;nbsp; 0x00001300 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x4000004C &amp;nbsp; 0x00FC0001 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 &amp;nbsp; 0x00001308 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x00000000 &amp;nbsp; 0x00000000 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Wait a bit&lt;/P&gt;&lt;P&gt;delay 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Initialize SDRAM with a write&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 0x00009300;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 0x00009340;&lt;/P&gt;&lt;P&gt;writemem.l 0x00000400 0x00000000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Wait a bit more&lt;/P&gt;&lt;P&gt;delay 600&lt;/P&gt;&lt;P&gt;writemem.w 0x40140000 &amp;nbsp; 0x0000 ; disable the watchdog timer in WCR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the following lines before initialising hardware:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;asm&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;move.l &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;#(__IPSBAR + 1),d0&lt;/P&gt;&lt;P&gt;move.l &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;d0,0x40000000&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint8 *)0x40100046) = 0x3F;&lt;/P&gt;&lt;P&gt;(*(uint8 *)0x40100040) = 0xE1;&lt;/P&gt;&lt;P&gt;MCF_WTM_WCR = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x4000008C) = 0x3000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000090) = 0x000F0001;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000096) = 0x3D20;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000080) = 0xFFE0;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000084) = 0x001F0001;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x4000008A) = 0x1980;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000040) = 0x0446;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000048) = 0x00009340;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x00000000) = 0x00000000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x00000400) = 0x00000000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x4000004C) = 0x00FC0001;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Processor works wrongly when I reset it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hari&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by habha on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-04-07&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:23 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by habha on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-04-07&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:24 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Apr 2009 02:16:00 GMT</pubDate>
    <dc:creator>habha</dc:creator>
    <dc:date>2009-04-08T02:16:00Z</dc:date>
    <item>
      <title>On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169012#M6107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have programmed M5234 using codewarrior 7.1. It is behaving rightly when I run code from codewarrior GUI, but once I reset the processor it goes crazy.&lt;/P&gt;&lt;P&gt;Its the same with RAM or Flash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My program did configure eTPU channel to output PWM(1Khz,50%) and toggling another eTPU GPIO channel. When run from CW(CodeWarrior) its working as intended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I restart PWM output will 250Hz, 25%. whatever I program this PWM output will be the same on reset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody suggest me where I am going wrong. Am I forgetting to initialize something?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 05:21:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169012#M6107</guid>
      <dc:creator>habha</dc:creator>
      <dc:date>2009-04-02T05:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169013#M6108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The time I typically see a difference between running in the debugger and running after a reset is if my debugger CFG file is initializing something I'm forgetting to (re)initialize in the code.&amp;nbsp; The debugger will run thru the lines of the CFG file after the MCU is reset and before the MCU starts running.&amp;nbsp; That doesn't happen after a normal reset.&amp;nbsp; (I actually use this to *detect* if I am running in the debugger, BTW.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a lot of stuff in your CFG file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've even seen CFG files turn off watchdog timers...&amp;nbsp; If you run in the debugger, everything is fine...&amp;nbsp; If you run outside of it, boom, the watchdog pops and you magically reset (over and over) in a few milliseconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's also a good idea to read the RSR on boot and do something special (detectable) if you reset for any unexpected reasons, like the watchdog popping, otherwise those things can be hard to detect.&amp;nbsp; (I had unexpected LVD resets occurring on another MCU as we powered up,&amp;nbsp;and did not track them down until I put in special instrumentation to read RSR -- I then flashed LEDs to indicate it had happened before proceeding with the boot.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 05:41:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169013#M6108</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2009-04-02T05:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169014#M6109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see your point about ".cfg". But how to include .cfg implementation in our image?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought of including it in "_startup()" of startcf.c . But &amp;nbsp;some syntax errors occured.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 06:04:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169014#M6109</guid>
      <dc:creator>habha</dc:creator>
      <dc:date>2009-04-02T06:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169015#M6110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's in your CFG file?&amp;nbsp; We'll need to make sure each line has a corresponding line in your startup code, or that the line is unnecessary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just as an example, if your CFG file had a line like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;; Turn off WCR&lt;BR /&gt;writemem.w 0x40140000&amp;nbsp; 0x0000&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you'd be running w/o a watchdog under the debugger (since the debugger set WCR to 0x0000), but with a watchdog otherwise (since WCR defaults to 0x000f, according to the RM).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to set the same state in your initialization code, you'd first search your header files for the register at that address and you would find (in MCF5234_WTM.h?):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;#define MCF_WTM_WCR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(*(vuint16*)(&amp;amp;__IPSBAR[0x140000]))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you would want to set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;MCF_WTM_WCR = 0;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your startup code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, you want to not depend on the CFG file when you are running, and unless you've coded up watchdog routines, you probably don't want the watchdog enabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 06:18:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169015#M6110</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2009-04-02T06:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169016#M6111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could replace all the code of ".cfg" using "C" statements instead of asm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"writecontrolreg 0x0801 0x00000000" --- how to write this in "C" or "asm"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i understand "writemem.b 0x40100040 0xE1" --&amp;gt; "*(uint8_t *) (0x40100040) = 0xE1"&amp;nbsp;in "C"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 10:50:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169016#M6111</guid>
      <dc:creator>habha</dc:creator>
      <dc:date>2009-04-02T10:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169017#M6112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably want to be careful about what you copy from the CFG file to your .c or .asm file -- some of the lines in the CFG are only appropriate for debugging (for example, I actually turn off processor status signals when not under the debugger, to reduce emi)...&amp;nbsp; My usual approach is to remove unnecessary code from the CFG, and to copy only what I really need to C.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; "writecontrolreg 0x0801 0x00000000" --- how to write this in "C" or "asm"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The control registers are likely already set up in your C code...&amp;nbsp; You can see them listed in table 3-5 of your Reference Manual.&amp;nbsp; 0x801 is the VBR and 0xC05 is RAMBAR, and they are both written with asm MOVEC.&amp;nbsp; My guess is your startup code already sets these.&amp;nbsp; Obviously if you point VBR somewhere other than flash, you have to make sure all the vectors are copied there before you enable interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have to do it yourself, it looks something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; move.l&amp;nbsp; #0x00000000,d0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; movec&amp;nbsp;&amp;nbsp;d0,VBR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you have to be sure your assembler/compiler is set to the right MCU or you can silently generate the wrong opcode for the movec.&amp;nbsp; And the RAMBAR name might be RAMBAR0 or RAMBAR1&amp;nbsp;or something else -- I haven't used that MCU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the RAMBAR CPU space register is distinct from&amp;nbsp;the SCM&amp;nbsp;&lt;FONT size="2"&gt;MCF_SCM_RAMBAR -- the former is for CPU access to SRAM and the latter is for peripheral access to SRAM.&amp;nbsp; You may have to set both during startup.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Rich&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2009 11:22:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169017#M6112</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2009-04-02T11:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169018#M6113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added all the code in ".cfg" into my ".c" file before initialising hardware. But still it is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my ".cfg" file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;ResetHalt&lt;/P&gt;&lt;P&gt;Delay 200&lt;/P&gt;&lt;P&gt;Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set VBR to the beginning of what will be SDRAM&lt;/P&gt;&lt;P&gt;; VBR is an absolute CPU register&lt;/P&gt;&lt;P&gt;; SDRAM is at 0x00000000+0x0400000&lt;/P&gt;&lt;P&gt;writecontrolreg 0x0801 0x00000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set RAMBAR = 0x20000001&lt;/P&gt;&lt;P&gt;; RAMBAR is an absolute CPU register&lt;/P&gt;&lt;P&gt;; This is the location of the internal 64k of SRAM on the chip&lt;/P&gt;&lt;P&gt;writecontrolreg 0x0C05 0x20000001&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set PAR_SDRAM to allow SDRAM signals to be enabled&lt;/P&gt;&lt;P&gt;writemem.b 0x40100046 0x3F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Set PAR_AD to allow 32-bit SDRAM if the exteranl boot device is 16-bits&lt;/P&gt;&lt;P&gt;writemem.b 0x40100040 0xE1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Turn off WCR&lt;/P&gt;&lt;P&gt;writemem.w 0x40140000 &amp;nbsp;0x0000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 1MB ASRAM on CS1 at 0x30000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x4000008C &amp;nbsp; 0x3000 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSAR1&lt;/P&gt;&lt;P&gt;writemem.l 0x40000090 &amp;nbsp; 0x000F0001 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSMR1&lt;/P&gt;&lt;P&gt;writemem.w 0x40000096 &amp;nbsp; 0x3D20 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSCR1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 2MB FLASH on CS0 at 0xFFE00000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x40000080 &amp;nbsp; 0xFFE0 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSAR0&lt;/P&gt;&lt;P&gt;writemem.l 0x40000084 &amp;nbsp; 0x001F0001 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSMR0&lt;/P&gt;&lt;P&gt;writemem.w 0x4000008A &amp;nbsp; 0x1980 &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;; CSCR0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;delay 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; 16 MB SDRAM&lt;/P&gt;&lt;P&gt;; Like the 5307 and 5407 Cadre 3 boards, this board uses DCR,DACR, DMR to access SDRAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.w 0x40000040 &amp;nbsp; 0x0446 &amp;nbsp; &amp;nbsp; ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 &amp;nbsp; 0x00001300 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x4000004C &amp;nbsp; 0x00FC0001 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 &amp;nbsp; 0x00001308 ;&lt;/P&gt;&lt;P&gt;writemem.l 0x00000000 &amp;nbsp; 0x00000000 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Wait a bit&lt;/P&gt;&lt;P&gt;delay 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Initialize SDRAM with a write&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 0x00009300;&lt;/P&gt;&lt;P&gt;writemem.l 0x40000048 0x00009340;&lt;/P&gt;&lt;P&gt;writemem.l 0x00000400 0x00000000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;; Wait a bit more&lt;/P&gt;&lt;P&gt;delay 600&lt;/P&gt;&lt;P&gt;writemem.w 0x40140000 &amp;nbsp; 0x0000 ; disable the watchdog timer in WCR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the following lines before initialising hardware:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;asm&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;move.l &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;#(__IPSBAR + 1),d0&lt;/P&gt;&lt;P&gt;move.l &lt;SPAN class="Apple-tab-span"&gt;&lt;/SPAN&gt;d0,0x40000000&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint8 *)0x40100046) = 0x3F;&lt;/P&gt;&lt;P&gt;(*(uint8 *)0x40100040) = 0xE1;&lt;/P&gt;&lt;P&gt;MCF_WTM_WCR = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x4000008C) = 0x3000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000090) = 0x000F0001;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000096) = 0x3D20;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000080) = 0xFFE0;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000084) = 0x001F0001;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x4000008A) = 0x1980;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(*(uint16 *)0x40000040) = 0x0446;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x40000048) = 0x00009340;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x00000000) = 0x00000000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x00000400) = 0x00000000;&lt;/P&gt;&lt;P&gt;(*(uint32 *)0x4000004C) = 0x00FC0001;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Processor works wrongly when I reset it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hari&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by habha on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-04-07&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:23 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by habha on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-04-07&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:24 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 02:16:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169018#M6113</guid>
      <dc:creator>habha</dc:creator>
      <dc:date>2009-04-08T02:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: On reset processor behaves differently</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169019#M6114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I could not read your post -- the line endings looked like they got munged.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I definitely would not suggest just translating the entire cfg file to C since what you really want to do depends a lot on what the rest of your initialization sequence does, and many of the lines of the cfg file may be superfluous anyway...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;However, if you want a literal translation, I believe it is:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;
volatile static int g;asm {  move.l #0x00000000,d0  movec d0,VBR  move.l #0x20000001,d0  movec d0,RAMBAR}*(vuint8 *)0x40100046 = 0x3F;*(vuint8 *)0x40100040 = 0xE1;*(vuint16 *)0x40140000 = 0x0000;*(vuint16 *)0x4000008C = 0x3000;*(vuint32 *)0x40000090 = 0x000F0001;*(vuint16 *)0x40000096 = 0x3D20;*(vuint16 *)0x40000080 = 0xFFE0;*(vuint32 *)0x40000084 = 0x001F0001;*(vuint16 *)0x4000008A = 0x1980;for (g = 0; g &amp;lt; 100*100000; g++) ;*(vuint16 *)0x40000040 = 0x0446;*(vuint32 *)0x40000048 = 0x00001300;*(vuint32 *)0x4000004C = 0x00FC0001;*(vuint32 *)0x40000048 = 0x00001308;*(vuint32 *)0x00000000 = 0x00000000;for (g = 0; g &amp;lt; 100*100000; g++) ;*(vuint32 *)0x40000048 = 0x00009300;*(vuint32 *)0x40000048 = 0x00009340;*(vuint32 *)0x00000400 = 0x00000000;for (g = 0; g &amp;lt; 600*100000; g++) ;*(vuint16 *)0x40140000 = 0x0000;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Note especially that you should disassemble the movec instructions and ensure that they refer to registers 0x0801 and 0x0C05.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;My recommendation would be to a) understand everything in your cfg file, and then b) remove all lines that are unnecessary for your configuration, and then c) incorporate the remaining lines into your C initialization which were not otherwise already handled in a different way already.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;-- Rich&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:16:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/On-reset-processor-behaves-differently/m-p/169019#M6114</guid>
      <dc:creator>RichTestardi</dc:creator>
      <dc:date>2020-10-29T09:16:36Z</dc:date>
    </item>
  </channel>
</rss>

