MPC5643L_ some ques tion about DMA

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

MPC5643L_ some ques tion about DMA

Jump to solution
986 Views
yanna
Contributor IV
  • Some details of the follow code @

 

const struct CTU_Commands DMA_CTU  = // DMA_CTU will be sent to CLR4

        {

                /* configure the conversion sequence for ADC dynamic channels  (CTU.CLR_SCM4.R)

                 * every 20 us the next value is written to the ADC commands list entry 4. It is

                 * not clear up to now whether enty 0 is transfered via DMA or not, so it is done

                 * redundant now  */

                CTU_CLR_CMS_DUAL

                | CTU_CLR_CMS_CH_ADC0(7)

                | CTU_CLR_CMS_CH_ADC1(8) ,

 

                CTU_CLR_CMS_DUAL

                | CTU_CLR_CMS_CH_ADC0(7)

                | CTU_CLR_CMS_CH_ADC1(7) ,

 

                CTU_CLR_CMS_DUAL

                | CTU_CLR_CMS_CH_ADC0(7)

                | CTU_CLR_CMS_CH_ADC1(8) ,

               

                CTU_CLR_CMS_DUAL

                | CTU_CLR_CMS_CH_ADC0(7)

                | CTU_CLR_CMS_CH_ADC1(7) ,

 

        };

Q1: In the description ,it says “It is  not clear up to now whether enty 0 is transfered via DMA or not  it is related to entry 0? Why ? Does the RM(reference mannual ) have the related text ?  I can’t understand the whole meaning of the last sentence(descripition above).,could you give me any clue?.

 

Q2:                                          CTU_CLR_CMS_DUAL              // 0XF0F0

                | CTU_CLR_CMS_CH_ADC0(7)       //0X0101

                | CTU_CLR_CMS_CH_ADC1(8) ,        //0X0808

 

The symbol   | represent or , is it right ? if so , the value above is 0xF9F9 , is it right ?

 

Why was it written in this form(3 lines), other than A|B|C (1 line)?

 

Does there exist some instructions verstion of the programing in the NXP(freescale) website?

 

Q3:

 

#define CTUCOMCOUNT (sizeof(DMA_CTU)/2) /* count of CTU Commands set by DMA*/

 

The value of CTUCOMCOUNT is 4,is it right ?

 

 

 

Thanks very much!

Yanna

 

 

Petr Stancik

Labels (1)
Tags (3)
1 Solution
485 Views
markpiffer
Contributor II

Q1: where is this code from? Without context it is impossible to tell what the author meant.

Q2: the '|' represents the binary-OR operation in C, so your result is correct.

Q3: 'sizeof' gives the size of an object in 'Bytes' which in turn is NOT NECESSARILY a 8-bit memory cell, although on the MPC5xxx using a standard C compiler it is. But without seeing the definition of struct CTU_commands it is not possible to assess the right value.

I strongly recommend that you first learn the programming language C *very thorougly* before trying to program a microcontroller at this level. Going on without a deep knowledge of the basics of C operators, datatypes and memory representation will just give you a frustrating experience.

View solution in original post

1 Reply
486 Views
markpiffer
Contributor II

Q1: where is this code from? Without context it is impossible to tell what the author meant.

Q2: the '|' represents the binary-OR operation in C, so your result is correct.

Q3: 'sizeof' gives the size of an object in 'Bytes' which in turn is NOT NECESSARILY a 8-bit memory cell, although on the MPC5xxx using a standard C compiler it is. But without seeing the definition of struct CTU_commands it is not possible to assess the right value.

I strongly recommend that you first learn the programming language C *very thorougly* before trying to program a microcontroller at this level. Going on without a deep knowledge of the basics of C operators, datatypes and memory representation will just give you a frustrating experience.