This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

wrong execution of instructions ( changing the value of SPICDR register by writing to another register (SPICCR) )

It is a crazy behavior

1. At the beginning my program have worked reasonable

But after some miserable changes in one part of code, another part became crazy.

After some redistribution of code it is working again.

2. I use CCS v5

I use ezdsp5535 usb stick, and I start my program from some examples.

The examples I have got from spectrumdigital teaching_material_C5505 using recommendation to port these examples to C5535 processor.

Also I have used the examples from CSL v2.5

3. For  example,  the part of code

#define SYS_SPICDR                               *(volatile ioport Uint16*)(0x3000)

#define SYS_SPICCR                               *(volatile ioport Uint16*)(0x3001)

Uint16                 rSPICDR_Lcd, rSPICCR_Lcd;

void Init_SpiCfgLcd()

{

         rSPICDR_Lcd = 10;             //       10 minim   SPI speed

          SYS_SPICDR = rSPICDR_Lcd;           //       =3 abs minim

         rSPICCR_Lcd |= 0x8000;             //       spi_clk enable

           SYS_SPICCR = rSPICCR_Lcd;

}

4. Under debugger I can see the disassemble of the code and I can see the SPI control registers

The disassemble is looking reasonable:

 

        Init_SpiCfgLcd:

02399c:   4eff                     AADD #-1,SP

121                 rSPICDR_Lcd = 10;            //          10 minim        SPI speed

02399e:   e6310a004420             MOV #10,*(#04420h)

122                             SYS_SPICDR = rSPICDR_Lcd;               //          =3 abs minim

0239a4:   a931004420               MOV *(#04420h),AR1

0239a9:   c9513000                 MOV AR1,port(#03000h)

123                 rSPICCR_Lcd |= 0x8000;

0239ad:   f5318000004421           OR #32768,*(#04421h)

124                             SYS_SPICCR = rSPICCR_Lcd;

0239b4:   a931004421               MOV *(#04421h),AR1

0239b9:   c9513001                 MOV AR1,port(#03001h)

 

But the behavior of the SPICDR register is looking totally crazy

At the line 122 everything is reasonable – I have written 10 in the register SPICDR and I can see it immediately.

But at the line 124 it is became crazy : have written 0x8000 in the another register  SPICCR but it change the content of SPICDR register (reset to 0)

5. Obviously I have configured something wrong. And this is only one example. Probably another parts of program are also compiled wrong.

According to the documentation, there are many possibilities to make “cpu hang” and I tried to take in to account all that I have found.

I use huge memory model

I use all recommendation in configuration of example project.

6. Excuse me for my English, but please give me some ideas what it could be, what also I could check and change.

Thank you for your attenthion.