This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

XT1 fault flag issue with FR4133 in assembly

Other Parts Discussed in Thread: MSP430FR4133

Hi team,
I work on MSP430FR4133 launchpad.

When I test LCDE_01.c from code examples it works fine :)

So, for some reasons I would like to write it in assembly code.

The code below don't work, it remains stuck in the loop : jnz Test_Osc __> Test_Osc and never reach the line 005

; Configure XT1 oscillator
                           bis.w    #BIT1|BIT2,&P4SEL0        ; P4.2~P4.1: crystal pins
;
001 Test_Osc:    bic.w     #XT1OFFG|DCOFFG,&CSCTL7    ; Clear XT1 and DCO fault flag
002                      bic.w    #OFIFG,&SFRIFG1            ; Clear OSC fault flag
003                      bit.w    #OFIFG,&SFRIFG1             ; Test oscillator fault flag
004                      jnz        Test_Osc                           ; if OSC_Fault_Flag == True GOTO Test_Osc
                                                                                    ; ie: wait for stable clock signal
005                     bic.w    #XT1DRIVE_3,&CSCTL6

OFIFG is always set in SFRIFG1 !

Any idea ?

BR

Claude

  • Use .w to access Word (16-bit) registers and .b to access Byte (8-bit) registers.

  • Hi Leo,

    thanks, You're right.

    Replacing :

    bis.w    #BIT1|BIT2,&P4SEL0

    by:

    bis.b    #BIT1|BIT2,&P4SEL0

    make the code works fine.

    I did'nt see that P4SEL0 was a 8 bits REG (MSB of PBSEL0, PBSEL0_H)

    BTW, programming in C in CCS 6.01, when you move the mouse over a defined item like a register for example, CCS show some very useful détails in a litlle pop up window. Programming in assembly code, I don't have the same behavior.

    Do I miss some parameters somewhere ?

    Claude

  • C writers are a little bit spoiled by this, but maybe also necessary, they are not accustomed to read manuals.
    I think the CCS team assumes assembler writers are doing a more serious job and are accustomed to invest time in what they need to know to come to a short, fast and accurate piece of software, and adding here more help is waste of time, maybe?

    When I see .w & Port there starts to ring a bell, MSP Ports are 8-bit, sometimes also accessible with 16-bit but with exceptions. It’s experience, keep practicing and you will get that also and don’t need this, sometimes annoying, hovers.

**Attention** This is a public forum