FLEXBUS_DRV functionality to setup up multiple flexbus regions

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

FLEXBUS_DRV functionality to setup up multiple flexbus regions

858 Views
yorknh
Contributor IV

Maybe I'm missing it somewhere, but there doesn't seem to be a clean way to set up multiple regions of the flexbus using the flexbus driver directly. Setting up the first region is simple enough using FLEXBUS_DRV_Init() but you can't call it a second time to set up another region because it calls FLEXBUS_HAL_Init() which clears out all of the flexbus registers, thus clobbering the settings for the first region. I know I can access the appropriate registers directly, or call FLEXBUS_HAL_Configure(), but isn't the point of the abstraction layers and ultimately the driver to make it so the user doesn't have to have intimate knowledge of the lower layers?

 

My suggestion would be that FLEXBUS_DRV_Init() does what it does now, minus the call to FLEXBUS_HAL_Configure(). A new function should be added, something like FLEXBUS_DRV_AddRegion( const flexbus_user_config_t* userConfigPtr ) that allows you to set up different parameters for different chip selects without having to muck with registers directly or having to reference g_fbBase[] for the sake of having a pointer to pass to FLEXBUS_HAL_Configure().

 

Anyone else run into this, or am I missing something?

Labels (1)
3 Replies

530 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Larry,

Yes, it's unavailable to configure additional region by using some specific functions that from the KSDK 1.2.0.

Below is an example of setup flow, and you can follow the flow to setup other regions of the FlexBus.

#define FLEX_BASE_ADDRESS     0x6000
#define SRAM_BASE_ADDRESS     0x8000
#define FLEX_ADRESS_MASK      0x000f
#define MRAM_CHIP_SELECTION    2
#define LCD_CHIP_SELECTION     0

void lcd_flexbus_init(void)

{

configure_flexbus_pins(0);
CLOCK_HAL_SetDivider(SIM_BASE,kClockDividerOutdiv3,3);
SIM_HAL_SetFlexbusSecurityLevelMode(SIM_BASE,kSimFbslLevel3);
SIM_HAL_EnableFlexbusClock(SIM_BASE,0);
FB_HAL_SetChipSelectValidCmd(FB_BASE,LCD_CHIP_SELECTION,1);
FB_HAL_WriteBaseAddr(FB_BASE,LCD_CHIP_SELECTION,FLEX_BASE_ADDRESS);  
FB_HAL_SetByteLaneShift(FB_BASE,LCD_CHIP_SELECTION,kFlexbus_shifted); 
FB_HAL_SetAutoAcknowledgeCmd(FB_BASE,LCD_CHIP_SELECTION,1);
FB_HAL_SetPortSize(FB_BASE,LCD_CHIP_SELECTION,kFlexbus_2bytes); 
FB_HAL_SetByteModeCmd(FB_BASE,MRAM_CHIP_SELECTION,1);
FB_HAL_SetMultiplexControlGroup2(FB_BASE,kFlexbus_multiplex_group2_FB_BE_31_24);
FB_HAL_SetMultiplexControlGroup3(FB_BASE,kFlexbus_multiplex_group3_FB_BE_23_16);
FB_HAL_SetMultiplexControlGroup4(FB_BASE,kFlexbus_multiplex_group4_FB_CS2);

}


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

530 Views
davidtietz
Contributor III

Hi Ping,

Definitely correct me if I am wrong, but I don't think some of these calls are supported in KSDK 1.2.

For example FB should be Flexbus. FB_HAL_WriteBaseAddr should be Flexbus_HAL_WriteAddr, etc.

Thanks,

David

0 Kudos

530 Views
jeremyzhou
NXP Employee
NXP Employee

Hi David,

Thanks for your feedback.

In the KSDK 1.2, it should use the Flexbus_HAL_WriteAddr instead of the FB_HAL_WriteBaseAddr.
Have a great day,

Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------