MC9S08AC128 ICG and SCI issue

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

MC9S08AC128 ICG and SCI issue

3,159 次查看
mylim
Contributor IV

Hi, I am using ac128 44pin with an external 32kHz osc to obtain 4.19MHz bus freq and SCI configured to 2400 baudrate.

 

My init is as follow;

 

 

 

           lda   #$38                   sta   ICGC1
           lda   #$00             
           sta   ICGC2

 

            clr   SCI2C2                lda   SCI2S1            lda   SCI2D            mov   #$C0,SCI2S2            clr   SCI2BDH            mov   #$61,SCI2BDL            clr   SCI2C1            clr   SCI2C3            mov   #$2C,SCI2C2

 

I tried to send data from hyperterminal to my board it seems to hang after the first charactor is sent.

Then I tried configured to internal clock by changing ICGC1 = #$66. It doesnt hang anymore, but when i send ASCII char '0' which in hex is $30 is kept receiving hex $90.

 

Besides, I tried using code warrior device initialisation to do the setup but it doesn't have AC128 - 44pin configuration. The only have 80, 64 and 48 pins. Where do i get the patch? I cant find it anywhere online.

 

Please advise.

Thanks.

 

MY 

标签 (1)
0 项奖励
回复
7 回复数

1,340 次查看
peg
Senior Contributor IV

Hi Mingyee,

 

Your original clock setup with 4.19MHz bus needs a baudrate divisor of $6D not $61 as you have used.

$61 will give you a baudrate of about 2700 baud.

 

4190000 / 16 / 109 = 2402.5229 (109dec is $6D)

 

 

0 项奖励
回复

1,340 次查看
mylim
Contributor IV

Hi Peg,

Basing on you recommendation the ICGC1 = #$38 and ICGC2 = #$00.

With this config my code couldn't run till the main routine.

The only config that I am able to run with the program hang is ICGC1 = #$66 and ICGC2 = #$00 which is External Osc 32kHz, internal clk sourse and FLL off.

I have attached my dev init config for your reference.

Please advise.

Thanks.

 

Regards,

MY

ac128_clk_config.zip

Message Edited by t.dowe on 2009-10-19 10:31 AM
0 项奖励
回复

1,340 次查看
peg
Senior Contributor IV

Hello again,

 

You are selecting SCM (Self clocked mode) this mode is not meant for normal use and does not provide an accurate clock source. You might fiddle with values to get it to work. But you should be using the FLL to provide a stable clock.

 

0 项奖励
回复

1,340 次查看
mylim
Contributor IV

Hi Peg,

I tried self clock and also external clock.

The external clock doesnt seems to be working for my case.

Any advise on my initialisation?

I also tried doiing it in absolute asm with your recommended config and other too.

please find the .asm file as attached. Hope you could advise me on that.

Thanks.

 

MY 

0 项奖励
回复

1,340 次查看
peg
Senior Contributor IV

Hello,

 

Try this:

 

ICGC1 = $28

ICGC2 = $21

SCI1BDL = $74

 

This gives a bus of 4.44MHz and a baudrate of 2394 using the internal oscillator.

Get the programmer to do the trim and make sure you load it in your code.

 

0 项奖励
回复

1,340 次查看
mylim
Contributor IV

Hi Peg,

When i mean trim the value does that mean playing with the ICGTRM register?

I tried w/o adjusting ICGTRM, the result is still the same. 

I couldnt get the data from my hyper terminal.

I've also confirmed my crystal is connected with reference to page 28 of AC128 reference manual.

I've tried my previous configs on a QE128 board and it works. 

i cant get a AC128 - 44pin config from processor expert bean nor devevice initialisation on code warrior.

They only have 48 pins. 

Please advise.

Thanks.

 

Regards,

MY 

0 项奖励
回复

1,340 次查看
peg
Senior Contributor IV

Hi mingyee,

 

Yes, the ICGTRM is the trim value I am referring too. Note that it only affects the internal reference generator and so only affects FEI mode. Are you using the settings I suggested in my last post, this is FEI mode. Your programmer should calculate the correct trim value for you and store it at $FFBE, your code must move this to the volatile register (ICGTRM) on power up.

 

You seem to have a problem with your crystal so this is why I am suggesting FEI mode, it should just work with the right settings.

 

As I rarely use Codewarrior and never use Processor Expert I cannot assist you with these other issues.

 

0 项奖励
回复