MCU has external 10MHz oscillator module.
ICSC1 is #%10000000 external reference clock selected.
ICSC2 is #%00110000 clock source divided by 1.
If I BSET then BCLR the port pin goes high for 1uS. I was expecting 0.5uS seeing it takes 5 cycles. How can I get the bus speed to 10MHz? I did it easy with a S08PA but they are currently in short supply so I had to switch to the S08FL. They have heaps of registers that do similar things to the PA version but with completely different names and it's so confusing so I don't really know what I'm doing. I only write in assembler so any advice in C or whatever won't mean much
Solved! Go to Solution.
Hi please check this application note
https://www.nxp.com/docs/en/application-note/AN3499.pdf
also please check this code with this I am setting to use an external crystal of 10 MHZ and bus clock of 10 MHz,CPU clock of 20 MHz
158: if (*(uint8_t*)0xFFAFU != 0xFFU) { /* Test if the device trim value is stored on the specified address */
00000012 C6FFAF LDA 0xFFAF
00000015 A1FF CMP #0xFF
00000017 270E BEQ *+16 ;abs = 0x0027
159: ICSTRM = *(uint8_t*)0xFFAFU; /* Initialize ICSTRM register from a non volatile memory */
00000019 C6FFAF LDA 0xFFAF
0000001C C70000 STA ICSTRM
160: ICSSC = (uint8_t)((*(uint8_t*)0xFFAEU) & (uint8_t)0x01U); /* Initialize ICSSC register from a non volatile memory */
0000001F C6FFAE LDA 0xFFAE
00000022 A401 AND #0x01
00000024 C70000 STA ICSSC
164: setReg8(ICSC1, 0x18U); /* Initialization of the ICS control register 1 */
00000027 A618 LDA #0x18
00000029 C70000 STA ICSC1
166: setReg8(ICSC2, 0x36U); /* Initialization of the ICS control register 2 */
0000002C A636 LDA #0x36
0000002E C70000 STA ICSC2
167: while(ICSSC_OSCINIT == 0U) { /* Wait until the initialization of the external crystal oscillator is completed */
00000031 C60000 LDA ICSSC
00000034 A502 BIT #0x02
00000036 27F9 BEQ *-5 ;abs = 0x0031
170: clrReg8Bits(ICSSC, 0xE0U); /* Initialization of the ICS status and control */
00000038 C60000 LDA ICSSC
0000003B A41F AND #0x1F
0000003D C70000 STA ICSSC
171: while((ICSSC & 0xC0U) != 0x00U) { /* Wait until the FLL switches to Low range DCO mode */
00000040 C60000 LDA ICSSC
00000043 A5C0 BIT #0xC0
00000045 26F9 BNE *-5 ;abs = 0x0040
176: __asm jmp _Startup ; /* Jump to C startup code */
Sorry I am not good in ASM code so I just disasambled my code
I hope this will help you
Have a good day
One thing I did notice now I have it running properly is with a repetitive 500nS wide pulse coming out the port pin, the PA micro signal is dead rock solid whereas the FL micro signal has the very slightest amount of jitter, presumably because it is the result of the FLL operating. This is not a concern in my application but it does indicate a difference in the two micros internally. Anyhow, it's all good.
Hey vincentegomez, that was it!
From your code I used
LDA #%00011000
STA ICS_C1
LDA #%00110110
STA ICS_C2
and that sorted it out.
That has made my day. Thank you so much
Bus clock is 1/2 of oscillator or FLL output clock. So you need FLL engaged external mode (FEE) to get 20MHz, which will be further divided by 2 to get 10MHz bus clock.
Interesting, I thought all S08's have the same fixed 1/2 bus clock divider. S08PA is exception to this.
I went and checked it again just to make sure. S08PA can definitely do 10MHz bus frequency using 10MHz external oscillator. BSET then BCLR takes 500nS. I can just use a 20 MHz oscillator with a S08FL but I want to know if I am doing something wrong.
Hi please check this application note
https://www.nxp.com/docs/en/application-note/AN3499.pdf
also please check this code with this I am setting to use an external crystal of 10 MHZ and bus clock of 10 MHz,CPU clock of 20 MHz
158: if (*(uint8_t*)0xFFAFU != 0xFFU) { /* Test if the device trim value is stored on the specified address */
00000012 C6FFAF LDA 0xFFAF
00000015 A1FF CMP #0xFF
00000017 270E BEQ *+16 ;abs = 0x0027
159: ICSTRM = *(uint8_t*)0xFFAFU; /* Initialize ICSTRM register from a non volatile memory */
00000019 C6FFAF LDA 0xFFAF
0000001C C70000 STA ICSTRM
160: ICSSC = (uint8_t)((*(uint8_t*)0xFFAEU) & (uint8_t)0x01U); /* Initialize ICSSC register from a non volatile memory */
0000001F C6FFAE LDA 0xFFAE
00000022 A401 AND #0x01
00000024 C70000 STA ICSSC
164: setReg8(ICSC1, 0x18U); /* Initialization of the ICS control register 1 */
00000027 A618 LDA #0x18
00000029 C70000 STA ICSC1
166: setReg8(ICSC2, 0x36U); /* Initialization of the ICS control register 2 */
0000002C A636 LDA #0x36
0000002E C70000 STA ICSC2
167: while(ICSSC_OSCINIT == 0U) { /* Wait until the initialization of the external crystal oscillator is completed */
00000031 C60000 LDA ICSSC
00000034 A502 BIT #0x02
00000036 27F9 BEQ *-5 ;abs = 0x0031
170: clrReg8Bits(ICSSC, 0xE0U); /* Initialization of the ICS status and control */
00000038 C60000 LDA ICSSC
0000003B A41F AND #0x1F
0000003D C70000 STA ICSSC
171: while((ICSSC & 0xC0U) != 0x00U) { /* Wait until the FLL switches to Low range DCO mode */
00000040 C60000 LDA ICSSC
00000043 A5C0 BIT #0xC0
00000045 26F9 BNE *-5 ;abs = 0x0040
176: __asm jmp _Startup ; /* Jump to C startup code */
Sorry I am not good in ASM code so I just disasambled my code
I hope this will help you
Have a good day