PSoC™ 5, 3 & 1 Forum Discussions
In the application note AN52705, Example 5 shows how two separate buffers can be used. I would like to implemented a ping-pong DMA for the SAR ADC but with an interrupt after each buffer is full. i.e. An ISR should be generated when Destination 1 is full and when Destination 2 is full.
Is it correct to assume 2 DMAs are needed? If so how would these be configured so that one triggers the next?
UPDATE: I have it working with the following flag settings: I would now like to know if Dma_1_TD[0] or Dma_1_TD[1] triggered the ISR? i.e. is adc_buffer1 or adc_buffer2 full.
CyDmaTdSetConfiguration(DMA_1_TD[0], TFR_CNT, DMA_1_TD[1],
TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT | TD_TERMOUT0_EN | DMA_1__TD_TERMOUT_EN);
CyDmaTdSetConfiguration(DMA_1_TD[1], TFR_CNT, DMA_1_TD[0],
TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT | TD_TERMOUT0_EN | DMA_1__TD_TERMOUT_EN);
#define NSAMPLES 32
#define TFR_CNT NSAMPLES * 2
#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)
uint8 DMA_1_Chan; //TODO: use the int assigned in DMA_1_dma.h
uint8 DMA_1_TD[2];
uint16_t adc_buffer1[NSAMPLES] ={0};
uint16_t adc_buffer2[NSAMPLES] ={0};
void init_adc_dma(void) {
//Init DMA channel
DMA_1_Chan = DMA_1_DmaInitialize(DMA_BYTES_PER_BURST, DMA_REQUEST_PER_BURST, HI16(DMA_SRC_BASE), HI16(DMA_DST_BASE));
//Create TD instances
DMA_1_TD[0] = CyDmaTdAllocate();
DMA_1_TD[1] = CyDmaTdAllocate();
//Configure each TD
CyDmaTdSetConfiguration(DMA_1_TD[0], TFR_CNT, DMA_1_TD[1],
TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT | TD_TERMOUT1_EN | TD_TERMOUT0_EN);
CyDmaTdSetConfiguration(DMA_1_TD[1], TFR_CNT, DMA_1_TD[0],
TD_INC_DST_ADR | TD_AUTO_EXEC_NEXT | TD_TERMOUT1_EN | TD_TERMOUT0_EN);
//Set TD source and destination address
CyDmaTdSetAddress(DMA_1_TD[0], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)&adc_buffer1[0]));
CyDmaTdSetAddress(DMA_1_TD[1], LO16((uint32)ADC_SAR_1_SAR_WRK0_PTR), LO16((uint32)&adc_buffer2[0]));
//Set the channel's initial TD
CyDmaChSetInitialTd(DMA_1_Chan, DMA_1_TD[0]);
//Enable the DMA channel
CyDmaChEnable(DMA_1_Chan, 1);
}
/*
*Called when the adc_buffer1 or adc_buffer2 is full
*/
CY_ISR(ISR_DMA_DONE_ADC)
{
//Toggle LED
LED_BLUE_DR ^= LED_BLUE_MASK;
CyDmaClearPendingDrq(DMA_1_Chan);
//Process the buffer
}
Show Less
Dear friends,
I have spent quite sometime reading through the user guides. Probably I can get some information more efficiently here.
Currently I am using PSoC 1 designer with CY8C24894 chip.
Ideally I want to generate some data pattern output on some pin of the chip.
The data could be like byte0, byte1, byte2 ,... in serial lsb/msb.
I manage to setup PC->USB->CY8C24894->output by using USBUART user module.
However UART speed is a bit low. In my case I want to have 1bit/us.
My questions are
1) If I continue with this approach, how can I increase its speed?
2) I checked about the SPI dedicated hardware resource. However it seems only 1 byte buffer. In my case I care about timing.
I want to have accurate between each bit and each byte.
Direct firmware driving GPIO is also not feasible since timing will be very hard to control.
Are there any hardware resource I can achieve my intention?
Any suggestions and recommendations are welcome.
Thank you very much!
Chao
Show LessI was thinking of some customization required or the hardware optimization.
Below is something I want:
- PC to send 32 bytes of data through USB to CY8C24984 every sometime interval.
- CY8C24894 firmware process the data only after 32 bytes or more are received.
- CY8C24894 firmware then put the data into USB buffer.
- PC to read 32 bytes of processed data.
Tentatively we can forget those things like data overflow.
I know there are USB2IIC.exe DLL used for the PC GUI to interface when the CY8C24894 configured as USB2IIC bridge.
However in this case, can we have some more generic, or lower level of DLL that handles like data write/read to CY8C24894.
I was a bit new to USB.
I know online there are CyAPI.lib/CyUSB.dll, which is for EZ-USB (like FX/FX1/FX2/FX2LP).
But can this be used for PSoC1 CY8C24894 device?
Thanks!
Show LessI'd like to use a timer to measure an interval in microseconds (as the interval would be less than 1ms). Is there any way to do this?
I'm sorry if this information exists out there, I've been looking for hours and haven't been able to find anything at all. Thanks for your help!
Show LessDear sir,
We are using CY8C5666AXI-LP004 series cypess controller.
we are facing th issue with frequent reset of controller.
we are going to implement power monitoring for Analog/Digital Low Voltage Interrupt, Analog High Voltage Interrupt.
please help us to implement it into program. if possible please share the proper documentation.
also we want to implement power monitoring for I/O pins.
please revert back ASAP.
Thanks.
Show LessI was developing with Creator 3.0, but when I have migrated to 4.2 I can't select the option GPIO for the Debug Select at the system options.@
Show LessAfter line 205 i was trying to trigger ultrasonic transmitter and resetting the timer by setting the trigger high , afterwards i would stop the transmission and set the reset to low to star counting time it takes to receive the signal.Once signal was receive my timer which was set to one shot halt on interrupt should stop since my capture generated an interrupt. But when i printed out read_counter the second time, my counter changes even before i reset the timer. Can anyone tell me why is it so. Thanks in advance
Show LessHi everyone,
I have a problem with CY8CKIT-050 PSoC5LP. When I tried the examples with Mixer, it builds and works perfectly, until I connect the wrong ports with each other. After that, I notice the LED3 and LED4 turned on. And I can't debug anymore because of this warning. The board turns hot very quickly. I hope I didn't burn the PSoC chip already. Is there any way to reflash the board with PSoC programmer?
Any help is appreciated.
Best regards,
V
Show LessHello,
I have two project codes, one based on the CY8C526LTI chip and the other on the CY8C5888AXQ chip.
I am using the miniprog 3 kit in j-tag mode to program and debug each of the individual projects.
For some reason I can program and debug my CY8C52LTI program into the CY8C5888AXQ chip, but not vice versa.
No error sign pops up for some strange reason.
Can anyone shed light on this issue?
Any help would be extremely helpful.
Thank you.
Show LessHi, I am a new user for PSOC 5LP, I am wondering if there is any advise to start over with, as what is the best kit for CY8C5287AXI-LP095 and STEP MOTOR CY8CKIT037.
If I need help in the schematic and programming, can I find help to review my work?
Show Less