PSoC™ Creator & Designer Forum Discussions
Wasn't sure exactly where to put this since there isn't really a "dev tools" forum category and this seems like the closest thing.
I'm trying to familiarize myself and start using the PSoC Programmer COM Interface and running into something strange.
Following the COM Interface Guide in the PSoC Programmer program directory I've assembled a small C# .NET project to (for now) simply grab the connected programmers and report their status/capabilities. I'm using the "Late Binding" as described in section 1.2 of the COM Interface Guide.
The program works (eventually), but I'm running into a problem where the first time I press my "Connect" button I am getting System.NullReferenceException thrown on both w_IsConnected() and w_ConnectToLatest().
w_IsConnected():
w_ConnectToLatest:
Here's the event handler I have for a Connect/Disconnect toggle button:
private void btn_toggleConnect_Click(object sender, EventArgs e)
{
if (!pprog.w_IsConnected())
{
if (pprog.w_ConnectToLatest() == 0)
{
rtb_infoBox.AppendText("Programmer COM-object " + pprog.Version() + "\r\n");
if (SUCCEEDED(pprog.GetPorts(out portList, out strErr))){
foreach (string port in portList)
{
rtb_infoBox.AppendText(port + "\r\n");
}
btn_getInfo.Enabled = true;
} else
{
rtb_infoBox.AppendText(strErr + "\r\n");
}
btn_toggleConnect.Text = "Disconnect";
} else
{
rtb_infoBox.AppendText("No programmer detected.\r\n");
}
} else
{
pprog.w_Disconnect();
rtb_infoBox.AppendText("Programmer Disconnected.\r\n");
btn_toggleConnect.Text = "Connect";
btn_getInfo.Enabled = false;
}
}
It looks like the Version() member is null for some reason, and that's where the exception is being thrown. I would think it would be set when the ComLib_WrapperClass() is Instantiated in the constructor for the form:
public partial class frm_mainFrm : Form
{
PP_ComLib_WrapperClass pprog;
string[] portList;
string strErr;
public frm_mainFrm()
{
InitializeComponent();
pprog = new PP_ComLib_WrapperClass();
portList = new string[10];
strErr = "";
}
//Snipped
}
If I eat these exceptions (ignore them) and simply keep executing, after a delay of a few seconds, the application does come up with the COM object version and I can get the MiniProg 3 and KitProg (CY8CKIT-050) I have connected:
Past this point I don't seem to have any issues, I can query the capabilities of each of these devices without any problems. If I disconnect and reconnect (call w_Disconnect() and then w_ConnectToLatest()) the exceptions are no longer thrown in everything appears to operate as expected. I assume this is because the .Version() member is now loaded with a value.
Would anyone know why I'm getting these exceptions thrown at me only on the first attempt? Is there something else I should be calling to ensure my instance of the PP_ComLibWrapperClass() is ready to use? I'm following the steps laid out in the Interface Guide, so I'm not sure what I'm missing here.
I have attached the Visual Studio project, it's not very large or complex, just for now trying to find my way around using the library. If someone could see if they could reproduce this (or has any insight to why it is behaving this way) it would be very helpful.
Thanks!
Show LessI had a project using 2 SAR ADC's on the marvelous PSOC 5.
The PSOC Creator is a great platform for getting complex projects done very quickly. I usually have a project up and running before any other IDE out there has finished pointing me to the Google search areas where the IDE has made your life difficult. But I digress.
I was running the SARS in Differential Input Mode sharing a common reference, all on port 3.
The router routed SAR1 input to SAR2 and vice versa, even though the pin numbers were correct.
I put in an analog pin on port 3 to monitor the SAR Input, and suddenly it routed correctly. Took it away and got a bad route.
I was able to permanently cause a proper route by using a monitoring pin for the opAmp driven reference on an unused Port 3 pin. (I noticed it took more analog iterations to do the route, so I think the iterator said it was done too soon otherwise.
So, next time some thing like that happens, place an additional monitor on an unused pin on that port to see what happens!
Show LessHello,
I'm trying to integrate the Segger SystemView into my FreeRTOS PSOC5 project, but I'm encountering errors during the project compilation. It appears that certain assembly codes are generating 'bad instruction' errors. Please see the output below for more details:
arm-none-eabi-as.exe -mcpu=cortex-m3 -mthumb -I. -IGenerated_Source\PSoC5 -alh=.\CortexM3\ARM_GCC_541\Debug/SEGGER_RTT_ASM_ARMv7M.lst -g -W -o .\CortexM3\ARM_GCC_541\Debug\SEGGER_RTT_ASM_ARMv7M.o ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s: Assembler messages:
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:78: Error: bad instruction `name SEGGER_RTT_ASM_ARMv7M'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:93: Error: bad instruction `_ext_sym __aeabi_memcpy'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:94: Error: bad instruction `_ext_sym __aeabi_memcpy4'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:95: Error: bad instruction `_ext_sym _SEGGER_RTT'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:97: Error: bad instruction `_pub_sym SEGGER_RTT_ASM_WriteSkipNoLock'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:126: Error: unexpected character `t' in type specifier
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:126: Error: bad instruction `_section(.text, CODE,2)'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:127: Error: bad instruction `_align(2)'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:128: Error: bad instruction `_thumb_func'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:175: Error: bad instruction `_align(2)'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:237: Error: bad instruction `_place_lits'
ThirdParty\SEGGER\SEGGER\SEGGER_RTT_ASM_ARMv7M.s:240: Error: bad instruction `_end'
The command 'arm-none-eabi-as.exe' failed with exit code '1'.
I attached the ASM file that triggered the errors. Do you have any suggestions on how to address this? Could it possibly be linked to the GCC version utilized in PSOC Creator 4.4?
Thank you and best regards
Show LessJust bought a PSoc MiniProg3 to debug a special board.
I cannot install the software from www.cypress.com/psocprogrammer.
The download I get is for another program. It asks to attach the USB cable.
Nothing happens.
How do you get Psoc programmer up and running?
Seems the "quick start" guide is out of date.
D Hoffman
Hagenhoff LLC
Show LessHello, I have been using PSoC Creator for many years. But a few days ago, when I launched PSoC Creator and tried to open the design resources (i.e. the cydrw file) then, PSoC Creator freezes indefinitely. I have a Win 11 Dev machine. However, I tried it with Win 10 Enterprise running on a VM and a Win 11 Dev image running on a VM and all had exactly the same problem. This seems to be a problem that is at a lower level than a VM. Please can you investigate? The rest of the software seems to behave as expected, including compiling and programming.
Show LessHi,
I am using MiniProg4 as USB-I2C bridge. I am using COM interface with Python.
I2C initialization and port opening go well until I want to use the I2C_SendData() function. Here is my code
def SendData():
dataIN.append(reg_address)
dataIN.append(0x41)
dataIN.append(0x42)
dataIN.append(0x63)
dataIN.append(0x44)
data = array.array('B',dataIN)
hResult = I2C_SendData(devices[0], memoryview(data))
hResult = I2C_ReadData(devices[0],4)
I am using the first byte as the register address.
- The first problem is that I cannot change more than 4 bytes. For example, if dataIN has six elements instead of 5 (the first byte is the register address) the sixth byte is not changed. Why is that the case?
- The second problem is that to read 4 bytes I use I2C_ReadData() function which always returns an error of "The Address Byte is not acknowledged. Device doesn't respond". How can I fix the problem?
I have very basic knowledge of I2C and maybe I am missing something here.
Show Less
Hi,
I'm new to the PSoC and PSoC Creator, so is there a way to include the whole source folder recursively in the project? Like if I put all the supporting source into one source folder, organized into modules, do I still need to create folders in the Creator IDE one by one and include all the files?
Show LessI don't know where to put this because there really isn't a "development tools" forum category and this seems to be the closest thing.
When I started using the PSoC Programmer COM interface to get used to it, I ran into something strange.
Following the COM interface guidelines in the PSoC Programmer Program Catalog, I've put together a small C# .NET project to get the programmer connected (for now) and report its status/capabilities. As described in section 1.2 of the COM Interface Guide, we are using late binding.
The program works fine (eventually), but when I press the Connect button for the first time, both w_isConnected () and w_connecttolatest () get a System.nullReferenceException I ran into the problem of throwing a .
w_isConnected():
w_connecto Latest:
This is the event handler to use for the connect/disconnect toggle button.
private void btn_toggleConnect_Click(object sender, EventArgs e)
{
if (!pprog.w_IsConnected())
{
if (pprog.w_ConnectToLatest() == 0)
{
rtb_infoBox.AppendText("Programmer COM-object " + pprog.Version() + "\r\n");
if (SUCCEEDED(pprog.GetPorts(out portList, out strErr))){
foreach (string port in portList)
{
rtb_infoBox.AppendText(port + "\r\n");
}
btn_getInfo.Enabled = true;
} else
{
rtb_infoBox.AppendText(strErr + "\r\n");
}
btn_toggleConnect.Text = "Disconnect";
} else
{
rtb_infoBox.AppendText("No programmer detected.\r\n");
}
} else
{
pprog.w_Disconnect();
rtb_infoBox.AppendText("Programmer Disconnected.\r\n");
btn_toggleConnect.Text = "Connect";
btn_getInfo.Enabled = false;
}
}
For some reason, the Version() member appears to be empty, and an exception is thrown there. I think it's set when comlib_WrapperClass() is instantiated in the form's constructor.
public partial class frm_mainFrm : Form
{
PP_ComLib_WrapperClass pprog;
string[] portList;
string strErr;
public frm_mainFrm()
{
InitializeComponent();
pprog = new PP_ComLib_WrapperClass();
portList = new string[10];
strErr = "";
}
//Snipped
}
If you handle (ignore) these exceptions and continue execution, after a delay of a few seconds, the application can get the version of the COM object and get the connected miniProg 3 and KitProg (CY8CKIT-050).
After this, there seems to be no problem and we can query the capabilities of each device without any problem. If you disconnect and reconnect (if you call w_Disconnect() and then w_connectTolatest()), everything seems to be working as expected, so no exceptions are thrown. This is. I think it's because the Version() member was loaded with a value.
Does anyone know why I get these exceptions only on the first try? Are there any other methods I need to call to make sure the pp_comlibWrapperClass() instance is available? I've followed the steps mentioned in the interface guide, so I don't know what I'm missing here.
I'VE ATTACHED A VISUAL STUDIO PROJECT. It's not that massive or complicated, but I'm just trying to figure out how to use the library right now. If anyone can reproduce this (or if they know why it behaves the way it does), it would be very helpful.
Thank you!
Show LessDon't know where to put it because there's actually no " dev forum category", and this seems to be the closest thing to it.
I wanted to get familiar with myself and then started using the PSoC Programmer COM interface and then came across some weird stuff.
Following the COM interface guide in the PSoC Programmer Directory, I organized a small C# .NET project to (currently) grab the connected programmers and report their status/abilities. What I use is COM Interface Guide 1.1.2 "Posterior bindings as " described in the section.
The program (finally) works fine, but I have a problem, which is that when I press the connect " button for the first time, both w_isConnected () and w_connectToLatest () throw " System.NullReferenceException。
w_isConnected ():
W_ConnectoLATest:
This is the event handler I use for the Connect/Disconnect toggle button:
private void btn_toggleConnect_Click(object sender, EventArgs e)
{
if (!pprog.w_IsConnected())
{
if (pprog.w_ConnectToLatest() == 0)
{
rtb_infoBox.AppendText("Programmer COM-object " + pprog.Version() + "\r\n");
if (SUCCEEDED(pprog.GetPorts(out portList, out strErr))){
foreach (string port in portList)
{
rtb_infoBox.AppendText(port + "\r\n");
}
btn_getInfo.Enabled = true;
} else
{
rtb_infoBox.AppendText(strErr + "\r\n");
}
btn_toggleConnect.Text = "Disconnect";
} else
{
rtb_infoBox.AppendText("No programmer detected.\r\n");
}
} else
{
pprog.w_Disconnect();
rtb_infoBox.AppendText("Programmer Disconnected.\r\n");
btn_toggleConnect.Text = "Connect";
btn_getInfo.Enabled = false;
}
}
For some reason, it looks like the Version () member is empty, which is where the exception is triggered. I think it will be configured when instantiating comlib_wrapperClass () in the form's constructor:
public partial class frm_mainFrm : Form
{
PP_ComLib_WrapperClass pprog;
string[] portList;
string strErr;
public frm_mainFrm()
{
InitializeComponent();
pprog = new PP_ComLib_WrapperClass();
portList = new string[10];
strErr = "";
}
//Snipped
}
If I eat these exceptions (ignore them) and keep running, then after a few seconds of delay the application does bring up a version of COM objects, I can get MiniProg 3 and KitProg (CY8CKIT-050) connected to me:
After that, I don't seem to have any problems and I can query the features of each device without any problems. If I disconnect and reconnect (call w_disconnect () and then call w_connectToLatest ()), it no longer triggers an exception because everything seems to be working as expected. I think this is because the.Version () member now loads a value.
Does anyone know why I only experience these anomalies the first time I try? Should I also call other methods to make sure my pp_comlibWrapperClass () instance is usable? I'm following the steps listed in the Interface Guide, so I'm not sure what I'm missing here.
I'VE ATTACHED A VISUAL STUDIO PROJECT AND IT'S NOT BIG OR VERY COMPLICATED, JUST TRYING TO FIND A WAY TO USE THE LIBRARY NOW. It would be very helpful if someone could see if they could reproduce this (or know why it would do so).
Thank you!
Show Less