SDK 2.11.0 - Inconsistency in SEMC SRAMCR0 init

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

SDK 2.11.0 - Inconsistency in SEMC SRAMCR0 init

Jump to solution
1,230 Views
dmarks_ls
Senior Contributor I

Hi there,

While investigating the issues in my previous post, I discovered there may be an inconsistency in your SEMC driver when initializing the SRAM interface.

A previous user asked about the purpose of the COL field in SRAMCR0, and NXP technician Yuri advised "Bit field COL of SRAM control register 0 (SRAMCR0) is not used, may be zero."  Following is the source code in the FSL SEMC driver that initializes the register (I've removed grayed-out code for clarity):

{
    tempCtrlVal = SEMC_SRAMCR0_PS(config->portSize) |
                  SEMC_SRAMCR0_BL(config->burstLen) | SEMC_SRAMCR0_AM(config->addrMode) |
                  SEMC_SRAMCR0_ADVP(config->advActivePolarity) |
                  SEMC_SRAMCR0_COL_MASK;
}
base->SRAMCR0 = tempCtrlVal;


The issue is that SEMC_SRAMCR0_COL_MASK is 0xF000, not 0.  While both 0000 and 1111 select the same COL value of 12 bits, I'm concerned that setting this field to anything other than its power-on default of 0 might introduce side effects for an unused field.  I suggest changing this code to read:

{
    tempCtrlVal = SEMC_SRAMCR0_PS(config->portSize) |
                  SEMC_SRAMCR0_BL(config->burstLen) | SEMC_SRAMCR0_AM(config->addrMode) |
                  SEMC_SRAMCR0_ADVP(config->advActivePolarity) |
                  SEMC_SRAMCR0_COL(0);
}
base->SRAMCR0 = tempCtrlVal;


There is also a similar use of the SEMC_SRAMCR0_COL_MASK macro about 14 lines prior that should also be replaced with SEMC_SRAMCR0_COL(0).

David R.

0 Kudos
1 Solution
1,206 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @dmarks_ls ,

Yes, you are right. I'll report this suggestion.

 

Regards,

Jing

View solution in original post

0 Kudos
3 Replies
1,219 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @dmarks_ls ,

I've answered your previous question. But this is not the issue I think. 

 

Regards,

Jing

0 Kudos
1,212 Views
dmarks_ls
Senior Contributor I

Agreed, this item did not affect the behavior of my system.  However, I would argue that it is more correct to use SEMC_SRAMCR0_COL(0) in your code instead of SEMC_SRAMCR0_COL_MASK.  That's all.

David R.

0 Kudos
1,207 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @dmarks_ls ,

Yes, you are right. I'll report this suggestion.

 

Regards,

Jing

0 Kudos