external bus address conversion in HCS12

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

external bus address conversion in HCS12

跳至解决方案
1,671 次查看
yellowmaple
Contributor II

       Hi,I need to use the HCS12(mc9s12kt256mpv) to interface a freescale MFR4310.

       I have got a problem.I can access the external space address now,but the addresses which are sent out are not completely right.For example,when I access (int far*)0x008000,I get 0x8000 at the external bus port,and 0x00 at the XADDR port.when I access (int far*)0x000000(according to the manual this is not a legal address),I get 0x0000 at the external bus port,and 0x3b at the XADDR port.This is not consistent with the conversion scheme in the application notes related. According to the algorithm in the AN when I access 0x008000,I should get :0*0x4000+ (0x8000-0x8000)= 0x000000,not 0x8000.

        I don't know where is the problem.At first ,I thought this would never matter ,because I thought the output address 0x8000 would be OK as well .Then  I interfaced the mc9hcs12kt256 to the Freescale MFR4310,at this moment I realize 0x8000 will never work,it must be the right address 0x0000 with the right xaddr=0x00.I have checked the PRM file and DEBUGGING MEMORY MAP DEBUGGER .I have put this in my PRM file :

PAGE_00 = READ_WRITE 0x008000 TO 0x00BFFF; //linear addr 0x000000 - 0x003FFF //16kB

I have configured the DMM as my real environment:143877_143877.JPGIMG_0533.JPG

         Anyone gives a hand?Thanks.

标签 (1)
0 项奖励
回复
1 解答
1,361 次查看
yellowmaple
Contributor II

Hi,

     My project is a simple one ,I use the MC9S12KT256 to control a bus controller--mfr4310.Because it is the first time to use the HCS12,I want to check whether the signals sent out on the exbus ports are correct.I use the cw5.1 to initiate my device.Here are the key points I think to use the EXbus.

     1.configure the cpu to normal expanded mode,so PORTA and PORTB are used as addr/data bus.

     2.enable the bus control signals,such as Eclk,RD/WR,LBSTROB,and XADDRS.

     3.add the pagedata.c file to the project so I can access paged external address space,for example kt256 PAGE30-PAGE3F are used as internal FLASH,so I can use PAGE00 to               point to my external space.

     4.use *far pointer:volatile unsigned char *far p_RAM_PG_00; // pointer to external memory

                                  p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>

                                                                                                                  // => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000

                                  a2 = *p_RAM_PG_00;

     5.add this command to the compiler:-CpPPAGE=RUNTIME -D__FAR_DATA -CPUHCS12 -D__NO_FLOAT__ -Mb

     6.set the debugging memory map in the debugger as the real chip ,and the picture above in my question has depicted the specific configuration.

     Any thing more need to be configured?please help.And I will add my project as an accessory,it runs well in simulation mode,but when I change into onchip mode,it just become incorrect.I run the code :

                                   p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>

                                                                                                                  // => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000

                                  a2 = *p_RAM_PG_00;

          I can not get 0x000000,but 0x008000 instead.This is wrong ,not consistent with the example.

    

    

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,361 次查看
yellowmaple
Contributor II

Nobody ?

0 项奖励
回复
1,360 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi.

can you please create a demo project thus we can easily reproduce your problem?
Have a great day,
Jennie Zhang

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

0 项奖励
回复
1,362 次查看
yellowmaple
Contributor II

Hi,

     My project is a simple one ,I use the MC9S12KT256 to control a bus controller--mfr4310.Because it is the first time to use the HCS12,I want to check whether the signals sent out on the exbus ports are correct.I use the cw5.1 to initiate my device.Here are the key points I think to use the EXbus.

     1.configure the cpu to normal expanded mode,so PORTA and PORTB are used as addr/data bus.

     2.enable the bus control signals,such as Eclk,RD/WR,LBSTROB,and XADDRS.

     3.add the pagedata.c file to the project so I can access paged external address space,for example kt256 PAGE30-PAGE3F are used as internal FLASH,so I can use PAGE00 to               point to my external space.

     4.use *far pointer:volatile unsigned char *far p_RAM_PG_00; // pointer to external memory

                                  p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>

                                                                                                                  // => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000

                                  a2 = *p_RAM_PG_00;

     5.add this command to the compiler:-CpPPAGE=RUNTIME -D__FAR_DATA -CPUHCS12 -D__NO_FLOAT__ -Mb

     6.set the debugging memory map in the debugger as the real chip ,and the picture above in my question has depicted the specific configuration.

     Any thing more need to be configured?please help.And I will add my project as an accessory,it runs well in simulation mode,but when I change into onchip mode,it just become incorrect.I run the code :

                                   p_RAM_PG_00 = (unsigned char *far)0x008000; // initialize pointer to page 0 address 0x8000 =>

                                                                                                                  // => external bus address is 0*0x4000+ (0x8000-0x8000)= 0x000000

                                  a2 = *p_RAM_PG_00;

          I can not get 0x000000,but 0x008000 instead.This is wrong ,not consistent with the example.

    

    

0 项奖励
回复