cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

New Contributor

 Sorry,

   

My English is poor,look at the picture

0 Likes
Reply
14 Replies
Honored Contributor II

Please don't create a new thread everytime, just add the picture here. Maybe you can just drag-and-drop it into the editor?

0 Likes
Reply
New Contributor

 Sorry,

   

pls click it to see

   

thanks.

   

      http://www.xuan.idv.tw/wordpress/?p=1745

0 Likes
Reply
Honored Contributor II

There was a bug IIRC that the debugger showed values in the watch windows only after execution of the line. So it might be that the first image (3.jgp) just shows the wrong value anyways, and only the second one is correct. I think Bob knows more about that...

   

Apart from that, there is a waring in Creator which affects how function calls during interrupts are handled (one method is not made re-entrant), maybe thats the issue?

   

(And the code in question is rather pointless and show be removed by the compiler anyway...)

0 Likes
Reply
Honored Contributor II

I just saw that you always show the same line in your screenshots. Are these from different runs of the project, or did you just stop multiple times and looked at the value? Like said before, I would expect the compile to optimize the line in question from the program altogether, so the value of the variable should never be touched.

   

Can you post your example project showing this behaviour? (Use the 'archive project' function of Creator).

0 Likes
Reply
New Contributor

I  just stop multiple times and looked at the value.

0 Likes
Reply
New Contributor

 I can certainly this variable is not used anywhere in the remote.c

   

   

I try to add other variables

   

This phenomenon occurs only in the same address

0 Likes
Reply
Esteemed Contributor II

This is a programming error:

   

slaveaddress = slaveaddress; is not what you want!

   

should look something like slaveaddress = slaveid;

   

 

   

Bob

0 Likes
Reply
Honored Contributor II

But this was not the question. Why does the value of slaveaddress change when it is only assigned to itself?

0 Likes
Reply
New Contributor

 Sorry

   
    I own mistakes   
   
        
   
    DMA at play   
   
        
   
    Too careless   
0 Likes
Reply
Honored Contributor II

So you had slaveaddress as target of a DMA process? How does this come to be? (It is something which could be found with a full text search over the whole project, btw. This is sometimes really helpful...)

0 Likes
Reply
New Contributor

 I enable the DMA but it seems that there are some problems

   

The enable DMA would have been changed 02000000H (.map file) address value

   

Close DMA no longer occurs

   

I changed Enable DMA after an error occurs

   

(Thanks to google translation)

   

 

   

------------------------------------------------------------------------------------

   

   

#define DMA_BYTES_PER_BURST 2

   

#define DMA_REQUEST_PER_BURST 1

   

#define DMA_SRC_BASE (CYDEV_PERIPH_BASE)

   

#define DMA_DST_BASE (CYDEV_SRAM_BASE)

   

DMA_Chan = DMA_DmaInitialize(DMA_BYTES_PER_BURST, DMA_REQUEST_PER_BURST, 

   

    HI16(DMA_SRC_BASE), HI16(DMA_DST_BASE));

   

DMA_TD[0] = CyDmaTdAllocate();

   

CyDmaTdSetConfiguration(DMA_TD[0], 16, DMA_INVALID_TD, TD_TERMIN_EN | DMA__TD_TERMOUT_EN | TD_INC_DST_ADR);

   

CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADCINC_DEC_SAMP_PTR), LO16((uint32)0));

   

CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);

   

CyDmaChEnable(DMA_Chan, 1);

   
        
0 Likes
Reply
New Contributor

 To Bob

   

   

[This is a programming error:

   

slaveaddress = slaveaddress; is not what you want!

   

should look something like slaveaddress = slaveid;]

   

 

   

Yes,slaveaddress = slaveaddress; is pointless

   

 

   

I just want to confirm that he should not be changed

   

 

   

Thanks.

0 Likes
Reply
Honored Contributor II

"The enable DMA would have been changed 02000000H (.map file) address value"

   

But 0x02000000 is the address of your slaveAddr variabl - look at the comment in your source file (the excerpt from the map file). It seems to be the first variable located in the sRAM, and the sRAM is the target base address for the DMA. And since you set the offset of the target to 0, you write to this variable...

   

The CyDmaTdSetAddress() call should set a proper address for the target - normally it should be the address of an array in RAM.

0 Likes
Reply
Honored Contributor II

(I suspect you did not properly copy the DelSig-ADC example from the AppNote 🙂

0 Likes
Reply