What difference between the following code?
SYS->GPA_MFPH &= ~(SPI2_SS_PA11_Msk | SPI2_CLK_PA10_Msk | SPI2_MOSI_PA8_Msk | SPI2_MISO_PA9_Msk);
SYS->GPA_MFPH |= SPI2_SS_PA11 | SPI2_CLK_PA10 | SPI2_MOSI_PA8 | SPI2_MISO_PA9;
and
SYS->GPA_MFPL = SYS_GPA_MFPH_PA11MFP_SPI2_SS | SYS_GPA_MFPH_PA8MFP_SPI2_MOSI | SYS_GPE_MFPH_PE9MFP_SPI2_MISO | SYS_GPA_MFPH_PA10MFP_SPI2_CLK;
IO pin function setting
The first writing method configures PA.9~PA.11 function only.
For the sencond writing method, it will overwrite others IO setting, which are not assigned, to GPIO. (for example, PA.8 and PA.12~PA.15).
It is recommonded to use the first method to avoid configuration overwriting.
For the sencond writing method, it will overwrite others IO setting, which are not assigned, to GPIO. (for example, PA.8 and PA.12~PA.15).
It is recommonded to use the first method to avoid configuration overwriting.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests