Part Number: MSP430FR6989
Hi,
At the moment I'm facing problems with the MPU. My Init routine looks like this:
extern uint16_t lcf_crcMem_begin;
#define beginSegment2 &lcf_crcMem_begin
extern uint16_t lcf_code_forbidden_begin;
#define beginSegment3 &lcf_code_forbidden_begin
int16_t _system_pre_init(void)
{
/* Insert your low-level initializations here */
/* Disable Watchdog timer to prevent reset during */
/* long variable initialization sequences. */
WDTCTL = WDTPW | WDTHOLD;
#ifdef halInterface_assembledVersion_radio
// Configure MPU
MPUCTL0 = MPUPW; // Write PWD to access MPU registers
MPUSEGB1 = (uint16_t)(((uint32_t)beginSegment2) >> 4);
MPUSEGB2 = (uint16_t)(((uint32_t)beginSegment3) >> 4); // Borders are assigned to segments
// Segment 1 Allows read and write only
// Segment 2 Allows read and execute only
// Segment 3 Allows read and execute only
MPUSAM = MPUSEG1WE | MPUSEG1RE | MPUSEG1XE |
MPUSEG2WE | MPUSEG2RE | MPUSEG2XE |
MPUSEG3WE | MPUSEG3RE | MPUSEG3XE;
MPUCTL0 = MPUPW | MPUENA | MPUSEGIE; // Enable MPU protection
// MPU registers locked until BOR
#endif
/*==================================*/
/* Choose if segment initialization */
/* should be done or not. */
/* Return: 0 to omit initialization */
/* 1 to run initialization */
/*==================================*/
return 1;
}
lcf_crcMem_begin -> is 0x6800
lcf_code_forbidden_begin -> is 0x68C0
For the first test I allowed everything for all segments. But I get resets all the time.
I see in MPUSEG1 that the address is written correctly (0x0680) but in MPUSEG2 is also written 0x0680 although there should be 0x068C. In datasheet there is a hint that only bit 6-13 should be taken. So this is OK for this example. Where is the problem?
Kind regards
