CW, MQX, PE, Flexbus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW, MQX, PE, Flexbus

490 Views
sjh
Contributor I

I am trying to get the flexbus working with an 8 bit peripheral. I have CW, MQX and PE installed and working.

hardware designer, haven't written C for a long time, never used Eclipse before, or any real time OS so some things that are obvious to an experienced software person might need a little extra explanation.
I have two questions, first is getting the flexbus setup correctly, the second is about removing stuff I don't need without breaking the compile.

I have a tower k60F system wired up to some external hardware. I have successfully compiled and run the PE demo. Then I added some PE LDD components (GPIO and SPI slave) and moved the RS232 port to different pins. I can toggle the GPIOs and the RS232 port works in it's new location. I haven't tried the SPI interface yet but I expect it to work OK because the PE configuration was straightforward.

The problem is with the flexbus interface and CW / MQX / PE combo.  PE says that the flexbus is configured in MQX. In init_hw.c there are the following lines:

#if PE_LDD_VERSION

  __pe_initialize_hardware();

#else

  _bsp_initialize_hardware();

I know it's using the pe_initialize because I edited the bsp_initialize files but it didn't have any effect. The pe code is generated so I can't edit it, but it does have a call to a user init. I found the file that calls the user function once but I can't seem to locate it again. Can someone tell me where it is so I can get the name of the function I need to write to initialize the flexbus the way I want it.

I found in other discussions that the address used for the MRAM and LCD are cachable so I should move my peripheral up to A000000 if I don't want to turn off caching. I will be using CS0 and CS1 so I have to overwrite the flexbus settings that are generated for the MRAM and LCD. I don't need the MRAM or LCD config so how do I get CW / PE to stop generating the flexbus config for them without breaking something in the compile?

The external devices are DS26521 T1 framers. I have actually managed to read the ID because the mram config was close enough for some data to come out but I know the bus isn't correct yet and the caching probably didn't help either. I am sure I can get it to work right I just need a couple pointers to the right files to edit to get the flexbus set up correctly.

Thanks,

Steve

0 Kudos
2 Replies

280 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Steven,

In C:\Freescale\Freescale_MQX_4_1\mqx\source\bsp\twrk60f120m\init_hw.c you will find the functions that initialize flexbus. These functions are

static void _bsp_flexbus_setup (void)

static void _bsp_flexbus_mram_setup (const uint32_t base_address)

The base address is provided by the linker file:

C:\Freescale\Freescale_MQX_4_1\mqx\source\bsp\twrk60f120m\gcc_arm\intflash.ld

__EXTERNAL_MRAM_BASE  = 0xA0000000;

For details about disabling code generation please see the post below:

http://mcuoneclipse.com/2012/03/23/disable-my-code-generation/

Rest regards,

Carlos

0 Kudos

280 Views
sjh
Contributor I

Hi Carlos:

Slow reply because I only get a bit of time now and then to look at this.

I can read and write to the device when I move it to 0xA000000 but I have yet to get it to work the way I want at 0x7000000 even if I add a call to _DCACHE_DISABLE(). I don't know if that call is in the correct place. I don't want to disable code generation because I have more PE components to add.

What I found so far:

in init_hw.c, __pe_initialize_hardware() is called.

That function is found in BSP files -> generated code -> CPU.c

Then to add user code in  __pe_initialize_hardware, in the processor expert components view, select the processor, then in the component inspector select the "build options" tab and there is a place to enter a few lines of text before or after the generated __pe_initialize_hardware() code. This all seems to work but I don't think I need to add any code there. I haven't figured out how to get the flexbus working in the cachable address space.

Where should the call to _DCACHE_DISABLE() go?

The reference I saw to using it referred to putting it at the start of main, but that doesn't apply here since I'm using MQX so all I have is the tasks created based on the example hello project. What would be the correct way to disable caching when using MQX and processor expert?

Thanks,

Steve

0 Kudos