MCF52259 External nvSRAM problems

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

MCF52259 External nvSRAM problems

680 Views
GarRoble
Contributor I

Hi everybody.

 

I'm (once again) in trouble. I've designed a board based on MCF52259 microcontroller and I'm having several problems with the external memory.

 

Hardware Description

------------------------------

The external memory is based on two Cypress CY14B108N-ZSP45XI nvSRAM memory chips. Each chip has 1Mb memory and is 45ns memory. When added, I've got 2Mb installed and connected to the Mini FlexBus port.

 

The mean of connection is by routing FB_A0 directly to BHE signal, and not(FB_A0) using an inverter to BLE. As a result of this, I've connected FB_A[1..19] to memory A[0..18] lines. So that's the address bus. The data bus is connecting this way: FB_D[0..7] connected to D[0..7] and to D[15..8]. (Notice that FB_D0 is connected to D0 and D15.) As you can guess this is exactly the same setup that is used in the tower board.

 

Each memory chip has one chip select (CS0 for one, and CS1 for the other) connected to CE.

 

Software Description

-----------------------------

I've tuned the twrmcf52259 bsp to meet my board requirements. Basically I've changed the function that setups the CS0 and CS1 in order to have the following code:

static void _bsp_flexbus_nvsram_setup (const uint_32 base_address){    VMCF5XXX_MINIFB_STRUCT_PTR fb_ptr = &((VMCF5225_STRUCT_PTR)BSP_IPSBAR)->FB;        /* Enable external nvSRAM mapped on CS0 */    fb_ptr->CSAR0 = MCF5XXX_FBCS_CSAR_BA(base_address);     /* CS0 base address */    fb_ptr->CSCR0 = 0x00000d40;           /* CS0 control (8bit data, 3 waitstate) */    fb_ptr->CSMR0 = MCF5XXX_FBCS_CSMR_BAM_1024K | MCF5XXX_FBCS_CSMR_V; /* CS0 address mask and enable */        /* Enable external nvSRAM mapped on CS1 */    fb_ptr->CSAR1 = MCF5XXX_FBCS_CSAR_BA(base_address)+0x00100000;  /* CS1 base address */    fb_ptr->CSCR1 = 0x00000d40;           /* CS1 control (8bit data, 3 waitstate) */    fb_ptr->CSMR1 = MCF5XXX_FBCS_CSMR_BAM_1024K | MCF5XXX_FBCS_CSMR_V; /* CS1 address mask and enable */}

 base_address is set externally to 0x10000000.

 

In my functions I'm just writing directly to the memory and then reading it.

void write_nvSRAM(uint_8 wr) { char   *pc_posRAM; uint_32  i; uint_32  ui_ramsize = 0x200000; pc_posRAM = (char*)0x10000000; printf("\nWriting RAM memory %x\n", wr); for (i=0; i<ui_ramsize; i++) {  pc_posRAM[i] = wr; }}

 

void read_nvSRAM(uint_8 rd) { char   *pc_posRAM; uint_32  ui_ramsize = 0x200000; uint_32  i, j; uint_8  ui_value = 0; printf("Reading RAM memory %x\n", rd); pc_posRAM = (char*)0x10000000; j = 0; for (i=0; i<ui_ramsize; i++) {  ui_value  = pc_posRAM[i];  if (ui_value != rd) {   //printf("0x%x\n", i);   j++;  } } printf("Finished Reading RAM memory!! There are %d errors.\n", j);}

 

In the main program I just call this functions:

write_nvSRAM(0x00);
read_nvSRAM(0x00);

My problem is that the number of errors that the program find aren't always the same, not even in the same addresses. It doesn't seem to be a problem with one of the address or data lines.

 

Then, I've tried to write directly in the memory via de debugger. This is more extrange if possible. I can only write the even memory positions and not the odd ones. And if I write on an odd memory position, it is written in the previos even position.

 

I'm lost, any idea will be welcomed.

 

Best regards.

Labels (1)
0 Kudos
3 Replies

405 Views
angelo_d
Senior Contributor I

Hi,

 

i had similar issues, but in a slightly different architecture with MCF5307. Generally someting can disturb the data bus.

 

1) In your HW, is there anything else connected to the data bus ? Is there any pull up/down for any bootstrap option ?

0 Kudos

405 Views
GarRoble
Contributor I

Thanks for answering spectrum.

 

In the end I've found that a capacitor attached to A0 (wrongly attached) was half burned and therefore working badly when running the bus at full speed. The capacitor is attached to A0 and 3.3V, it shouldn't make any major problem, but when burnt it becomes unpredictable.

 

Regards.

0 Kudos

405 Views
angelo_d
Senior Contributor I

Uhm, a capacitor in an address line, depending from the value, can cause problems to the bit shape. Anyway, you sure know the reason of it and the right value. Happy you have solved,

 

regards,

angelo

0 Kudos