RE: MPC-55xx - Write 1 to clear.
"Dobbin Allan-r11834" <[email protected]> Tue, 3 Jul 2007 09:22:54 -0700
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <4147ED8B92A864498825C07E53594E4A0252B6CE@az33exm20.fsl.freescale.net> |
In general terms, you have to use method 2 to clear w1c bits and can never use method 1. If, however, the w1c bits appear in a register with other writable bits that are not w1c, you have to take special care in handling that particular register i.e. read the register contents into a variable, AND the variable with a mask designed to clear all the w1c bit positions (i.e. writing back will NOT clear those w1c bits), set the bit position you intend to clear and then write that value back to the register which will clear only the bit of interest and not effect the other writable bits. Regarding the FLASH_MCR[STOP] bit, it's a special case - if the STOP bit is set, then its the only bit in the FLASH_MCR that can be written, so attempting to clear the w1c bits while it's set is pointless anyway. You are correct regarding the ETPU_CnSCR. Either handle it as above, or perform a 16-bit write to the w1c upper half of the register. - Allan ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Praveenmuthu, E Sent: Tuesday, July 03, 2007 5:53 AM To: [email protected] Cc: Lumpkin, Everett R; Manjunath, Bc ; Sharma, Aravinda ; Nicholson, Rick F Subject: [MPC500] MPC-55xx - Write 1 to clear. Hi All, I have questions regarding the "w1c" flag bits. From the MPC5554 manual, "w1c" flags are cleared by writing a 1 to it. 1) The manual (MPC5553/MPC5554 Microcontroller Reference Manual Devices Supported: MPC5553 MPC5554 MPC5554RM Rev. 3.1 11/2005) refers to preface section as shown below: "Note: w1c means "write 1 to clear" and is explained in the Preface." But there is no preface section in the document. Please provide the same. 2) Now there are two methods to clear the flag. Method one is writing 1 to the bitfield. Method two, writing the 32 bit value into the status register. Both methods are shown below. In method one, the assembly code reads the status register and sets this particular bit and writes back. But the side effect is if the status of other "w1c" bits is also 1, then it is reading and writing back a 1 to other "w1c" bits. Thereby it clears other "w1c" bits (which may not be intentional). In method two, we are writing 1 to the "w1c" bit of our interest and zero for the rest. Hence we do not have side effect for the other "w1c" bits (writing 0 has no effect). But not sure on the impact on "non-w1c" bits as in the registers ETPU_CnSCR's (FM) and FLASH_MCR's (STOP bit). So the question is what is the recommended way to clear only "w1c" bit of interest without affecting other (w1c or non-w1c bit) in the same register? Method 1: (complied with Windriver Diab) EQADC.FISR[RFIFONUM].B.CFUF = 1; 80060000 lwz r0,0x0(r6) ; r0,0(r6) 3D404001 lis r10,0x4001 ; r10,16385 5160D908 insrwi r0,r11,0x1,0x4 ; r0,r11,1,4 90060000 stw r0,0x0(r6) ; r0,0(r6) Method 2: EQADC.FISR[RFIFONUM].R = 0x08000000; 3CA00800 lis r5,0x800 ; r5,2048 90A60000 stw r5,0x0(r6) ; r5,0(r6) Regards Praveen ************************************************************************ **************** Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. ************************************************************************ **************** [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]