PSoC™ Creator & Designer Forum Discussions
I'm trying to create a 16-bit adder using the UDB Editor. First of all, is this even possible? It seems that if I want a device with 48 "pins" I may not have enough registers to handle two words of input and one word of output.
Background might help, I guess. I am trying to set up DMA to allow write (at least), and ideally also read, from a 4K array in SRAM on PSOC 5 (and maybe also PSOC 4). I have a 16-bit address bus implemented in two sets of 8 GPIO pins. The access from the external bus is random, and one byte at a time. A R/W pin indicates the direction of data flow, and there are another 8 pins for D0-D7. This currently works fine for writing to a single uint8 in SRAM, but not for being able to address multiple locations based on the GPIO address.
What I think I need is this adder, so I can load it with the base address of the array at startup, and have it add to that the offset into the array coming from the lower 12 bits of the address bus.
I've been looking for indexed DMA solutions, but the documentation on that is really sparse and I still can't see how it would do what I need. As far as I can tell, indexed DMA works if you can get the absolute destination address from somewhere else. I can get the relative offset, but not the absolute address... thus the need (I think) for an adder. I do see that the Keil compiler allows some explicit object positioning in SRAM, but I'm using gcc.
So, the goal I'm currently working towards in the UDB Editor is this adder. It's pretty easy to see how to set up some instructions and state machine states to load A0 from D0, then add A0 to D1 and have the result available from the ALUout. What I can't see is how to correctly make byte or word wide interfaces available in the component so I can connect them to my pins. UDB Designer allows me to add single pin/bit inputs, and it also allows me to add design-wide variables (but the design-wide variables seem to be almost undocumented... what is registered vs. combinatorial? what kinds of expressions are allowed for them?) Come to think of it, I really only need 12 "pins" for the offset address from my GPIO pins. Everything else I can read and write in firmware/software.
To recap, here's what I think I need:
--- in the solution ---
1. Connect AD0-A12 from GPIO pins to the adder component... maybe also connect CS or some other enable signal or clock
2. Configure DMA to use address from adder output as destination
--- when running ---
1. Create 4K uint8 array
2. Set the LO16 of the array start address into the adder
3. (when a new address is available, the adder will be providing a computed absolute corresponding address into the 4K array so DMA read or write requests can source or store the correct byte location)
I've been reading through the AN's on the UDB Editor. I'm not yet finding what I need. I get the impression that I need to use the FIFO registers to load D0 and D1 first, but I still don't see how to load F0 and F1 from hardware inputs. I also dropped a Control Register into the design, but I can't see how to hook that up to anything.
Worst case, I might be able to make this work with an interrupt to copy a single DMA-received byte to the correct location in the buffer, or, I guess I could create an interrupt handler to copy each written byte into the correct place in the array after DMA is complete, but that's a lot messier and I already know the entire CPU-driven data read process isn't fast enough on PSOC 4. Hardware/firmware addressable DMA seems so much more elegant here.
So, thanks in advance for some pointers on what I'm trying to do, or towards documentation that I should be reading.
Thanks,
Paul
For example, the project (developed on a different PC) uses USBFS 3.20.
The Component Update Tool shows the Current Version as '3.20 (Unknown)' and the New Version as 3.10.
The internet connection is fine. Both PCs have PSoC Creator 4.1 Update 1.
I'd be grateful if anyone could suggest a method to debug this.
Show LessI want to build a simple SR flip-flop that is not synchronized. Simple two NAND gate design you find in basic logic. If I use synthesis optimization I get a lovely *Warning* - "Warning-1361: The design contains a combinational loop. Check the design for unintentional latches. Breaking the loop at SR_Feedback1/main_1 --> SR_Feedback1/q" which apparently alters the design for a WARNING.
Looking in the forums, the *fix* is to set synthesis optimization to none, but then the design no longer fits.
So optimization means the synthesizer get to be my mother too?
Show LessI am trying to get a CI build going with Jenkins. I followed these instructions to get a headless build working: https://community.cypress.com/docs/DOC-10865
This works fine from a command line or from a batch file, but when I call the same batch files from Jenkins I get the following failure message:
Error: mgr.M0027: Argument passed in is not serializable.
Parameter name: value (App=cyprjmgr)
at System.Collections.ListDictionaryInternal.Add(Object key, Object value)
at CyDesigner.Common.Base.CyRsltOrErr`1.get_Value()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyWcdMgr.get_InstallBaseDir()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyDcPlugin.get_DeviceDataPath()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyDcPlugin.PostPluginsLoadedInit()
at CyDesigner.Framework.CyPlugin.InitializePlugins(IEnumerable`1 plugins)
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.LoadPlugins()
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.Run(CyApp app, CyErr& err)
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.Main(String[] args)
The full Jenkins output is shown below. Has anyone else had luck with this?
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc
[Switchbox_psoc] $ cmd /c call C:\Windows\TEMP\hudson5210422228259853648.bat
C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc>cd PSoC\Switchbox
C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc\PSoC\Switchbox>dir
Volume in drive C has no label.
Volume Serial Number is 747E-8C27
Directory of C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc\PSoC\Switchbox
01/12/2018 01:51 PM <DIR> .
01/12/2018 01:51 PM <DIR> ..
01/12/2018 02:38 PM <DIR> Switchbox.cydsn
01/12/2018 01:51 PM 1,265 Switchbox.cywrk
1 File(s) 1,265 bytes
3 Dir(s) 43,292,274,688 bytes free
C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc\PSoC\Switchbox>"c:\Program Files (x86)\Cypress\PSoC Creator\4.1\PSoC Creator\bin\cyprjmgr.exe" -w "C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc\PSoC\Switchbox\Switchbox.cywrk"
Error: mgr.M0027: Argument passed in is not serializable.
Parameter name: value (App=cyprjmgr)
at System.Collections.ListDictionaryInternal.Add(Object key, Object value)
at CyDesigner.Common.Base.CyRsltOrErr`1.get_Value()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyWcdMgr.get_InstallBaseDir()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyDcPlugin.get_DeviceDataPath()
at CyDesigner.Common.Db.DeviceDb.Catalog.CyDcPlugin.PostPluginsLoadedInit()
at CyDesigner.Framework.CyPlugin.InitializePlugins(IEnumerable`1 plugins)
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.LoadPlugins()
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.Run(CyApp app, CyErr& err)
at CyDesigner.Common.ProjMgmt.PrjMgrTool.CyPrjMgrTool.Main(String[] args)
cyprjmgr [-h] [-ver] [-wrk <workspace_name>] [-clean] [-build] [-rebuild]
[-archive <archive_level> <archive_as_zip>] [-t <toolchain>] [-c <config>]
[-p <TopProject>] [-n <TopDesign>] [-d <selectedDev>]
[-m <paramsFile>] [-import <Source_Project> <Source_Component>]
[-rename <component_name> <new_name>] [-delete <component_name>]
[-exclude <component_name>] [-l <NewPrjName>]
[-s] [-v <visibility>] [-prj <Target_Project>] [-cmp <Target_Component>]
[-addprj <prj_path>] [-cp <path>] [-con <Target_Project>] [-batch <file_name>]
[-updateComp <source_project> <source_component>] [-updatePrj <source_project>]
[-updateInst] [-updateDWInst] [-forceWrite] [-noCustBuild] [-noRefresh]
[-ol <compiler optimization level>] [-warn <High|Low|None>]
[-buildPreCompCust <Project>] [-updateInstIfNeeded]
[-ignoreDepsWarning] [-allowIllegalUpdates] [-export <IDE>] [-pdlPath <path>]
The following options are tool wide:
-h Displays this help message
-ver Displays the version and build number of cyprjmgr
The following options apply to the chosen workspace:
-wrk, -w Specifies the workspace to be used
-prj Specifies the target project on which all the command line
options will be targeted. In case target project is not
specified, Top Project of the workspace becomes the target
project
-p Sets the Top Project in the workspace
-cmp, -o Specifies the target component on which all the library options
will be targeted. In case target component is not specified,
the Top Block of the Target Project becomes the Target Component
-addprj Adds an existing project <prj_path> to the workspace
-l Adds a new empty library project with name <NewPrjName> to the
workspace
-d Sets the selected device of projects to be built
-cp Copies the entire workspace to the location specified by
<path>, all command line options will act on the copy created
The following four options target the entire workspace unless the
target project is set with -prj:
-clean Cleans the workspace/project
-build Builds the workspace/project
-rebuild Rebuilds the workspace/project
-archive Archives the workspace/project with different archiver levels
(complete/typical), and as zip or nozip
The following options apply to the target project:
-t Sets the tool chain the action should use (Keil, ARM etc.)
-c Sets configuration the action should use (Debug, Release)
-ol Sets compiler optimization level
-warn Sets compiler warning level
-n Sets the Top Design of the Top Project
-m Parameters file that will override the default parameter values
of the schematic in the TopDesign of the Top Project
-import Imports the Source Component from the Source Project into the
target project of the workspace
-rename Renames component_name in target project of the workspace to
new_name
-delete Deletes component from the disc
-exclude Excludes component from the target project of the workspace
-s Lists the external dependencies of the target project
-v Sets the visibility of the target component to true/false
-con Checks the consistency of the target project of the workspace
-batch Reads a file containing a series of commands, one on each line.
Executes the commands one by one. When batch option is used, all
other optional switches are ignored
-updateComp Updates a component in the Target Project from the source project
-updatePrj Updates the Target Project from the Source Project
-updateInst Updates the instances on the schematic with the latest components
-forceWrite Makes read-only files writable and then makes the change
-noCustBuild Delay building of customizer DLLs until the end (e.g., during
imports)
-noRefresh Disable updates from the refresh manager (Use with extreme care)
-buildPreCompCust Build customizer for a project
-updateDWInst Updates the design-wide instances with the latest components
-updateInstIfNeeded Update instances to minimum valid version
-ignoreDepsWarning Suppress SystemDepNotFoundOnDisk warning while building
primitives
-allowIllegalUpdates Allows updating instances to latest version, even if illegal
-export Exports the project to the target IDE. Valid targets are EWA, Eclipse and uVision
-generateDescFiles For all specified projects that have 'Generate description files'
enabled, generates the description files.
-verifyDescFileEnabled Verifies that all specified projects have 'Generate description files' enabled.
-verifyDescFileContents Verifies that all specified projects (that have 'Generate description
files' enabled) have generated files that are in-sync with the current
version of their source files.
-pdlPath Sets the path to the PDL file for the project
C:\Program Files (x86)\Jenkins\workspace\Switchbox_psoc\PSoC\Switchbox>exit 6
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Show Lesswhat is the difference between SDA_SetDriveMode(SDA_DM_DIG_HIZ) and SDA_write(high) or what is the use of void Pin_SetDriveMode (uint8 mode)
Show LessIam using psoc creator 4.1 .I want to view the value of u_n8Zone by using breakpoint.But compiler show u_n8Zone is "optimised out"> .what is the reason for this.How do i view the value of u_n8Zone.
Here is the code
#include "project.h"
#include "SmartCardI2C.h"
#define true 1;
#define false 0;
int m;
int ICCARD_STATUS_RECHARGE_SUCCESS;
int ICCARD_STATUS_WRITE_FAIL;
int ICCARD_STATUS_USED_CARD;
int ICCARD_STATUS_READ_ERROR;
int ICCARD_STATUS_CARD_NOT_PRESENT;
int ICCARD_VALUE_SERVICE_USER;
int ICCARD_STATUS_WRITE_SUCCES;
int ICCARD_VALUE_FACTORY_USER;
int ICCARD_STATUS_FACTORY_CARD;
int ICCARD_STATUS_SERVICE_CARD;
int ICCARD_VALUE_NORMAL_USER;
int ICCARD_STATUS_NORMAL_CARD;
int SMART_CARD_POWER_PIN;
int GPIO_DIRECTION_OUT;
int SMART_CARD_SENSE_PIN;
int GPIO_DIRECTION_IN;
int SMART_CARD_RESET_PIN;
bool GetULongValueFromCard(u_int8_t u_n8ZoneNo,u_int8_t u_n8ZoneAddress,u_int32_t *ptr_u_n32Value);
bool ReadCardUserZone(u_int8_t u_n8Zone,int nAddress,u_int8_t *ptr_u_n8Data,int nNoofBytes);
int SendBytesToCard(int nNumber,u_int8_t *ptr_u_n8Data);
u_int8_t GetRechargeValue(u_int32_t *ptr_u_n32RechargeValue);
bool GetByteFromCard(u_int8_t u_n8ZoneNot ,u_int8_t u_n8ZoneAddress,u_int8_t *ptr_u_n8ByteAddress);
bool WriteULongValuetoCard(u_int8_t u_n8Zone,u_int8_t u_n8ZoneAddress,u_int32_t u_n32ValueToLoad);
void ReadBytesFromCard(int nNumber, u_int8_t *ptr_u_n8Data);
bool GetULongValueFromCard(u_int8_t u_n8ZoneNo,u_int8_t u_n8ZoneAddress,u_int32_t *ptr_u_n32Value);
int WriteCardUserZone(u_int8_t u_n8Zone,int nAddress,u_int8_t *ptr_u_n8Data,int nNoofBytes);
int InitSmartCard();
void resetGetPinStatus();
bool GetCardPresentStatus();
int main(void)
{
u_int32_t *ptr_u_n32Value;
CyGlobalIntEnable;
InitSmartCard();
if(1==GetCardPresentStatus())
{
GetULongValueFromCard(10,1, ptr_u_n32Value);
}
return 0;
}
//SmartCard()
//{
//GPIO Sense()
//GPIO Sense;
//GPIO Power;
//}
int InitSmartCard()
{
int nI;
InitializeI2C();
cardrst_Write(1);
//resetSetPinStatus();
/*if(I2C_FAIL == InitializeI2C())
{
return SMART_CARD_FAIL;
}
if(GPIO_FAIL == SetPinDirection(GPIO_DIRECTION_OUT,SMART_CARD_POWER_PIN))
{
return SMART_CARD_FAIL;
}
return SMART_CARD_PASS;*/
//WriteByteToCard(10,0,ICCARD_VALUE_FACTORY_USER);
nI=WriteULongValuetoCard(10,1,100);
//SetcardasServiceCard();
return 0;
}
u_int8_t GetRechargeValue(u_int32_t *ptr_u_n32RechargeValue)
{
bool bStat;
if(1==GetCardPresentStatus())
{
bStat = GetULongValueFromCard(10,1,ptr_u_n32RechargeValue);
if(1 == bStat)
{
if((*ptr_u_n32RechargeValue)!=0)
{
if(1 == WriteULongValuetoCard(10,1,0))
{
return ICCARD_STATUS_RECHARGE_SUCCESS;
}
else
{
return ICCARD_STATUS_WRITE_FAIL;
}
}
else
{
return ICCARD_STATUS_USED_CARD;
}
}
else
{
return ICCARD_STATUS_READ_ERROR;
}
}
else
{
return ICCARD_STATUS_CARD_NOT_PRESENT;
}
}
bool GetULongValueFromCard(u_int8_t u_n8ZoneNo,u_int8_t u_n8ZoneAddress,u_int32_t *ptr_u_n32Value)
{
if(1==ReadCardUserZone(u_n8ZoneNo,u_n8ZoneAddress,(u_int8_t*)(ptr_u_n32Value),4))
{
return true;
}
return false;
}
bool WriteULongValuetoCard(u_int8_t u_n8Zone,u_int8_t u_n8ZoneAddress,u_int32_t u_n32ValueToLoad)
{
return WriteCardUserZone(u_n8Zone,u_n8ZoneAddress,(u_int8_t*)(&u_n32ValueToLoad),4);
}
bool GetByteFromCard(u_int8_t u_n8ZoneNo,u_int8_t u_n8ZoneAddress,u_int8_t *ptr_u_n8ByteAddress)
{
return ReadCardUserZone(u_n8ZoneNo,u_n8ZoneAddress,ptr_u_n8ByteAddress,1);
}
bool WriteByteToCard(u_int8_t u_n8ZoneNo,u_int8_t u_n8ZoneAddress,u_int8_t u_n8Value)
{
return WriteCardUserZone(u_n8ZoneNo,u_n8ZoneAddress,&u_n8Value,1);
}
u_int8_t SetCardAsServiceCard()
{
if(1==GetCardPresentStatus())
{
//if(true == GetByteFromCard(10,0,&u_n8CardType))
if(1 == WriteByteToCard(10,0,ICCARD_VALUE_SERVICE_USER))
{
return 1;//ICCARD_STATUS_WRITE_SUCCES;
}
else
{
return 2;// ICCARD_STATUS_WRITE_FAIL;
}
}
else
{
return 3;// ICCARD_STATUS_CARD_NOT_PRESENT;
}
}
u_int8_t CheckCardType()
{
u_int8_t u_n8CardType;
if(1==GetCardPresentStatus())
{
if(1 == GetByteFromCard(10,0,&u_n8CardType))
{
if(u_n8CardType == ICCARD_VALUE_FACTORY_USER)
{
return ICCARD_STATUS_FACTORY_CARD;
}
else if(u_n8CardType == ICCARD_VALUE_SERVICE_USER)
{
return ICCARD_STATUS_SERVICE_CARD;
}
else if(u_n8CardType == ICCARD_VALUE_NORMAL_USER)
{
return ICCARD_STATUS_NORMAL_CARD;
}
else
{
return ICCARD_STATUS_READ_ERROR;
}
}
else
{
return ICCARD_STATUS_READ_ERROR;
}
}
else
{
return ICCARD_STATUS_CARD_NOT_PRESENT;
}
}
bool ReadCardUserZone(u_int8_t u_n8Zone,int nAddress,u_int8_t *ptr_u_n8Data,int nNoofBytes)
{
u_int8_t u_n8SendData[20];
int nI=0;
cardpower_Write(1);// SMART_CARD_POWER_ENABLE
CyDelay(200);
u_n8SendData[nI++] = 0xB4;
u_n8SendData[nI++] = 0x03;
//User Zone 0- read 8 bytes from here initially.
u_n8SendData[nI++] = u_n8Zone;
u_n8SendData[nI] = 0;
nI = SendBytesToCard(4,u_n8SendData);
i2cstop();
if(nI ==1)
{
//read user config 0
nI = 0;
//Read Config Zone
u_n8SendData[nI++] = 0xB2;
u_n8SendData[nI++] = 0x00;
//User Zone 0-
u_n8SendData[nI++] = nAddress;
u_n8SendData[nI] = nNoofBytes;
nI = SendBytesToCard(4,u_n8SendData);
if(nI == 1)////(nI==SMART_CARD_PASS )
ReadBytesFromCard(nNoofBytes,ptr_u_n8Data);
}
cardpower_Write(0);//SMART_CARD_POWER_DISABLE
return 1;
}
int WriteCardUserZone(u_int8_t u_n8Zone,int nAddress,u_int8_t *ptr_u_n8Data,int nNoofBytes)
{
u_int8_t u_n8Senddata[200];
int nI=0,nJ;
cardpower_Write(0);//SMART_CARD_POWER_ENABLE
CyDelay(200);
//i = 0;
//setting user zone
u_n8Senddata[nI++] = 0xB4;
u_n8Senddata[nI++] = 0x03;
//User Zone 0- read 8 bytes from here initially.
u_n8Senddata[nI++] = u_n8Zone;
u_n8Senddata[nI] = 0;
nI= SendBytesToCard(4,u_n8Senddata);
i2cstop();
if(nI ==1)//(nI==SMART_CARD_PASS )
{
//Write user zone
nI = 0;
//Write User zone
u_n8Senddata[nI++] = 0xB0;
u_n8Senddata[nI++] = 0x00;
//User Zone 0- read 8 bytes from here initially.
u_n8Senddata[nI++] = nAddress;
u_n8Senddata[nI++] = nNoofBytes;
for(nJ = 0;nJ < nNoofBytes;nJ++)
u_n8Senddata[nI++] = ptr_u_n8Data[nJ];
nI = SendBytesToCard(nNoofBytes+4,u_n8Senddata);
i2cstop();
}
//power down
CyDelay(200);
cardpower_Write(1);//SMART_CARD_POWER_DISABLE
return 1;
}
void ReadBytesFromCard(int nNumber, u_int8_t *ptr_u_n8Data)
{
int nI=0;
while(nNumber--)
{
ptr_u_n8Data[nI]=i2cgetbyte();
nI++;
if(nNumber > 0)
{
i2csendack();
}
}
i2cstop();
}
int SendBytesToCard(int nNumber,u_int8_t *ptr_u_n8Data)
{
int nI=0;
int nRetry = 0;
int var;
i2cstart();
while(nNumber--)
{
var =i2csendbyte(ptr_u_n8Data[nI]);
if(!i2cgetack())
{
i2cstart();
nNumber++;
nRetry++;
if(nRetry > 5)
return 0;
}
else
nI++;
}
return 1; // SMART_CARD_PASS
}
void resetGetPinStatus()
{
cardrst_Read();
}
bool GetCardPresentStatus()
{
if(0 == cardsense_Read())
{
return true;
}
else
{
return false;
}
}
please help me to slove this problem.
Show LessI install a new version og Psoc creator 3.1 and when try to view or modify the main code of my project and when arrive near to the 1500 line of code , the code it is 5000 line , it is not possible view the code in corretct way because the last line it is too long and it is a single line.
The problem it is present on any file that have a 1200.1500 line.
Incredible but the compilation work fine but it is impossible modify the file over the line 1500.
The previus version 3,0 not have this problem.
I try to install the the Psoc creator 3.1 on my portable computer e this problem not appair but on my portable computer it is not present other version of the Psoc Creator.
I working from two years with Psoc creator and not have never one problem and i developped 6 board using the Psoc5 and the Psoc4 with glad.
I think that this problem would to be caused because i have the all version , 2,2 to 3.1 installed on my computer.
The OS it is Microsot Windows XP service pack 3 italian version.
I attach the project for your analisis
Thank for your help
Giorgio T.
I experience a strange problem with PSoC Creator 3.1:
starting from a certain line in my main.c file, the editor displays all the remainder of the file on one single line.
Line breaks (CR+LF) in the .c source file are ignored and instead, the editor displays empty squares (see items marked in red in the following screenshot).
Nevertheless, the file compiles without errors.
How can I fix this erratic behavior of the editor?
And another question:
is it possible to permanently disable "Automatic Outlining" in source files?
Whenever I open a code source file, I find this option turned on.
Thanks for any help!
Show LessHi all,
Is there any way to use the CY7C65211 with the Capsense tuner application?
It would be really useful to connect the CY8CKIT-049 directly to tuner application using the onboard I2C to USB bridge.
I find it strange that the Cypress I2C Bridge software can't be used with the Cypress I2C to USB bridge chip...
Thank you,
Errol