PSoC™ 5, 3 & 1 Forum Discussions
Till now I bitbashed the SPI. I would like to use the component but cannot see how you can read back bytes at same time as sending (in my bit-bashed code I return the received character). Here is my code. Would somone mind advising me how to set this up better.
#include <project.h>
#define CONFIG_REG 0x01
uint8 RX_Buf[20];
uint8 RX_Bytes;
uint8 TX_Buf[20];
void SPI_Write(uint8 * buf, uint8 n){
uint8 i;
for(i=0;i<n;i++){
SPIM_WriteTxData(buf);
while(!(SPIM_ReadStatus() & SPIM_STS_TX_FIFO_EMPTY));
}
}
uint8 SPI_Read(uint8 adr,uint8 n, uint8 * buf){
uint8 i;
SPIM_WriteTxData(adr); //Register address
while(!(SPIM_ReadStatus() & SPIM_STS_TX_FIFO_EMPTY)){};
for(i=0;i<n;i++){
SPIM_WriteTxData(0xff); //write dummy byte
while(!(SPIM_ReadStatus() & SPIM_STS_RX_FIFO_NOT_EMPTY)){};
CyDelay(1);
buf= SPIM_ReadRxData();
}
return i;
}
int main()
{
CyGlobalIntEnable;
SPIM_Start();
for(;;)
{
RX_Bytes = SPI_Read(CONFIG_REG,1,RX_Buf); //read 1 byte from Config Register and place in RX Buffer
TX_Buf[0] = 'A';
TX_Buf[1] = 'B';
TX_Buf[2] = 'C';
SPI_Write(TX_Buf,3); //Write 3 bytes of TX buffer to SPI
CyDelay(100);
}
}
Show Lessto clock speed must work INSAMP Three Op-Amp Topology?
I am now back home from a visit to Cypress at the embedded world in Nuremberg hving talked to many of the Cypress engineers and having seen the new devices Cypress is going to release.
In my opinion the most remarkable news is a PSoC5 Prototyping Kit that, differently to the PSoC4 version, allows for debugging!!!
Second in list, not in value, is a re-designed Pioneer Kit which has got an external F-Ram on-board that is interfaced like an eeprom, but is quite more reliable and nearly immune against power losses during write-accesses, see a video here. I was able to see at the Cypress booth that there is no fake with the F-Ram, so no additional pre-cautions are needed to bypass the power-loss problem when an eeprom-write is started.
Cypress announced some larger PSoC4 BLE chips for the next quater
And lastly: I had a (very) small glimpse ar a Creator 3.2 Beta on one of the PCs, so stay tuned for the new announcements when all of those "secrets" get official.
Happy coding
Bob
Show LessI have discovered that procedure I2C_MasterWriteByte() only returns if an ACK is received otherwise it hangs forever. This doesn't seem right. I know the component data sheet says this function is blocking and does not exit until the byte_complete bit is set in the I2C_CSR register. But the description of this register states this bit indicates that eight bits of data plus ACK/NAK.
Show LessI have a project where I'm using the DMA to access memory in RAM. The whole problem is that I need to specify the base address of a 2D array, so for example how do I specify the starting address for:
uint8 frame[2][19200];
Show LessHi,
I am trying to use Delta Sigma ADC with 16bit resolution in differential mode. I created 4 configurations, which differ only in input range (image for CFG0😞
- CFG0 - +/-1.024V
- CFG1 - +/-0.256V
- CFG2 - +/-0.128V
- CFG3 - +/-0.064V
I am using 10 Ohm resistor as a shunt to measure current going through a 10kOhm resistor at 3.3V. In topdesign I just connected two analog input pins to inputs of ADC.
If I use configuration 0 (input range +/-1.024V), I get values that are similar to those that I measure with my multimeter, around 3.15mV. However, if I use any of the other 3 configurations, measured voltage is around 1.75mV.
I have also tried to modify the CFG0 to use different input ranges, but I get same results. Also, if I use input range +/-0.512V, I get expected results (~3.15mV). So the problem appears when I use input range +/-0.256V, +/-0.128V and +/-0.064V.
Am I doing something wrong? Are there any additional settings that need to be configured?
Thanks!
Strahinja
Show LessI found there are two CPSD0 and CPSD1 block in creator3.1/analog tab for cy8c3865axi-204.
so i want to use one of these cpsdx to implement touch-key. but when i add capasense-csd component in project, i found the component need a comparator, but this device doesn't have comparametor.
So, is there at least one error built in capasense component that it doesn't release attribute which is set by default to true for autoenable in Vref component?
or, other errors?
Show LessAs you can see, I got the serial out to work, but not the serial in. I also tried various configs for the uart, but no luck yet. I don't need to use interrupts yet, so let's leave that out for now. Pretty simple. . . use crlf to store the string, check the string (future code) for valid stuff, and then do whatever. More pressing instrumentation problems are awaiting me. Thanks for any help.
Never sent a bundled file. Hope it works.
Show Less