When using a CY8CKIT-042 or -044 for developing, you could use an UART connected to the KitProg of the development kit. On the PC-side you may run PuTTY or a self-written program reading data from com-port and writing it to a file.
When there is room enough in sram (the -044 has some more) you may use a large UART-Tx buffer to keep the system undisturbed by the transmission.
Any chance you can add a UART into design to output data ?
UART takes care of itself once you write its FIFO.
You could consider Python programming the SWD interface, thsi manual
discusses the commands SWD can use and access M0 silicon.
Thanks both for prompt replies.
This is encouraging, as you are confirming that it is possible.
I'm using the CY8CKIT-049-42xx as the functional device, and programming it via
a CY8CKIT-042 4 Pioneer Kit with the programming connections tapped off.
Your comments about using a UART have prompted me to read the section 3.3 in CY8CKIT-042 PSoC 4 Pioneer Kit Guide, Doc. # 001-86371, on USB-UART Bridge.
This seems to say that UART functionality is already built-in on the CY8CKIT-042 board.
Is that correct ?
If so, then I just need to connect the RX and TX lines as instructed, then follow the instructions in section 6.1. I'm not sure if I have HyperTerminal, but can easily download PuTTY if necessary.
I could have worked this out for myself, but had paid no attention to the UART stuff, as I was not aware of its purpose.
I guess your suggestion to program the SWD interface, using Python, is an alternative to using a UART. I've downloaded the programming spec, but will try the UART route first
It might take me a little while for me to work through this, but I will update the post with my progress.
Many thanks for your help. Ken.
The 042 board has not only a PSOC 4 on it but a 5LP. The 5LP acts
as proigrammer/debugger. But you can create a different program
with it, and use a serial connection to the 4, and a USBUART or just
UART to the PC. Note once you reporgram the 5LP you can no longer
debug the PSOC 4 unless you reprogram the 5LP with its "normal"
You could ask Cypress for the source, and mod that firmware to both
debug and add the link to the 4.
Note you can do a USBUART bridge to 4 or an I2C bridge to 4.
There is a documentation (with pictures) on how to use the UART interface of a -042 Kit and PuTTY, quite easy.
Cypress has an FRam-kit and uses this feature to prove its working. The documentation shows (page 28) the FRam-kit stuck on top of the -042 and 2 wire-bridges which in real do not use the FRam-Kit but an interconnection of the -042.
Thanks again to you both for this further info.
I think I'll first try Bob's suggestion, as in fact I think it is the same
as I have found in the CY8CKIT-042 PSoC 4 Pioneer Kit Guide. The documentation link
to FRam Kit contains useful stuff on using PuTTY (which I have now downloaded), so thanks
Best regards, Ken.
An update on progress with Uart etc.
First, I tried implementing the UART function as you suggested, but could not get it to work. I then spotted the comment in the datasheet that UART is not available on PSoC4, so gave up on this fairly quickly. Your earlier posts seemed to say it should work, so I'm confused now regarding UART.
I then tried I2C, ie the USB-I2C Bridge, with Bridge Control Panel.
Because my target PSoC4 device is not on same board as the PSoC5, I had to make some mods to the CY8CKIT-042 PSoC 4 Pioneer Kit board. I removed zero ohm resistors R24 and R25, which route the I2C lines to the on-board PSoC4, and attached wires to connect to the off-board target PSoC4. I first connected them to pins P3_0 and P3_1 as that is where they go for on-board PSoC4, but this did not work. So I then tried pins P4_0 and P4_1, and now it worked ! In the .cydwr file the P3_0 and P3_1 pins are labelled SCB1, while the P4_0 and P4_1 pins are labelled SCB0. I don't understand what the difference is, nor why SCB0 is OK but SCB1 is not.
[ As an aside, it was very fiddly to mod the board -- it would be nice if it had jumpers and connectors to do the job ]
Anyway, I can now capture data from my running PSoC4 chip.
My problem now is getting the data out in the right format.
I have used the code snippet in CY8CKIT-042 PSoC 4 Pioneer Kit Guide, which works, but seems to capture only one byte rather than the whole variable value. The detailed info on the SCB APIs in the datasheet is not of much help. I have tried playing about with, eg, read buffer size, but to no avail. I'm fairly sure it's my code that need fixing, rather than anything in the Bridge Control Panel.
On each pass through a forever loop I need to capture a mix of:
Integer numbers, Floating point numbers, and Character strings.
I wonder if you can point me to some example code which would help me to understand what I need to do ?
Many thanks, Ken.
"I then spotted the comment in the datasheet that UART is not available on PSoC4, so gave up on this fairly quickly."
That was quite too quickly! Of course there are UARTs within a PSoC4, even several and when using a PSoC 42xx even several different ones!
Despite from the connection of your Pioneer board and your own pcb you always have the chance to use two pins of your board as Rx and Tx of an UART running at 115200Baud and with a fairly large buffer to avoid blocking and connecting the two pins to the Pioneer Kit PSoC5 Rx and Tx pins on J8(9) and J8(19) and a GND connection..
Follow all the advices given in the Pioneer Kit Guide concerning the USB-UART bridge.
Thanks Bob for your further comments on UART.
However, I have invested quite a lot of time in getting the USB-I2C route working, and don't want to abandon this and start again with UART, unless there is a really good reason to do so.
USB-I2C used with the Bridge Control Panel works fine, and does not seem to slow down the execution time.
However, I do still have a problem as mentioned in my previous post, of getting the data out. The I2C link handles data a byte at a time. If the variable I am monitoring, target_variable, is one byte ( ie type uint8 ) there is no problem. But if it is more than one byte, eg type int or float, then I cannot for the life of me work out how to get the link to access anything other than the first byte (LSbyte).
Here is a snippet of code to try to read target_variable where it is type uint16 (two bytes):
uint8 rdBuf; // I2C read buffer. I assume this must be uint8 since I2C handles bytes.
while(1u) // Loops forever.
byteCnt = 2;
indexCntr = 0;
for(indexCntr=0; indexCntr<byteCnt; indexCntr++) rdBuf[indexCntr] = target_variable;
It is obvious that above will just read the same byte twice.
I have tried using pointer constructions, but there just seems to be no way to get at the "internal" bytes of a multi-byte variable.
My C knowledge is very limited, and I am clearly missing something quite basic.
Can anyone offer advice on this, or even better direct me to existing code which uses USB-I2C to capture integers and floating point numbers.
Many thanks, Ken.
You need to retreive the msb and the lsb in two different variable.
Here is an example:
rdBuf[indexCntr] = target_variable & 0xFF;//Retreive LSB
rdBuf[indexCntr + 1] = (target_variable & 0xFF) >> 4 ;//Retreive MSB