DMA and PIT for FRDM K64F board

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

DMA and PIT for FRDM K64F board

5,679 Views
kirantujare
Contributor IV

I'm working on a project where I'm trying to design a frequency generator. I want to use DMA and PIT(Periodic Interrupt Timer) feature on FRDM K64F board. I would like some help on the use of these on FRDM K64F board using KSDK+PE. I am using KDS Version: 3.2.0 and KSDK 1.3.

25 Replies

254 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Kiran

If you want to use variable from main.c to other source files, you should declare this variable as global in main.c for example: int q[50] = {0}; and this same variable needs to be included as extern in the other source file, for example, it will look like extern int q[50]; in events.c

How  are you getting the sin values?

I am supposing you are moving data from internal buffers by using PIT to trigger dma channel, aren't you? If so, you will need to use other 2 dma channels as well as 2 PIT channels to replicate this behavior for other 2 signals and this way, all channels will be independently (frequency and data) for each signal

If you have another question let me now

Mario Castañeda

0 Kudos

254 Views
kirantujare
Contributor IV

I wanted to direct you to another post. Please take a look in your spare time.USB as Device Driver

0 Kudos

254 Views
kirantujare
Contributor IV

Can we generate a wave using values generated from a user given input without putting constant values in a buffer??

For example to generate sin wave: I have used the following piece of code:

#define DAC_TEST_BUFF_SIZE  (120U)

uint16_t dac_buffer[DAC_TEST_BUFF_SIZE] =

    {0x7ff, 0x86a, 0x8d5, 0x93f, 0x9a9, 0xa11, 0xa78, 0xadd, 0xb40, 0xba1,

        0xbff, 0xc5a, 0xcb2, 0xd08, 0xd59, 0xda7, 0xdf1, 0xe36, 0xe77, 0xeb4,

        0xeec, 0xf1f, 0xf4d, 0xf77, 0xf9a, 0xfb9, 0xfd2, 0xfe5, 0xff3, 0xffc,

        0xfff, 0xffc, 0xff3, 0xfe5, 0xfd2, 0xfb9, 0xf9a, 0xf77, 0xf4d, 0xf1f,

        0xeec, 0xeb4, 0xe77, 0xe36, 0xdf1, 0xda7, 0xd59, 0xd08, 0xcb2, 0xc5a,

        0xbff, 0xba1, 0xb40, 0xadd, 0xa78, 0xa11, 0x9a9, 0x93f, 0x8d5, 0x86a,

        0x7ff, 0x794, 0x729, 0x6bf, 0x655, 0x5ed, 0x586, 0x521, 0x4be, 0x45d,

        0x3ff, 0x3a4, 0x34c, 0x2f6, 0x2a5, 0x257, 0x20d, 0x1c8, 0x187, 0x14a,

        0x112, 0xdf, 0xb1, 0x87, 0x64, 0x45, 0x2c, 0x19, 0xb, 0x2,

        0x0, 0x2, 0xb, 0x19, 0x2c, 0x45, 0x64, 0x87, 0xb1, 0xdf,

        0x112, 0x14a, 0x187, 0x1c8, 0x20d, 0x257, 0x2a5, 0x2f6, 0x34c, 0x3a4,

        0x3ff, 0x45d, 0x4be, 0x521, 0x586, 0x5ed, 0x655, 0x6bf, 0x729, 0x794};

uint16_t index = 0;

void pitTimer1_IRQHandler(void)

I want to generate a wave without using this lookup table. Is it possible to do that?
Does the buffer take constant values only?

0 Kudos

254 Views
kirantujare
Contributor IV

If I use extern int q[7200]; in events .c after putting int q[7200] = {0} in main.c I get the error "undefined reference to 'q' " and if I use extern int q[7200] = {0} in events.c after putting int q[7200] = {0} in main.c I get a warning " 'q' initialized and declared 'extern' " Is this warning fine? I have attached the screenshots for the errors and warnings.

0 Kudos

254 Views
kirantujare
Contributor IV

Thank you so much. It makes total sense now. I did like you said. But how do you check the output for the other two waveform. I am using DAC0_OUT(Analog Out) Pin to check the waveform on scope and I see only one waveform. Which pins will be used to check multiple outputs.?

0 Kudos