PSoC™ 5, 3 & 1 Forum Discussions
text.format{('custom.tabs.no.results')}
Hello,
I am writing a custom component to drive WS2812 pixels with as less hardware as possible. I am already done with Verilog part, but I can't get DMA working. When I write to FIFO using CPU, it is working as expected. When I try my DMA code, nothing happens.
Does anyone see what I am doing wrong? I need to use DMA. Simultaneously driving 24 strings + generating patterns seems like too much for CPU only approach.
Thanks in advance,
Stanislav
#include "cytypes.h"
#include "cyfitter.h"
#include "`$INSTANCE_NAME`_DMA_dma.h"
#define `$INSTANCE_NAME`_Data_Reg `$INSTANCE_NAME`_WS2812Internal_Shifter_u0__F0_REG
#define `$INSTANCE_NAME`_DMAStatus_Active 0
#define `$INSTANCE_NAME`_DMAStatus_Completed 1
#define `$INSTANCE_NAME`_DMAStatus_Failure -1
void `$INSTANCE_NAME`_InitDMA();
void `$INSTANCE_NAME`_InitIRQ(cyisraddress isr);
void `$INSTANCE_NAME`_SendDMA(uint8_t *data, uint16_t count);
uint8_t `$INSTANCE_NAME`_GetDMAStatus();
void `$INSTANCE_NAME`_WaitDMAComplete();
Show Less#include <project.h>
#include "cytypes.h"
#include "stdlib.h"
#include "cyfitter.h"
#include "`$INSTANCE_NAME`_WS2812.h"
uint8_t `$INSTANCE_NAME`_DmaChannel;
uint8_t `$INSTANCE_NAME`_DmaTd;
void `$INSTANCE_NAME`_InitDMA()
{
`$INSTANCE_NAME`_DmaChannel = `$INSTANCE_NAME`_DMA_DmaInitialize(1,1,HI16(CYDEV_SRAM_BASE),HI16(CYDEV_PERIPH_BASE));
`$INSTANCE_NAME`_DmaTd = CyDmaTdAllocate();
}
void `$INSTANCE_NAME`_InitIRQ(cyisraddress isr)
{
`$INSTANCE_NAME`_IsrTxComplete_StartEx(isr);
}
void `$INSTANCE_NAME`_SendDMA(uint8_t *data, uint16_t count)
{
CyDmaTdSetConfiguration(`$INSTANCE_NAME`_DmaTd,count,`$INSTANCE_NAME`_DmaTd,CY_DMA_TD_INC_SRC_ADR | WS2812_1_DMA__TD_TERMOUT_EN );
CyDmaTdSetAddress(`$INSTANCE_NAME`_DmaTd,LO16((uint32)data),LO16(`$INSTANCE_NAME`_Data_Reg));
CyDmaChSetInitialTd(`$INSTANCE_NAME`_DmaChannel,`$INSTANCE_NAME`_DmaTd);
CyDmaChEnable(`$INSTANCE_NAME`_DmaChannel,1);
CyDmaChSetRequest(`$INSTANCE_NAME`_DmaChannel,CPU_REQ);
}
uint8_t `$INSTANCE_NAME`_GetDMAStatus()
{
uint8_t state;
if(CyDmaChStatus(`$INSTANCE_NAME`_DmaChannel,NULL,&state) == CYRET_SUCCESS)
{
if((state && STATUS_CHAIN_ACTIVE) == STATUS_CHAIN_ACTIVE)
return 0;
else
return 1;
}
return -1;
}
void `$INSTANCE_NAME`_WaitDMAComplete()
{
uint8_t state;
while(1)
{
CyDmaChStatus(`$INSTANCE_NAME`_DmaChannel,NULL,&state);
if((state & STATUS_CHAIN_ACTIVE) == 0)
return;
}
}
This is weird problem faced by me. I stucked from days. I have given a task to add some features like pwm to the firmware. I am using 29666 psoc1 chip 32kb . Almost 95% chip is used. however there is some place for pwm16 module to be added.
My problem is I successfully added the pwm 16 module and updated the boot.tpl for appropriate isr on correct block interrupt but still my code under ISR routine doesnt get executed as i am not getting the interrupt call within the firmware.
Is it that if chip is almost full with firmware starts giving error.
Show LessHello
I am having some problems connecting the ice cube with the pod
I could download a design but I could not connect the pod and it shows me an error
"could not detect the pod"
The power led of the pod turns on for a few seconds but vanishes when connection is attempt
Thanks for any help....I would like to power my pod to make a circuit debug
Show LessHi...
On my PCB MCU CY8C26643-24PI is mounted and which is working with software.
And now that MCU gone faulty and i want replace it with new fresh MCU.
So for that i have programme it or will it work directly.
Already we are giving commands from PC.
Show LessI want to use timer 8 capture and terminal count isr in my code . how to to that. psoc designer 5.4 gives opportunity to either use capture isr or terminal isr. but is there any way to use both isr at once in firmware.
My psoc1 29666 is almost out of resources and i cant generate the pwm using the hardware digital block. I want to use capture isr and terminal count isr to toggle the output pin for desired pwm. pwm frequency is very low in few hz. so my firmware will handle. But i can see how to generate the two simultaneous isrs in firmware.
Show LessHi,
I have 8 digital outputs that are on various pins of the 5LP that I want to control as a port using an 8-bit variable in code.
I created a digital output pin then then set number of pins to 8. I named the port "POWER"
Next I selected "Display as Bus" mapping.
Then I went to "pins" tab and set the pin designation.
I am having trouble setting the value of "PORT" in code.
The intellisense in PSOC creator shows "POWER_0, POWER_1 etc but I cannot work out correct syntax to do equivalent of POWER_Write(23) for instance.
Have I set this up wrong or simply not using corect syntax?
Thanks
Show LessI send info thru a UART and I see that the program stays in Main. I think the timer is not running. I have attached a bundle.
thanks for any advice.
Show LessHi,
I am working on SPI Slave communication using SPI Slave component on PSoC 5LP IC.
SPI Slave component is configured as 8-bit word size CPHA = 0, CPOL = 0 with 4-byte Rx and Tx buffers.
The first byte in the communication determines what will be transmitted afterwards, if bytes will be subsequently sent or received.
Any number of bytes can be transferred. The transmission will be terminated after the SS (Slave Select) signal deaserted, when the waiting time for the instruction byte is set again.
How is it possible to capture deaserting SS singal via SPI Slave component?
There is no flag in the Rx and Tx Status registers to capture the beginning or end of the communication specified by the SS signal.
Thank you
Milos
Show LessHi,
I've setup a DMA transfer from a software buffer (which is filled via an Ethernet receive) to the TX of a UART. I've set it up so when the TX interrupt is fired, it will send a software request to the DMA when the TX FIFO is not full and TX complete are satisfied. I've set it up using a software request as I couldn't seem to get it working from a direct interrupt.
The DMA is initialised each time the Ethernet receives data (due to having a dynamic buffer size). The DMA is setup as 1 TD which is disabled once the transfer count has been completed. This is followed by an NRQ which turns off the UART TX interrupt and tells main.c that the DMA is "free".
This all seems to work fine for the most part. Except, I'm having an issue which I believe is related to the DMA and TX FIFO. If I send a 4MB file down the Ethernet and then check it at the other end of the UART TX, there seem to be characters which are out of place. For example in the below extract from a log, you can see that the word "across" has become malfomed and "he" is missing an "r":
"her feet, for it flashed acrosr he mind that she had never"
It appears from the above that the "r" character has happened 4 bytes before it was supposed to happen and in turn replacing the "s" in "across". Another example is the following below:
Either the well was very deep, or she fell very slowly, fo,r she
In this example, you can see that the "," after "slowly" has appeared again 4 bytes later in "fo,r" but this time didn't replace the "r". My TX UART buffer is of size 4 bytes so this may just be a coincidence but I'm not sure why this is happeneing? There are cases with lower sized files where no errors happen at all but it will always error 10 or so times when sending a large file across the Ethernet to the UART TX. Any ideas why this might be happening would be appreciated?
I've attached a minimal stripped back version of the project if you'd like to view the settings etc.
Show LessDear Sirs and Madams,
We would like to use SysTick Timer of PSoC5LP, However I can't use it well.
Is there a sample project that turns on the LED with a SysTick timer interrupt?
Regards,
Show Less