AnsweredAssumed Answered

MPC5777C CSE Inconsistency

Question asked by Jeff Campbell on Aug 30, 2016

Everyone,

 

I'm having an absurdly difficult time getting the CSE to do anything consistently.  Completely unrelated changes in my programs are breaking CSE-related code.  Here's one recent example.

 

In this code, currentSig is a struct that holds the 64-bit message length for MAC computation and its starting address.  I've verified that it's initialized correctly.  All variables that interact with the CSE are volatile.

 

CSE.P1.R = CSE_RAM_KEY;
CSE.P2.R = (volatile int)currentSig.msg_length;
CSE.P3.R = (volatile int)currentSig.start_address;
CSE.P4.R = (volatile int)pulMac;
CSE.CMD.R = CSE_GENERATE_MAC;
while (CSE.SR.B.BSY == 1u);

 

When this runs, I get an error code of 0xC, or "System memory error."  After random experimentation I tried this:

 

temp = currentSig.msg_length[1];

CSE.P1.R = CSE_RAM_KEY;
CSE.P2.R = (volatile int)currentSig.msg_length;
CSE.P3.R = (volatile int)currentSig.start_address;
CSE.P4.R = (volatile int)pulMac;
CSE.CMD.R = CSE_GENERATE_MAC;
while (CSE.SR.B.BSY == 1u);

 

Now, no change has been made to the data or variables being passed to the CSE, but it no longer throws the error.  It runs, but it doesn't populate pulMac with any output.

 

I'm constantly running into problems like this (only in interactions with the CSE), and needing to randomly flail about until I find the combination of unrelated statements that produce a result.  Has anybody else seen behavior like this, and does anyone have an idea what might be causing it?

Outcomes