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;
#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?