Author Topic: PSoC examples  (Read 37422 times)

0 Members and 1 Guest are viewing this topic.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PSoC examples
« Reply #50 on: September 07, 2014, 04:46:55 pm »
I found it - it is in the register TRM. there is also an architecture TRM.

How about a header file with all the definitions / addresses?
================================
https://dannyelectronics.wordpress.com/
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 556
  • Country: pt
Re: PSoC examples
« Reply #51 on: September 07, 2014, 05:09:08 pm »
I didn't check but the header file probably exists. There are (or were, it's been a few months) some CSD registers missing from the register TRM of the 4200, but they are used in the code generated by the IDE, and all by name including bit definitions. I needed to do some agressive code optimization on the 1st design of the triangle wave generator, and I just took a look at the code they generated and optimized it to my case. The code they generate is not very worried with performance, but has the advantage that you can easilly see how to configure the registers.

There are some minor issues with the build which I have reported to them:

1) In the prototyping kit you need to link with a library which has the bootloader. It happens that for some reason the IDE always re-builds the .a lib (not the entire library, just the final .a). This leads to your project being re-linked again.

2) Their "clean" is not an industry standard clean. They won't delete all the generated code, leaving *a lot* of generated files behind. They justify this by saying the user may have modified them, I don't think it is a good (nor acceptable, actually) reason. A "clean" is supposed to clean everything. If generated files may be modified, there should be some other mechanism to deal with this (like user should rename the file and make it an own file).
« Last Edit: September 07, 2014, 05:12:21 pm by nuno »
 

Offline Corporate666

  • Supporter
  • ****
  • Posts: 2004
  • Country: us
  • Remember, you are unique, just like everybody else
Re: PSoC examples
« Reply #52 on: September 07, 2014, 05:43:53 pm »
4) limited number of user configurable blocks in the 4100/4200 devices. If they had 6 or 12 such blocks, it would have been superb.
This, and I don't get what is so superb about them. The Psoc3 has a slow 20 bit ADC, but it is cheaper to just use an external, the Psoc4 has up to 32 macrocells. So I can make a 32 bit counter in it  :-// Or I can make PWM with it, which is already there in preatty much anything. The 8 bit DAC and 12 bit ADC is not enough for any application I'm looking for, ADCs and DACs start at 16 bit.
And we have 2 communication interfaces, which you can set to anything... except any ARM will have all 4 of it for the same price.
The only exceptional thing I see here is the 5V and the pin remapping. If there would be some real decent hardware built in, maybe, but it looks like to me that they just didnt add enough precision and size for anything useful.

The PSoC has it's place, but to say it's not big or precise enough for anything useful is silly.  In the PSoC 3 and 4, you're talking chips in the $1-4 range.  A 12 bit ADC is pretty good, especially considering you can configure the additional blocks for whatever you like.  If you need a fast ADC of more than 20 bits, then you're not going to be looking at $3 MCU's to have it built in anyway.

With most chips, you figure out the peripherals you need and then buy the cheapest chip which has those peripherals, and almost always you end up with stuff you don't need and won't use.  With the PSoC, you buy a chip with a big enough configurable logic to fit the peripherals you need.  I've got projects with dozens of PWM's, others with lots of ADC channels, others with stuff built in programmable logic that would be lots of code in other chips (like drivers for WS2812 LED's, signal decoders, etc).

They are amazingly versatile and useful chips.  But if you are going to compare one feature of the $3.50 PSoC3 to a $20 dedicated chip and call the PSoC too weak to do anything useful, then pretty much everything made by Microchip, Atmel, ST, Cypress, NXP and TI is useless also, because dedicated single chips exist which do one thing better (at 10 times the price).
It's not always the most popular person who gets the job done.
 

Offline Corporate666

  • Supporter
  • ****
  • Posts: 2004
  • Country: us
  • Remember, you are unique, just like everybody else
Re: PSoC examples
« Reply #53 on: September 07, 2014, 06:04:36 pm »
I've been looking at the Pioneer kit too. I thought I would look at typical prices of their uC's before spending time and money on them and they seem to be pretty pricey. I searched at DK and did a sort by price and not much selection on 32b with clock speeds of at least 48MHz under 7 bucks. Hell even some of their 8b 12MHz chips are over 7 bucks.

What are the goto chips from them? Sorting by availability shows the CY8C4013SXI-400 at the top a 16MHz ARM with 5 I/O then a CY8C27443-24PVX an 8b 24MHz chip with 24 i/o and they want over 6 bucks for that!

I'm not sure what is up with Digikey pricing, but you're better looking right at Cypress.com.  The most expensive 12Mhz chip is the CY8C29466 which ranges from $4.03 to $5.29 depending on the package you order.   The 29466 range is their "biggest" PSoC1 series chip with 16 digital blocks and 12 analog blocks and the most RAM amongst the PSoC1 series.

Honestly, there really isn't much reason to be using PSoC1's at this point... they are old tech, superseded in price, performance and capabilities by the PSoC3 and PSoC4.  Plus you have to use the old IDE and toolchain.  Better stick with PSoC3/4/5.  But for reference, the chip you mentioned - the CY8C27443 is $3.99 on Cypress' website.

I think they are very price competitive with other solutions.  Looking again at the Cypress website, the PSoC 4 CY8C4245AXI-483 is $1.92 and runs at 48Mhz, has 4 programmable digital blocks in addition to 2 built in dedicated communications blocks (for SPI/I2C/UART) and 4 timer/counter/PWM blocks, programmable op-amps/comparators and a 12-bit ADC and two DAC's and has 32k of flash and has capsense and 36 GPIO's. 

I think that's pretty good for less than $2. 

On the cheap end, they also have a PSoC 40000 series for $0.29 with an ARM M0 core, 8k of flash, 5 GPIO's (SOIC-8 package), a serial communicaton block and a timer/pwm/counter block.  That seems pretty competitive with what else is out there in the price range.
It's not always the most popular person who gets the job done.
 

Offline NANDBlog

  • Super Contributor
  • ***
  • Posts: 4443
  • Country: nl
Re: PSoC examples
« Reply #54 on: September 07, 2014, 06:31:21 pm »
4) limited number of user configurable blocks in the 4100/4200 devices. If they had 6 or 12 such blocks, it would have been superb.
This, and I don't get what is so superb about them. The Psoc3 has a slow 20 bit ADC, but it is cheaper to just use an external, the Psoc4 has up to 32 macrocells. So I can make a 32 bit counter in it  :-// Or I can make PWM with it, which is already there in preatty much anything. The 8 bit DAC and 12 bit ADC is not enough for any application I'm looking for, ADCs and DACs start at 16 bit.
And we have 2 communication interfaces, which you can set to anything... except any ARM will have all 4 of it for the same price.
The only exceptional thing I see here is the 5V and the pin remapping. If there would be some real decent hardware built in, maybe, but it looks like to me that they just didnt add enough precision and size for anything useful.

The PSoC has it's place, but to say it's not big or precise enough for anything useful is silly.  In the PSoC 3 and 4, you're talking chips in the $1-4 range.  A 12 bit ADC is pretty good, especially considering you can configure the additional blocks for whatever you like.  If you need a fast ADC of more than 20 bits, then you're not going to be looking at $3 MCU's to have it built in anyway.

With most chips, you figure out the peripherals you need and then buy the cheapest chip which has those peripherals, and almost always you end up with stuff you don't need and won't use.  With the PSoC, you buy a chip with a big enough configurable logic to fit the peripherals you need.  I've got projects with dozens of PWM's, others with lots of ADC channels, others with stuff built in programmable logic that would be lots of code in other chips (like drivers for WS2812 LED's, signal decoders, etc).

They are amazingly versatile and useful chips.  But if you are going to compare one feature of the $3.50 PSoC3 to a $20 dedicated chip and call the PSoC too weak to do anything useful, then pretty much everything made by Microchip, Atmel, ST, Cypress, NXP and TI is useless also, because dedicated single chips exist which do one thing better (at 10 times the price).
I never said that it should be compared with high end dedicated chips. I pointed out that 12 bid ADC is not enought because anyone makes 12 bit ADC in their MCUs. And making it 20 bit, and selling it for more than a MCU+20 bit ADC+ frontend is not cool. I guess indeed everything below Psoc 3 is legacy, and should be NRND. Either the price point has to be better or the functionality. The above mentioned CY8C4245AXI is doable with a STM32F030 and a LM358 (except capsense), yet it's price is triple of the above. And if you go higher, you are competing with Analog's ADUC7061 microcontroller for exampe: 8 KSPS 24 bit ADC+ 14 bit DAC for e dollar.
You probably missed my point: I want them to succeed. There must be a change in the MCU market, because in the last few years only the clock speeds increased and the price and current consumption decreased. I like when they integrate stuff beyond the usual peripherals, but it needs to be competitive. I guess they realized it also, that is why they dropped the price from two something to one dollar for some chips.
 

Offline chickenHeadKnob

  • Frequent Contributor
  • **
  • Posts: 802
  • Country: ca
  • doofus programus semi-retiredae
Re: PSoC examples
« Reply #55 on: September 07, 2014, 06:38:03 pm »
I would genuinely be interested in finding out what the "natural" noise floor of the configurable analog fabric is. And is it the same across the whole psoc series? Is the 20 bit adc really 20 bits or is the enob something closer to 12?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PSoC examples
« Reply #56 on: September 07, 2014, 07:07:03 pm »
Likely specified in the datasheet.

I would guess that it is closer to 17/18 bits rather than 20 bits.

Thar particular feature is likely to compete with F350 from Silabs.
================================
https://dannyelectronics.wordpress.com/
 

Offline chickenHeadKnob

  • Frequent Contributor
  • **
  • Posts: 802
  • Country: ca
  • doofus programus semi-retiredae
Re: PSoC examples
« Reply #57 on: September 07, 2014, 08:26:41 pm »
Likely specified in the datasheet.

I would guess that it is closer to 17/18 bits rather than 20 bits.

Thar particular feature is likely to compete with F350 from Silabs.

OK searching on cypress forums indicate that psoc 3 and 5 have been designed with lower noise than the others and that something like 18.5 bits should be attainable according to cypress applications engineer. However actual users report more trouble reaching that performance. The your mileage may vary quip applies  even more profoundly if you are in charge of the analog routing, that makes whatever is printed in the data sheet hard to gauge.

Back in the late 70's I believe Intel was the first one to offer a micro controller with on-chip ADC, an 8051 with 10 bit SAR. The Intel guy I talked to at the time said even 10 bits was hard to achieve and down played other manufactures  announced offerings as fiction. Well he would, salesmanship to be expected.

Looking at many of the  24 bit  delta sigma ADC data sheets out there it seems  that 22.5 bits enob is about the noise floor limit or wall for all  mixed signal processes.

Analogue Devices makes a cortex m3 integrated with a 24 bit ADC as another competitor to that scilabs part you linked:   ADuCM36x
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PSoC examples
« Reply #58 on: September 07, 2014, 08:45:26 pm »
Quote
something like 18.5 bits should be attainable

For an outboard adc, the practical limit for most engineers is 16-bit adc. If you are really good, maybe 20bit. 24 bit adcs are reserved for the analog Gods, :).

Yeah, I think 18.5 bits are pushing the truth for most of us.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PSoC examples
« Reply #59 on: September 07, 2014, 09:00:24 pm »
Quote
How about a header file with all the definitions / addresses?

That header file is cydevice_trm.h, generated by the Creator -> that sentence reads very religious, :)

I assume that the Creator copied it from somewhere.
================================
https://dannyelectronics.wordpress.com/
 

Offline Corporate666

  • Supporter
  • ****
  • Posts: 2004
  • Country: us
  • Remember, you are unique, just like everybody else
Re: PSoC examples
« Reply #60 on: September 07, 2014, 10:25:18 pm »
I never said that it should be compared with high end dedicated chips. I pointed out that 12 bid ADC is not enought because anyone makes 12 bit ADC in their MCUs. And making it 20 bit, and selling it for more than a MCU+20 bit ADC+ frontend is not cool. I guess indeed everything below Psoc 3 is legacy, and should be NRND. Either the price point has to be better or the functionality. The above mentioned CY8C4245AXI is doable with a STM32F030 and a LM358 (except capsense), yet it's price is triple of the above. And if you go higher, you are competing with Analog's ADUC7061 microcontroller for exampe: 8 KSPS 24 bit ADC+ 14 bit DAC for e dollar.
You probably missed my point: I want them to succeed. There must be a change in the MCU market, because in the last few years only the clock speeds increased and the price and current consumption decreased. I like when they integrate stuff beyond the usual peripherals, but it needs to be competitive. I guess they realized it also, that is why they dropped the price from two something to one dollar for some chips.

You're proving yourself wrong.  Yes, lots of companies offer 10-12 bit ADC's in their chips.  So clearly 10-12 bit ADC's are useful amongst their customer base.  They offer a 20-bit ADC in some chips which can also support dozens of PWMs or dozens of timers or counters or any other amount of configurable peripherals.   Interesting you mention the ADUC7061.  It's hardly a dollar... $8.27 on Digikey, 6 channel PWM, 14 GPIO's, only one UART/SPI/I2C interface, etc.  By your logic, that chip is overpriced and useless because it can't support 30 PWM's whereas a PSoC3 can for less than half the price.

In reality, every chip has it's target, and just like you wouldn't use a ADUC7061 if you need 30 PWM channels, you wouldn't use a PSoC3 if you need a 24bit ADC, just like you wouldn't use an Atmel XMega or a PIC16 for that purpose either.  It doesn't make any of the aforementioned chips useless or overpriced or anything else.  It means using them for something other than what they are intended for isn't as good as using something for what it was intended for.

Gee, what a shocking revelation that is.  ::)
It's not always the most popular person who gets the job done.
 

Offline NANDBlog

  • Super Contributor
  • ***
  • Posts: 4443
  • Country: nl
Re: PSoC examples
« Reply #61 on: September 12, 2014, 09:31:02 am »
Wait, let me think about this. A psoc 4200 It has two communication interfaces. You can reconfigure them on the fly and assign it to any pin. Does this mean that you can re-configure it to SPI access a device, change it to I2C access an other one, and if you receive a RTS signal on the serial, you set it to serial to receive data? Hmm, interesting.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #62 on: September 12, 2014, 02:33:41 pm »
I even think you can configure the pins to be hooked to the analog internals and time share the internal hardware. I'm going to play around hooking this to a DE0-Nano for heavy digital processing and back to the PSoC to make the processed data available to the Arm processor, and maybe some channel for video data back to the FPGA to drive a VGA monitor, should be doable.
 

Offline Corporate666

  • Supporter
  • ****
  • Posts: 2004
  • Country: us
  • Remember, you are unique, just like everybody else
Re: PSoC examples
« Reply #63 on: September 12, 2014, 07:50:43 pm »
Wait, let me think about this. A psoc 4200 It has two communication interfaces. You can reconfigure them on the fly and assign it to any pin. Does this mean that you can re-configure it to SPI access a device, change it to I2C access an other one, and if you receive a RTS signal on the serial, you set it to serial to receive data? Hmm, interesting.

At the first PSoC training seminar I went to, one of the big topics was dynamic reconfiguration of the device.  In PSoC Designer, you could have multiple configurations and just switch between them on the fly, essentially multiplexing the chip's resources:

http://www.cypress.com/?rID=2901

AFAIK, this is still possible with the PSoC3/4/5, because ultimate the chip is configured by writing configuration registers, but it's no longer built into PSoC Creator, mostly because it is not often used or needed. 

In the seminar, the example given was a transmitter/receiver.  The chip could be configured with a hardware decoder for the incoming signal, for example.  Then the chip could be reconfigured for an encoder and transmit through the same UART (for example).  By putting it all in hardware rather than software, it frees up software resources and programming hassle.
It's not always the most popular person who gets the job done.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #64 on: September 12, 2014, 08:24:35 pm »
They have digital and analog multiplexers that will allow you to do that.
On the analog multiplexer they have different choices
for example there is a sequencer so you can just jump to the next, they do offer a get channel call to find out the current channel.
They have a hardware one too that the channel is selected input pins, not sure if I could drive the pins by software.

Anyway, you can use those to route the limited resources to different input/output pins.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #65 on: September 13, 2014, 05:45:32 am »
I even think you can configure the pins to be hooked to the analog internals and time share the internal hardware. I'm going to play around hooking this to a DE0-Nano for heavy digital processing and back to the PSoC to make the processed data available to the Arm processor, and maybe some channel for video data back to the FPGA to drive a VGA monitor, should be doable.

Old Altera paper that uses the old SOPC (now QSys) but should still be applicable.

Interfacing an External Processor to an Altera FPGA

http://www.altera.com/literature/hb/nios2/external_processor_if.pdf

It shows architectures using the Avalon system interconnect fabric but also suggests that you can roll your own Verilog or VHDL without the SOPC (QSys) nor Avalon



As for interfaces via SOPC (QSys) it shows what protocols are available as processor interface solutions:
RapidIO
PCI Expres
PCI
PCI Lite
SPI

Also they offer a partial list of peripheral interfaces available for the SOPC builder
CAN
I2C
Ethernet
PIO
SPI
UART
USB

Pretty much you instantiate an Avalon Master interface component that talks to the processor using one of the protocols above to access the resources available to the FPGA. No sample code but lots of links within the document that might provide some code. Not sure.

What they mention is that PCI Lite and SPI don't require an OpenCore Plus license.
SPI looks like a sensible option too:



Towards the end it also suggest building a custom bridge to communicate with an Avalon slave interface for a custom FPGA component.



I think I'll try the 1st approach one because Qsys and the whole Avalon signal interconnects give me a headache.

But I do like the last one to enable access to the DE0-Nano memory via the FPGA (as in a frame buffer), but I'm still trying to get my head around the Avalon system, but I keep revisiting often and one of these days it will click. I think I'm pretty close to that moment.

« Last Edit: September 13, 2014, 05:49:20 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #66 on: September 18, 2014, 05:33:42 am »
I didn't get to the FPGA PSoC yet but today I found a little SOIC 0.65 pitch board so I used one of my 4200 SSOP 28 pin chips. I bought 10 SSOPs 10 QFPs and 20 QFN while they were (and still are) a dollar a pop.

I also had some 0805 caps so I put it together with the headers and bypass caps.
With the bypass you can feed VDDD from 1.8V to 5.5V and get regulated 1.8V out of VCCD.
Edit: I used TDK 1uF 25V (C2012X7R1E105K125AB $0.037 qty 100) and Syfer 0.1uF 50V (0805J0500104KJT $0.055 qty 100) both 10% that I got from Mouser.

Here is how I wired it up and feed it 3.39V coming from the Pioneer that, also connected the SWD clock and IO as well as the /XRES and ground.



The internal regulator is outputing 1.7985V. Well within the range of 1.71 to 1.89 V (1.8 ┬▒5%) if I didn't bypass VDDD and VCCD and shorted them that's the regulated external supply you have to give it, but 3 tiny caps and it's happy from 1.8V to 5.5V.

I powered it up and launched Creator and made a blinky which took no time because I just told it to do the example and just wired the led to a pin that I could use.

The programmer didn't show the board at the beginning it just showed a cortex m0 and that's it but once I click on the Port Acquire on the kitprog it saw the target chip just fine.


pressed program and:

Sorry about the flux mess, I don't have anything to clean it with, I couldn't find my kester flux pen so I used some rosin flux.

So from begin to end took me 15 minutes to put the board together and less than 2 to wire it up and program it.


So I guess this is the $1 one minute PSoC version :)
Well more than one dollar, maybe $4.
But this is an FPGA of shorts, actually you can program your own Verilog based custom components or you can use schematic, no VHDL though :(
Plus it has the analog as well since its a 4200 :)

Edit: Consumption
5 mA removing the LED
13.5 mA with the LED while the LED was on 5 mA when it was off.

Edit: I forgot, it does have a Sleep, Deep Sleep, Hibernate and Stop Mode (all resumable and different power consumption.

Sleep 1.3 mA
Deep Sleep with 1.8 to 3.6 V input: 1.3 uA
Deep Sleep with 3.6 to 5.5 V input: 15 uA
Hibernate: 150 nA
Stop: 20 nA

Hibernate and Stop can be woken up with a GPIO pin.

« Last Edit: September 18, 2014, 08:45:33 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
PSoC 4 dollar programmer
« Reply #67 on: October 01, 2014, 05:51:43 am »
So on the thread "One Dollar One Minute ARM Development" it was misunderstood how the $4 PSoC® 4200 Prototyping Kit (CY8CKIT-049-42xx) can be used as a programmer.

Thread:
https://www.eevblog.com/forum/microcontrollers/one-dollar-one-minute-arm-development/msg521972/#msg521972

$4 Programmer Project (needs to be recompiled or it might brick your prototype board):
http://www.cypress.com/?rid=92146

So I'm going to explain in here all the steps needed to program a virgin CY8C4245PVI-482 28 pin SSOP chip with one of those $4 breakout boards as described in the cypress link.

First we need to wire things up.
Here is how I'm wiring the board (because the camera angle the pins don't quite correspond to the breadboard the farther you are from the center of the picture, so I added extra lines to show where in the boards they connect).
Also I included the internal wiring of the target board with decoupling caps so that it can use the internal voltage regulator and accept an input from 1.8V to 5.5V. I used TDK 1uF 25V (C2012X7R1E105K125AB $0.037 qty 100) and Syfer 0.1uF 50V (0805J0500104KJT $0.055 qty 100) both 10% that I got from Mouser.


I used a 470 Ohm resistor to protect the LED because it was just there in my desk.

SSOP pinout:


Here is the actual wiring with jumpers.


First we are going to create and compile a blink program that we will program into the target board.

I'm using PSoC Creator 3.0 SP1.

1) Create New Project
   File->New->Project

2) Select Empty PSoC4 Design and name the project Blinky, expand the Advanced dropdown menu, change the device to CY84245PVI-482 and Click Ok.


3) Add a digital output pin by dragging it from the component catalog.


4) Right click on the new pin, rename it to Pin_Blue, clear the HW Connection checkbox and click OK.


5) We want pin P4[0] to drive the LED, so we assign it like this:


6) Add the LED blinking code into main.c

Code: [Select]
        Pin_Blue_Write(~Pin_Blue_Read());
        CyDelay(500);

7) Compile the program.


8 ) When done click on the Results tab, open the Blinky.hex file, hover over the label to find out where the output ends up. We are going to need this file to program our target board. You can right click on the tab and open the containing folder as well.


Next we need to download and compile the bootloadable 4 dollars programmer project.
« Last Edit: October 01, 2014, 09:25:46 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #68 on: October 01, 2014, 05:52:50 am »
Here we are going to configure the programming computer (windows based) to configure the CY8CKIT-049-42xx with a bootloadable (meaning it can be reprogrammed back with another bootloadable firmware) project that will enable you to program an external PSoC board, in this case a CY8C4245PVI-482 28 pin SSOP chip.

1) Go to http://www.cypress.com/?id=4&rID=98796 and download the "4 dollar programmer.zip" project.

2) Unzip the project (it doesn't create the directory so you want to use "Extract to 4 dollar programmer_001-93541" (I use WinRaR)

3) go into the extracted folder and you'll see a "PSoC 4 Firmware.zip" archive, this one will create the folder so use "Extract Here"

4) Navigate to UART_SWD and you'll find a PSoC Creator project named "UART_SWD_Bridge.cywrk", double click on it to open it. (I'm using PSoC Creator 3.0 SP1)

5) A prompt will pop up saying that the project contains special code that runs on your computer and do you trust the source of the project etc.. click Yes.


6) The Component Update Tool will show next asking to update the obsolete components. Uncheck the Archive before commiting checkbox and click on Next this will change to Finish so hit Finish as well.



7) The project is already targeted for the CY8C4245AXI-483 chip that is in the CY8CKIT-049-42xx prototype kit. But you should double click on main.c and change the "#define SCB_UART  1" to "#define SCB_UART  0". If you leave it as 1 it will work too, but it's preferable to use the UDB UART since we the prototype kit uses a 4200 chip.
Edit: Nope leave it alone as 1, the comments are wrong, If you already changed it and programmed it, you can change it back to 1 and reprogram the board.

8 ) After changing the 1 to 0 Click on the Build project button, it will compile giving you 2 warnings and one note, just ignore those.

9) Time to power up the prototype kit into bootloading mode, for that you press and hold the user button while connecting it to your computer's USB, you will see the in board blue LED flashing fast (about 3 times a second) that indicates that is ready to be programmed.


10) Click on the Results tab and double click on the UART_SWD_Bridge.cyacd file to locate where is at. Alternately you can right click on the tab and select "Open Containing Folder"

In my case is at "D:\projects\Cypress\4 dollar programmer_001-93541\PSoC 4 Firmware\UART_SWD\UART_SWD_Bridge.cydsn\CortexM0\ARM_GCC_473\Debug"

11) Go to Tools->Bootloader Host and under file navigate to where the UART_SWD_Bridge.cyacd file is located, Select the boot loader serial port (you would have to had install the drivers prior to this), leave the port configuration as the default. The light in the board is still blinking fast so hit the Program button (the blue arrow pointing down)


12) The light will stop blinking and show solid blue, and the protoboard is ready to program your external board.


Continued on the next post.


« Last Edit: October 01, 2014, 08:11:19 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #69 on: October 01, 2014, 05:53:46 am »
Time to actually program the external board.

But first we need to setup Python 2.7 and PySerial
https://www.python.org/download/
https://pypi.python.org/pypi/pyserial

1) Once you have that setup, locate the python script, in my case is at "D:\projects\Cypress\4 dollar programmer_001-93541\Python Programmer.py" and right click it and select the "Edit with IDLE" (I took the image from the project website because I can't do an Alt-PrtScr preserving the drop-down.


2) Change the COM port to the prototype UART port, in my case is com8


3) Change the hex file from Part 1 to upload into the external board, in my case it's here:
"C:\\Users\\Miguel\\Documents\\PSoC Creator\\Blinky\\Blinky.cydsn\\CortexM0\\ARM_GCC_473\\Debug\\Blinky.hex"


Note you have to escape the back slashes within the string.

4) Make sure you have closed the "Bootloader Host" from where you programmed the prototype board, or it will interfere because it's still connected to the COM Port. Also it won't hurt to power cycle the prototype board.

5) The moment of truth, in IDLE press F5 or select Run->Run Module. A Python Shell with show up spewing a bunch of numbers, it's not the fastest programmer but it will get it done.

I took that image from the project page as well.

While is programming you will see the prototype board built in LED blink really fast as t's writing data to the external chip. If it's solid then it's not programming at all. (it's more a flickering than blinking because it's doing it at 115Kbps).


You can experiment with the code to optimize it, since it programs the whole thing regardless of the size of the program.

Other things to try is to export the project to kiel and then use uVision to program the chips, not sure what programmers are supported.

The result:


« Last Edit: October 01, 2014, 08:33:25 am by miguelvp »
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Keil Program/Debug using Pioneer Kit
« Reply #70 on: October 14, 2014, 04:25:14 am »
So today I decided to export a PSoC creator project to Keil and I was greeted by a nice surprise:



Of course I did press the install,even if I don't have a miniprog3 I was thinking that maybe I can modify the kitprog that I use on my Pioneer to make a full programmer/debugger for Keil as well.

So on the export it asked me if I wanted to open the exported project with keil, so I went ahead with it.

I looked in: Project->Select Device for Target...

And selected my chip, it defaulted to Generic CPU Database either clicking ok in there or selecting PSoC devices the target chip was already selected to the one I used in the PSoC Creator project.

Then I went to: Flash->Configure Flash Tools... then to the Utilities Tab.
There I selected the Use Debug Driver.



Then to the Debug tab and selected use (instead of use simulator).
The drop down debugger selection had the MiniProg driver on it so I selected that one.



Then I clicked on Settings, thinking the KitProg wouldn't be there because it expects a MiniProg, but...



There it was KitProg listed and the full port configuration all set and unchangeable, clicked on the detected device and clicked on Port Acquire, even if I don't know if I need to do that.

Ok and Ok to save the settings, saved the project and restarted Keil just to make sure it all took in (yeah I'm paranoid)

Restarted it again, checked everything was still set as I left it, compiled the code and then selected: Flash->Download



Sure enough it programmed my device and I saw the LED blinking happily.

Done? nope, gotta try to debug it. So: Debug->Start/Stop Debug Session (or Ctrl+F5) and...



No problem since the PSoC 4 only has 32K of programmable memory  :)

Clicked OK and...



It programmed it and stopped in the for loop since I had Run to main() selected in the debugger options.

So there you have it a $25 dollar PSoC programmer that also works with Keil uVision  8)

Edit: If you don't want to modify the Pioneer KitProg to program an external PSoC, you can still use the updated KitProg and use Keil uVision to program and debug the built in PSoC 4200 chip in the Pioneer itself.

« Last Edit: October 14, 2014, 05:18:21 am by miguelvp »
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1945
  • Country: nl
Re: PSoC examples
« Reply #71 on: October 15, 2014, 10:21:02 am »
Nice, thanks for sharing. :-+

So this magic combo works with an evaluation version of Keil? Because if so, that's good to know for future psoc playing around and the inevitable installfest.

 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #72 on: October 15, 2014, 02:22:21 pm »
Yes it's the evaluation version of Keil, I think that's why the assembly instructions only show 0's and the 32K limit for debug, which is what the 4200 limit is currently at.

To be honest I rather stick with PSoC Creator, it's more functional to me. But it's nice that it supports any toolchain, including GCC or ARM's version of GCC.

Edit: But if you are going to use the UDBs I looked more into it and they get configured with a prepared table and location list before calling main. I guess we can figure out the addresses and what values do what for the interconnects, or just generate the table in PSoC creator first
« Last Edit: October 15, 2014, 02:27:52 pm by miguelvp »
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 1945
  • Country: nl
Re: PSoC examples
« Reply #73 on: October 15, 2014, 02:53:55 pm »
To be honest I rather stick with PSoC Creator, it's more functional to me. But it's nice that it supports any toolchain, including GCC or ARM's version of GCC.
Always nice when there are a few options. If for no other reason than to have some way of sanity checking if when your main dev environment is giving you trouble with one thing or another. And good to know that you can plug in gcc if you want to. :)

Quote
Edit: But if you are going to use the UDBs I looked more into it and they get configured with a prepared table and location list before calling main. I guess we can figure out the addresses and what values do what for the interconnects, or just generate the table in PSoC creator first
The configurable logic bits can be described using verilog, right? Or am I misremembering that from earlier on in this thread? If it is anything like schematic entry for regular fpga, then it is probably fun and easy to start out with the pretty gui buttons. And then when you get the hang of it you use the boring textual description of your design.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5549
  • Country: us
Re: PSoC examples
« Reply #74 on: October 15, 2014, 03:20:31 pm »
Quote
Edit: But if you are going to use the UDBs I looked more into it and they get configured with a prepared table and location list before calling main. I guess we can figure out the addresses and what values do what for the interconnects, or just generate the table in PSoC creator first
The configurable logic bits can be described using verilog, right? Or am I misremembering that from earlier on in this thread? If it is anything like schematic entry for regular fpga, then it is probably fun and easy to start out with the pretty gui buttons. And then when you get the hang of it you use the boring textual description of your design.

I didn't dig too much into this but you are right. You can create a component and then add Verilog code, they also have something called datapaths that programs the UDBs directly but I didn't play with that feature but watched a couple of videos and looks simple enough.

Here is a link to a datapath configuration cheatsheet:
http://www.cypress.com/?id=4&rID=77887

Another related document of Q&A
http://www.cypress.com/?docID=31432
« Last Edit: October 15, 2014, 03:23:35 pm by miguelvp »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf