9S12, SGATE and large blocks of memory.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

9S12, SGATE and large blocks of memory.

618 Views
jcdammeyer
Contributor III

I have a project that will use the XGATE to periodically send a large block of CAN messages from an array that is updated by the 9S12 processor.  So I've been playing with the sample xCAN AN2726 app note.  The memory map from the 9S12XDP512 suggests that some of the ram may be paged so I thought I'd put my sample array of 3080 integers into non banked ram.

 

eg. in the .h file.

#pragma DATA_SEG NON_BANKED
extern volatile int DataBuffer[3080];
#pragma DATA_SEG DEFAULT

 

In the xgate code I declare

volatile int * pXGDataBuffer = DataBuffer;

The problem is when I run the code and look at the DataBuffer with the debugger.   In the 9S12 main.c program a simple initialization loop should show 1..3079 in the DataBuffer array.  But it remains cleared.

for (i=0; i<3079; i++)
  DataBuffer[i] = i;

However, if I remove the #pragma DATA_SEG NON_BANKED the DataBuffer[] is now placed down at 0x2000 rather than 0xC040 and is also correctly initialized.  Breakpoints inside the XGATE code show that accessing the DataBuffer with the pXGDataBuffer pointer also now works.

 

So why does putting the DataBuffer at 0xC040 where the data sheet says there is RAM (interrupt variables are stored there) does it not work?  What is it that I'm missing? 

 

Thanks

John

Labels (1)
0 Kudos
2 Replies

353 Views
kef
Specialist I

XGATE can access only 30kB of flash memory. Flash memory at nonbanked 0xC000 is not accessible by XGATE. The only flash it can access is 14kB on flash ppage 0xE0 and 16kB on ppage 0xE1. Nonbanked 0xC000 is flash ppage 0xFF.

0 Kudos

353 Views
jcdammeyer
Contributor III

OK.  I think I understand my wrong thinking.  I was interpreting NON_BANKED as non paged RAM since I want the XGATE and the 9S12 CPU to both have access.  The XGATE does read only but I'll still use a semaphore since the 8 byte CAN data part of each messsage can be partially updated by the 9S12 when the XGATE wants to send it out.

 

All makes more sense now.

 

Thanks

John

 

0 Kudos