Code Examples Forum Discussions
Does Cypress have an example for a low end LED martix driver similar to the component that uses UDBs but without the need for UDBs. Could this be possible using Smart IO? Or even a firmware based example would be helpful.
Show LessI am trying to halt when a particular memory location gets set to a specific value. I'm not looking for a particular variable to change, but rather a word in the stack.
I know how to set a watchpoint to break on write access. That works fine, but it halts very frequently and I need it to halt only when a specific, invalid value is written.
I tried to add a "condition" to the memory access watchpoint, but this makes it either run so slowly that it never finishes timer interrupt handling, or it just locks up the debugger ("stop debugging" button in PSoC Creator button is ineffective). I read something about modifying the linker file to place a variable at a specific location, then watch that variable for changes, but I'm not clear on how that's different nor exactly how to do it.
This is the watchpoint condition I am using:
(*((volatile unsigned long *)0x20007b18))==0x00002b4F
Is there another way to do this? Is this slow behavior a bug in PSoC Creator, or maybe a limitation of the Cortex-M3?
Thanks!
-Will
Show LessHi All,
I'm working with a CY8CKIT-059 and I'm hung up on a I2C question that I'm hoping someone smarter than me can answer.
My basic design is pretty simple, using an I2C element I'm sending formatted text to an OLED display (1" EBAY device) with the usual informational messages an application would be sending to such a display.
Having accomplshed that, I'm now ready to move on to doing some data taking, but to do that I'll need to get some precise timestamps by communicating with a second I2C device, a DS3231AS based mini-board (also of Ebay origins).
My question is this - can I talk to this board using the same I2C bus as the OLED Device or do I need to set up another I2C element with a separate SDA/SCL pair?
I might add here that I eventually wish also to add a third SD card I2C-based device to do data logging to, but one step at a time.
I'm using PSOC Creator 4.2.
Rich
Show LessHello, I'm starting out with a simple SPI program in order to learn SPI. I'm using PSoc5 kit to program an SPI Master and SPI Slave. I'm getting data from the Slave but I have few questions.
1. When I use the Function call SPIS_WriteTXDataZero() this puts an extra byte in the TX FIFO and the Master SPI must send an extra word to get all of the data in the Slave TX FIFO clocked out. Doesn't this cause some problems, in managing what's in the FIFO and getting things aligned properly. I guess I could have the Master SPI send and extra word on the first SPI Master write. Comments?
2. I'm writing 8-bytes to the Master TX FIFO but on the scope I see a 50usec gap between the first four bytes and the remaining 4 bytes. Why?
3. Last, I'm tying to get an interrupt on the SPI Slave to work. I have tried to implement an Interrupt Service Routine but the data from the Slave RX FIFO seems to be missing some words:
I would expect to see 8-bytes in the dsp_spi_rcv_buffer but I'm only getting 4. Why?
Can anyone help me out please.
Thanks,
Joe
Show LessHello, I'm interfacing a PSoc5 MCU with a MAX6581 Temperature Sensor. The Sensor has a SMBUS/I2C Compatible interface. I'm using I2C Master module to interface with the device. I have been playing with a PSoc5 Dev Kit to learn how I2C works. The problem I see is that I don't see the I2C Read/Write on the Dev Kit match the datasheet page 10 and 11. I've attached pages 10 and 11 for anyone to look over and maybe see if it is even possible to implement an I2C link with this temperature sensor.
When I look at the I2C traffic is a logic analyzer and say I'm doing an I2C_MasterReadByte I only see the address followed by the Bytes I'm reading.
Can anyone help me please?
Thanks,
Joe
Show LessHello all ,
i have a custom PCB with PSOC4 on it ,
i have 1 input pin controlled by a switch (switchPIN),
i have 2 outputs pins (resetPin , onoff_Pin),
i need to implement the following logic :
starting state is switchPIN=1 in that case turn on onoff_Pin-->1,
if someone turn the switch off switchPIN=0 and 6 sec is passed then turn off onoff_Pin-->0,
but if someone turn the switch off switchPIN=0
and BEFORE 6 sec is passed he turns on the switch switchPIN=1
then send reset pulse (resetPin =1 wait 100ms then resetPin =0).
this simple logic is driving me crazy, i have tried using 2 timers with isr on
the switchPIN (one is 6 sec timer , and one is a fast timer),
i just can figured out a way to do it .
can someone direct me to a simple solution to this problem ????
I have attached a flow chart of what i want to achive .
Thanks in advanced.
Show Less
Hello.
I'm trying to use a ADC to digitize a signal from a microphone and pre-connect a potentiometer as a voltage divider at the input. As a result, the ADC read value periodically jumped .. I even added a delay to the program to see the jumps better ..
Why can this happen?
Show LessHello,
I have two PSoC4 L-Series Pioneer Kits (CY8CKIT-046) that I need to make talking to each other on a SPI bus. I found good sample code CE224339_PSoC4_SPI_Master_Polling01
and
CE224463_PSoC4_SPI_Slave_Polling01
that seem pretty simple and actually work. (They are located in the samples/SPI_polling folder in the workspace bundle that is attached to this discussion.)
Then I changed the code a bit to send more data (13 bytes). If data transmission is successful and sent data matches the received data then I lit the blue LEDs on the master and slave boards (in the niko_proj/SPI_polling_scb folder). All of this seems to work fine.
However, I need to use non SCB SPI components. So I mimicked the projects from niko_proj/SPI_polling_scb into niko_proj/SPI_polling_non_scb folder, and used non SCB components with their API calls in main.c. Everything builds fine, but the slave doesn't receive anything from master now.
Please help!
The workspace bundle is attached.
Thanks!
Nikolay
Show LessHello,
I am using PSoC4 L Series Pioneer Kit (CY8CKIT-046) and I am wondering if there is a way for me connect a terminal window(TerraTerm, PuTTY, ...) to the device and print something out to a screen to ease debugging process. I cannot find good instructions on how to do it. Is it even possible? Please Help!
Thanks!
Nikolay
Show LessHello,
I have two PSoC4 L-Series Pioneer Kits that I need to make talking to each other via SPI Bus. So I started with the CE224339_PSoC4_SPI_Master_DMA01 and CE224463_PSoC4_SPI_Slave_DMA01 examples. They seem to work fine: slave's LED repeatedly going through the colors. Then I created my own Master and Slave projects that are very similar to the examples with slight modifications. The code appears NOT to work at all: don't see LED lit blue, green or red. When the code starts it tests all three LEDs and they appear to respond. I put the design and source code files for master and slave bellow.
I desperately need help with this!
Thanks!
P.S.
The workspace is attached. The projects that I am working on named StellarMasterTest and StellarSlaveTest.
#include "project.h"
#define LED_ON 0
#define LED_OFF 1
#define DESCR0 0
#define CMD_END (0x07Fu)
#define PKT_LEN (13+1) // to fit 100 bits + CMD_END
// master buffers
static int8 mTxBuf[ PKT_LEN ] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, CMD_END };
static int8 mRxBuf[ PKT_LEN ] = { 0 };
static int8 sTxBuf[ PKT_LEN ] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u, CMD_END };
int main(void)
{
//CyGlobalIntEnable; /* Enable global interrupts. */
SPIM_Start();
RxDmaM_Start( (void *)SPIM_RX_FIFO_RD_PTR, (void *)mRxBuf );
TxDmaM_Start( (void *)mTxBuf, (void *)SPIM_TX_FIFO_WR_PTR );
DATA_RX_Write ( LED_ON ); CyDelay( 1000 ); DATA_RX_Write ( LED_OFF );
DATA_OK_Write ( LED_ON ); CyDelay( 1000 ); DATA_OK_Write ( LED_OFF );
DATA_ERROR_Write( LED_ON ); CyDelay( 1000 ); DATA_ERROR_Write( LED_OFF );
memset( (void *) mRxBuf, 0, PKT_LEN );
for(;;)
{
if( mRxBuf[ PKT_LEN - 1 ] == CMD_END )
{
DATA_RX_Write( LED_ON );
}
if( 0u == (CyDmaGetInterruptSourceMasked() ^ (RxDmaM_CHANNEL_MASK) ) )
{
// Clears the interrupt source for the next data to be sent
CyDmaClearInterruptSource( RxDmaM_CHANNEL_MASK ); // mocking the sample
DATA_RX_Write( LED_ON ); // because we received something
if( 0u == memcmp( mRxBuf, sTxBuf, PKT_LEN ) )
{
DATA_OK_Write( LED_ON ); // wow, it actually worked!
}
else
{
DATA_ERROR_Write( LED_ON ); // now what?
}
memset( mRxBuf, 0, PKT_LEN );
//CyDelay( 1000/*msecs*/ ); // let the LED shine
DATA_RX_Write( LED_OFF );
TxDmaM_ValidateDescriptor( DESCR0 ); // mocking the sample codesamples
TxDmaM_ChEnable(); // send again
CyDelayUs(20/*µsec*/);
}
//DATA_RX_Write( LED_OFF );
} // for(;;)
}
#include "project.h"
#define LED_ON 0
#define LED_OFF 1
#define DESCR0 0
#define CMD_END 0xFF
#define PKT_LEN (13+1) // to fit 100 bits + CMD_END
// master buffers
static int8 mTxBuf[ PKT_LEN ] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, CMD_END };
static int8 sTxBuf[ PKT_LEN ] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u, CMD_END };
static int8 sRxBuf[ PKT_LEN ];
int main(void)
{
//CyGlobalIntEnable; /* Enable global interrupts. */
SPIS_Start();
RxDmaS_Start( (void *)SPIS_RX_FIFO_RD_PTR, (void *)sRxBuf );
TxDmaS_Start( (void *)sTxBuf, (void *)SPIS_TX_FIFO_WR_PTR );
TxDmaS_ChDisable();
DATA_RX_Write ( LED_ON ); CyDelay( 1000 ); DATA_RX_Write ( LED_OFF );
DATA_OK_Write ( LED_ON ); CyDelay( 1000 ); DATA_OK_Write ( LED_OFF );
DATA_ERROR_Write( LED_ON ); CyDelay( 1000 ); DATA_ERROR_Write( LED_OFF );
memset( (void *) sRxBuf, 0, PKT_LEN );
for(;;)
{
DATA_RX_Write( LED_OFF );
/* wait for command to be received */
while (0u == (RxDmaS_CHANNEL_MASK & CyDmaGetInterruptSourceMasked()));
CyDmaClearInterruptSource(RxDmaS_CHANNEL_MASK);
DATA_RX_Write( LED_ON );
/* Data transfered using the DMA, clear the buffer */
SPIS_SpiUartClearRxBuffer();
if( 0u == memcmp( sRxBuf, mTxBuf, PKT_LEN ) )
{
DATA_OK_Write ( LED_ON );
}
else
{
DATA_ERROR_Write( LED_ON );
}
//memset( sRxBuf, 0, PKT_LEN );
/* Load the Tx FIFO with the first byte */
SPIS_SpiUartWriteTxData( (uint32)sTxBuf[ 0 ] );
TxDmaS_ChEnable();
/* Recieves dummy data in order to send response */
while (0u == (RxDmaS_CHANNEL_MASK & CyDmaGetInterruptSourceMasked()));
CyDmaClearInterruptSource(RxDmaS_CHANNEL_MASK);
/* Disable the tx DMA and clear out the RX buffer */
TxDmaS_ChDisable();
SPIS_SpiUartClearRxBuffer();
} // for(;;)
}
/* [] END OF FILE */
Message was edited by: Nikolay Pruss
Show Less