This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

xdata & sleep issue

Good morning, I want my nRF24LE1 to sleep & wake up (memory retention, timers on) while retaining data in xdata, but it's not doing so. Please help!! Thanks, Mahesh

For example, there's a 2D array,

uint8_t xdata _p_outbufs[5][32]

that does not survive a sleep/wake cycle. some of the other variables are persisted, but not all. i can't figure out why. i've attached the .M51 file. i also have below the list of all variables and their (pointer) locations. 

all values for _p_outbufs[5][32] are set to 0x55 just before it goes to sleep:

0: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
1: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
2: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
3: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
4: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
after waking up, the values are NOT the same anymore: 
0: F4 F0 F0 F8 8F 0F 0E 0E F8 F0 B0 F4 02 0F 0E AF D0 B0 D0 F0 2F 8F 0D 07 E0 F0 E0 F0 2D 8F 0F 0F
1: F0 F0 F0 F1 46 8F 4F 3F F0 70 70 F8 0F 2F 2E 0D E0 E0 C0 E0 0F 0F 0F 0F F0 F0 F0 E2 4F 0F 0F 0B
2: F1 F4 E0 F0 1F 0D 0B AF F0 F0 B0 F2 4F 15 07 8F 98 F0 F0 F0 1D 0F 1F 7B F0 D8 F4 F0 0B CF 8F 0D
3: E0 F1 F1 F0 0E 0F 0F 0D 20 20 7A D9 0F 03 0F 07 F0 70 F0 F0 F9 C8 F0 F0 07 0D 0F 1E F2 F0 F0 F0
4: 0F 8F 0F 1F F0 B0 F2 F0 0E 0E 0F 0F F0 F0 F0 F3 0F 03 0F 0E B0 F0 F4 F0 0E 0E 0E 0A F0 F0 E0 E0

here are the variables i'm using, and the pointer locations they report within the program. some of the pointer values match those in the .M51 file, others do not.

POINTERS:

uint8_t xdata _p_inbufs[IN_BUF_NUM][PACKET_SIZE_MAX]: x:00ca
uint8_t xdata _p_outbufs[OUT_BUF_NUM][PACKET_SIZE_MAX]: x:020c
xdata BufQueue inbufs: x:003a
xdata BufQueue outbufs: x:0042
uint8_t code code_ex: i:0042
uint8_t xdata xdata_ex: -:0042
uint8_t data data_ex: i:0042
uint8_t idata idata_ex: i:0042
uint8_t pdata pdata_ex: -:0042
uint8_t xdata packet_id: -:0042
uint8_t* packet: x:00ca
uint8_t xdata mad[MAC_ADDR_LEN]: x:00c4
uint8_t xdata payload[PACKET_SIZE_MAX]: x:02c5
uint8_t xdata params[P_MAX]: x:0021
uint8_t xdata mul: i:0021
uint16_t xdata status: -:c021
uint16_t* xdata sleep: x:0023
uint16_t* xdata adc_values: x:000d
uint8_t xdata adc_stack_pointer: i:000d
uint8_t xdata adc_packet[PACKET_SIZE_MAX]: x:0001
uint8_t xdata rx2[PACKET_SIZE_MAX]: x:004f
uint8_t xdata packet1[PACKET_SIZE_MAX]: x:00a4
char xdata name[NAME_MAX_LEN]: x:0094
uint16_t xdata request_id;: -:1094
uint16_t xdata response_id: i:0094
bool radio_busy: i:0094
bool tx_err: i:0094
uint8_t irq_flags: -:0094
bool got_ack_pack: i:0094
bool data_recd: i:0094
uint8_t len: -:0094

leakspotter.M51

Parents
  • Hi, I was able to get retention using the _at_ keyword and moving variables, thanks!!! even so, could you still give me answers to the questions above? i believe the answers are:

    A. Yes.

    B. Yes.

    B. (should be C). i don't know the answer to this -- why does code need a memory retentive block? isn't all code already retained?

    C. why does this happen?

    D. Yes, that was the problem.

    E. if there's an overlap between absolute placement of variables, the compiler raises a warning. does this mean that i could deliberately superimpose two variables, e.g.

    uint8_t xdata a[2] _at_ 0x004;

    uint16_t xdata b _at_ 0x004;

    a[0]=0xFF;

    a[1]=0xEE;

    the value of b will be 0xEEFF. is that correct?

Reply
  • Hi, I was able to get retention using the _at_ keyword and moving variables, thanks!!! even so, could you still give me answers to the questions above? i believe the answers are:

    A. Yes.

    B. Yes.

    B. (should be C). i don't know the answer to this -- why does code need a memory retentive block? isn't all code already retained?

    C. why does this happen?

    D. Yes, that was the problem.

    E. if there's an overlap between absolute placement of variables, the compiler raises a warning. does this mean that i could deliberately superimpose two variables, e.g.

    uint8_t xdata a[2] _at_ 0x004;

    uint16_t xdata b _at_ 0x004;

    a[0]=0xFF;

    a[1]=0xEE;

    the value of b will be 0xEEFF. is that correct?

Children
No Data
Related