기존의 5517 + 7020 HD 보드에 POD 를 붙이면서 생겼던 문제에 대해서 설명했다. 먼저 이 문서의 제목을 보고, 선뜻 의미를 이해하기 어려울 지도 모르겠다. 하지만, 이 문서를 다 읽었을 때 쯤이면 이해할 것이라 굳게 믿고 있다.
들어가기 전에
POD 를 마지막으로 테스트 했던 것은 예전에 PCB Ver2 보드가 마지막이었다. 그 이후로는 SMPS 의 파워용량 때문에 POD 테스트를 할 때는 반드시 7020 관련 루틴을 주석처리했었다. 물론 반대의 경우도 마찬가지였다.
이렇게 테스트한 결과, POD 는 성공적으로 잘 돌아가는 듯 했다.
한가지 걱정은 아직 한번도 Full 테스트를 못해봤다는 것이었다.
발생된 문제
먼저, 현재 마지막 프로그램(8월 8일자)에 POD, SI 를 붙였다. 이때, 다른 모듈과 연동되는 부분(cm, nim, ui)은 모두 주석처리했다. main 함수에 pod 를 초기화하는 루틴을 넣고, 돌려봤다. 아니나다를까 제대로 돌아가지 않았다.
테스트
정확한 실험결과를 얻기위해, POD 가 붙은 보드 중에 A/V 가 잘되는 HDT HD 보드 1 대와 HDT SD 보드 1 대를 준비했다. 원래 각각 2대를 준비하기로 했으나, 찾기가 쉽지 않았다.
S/W 는 POD 를 포팅한 마지막 버전과 DACS1000 의 마지막 버전을 준비했다.
테스트의 결과는 아래 표와 같다.
HD 보드 | SD 보드 | ||
DAC5000 | cis read 이상(0xFF 로 읽힘) | cis read 이상(0x22 로 읽힘) | |
DACS1000 | pod ok | pod ok |
이상한 것은 DACS1000 의 경우 H/W 에 상관없이 잘 돌아간다는 것이었다. 이것으로써, H/W 는 문제가 없다는 결론을 내릴 수 있었다. 문제는 바로 S/W!!
그래서 DACS1000 과 DAC5000 의 다른 점을 몇가지 찾을 수 있었다.
mb382_emi.cfg 파일
DAC5000 의 경우 POD 가 사용하는 bank2, bank3 에 대한 세팅이 빠져 있었다. 그래서 다음과 같이 수정했다.
## Bank 0 ## configured for 32Mb sdram (non-subdecoded) ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-strobeonfalling 0 -busreleasetime 3 -subbanks 1 -subbanksize 256 -shiftamount 9 -portsize 16 ## -rasbits 0x1fffc -prechargetime 3 -modesetdelay 3 -refreshtime 9 -activatetoread 3 ## -activatetowrite 3 -caslatency 3 -drambanks 1 -writerecoverytime 2 -sdrammodereg 0x32 ## -latencymode 3 -bursttype 0 -burstlength 2 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##TK poke -d 0x20200100 0x00004352 ## EMIConfigData0. ##TK poke -d 0x20200108 0x000FFFFC ## EMIConfigData1. Page address mask. poke -d 0x20200100 0x00004452 ## EMIConfigData0. poke -d 0x20200108 0x000FFFF8 ## EMIConfigData1. Page address mask. poke -d 0x20200110 0x00000020 ## EMIConfigData2. Precharge time (bits 7:4 => 1 to 16 sdram cycles) poke -d 0x20200118 0x00010929 ## EMIConfigData3. SDRAM memory read/write parameters ## Bank 1 ## STEM0. Configured as 16-bit peripheral ## Original STEM config edited out by MGB 9/4/02 poke -d 0x20200140 0x002006f1 ## Device=Per,32bit bus,BE=inactive,OE=activeread,CS=activeboth,BusRel=0, ## Datadrivedelay=0,latchpoint=3cyc,WaitPol=acthigh,WE_use_OE_config=0 poke -d 0x20200148 0x1f200044 ## Read BEe1=BEe2=OEe1=OEe2=0,CSe1=CSe2=2phases,Access=8cycles poke -d 0x20200150 0x1f220000 ## Write BEe1=BEe2=OEe1=OEe2=0,CSe1=CSe2=2phases,Access=8cycles poke -d 0x20200158 0x0000000a ## Bank 2 - STEM1 Configured as 16-bit peripheral ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-bank 2 -type Peripheral -weuseoeconfig 0 -waitpolarity 0 -latchpoint 1 -datadrivedelay 2 ## -busreleasetime 2 -csactive 3 -oeactive 1 -beactive 3 -portsize 16 -devicetype 1 ## -cyclenotphaseread 0 -accesstimeread 6 -cse1timeread 1 -cse2timeread 1 -oee1timeread 2 ## -oee2timeread 1 -bee1timeread 2 -bee2timeread 1 -cyclenotphasewrite 0 -accesstimewrite 7 ## -cse1timewrite 1 -cse2timewrite 1 -oee1timewrite 2 -oee2timewrite 2 -bee1timewrite 2 ## -bee2timewrite 2 -strobeonfalling 0 -burstsize 2 -datalatency 2 -dataholddelay 2 -burstmode 0 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##TK poke -d 0x20200180 0x001116f1 ## EMIConfigData0. Peripheral format settings ##TK poke -d 0x20200188 0x04112121 ## EMIConfigData1. Peripheral read configuration ##TK poke -d 0x20200190 0x05112222 ## EMIConfigData2. Peripheral write configuration ##TK poke -d 0x20200198 0x0000000a ## EMIConfigData3. Peripheral read/write configuration poke -d 0x20200180 0x001116f1 ## EMIConfigData0. Peripheral format settings poke -d 0x20200188 0x06210000 ## EMIConfigData1. Peripheral read configuration poke -d 0x20200190 0x06210000 ## EMIConfigData2. Peripheral write configuration poke -d 0x20200198 0x0000000a ## EMIConfigData3. Peripheral read/write configuration ######from US##### ## poke -d 0x20200180 0x00101671 ## 00000 0 0 00001 00000 0010 11 00 11 10 001 ## poke -d 0x20200188 0x06210000 ## poke -d 0x20200190 0x06210000 ## poke -d 0x20200198 0x00000000 ## !!! Note - These are faster timings to support up to PIO mode 4. !!! ## Bank 3 - ATAPI/DVB-CI. Configured as 16-bit peripheral -------->>>>>> 수정 ## Amended by AL 17/5/02 for ATA PIO mode 4 timings ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-bank 3 -type Peripheral -weuseoeconfig 0 -waitpolarity 0 -latchpoint 3 -datadrivedelay 12 ## -busreleasetime 0 -csactive 3 -oeactive 3 -beactive 0 -portsize 16 -devicetype 1 ## -cyclenotphaseread 0 -accesstimeread 16 -cse1timeread 0 -cse2timeread 2 -oee1timeread 8 ## -oee2timeread 7 -bee1timeread 2 -bee2timeread 2 -cyclenotphasewrite 0 -accesstimewrite 16 ## -cse1timewrite 0 -cse2timewrite 2 -oee1timewrite 8 -oee2timewrite 7 -bee1timewrite 2 ## -bee2timewrite 2 -strobeonfalling 0 -burstsize 2 -datalatency 2 -dataholddelay 2 -burstmode 0 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##poke -d 0x202001c0 0x00360791 ## EMIConfigData0. Peripheral format settings ##poke -d 0x202001c8 0x10028722 ## EMIConfigData1. Peripheral read configuration ##poke -d 0x202001d0 0x10028722 ## EMIConfigData2. Peripheral write configuration ##poke -d 0x202001d8 0x0000000a ## EMIConfigData3. Peripheral read/write configuration ## poke -d 0x202001c0 0x04000F99 ## 가장 처음 보드 원래 세팅값 version 1,2 poke -d 0x202001c0 0x04000e99 ## 가장 처음 보드 원래 세팅값 version 3,4 마지막 ## poke -d 0x202001c0 0x5F00E99 ##poke -d 0x202001c0 0x06000F99 ## we_use_oe_config = 1 , waitpolarity = 1 , oe : read and write version 3,4 ##poke -d 0x202001c0 0x06000E99 ## we_use_oe_config = 1 , waitpolarity = 1 , oe : read only version 3,4 ##poke -d 0x202001c0 0x04000F99 ## we_use_oe_config = 1 , waitpolarity = 0 , oe : read and write version 4,3 ##poke -d 0x202001c0 0x04000F99 ## we_use_oe_config = 1 , waitpolarity = 0 , oe : read only , oe 이 read only로 세팅 write 일때 움직이지 않음 ##poke -d 0x202001c0 0x02000F99 ## waitpolarity = 1 , oe : read and write version 1,2 ## poke -d 0x202001c0 0x00000e99 ## ##poke -d 0x202001c8 0x1000ff00 ## dvb-ci ##poke -d 0x202001c8 0xf066ca44 ## dvb-ci ##poke -d 0x202001c8 0x10004000 ## 가장 처음 보드 원래 세팅값 ##poke -d 0x202001c8 0x1C005400 ## Attribute Read 250ns fat81 250 ns ##poke -d 0x202001c8 0x08005400 ## Attribute Read 250ns fat81 250 ns ##poke -d 0x202001c8 0x3900f600 ## Attribute Read SCM 600ns fat81 600 ns ##poke -d 0x202001c8 0x1C00ff00 ##poke -d 0x202001c8 0x3600F300 ## Attribute Read LSI 600ns fat81 600 ns poke -d 0x202001c8 0x1800d500 ## IO Read LSI(read & write), SCM(read) 250ns fat81 250 ns ##poke -d 0x202001c8 0x9800D500 ##poke -d 0x202001d0 0x176C4000 ## EMIConfigData2. Peripheral write configuration ##poke -d 0x202001d0 0x17747400 ## Attribute Write 250ns fat81 250 ns poke -d 0x202001d0 0x1774c400 ## IO Write 250ns fat81 250 ns ## poke -d 0x202001d0 0x3601ff00 ## Attribute Write SCM 600ns fat81 600 ns ##poke -d 0x202001d0 0x36010000 ##poke -d 0x202001d0 0x1774ff00 ##poke -d 0x202001d0 0x3601af00 ## Attribute Write LSI 600ns fat81 600 ns ##poke -d 0x202001d0 0x10220000 ## 가장 처음 보드 원래 세팅값 poke -d 0x202001d8 0x00000040 ##poke -d 0x202001c0 0x02000F99 ##poke -d 0x202001c0 0x021607f9 ## EMIConfigData0. Peripheral format setting ##poke -d 0x202001c8 0x10004000 ##poke -d 0x202001c8 0x ##poke -d 0x202001c8 0xf066ca44 ## EMIConfigData1. Peripheral read configuration ##poke -d 0x202001d0 0xf066ca44 ## EMIConfigData2. Peripheral write configuration ##poke -d 0x202001d8 0x0000000a ##poke -d 0x202001c0 0x02000E99 ## EMIConfigData0. Peripheral format setting ##poke -d 0x202001c8 0xf066ca44 ## EMIConfigData1. Peripheral read configuration ##poke -d 0x202001d0 0x10220000 ## EMIConfigData2. Peripheral write configuration ##poke -d 0x202001d8 0x00000040 ## Bank 4 - Configured as 16-bit flash normal -------->>>>>> 수정 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-bank 4 -type Peripheral -weuseoeconfig 0 -waitpolarity 0 -latchpoint 0 -datadrivedelay 0 ## -busreleasetime 1 -csactive 3 -oeactive 1 -beactive 0 -portsize 16 -devicetype 1 ## -cyclenotphaseread 0 -accesstimeread 18 -cse1timeread 0 -cse2timeread 0 -oee1timeread 4 ## -oee2timeread 0 -bee1timeread 0 -bee2timeread 0 -cyclenotphasewrite 0 -accesstimewrite 18 ## -cse1timewrite 2 -cse2timewrite 2 -oee1timewrite 0 -oee2timewrite 0 -bee1timewrite 0 ## -bee2timewrite 0 -strobeonfalling 0 -burstsize 2 -datalatency 16 -dataholddelay 1 -burstmode 0 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##poke -d 0x20200200 0x00000e99 # default ##poke -d 0x20200208 0x10004000 # default ##poke -d 0x20200210 0x10220000 #default ##poke -d 0x20200218 0x00000040 # default ##poke -d 0x20200200 0x04000F99 poke -d 0x20200200 0x04000e99 poke -d 0x20200208 0x1800d500 poke -d 0x20200210 0x1774c400 poke -d 0x20200218 0x00000040 ## Bank 5 - Configured as 16-bit flash normal ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-bank 4 -type Peripheral -weuseoeconfig 0 -waitpolarity 0 -latchpoint 0 -datadrivedelay 0 ## -busreleasetime 1 -csactive 3 -oeactive 1 -beactive 0 -portsize 16 -devicetype 1 ## -cyclenotphaseread 0 -accesstimeread 18 -cse1timeread 0 -cse2timeread 0 -oee1timeread 4 ## -oee2timeread 0 -bee1timeread 0 -bee2timeread 0 -cyclenotphasewrite 0 -accesstimewrite 18 ## -cse1timewrite 2 -cse2timewrite 2 -oee1timewrite 0 -oee2timewrite 0 -bee1timewrite 0 ## -bee2timewrite 0 -strobeonfalling 0 -burstsize 2 -datalatency 16 -dataholddelay 1 -burstmode 0 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ poke -d 0x20200240 0x00000e91 poke -d 0x20200248 0x10004000 poke -d 0x20200250 0x10220000 poke -d 0x20200258 0x00000040 ## Others ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Parameters:-proc-name EMIpokes5514 -chip 5514 -base-address 0x20200000 -lock 0 -csa-type 1 -csb-type 0 ## -csc-type 0 -csd-type 0 -emi-wait 4 -bank0addshift 1 -bank1addshift 1 -bank2addshift 1 ## -bank3addshift 1 -bank4addshift 1 -bank5subdecode 0 -bank5subbanksize 4 ## -refreshinterval 4096 -flashclksel 0 -sdramclksel 0 -mpxclksel 0 -clockenable 1 ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ poke -d 0x20200020 0x00000000 ## EMI4.LOCK ## AL 01/05/02. Set bit 17 of GenConfig E for dvb logic enable. Use RmW type operation. ##config_E_val = peek -q 0x20010028 ------>>>> 주석 처리 ##config_E_val |= 0x00020000 ## Set bit 17, leave others unchanged. ------>>>> 주석 처리 ##poke -d 0x20010028 (config_E_val) ## Gen Config E register. ------>>>> 주석 처리 poke -d 0x20200028 0x000007c1 ## EMI4.GENCFG, shift for all banks enabled poke -d 0x20200038 0x00320032 ## EMI4.SDRAMMODEREG CAS=2, Burst Length=4 poke -d 0x20200048 0x00000fff ## EMI4.REFRESHINIT poke -d 0x20200050 0x00000000 ## EMI4.FLASHCLKSEL poke -d 0x20200058 0x00000000 ## EMI4.SDRAMCLKSEL poke -d 0x20200060 0x00000000 ## EMI4.MPXCLKSEL poke -d 0x20200068 0x00000001 ## EMI4.CLKENABLE ## According to the JEDEC standard a delay of 200us must be performed ## between starting the SDRAM clock and making any accesses to SDRAM. ## The following procedure will perform this delay in the ROM ## bootstrap. ## emidelay (400) poke -d 0x20200040 0x00000001 ## EMI4.SDRAMINIT }
중간에 표시 해놓은 부분을 잘 확인하기 바란다. 하지만, 위와 같이 .cfg 파일을 수정했지만, 여전히 cis read 는 제대로 수행되지 않았다. 바로 다음 문제들이 원인 이었다.
7020 부팅 루틴
7020 이 부팅할 때, 아래의 함수를 호출한다. 초기 부분에 레지스터 값을 쓰는 데, 바로 이 부분이 문제였다.
void Set7020Mode_16Bit() { U32 value,val; interrupt_lock(); //STSYS_WriteRegDev32LE(0x20010028, 0x0022003f); ------>>>>>> 기존 세팅 STSYS_WriteRegDev32LE(0x20010028, 0x0020003f); ------>>>>>> 수정한 세팅 STSYS_WriteRegDev32LE(0x20200028, 0x000006c1); value=(*(reg32*)(0x70000000 + 0xb0));//ST7020_VID1_OFFSET); STTBX_Print(("flash 0x70000000 + 0xb0 value =%x",value)); while(1) { // printf("Write EMPI \n"); STTBX_Print(("Write EMPI \n")); STSYS_WriteRegDev32LE((void *) (STI7020_BASE_ADDRESS + 0xb0),0x00000001); task_delay(4000); // printf("Read EMPI \n"); STTBX_Print(("Read EMPI \n")); value=(*(reg32*)(STI7020_BASE_ADDRESS + 0xb0));//ST7020_VID1_OFFSET); if(value==1) break; printf("Change 16bit mode Fail!0x%x\n",value); STTBX_Print(("Change 16bit mode Fail!0x%x\n",value)); task_delay(4000); } // printf("Change 16bit mode OK!\n"); STTBX_Print(("Change 16bit mode OK!\n")); interrupt_unlock(); }
기존의 세팅대로 라면, bank3 을 dvb-ci 모드(즉, personality change read 상태)로 read 된다. 그래서 수정된 값으로 바꾸었다. 수정하고 나니, POD 가 정상적으로 동작하는 듯 했다. 하지만, buffernego 이후에 시스템이 다운되는 현상이 나타났다. 바로 다음의 문제가 원인이었다.
POD personality change 루틴
personality change 시 아래의 함수가 호출된다. 이것 역시, 초반의 레지스터 세팅이 문제였다.
/* ========================================================================= Required Function Decription ========================================================================= */ void ciApiPersonalityChange() { ciApiGpioClean_zero(POD_EN); //GPIO bank=0, port=POD_EN, value=low //*((U32*)(0x20010000+0x28)) = 0x13803F; ------>>>>>> 기존 세팅 *((U32*)(0x20010000+0x28)) = 0x33803F; ------>>>>>> 수정된 세팅 *((U32*)(0x202001c0)) = 0x04000F99; // oe : read and write bank3 *((U32*)(0x20200200)) = 0x04000F99; //oe : reaed and write bank4 task_delay (TICKS_10MS); }
기존의 세팅은 'EMI_ADDRESS_EXPANSION' 옵션을 비활성화 시켰다. (P.207)
7020 이 죽는 이유는 바로 이것이다. 수정된 세팅을 적용했더니, buffernego 이후에도 잘 동작하였다.
결론
결국, 7020 과 POD 가 각각 레지스터 세팅시 서로의 영역을 건드리면서 발생되는 문제였다.
7020 과 POD 의 WAIT 문제
실험결과 POD 는 WAIT 핀을 전혀 사용하지 않았다. 그래서 POD 의 경우 wait 핀을 오픈 시켜놓았다.