mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-05 05:43:51 -04:00
Update MSP430X IAR port to ensure the power settings are correct for the clock speed.
This commit is contained in:
parent
f16af5d27e
commit
3b4771e1a9
11 changed files with 433 additions and 17 deletions
|
@ -23,5 +23,6 @@ in order to use MSP-EXP430F5438 HAL.
|
|||
//#include "hal_rf.h"
|
||||
//#include "hal_rtc.h"
|
||||
//#include "hal_tlv.h"
|
||||
#include "hal_pmm.h"
|
||||
|
||||
#endif /* HAL_MSP_EXP430F5438_H */
|
||||
|
|
|
@ -66,3 +66,43 @@ void halBoardInit(void)
|
|||
PJDIR = 0xFF;
|
||||
P11SEL = 0;
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
* @brief Set function for MCLK frequency.
|
||||
*
|
||||
*
|
||||
* @return none
|
||||
*************************************************************************/
|
||||
void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate)
|
||||
{
|
||||
/* Convert a Hz value to a KHz value, as required
|
||||
* by the Init_FLL_Settle() function. */
|
||||
unsigned long ulCPU_Clock_KHz = req_clock_rate / 1000UL;
|
||||
|
||||
//Make sure we aren't overclocking
|
||||
if(ulCPU_Clock_KHz > 25000L)
|
||||
{
|
||||
ulCPU_Clock_KHz = 25000L;
|
||||
}
|
||||
|
||||
//Set VCore to a level sufficient for the requested clock speed.
|
||||
if(ulCPU_Clock_KHz <= 8000L)
|
||||
{
|
||||
SetVCore(PMMCOREV_0);
|
||||
}
|
||||
else if(ulCPU_Clock_KHz <= 12000L)
|
||||
{
|
||||
SetVCore(PMMCOREV_1);
|
||||
}
|
||||
else if(ulCPU_Clock_KHz <= 20000L)
|
||||
{
|
||||
SetVCore(PMMCOREV_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetVCore(PMMCOREV_3);
|
||||
}
|
||||
|
||||
//Set the DCO
|
||||
Init_FLL_Settle( ( unsigned short )ulCPU_Clock_KHz, req_clock_rate / ref_clock_rate );
|
||||
}
|
||||
|
|
|
@ -27,5 +27,6 @@ static void halBoardGetSystemClockSettings(unsigned char systemClockSpeed,
|
|||
extern void halBoardOutputSystemClock(void);
|
||||
extern void halBoardStopOutputSystemClock(void);
|
||||
extern void halBoardInit(void);
|
||||
void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate);
|
||||
|
||||
#endif /* HAL_BOARD_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue