@frank_m
Pin configuration. Please note that I am manually configuring each pin instead of using pin_mux.c. All pins are multiplexed as FUNC6 type (EMC function).
@xiangjun_rong
Please find attached signals as probed on oscilloscope. All pins are configured as EMC (including BLSN0 & 1).
In the 1st image, write followed by read of the same location, with a delay of 1us in between is shown. This is done for the first 5 locations in DPRAM ie, 0x8000 0000 to 0x8000 0004 in EMC. Data is '0' to 1st location, 1 to 2nd, 2 to 3rd etc.
In the 2nd image, after running the write/read loop once as mentioned above, the first 5 locations are read consecutively with a 2us delay in between.
Query 1: When addressing an odd location (0x8000 0001, 3, 5 etc) during both read and write cycles, why does/CE, BLSN0, BLSN1, /OE etc toggle twice but only once for even addresses? It looks as though the EMC is trying to access data in odd locations as two separate bytes. All memory reads except the last location fails in this code.
(As pointed out in an earlier response, success rate improves to 50% when BLSN0 & 1 are configured as GPIO and permanently set to logic low. But these images are for all pins configured as type EMC and no GPIO)
5 consecutive (write followed by read), inside while loop
void DPRAM_full_emc_test_code(void){
PRINTF("DPRAM_full_emc_test_code\r\n");
while(1){
DPRAM_Write_to_multiple_loc1_full_emc(0x80000000, 0, DPRAM_param, 5U);
}
delay_1ms(1000U);
__DSB();
__ISB();
}

void DPRAM_full_emc_test_code(void){
PRINTF("DPRAM_full_emc_test_code\r\n");
DPRAM_Write_to_multiple_loc1_full_emc(0x80000000, 0, DPRAM_param, 5U);
delay_1ms(1000U);
__DSB();
__ISB();
while(1){
DPRAM_read_from_multiple_loc1_full_emc(0x80000000, 0, DPRAM_param, 5U);
delay_1ms(1U);
}
}
These are the contents of relevant registers of EMC peripheral:
SYSCON->EMCSYSCTRL: 0x4 // EMCSC bit = 0, burst disabled, EMC clk source is internal loop feedback of EMC_CLK output
EMC->CONTROL: 0x1 // EMC enabled, normal memory map
EMC->STATUS: 0x5 // EMC busy, write buffer empty, self-refresh mode
EMC->CONFIG: 0x0 // little endian
EMC->STATICEXTENDEDWAIT: 0x0
EMC->STATIC[0].STATICCONFIG: 0x81 // 16-bit, page mode disabled, active low chip select, PB bit = 1, extended wait disabled, buffer disabled, writes not protected
EMC->STATIC[0].STATICWAITWEN: 0x0
EMC->STATIC[0].STATICWAITOEN: 0x1
EMC->STATIC[0].STATICWAITRD: 0x4
EMC->STATIC[0].STATICWAITPAGE: 0x0
EMC->STATIC[0].STATICWAITWR: 0x0
EMC->STATIC[0].STATICWAITTURN: 0x0
DPRAM_full_emc_test_code
Ok, p=0, rb_val: 0x0, Add: 0x80000000
Ok, p=1, rb_val: 0x1, Add: 0x80000001
Ok, p=2, rb_val: 0x2, Add: 0x80000002
Ok, p=3, rb_val: 0x3, Add: 0x80000003
Ok, p=4, rb_val: 0x4, Add: 0x80000004
W&R complete
Mismatch, 0, 256, x80000000
Mismatch, 1, 513, x80000001
Mismatch, 2, 770, x80000002
Mismatch, 3, 1027, x80000003
Ok, p=4, rb_val: 0x4, Add: 0x80000004 // last location is a success! Wonder why.