04-23-2009 09:09 PM
Hi,
I am using LabVIEW ARM Embedded 1.1 with LV 8.6 and the MCB2400 dev-kit. I am trying to write to the external flash on the dev-kit which is connected via the EMC (External Memory Controller). I am using the Peek and Poke VI's with the new XML file from another post. I am able to write to address 0x01 and 0x00 and read them with these VI's. But when I change the address to 0x80000000 to write to the external NOR Flash on the dev-kit it doesn't work. When I read a value from there I get 255 (when using the 8-bit peek VI).
I looked into the LPC2400.s configuration wizard window in uVision3 and found the External Memory Controller Setup (EMC) was unticked. When ticked, I found that only CS0 area was checked in the dynamic and static memory interface setup areas. There is also external NAND flash which I assume should be under static memory CS1, which isn't setup.
My question is:
1. Why is this not already configured when you select the MCB2400 Target when this dev-kit is supported/recommended by LabVIEW?
2. Is there a LPC2400.s file which NI can provide with this parts correctly setup?
Thanks in advanced,
Ben
04-24-2009 11:03 AM - edited 04-24-2009 11:04 AM
Hello Ben,
1. The EMC actually is enabled, just not in the place you are looking.
If you look in the startup file you will see the line:
IF (: DEF:SETUP_EMC):LOR: (EMC_SETUP != 0)
SETUP_EMC is defined in target options, while using the configuration wizard will set EMC_SETUP.
If the EMC wasn't properly enabled, the external SRAM wouldn't work, and I happen to know it works fine. 🙂
2. If you look in the startup file for the line EMC_STACS1_SETUP EQU 0, you can change this to 1 to enable CS1. The memory range is already defined, it's just not enabled by default.
Thank you for pointing this out, perhaps it ought to be enabled by default in the next release. (provided it doesn't have a high resource cost)
Just FYI, If you ever want to allocate code to these sections of memory you have two options:
1. Check the default box next to the memory bank in the target options (in microvision)
2. Use the 'Memory Map' option in LabVIEW by right clicking the build specfication. This lets you allocate code, etc to non-default locations.
As for your difficulties with the peek and poke VIs, I'm afraid I have no experience with these VIs. Hopefully an AE can help you with this issue.
good luck
04-24-2009 06:15 PM - edited 04-24-2009 06:15 PM
Hi Ben,
If you configure things as gmg suggests, do the Peek and Poke VI's work properly for you. If not, can you elaborate on what bahavior you're seeing with those VI's? Then we can look into it further with you.
04-28-2009 12:28 AM
Thanks Gmg for your help.
I have changed EMC_STACS1_SETUP to 1.With it set to either 0 or 1, the memory locatation of 0x81000 0000 was available in the memory map window for the build spec. I also can't find the SETUP_EMC in the target options.. but I created the target via the project wizard...
LaRisa S: The peek and poke still does not work with this variable set to 1. ...I cannot write 0x8000 0001 (CS0) or 0x8100 0001 (CS1).. But I can write to 0x0000 0000 and 0xA0000000.
I have attached the VI I am using to write and read memory addresses. When I try and use 0x8000 0001 ... The value read is always 255. When I use 0x8100 0001 it always reads 0.
The address out poke and peek works correctly. The error status is always 0.
04-28-2009 10:15 AM - edited 04-28-2009 10:18 AM
Some things that might help you guys figure this out...
@BenKeane wrote:
I have changed EMC_STACS1_SETUP to 1.With it set to either 0 or 1, the memory locatation of 0x81000 0000 was available in the memory map window for the build spec. I also can't find the SETUP_EMC in the target options.. but I created the target via the project wizard...
Sorry, I was actually speaking about the target options in Microvision, not in LabVIEW. But this setting is already taken care fo for you.
BenKeane wrote:LaRisa S: The peek and poke still does not work with this variable set to 1. ...I cannot write 0x8000 0001 (CS0) or 0x8100 0001 (CS1).. But I can write to 0x0000 0000 and 0xA0000000.
I have attached the VI I am using to write and read memory addresses. When I try and use 0x8000 0001 ... The value read is always 255. When I use 0x8100 0001 it always reads 0.
The address out poke and peek works correctly. The error status is always 0.
The address should end in 0,4,8, or C to access memory correctly. I would try replaced the +1 primitive in your VI with a +4.
Also, if you are using the simulator, microvision may not like you accessing memory that wasn't already declared as a variable. You will need to explicitly map these regions as read/write on the simulator.
Since you are able to write/read to external RAM at 0xA000 0000, perhaps the issue is that you are working with flash. Why not use the external RAM? If you want to store data in a less volatile region, then you could use a C node to define yout data structures and use the memory map option to allocate the data to your specified region. Then you could use the peek VI to read from this location (or even another C node to access a pointer).
Also, If you want to verify that the memory at CS0 and CS1 are working, you can use memory map to allocate some data there and open microvision and look at the memory (using the memory window).
04-28-2009 06:33 PM
Hi again,
I tired writing to a multiple of 0, 4, 8, etc ... but it doesnt work.
I created a new VI which just has one boolean and tired to map its code space to 0x8100 0000 and I get the following error when trying to compile:
Memory Missmatch!
Address: 0x81000000
Value = 0x00
Expected = 0xFE
Memory Mismatch! Address: 0x81000000
Detail: [UVSC_DBG_ENTER, MSG: 0x2013, STATUS: 0x1F] (31)
Similar to when I use peek and poke.
04-28-2009 10:14 PM
04-28-2009 10:30 PM
I rebuilt-all the build spec, then run by right-hand mouse clicking on the build spec, and clicked run. It erased the flash, downloaded the application, verified, .. then said "Starting Target..." and then got the following error:
Memory Missmatch!
Address: 0x81000000
Value = 0x00
Expected = 0xFE
Memory Mismatch! Address: 0x81000000
Detail: [UVSC_DBG_ENTER, MSG: 0x2013, STATUS: 0x1F] (31)
05-05-2009 02:24 PM
Hi Ben,
Sorry for the delay, my MCB2400 was otherwise tied up.
As I'm sure you've figured out, this issue is occuring because the code is not being loaded on the flash properly, so it differs from the program once the target starts.
I found an example by Keil that uses the external NOR Flash (at 0x80000000) and was able to adapt it into LabVIEW.
1. You probably want to make these changes to your template project so they apply to all future projects you create in LabVIEW. This template project can be found at <LabVIEW folder>\Targets\Keil\Embedded\RealView\MCB2400\Template\Project\LabVIEW.Uv2. Open this project in Microvision.
2. Open the 'Target Options' dialogue and navigate to the 'Utlities' tab then click the 'Settings' button. You will use this dialogue to specify an algorithm for your flash download.
a) click on 'Add' and select 'SST39x320x Flash'
b) set the start to 0x80000000 (the size should already be set to 4MB)
c) click OK to close the dialogue
3. Back on the 'Utilities' tab click the '...' button next to the 'Init File' field and navigate to "C:\Keil\ARM\Boards\Keil\MCB2400\Blinky\Prog_Ext_NOR.ini"
4. Open the LPC2400.s file and verify the following values are set:
5. save/close microvision and re-create your LabVIEW project by deleting the generated folder and doing another build.
This will allow you to use the memory map function to download code to the region of flash at 0x8000 0000 (CS0). However, I've yet to get the block at 0x8100 0000 (CS1) working as there isn't a Keil example that I can find.
05-05-2009 07:42 PM
Thanks Gmg, this has fixed the memory map issue for that area of external memory.
LaRisa_S: The peek and poke functions still don't work for these memory location even though we can ... It seems the peek works, because if I change the memory location 0x80000000, 0x80000004, 0x80000008 .. I get different values read out (unless thats just random data). But I cant write to those locations...