1 2 3 Previous Next 33 Replies Latest reply on Jun 30, 2015 9:20 AM by jpellet

    UART in Standard Mode Example Code

      I would like to create a loopback for the UART just to get a feel for how it works.  Where can I find example  code for this?  Obviously the UART would need to be bi-directional and standard mode is fine.  No handshaking is needed.




      On the CY8CKit-49-41xx and CY8CKit-49-42xx it seems the baud rate is limited to about 9600 for the standard rates.  Anything higher and the error is too large.  Is there a way around this without changing the crystal?  Can an SCB be used to generate better clocks for a higher baud rate? 

        • 1. Re: UART in Standard Mode Example Code

          Use SCB-UART, connect externally Tx and Rx.


          Set the buffer sizes to something like 40, baud rate to 115200


          Set the IMO clock to 48MHz





          • 2. Re: UART in Standard Mode Example Code

            Where do you want to have the loopback? Should the PSoC send out data, which then gets looped back to it so you can print it to somewhere? Or should the PSoC receive data on Rx, which it then sends back on the Tx line?

            • 4. Re: UART in Standard Mode Example Code

              Yes, the data received on Rx will be transmitted back to the sender on the Tx line.  I will look for the example you point to.  Thanks

              • 5. Re: UART in Standard Mode Example Code

                I downloaded the project file and opened it in Creator.  I changed the tx and rx pins to match the PSOC proto kit.  It compiles ok.  I also downloaded the CyUSB-Serial_SDK drivers and installed them.  The COM port for the proto kit shows up in the bootloader host screen as COM6.  But I can't figure out how to download the project to the proto kit.  When I click the program icon it pops up a dialog that says "Port Acquire Failed". 




                Am I heading down the wrong road?

                • 6. Re: UART in Standard Mode Example Code

                  At first: check the baud-rate and other settings of both UART and your COM-port. Also check the mimic with the switch and the blinking LED as stated in the Kit's user guide.


                  Since we do not know exactly


                  Which Prototype kit you use


                  and which project you downloaded


                  it can be easier for us to trace down any bugs when you attach your complete project here so that we all can have a look at all of your settings. To do so, use
                  Creator->File->Create Workspace Bundle (minimal)
                  and attach the resulting file (do NOT use chrome, that still may not work).





                  • 7. Re: UART in Standard Mode Example Code

                    I don't think you understand my post.  First, the project and board are the ones listed here in the thread already. 




                    CY8CKit-49-42xx and the UART loopback at '100 projects in 100 days' series: http://www.element14.com/community/message/75846/l/psoc-4-pioneer-kit-community-project04--usb-uart-utility#75846  USB-UARTexample project.zip




                    I don't see a point to uploading the project as yet because I have not been able to program or even find a way to program the prototyping kit board.  I am asking for instructions on how to do that.




                    BTW, I tried to follow the introductory videos found on the web site, but I found them to be very marketing oriented and could not find the technical content.  The first two videos were 100% fluff.  When I tried to watch video three and four I tried skipping over the fluff content and every time the video would hang and the page would need to be reloaded.  I would get error messages saying use a different browser (no mention about which one works better) until I had tried all three that I have, Chrome, Firefox and IE.  Is there a way I can download the video and watch it offline?  That should allow me to view any portion of the video without watching all the marketing fluff.

                    • 8. Re: UART in Standard Mode Example Code

                      Using  the UART with this kit is a little harder than with the PSOC 4 pioneer kit because it contains the PSOC 5 for the usb interface and uart.  I have checked and found an example in this document http://www.cypress.com/?docID=48142. See section 5.4.2 it explains how to use the UART with this board.  As this board has limited resources I am not sure you will be able to read back your serial data. I would suggest that you get a PSOC 4 pioneer kit as it has more resources and is easier to debug in real time.  Also this document shows you how to get this board to program and work with the PSOC Creator 3.0.

                      • 9. Re: UART in Standard Mode Example Code

                        Well, the project you downloaded is not designed for using a bootloader which is needed if you do not have got a MiniProg3.




                        Have a look at the examples for the Kit-049-42xx and understand how bootloading works. Then you may expand the current project by using a BootLoadable component and changing the project's properties appropiately.


                        The examples are needed because they have got the BootLoader project which has been initially programmed into the kit. The bootLoadable project refers to some files of the bootloader project.





                        • 10. Re: UART in Standard Mode Example Code

                          An additionally downgrade: That project is made (as you can see from the pictures of the board) for the Pioneer Kit which has a UART-USB-bridge on board which is not the case for the Kit-049-4xxx.





                          • 11. Re: UART in Standard Mode Example Code

                            I'm a little confused by the bootloader vs. bootloadable.  When a bootloadable project is created, I assume that does not include a bootloader.  So I also assume the existing bootloader does not copy over itself then.  So I can create a project with the bootloadable component and it will not clobber the bootloader.  But how then do I use the exiting bootloader again if the UART is used by the app.  Do I have to include the bootloader and use a switch or other condition to run the bootloader for a new program? 




                            So if I include the bootloader and it doesn't work correctly I have bricked the kit until I can use a MiniProg3 or other programmer with it, right? 

                            • 12. Re: UART in Standard Mode Example Code

                              In a PSOC 4 pioneer kit the bootloader is stored in the PSOC 5 part on the board. In your project it is in the software on your computer when you are using the PSOC Creator. All of your projects must have a Bootable component on your Schematic or the unit will not function.  See example 36 of 100 projects in 100 days to better explain the bootloader and bootable information. Also you are not able to debug the CY8CKit-49-42xx in real time because you do not have the PSOC 5 part.  As I have suggested before I would start out with the PSOC pioneer kit to get use to the family and device and then try to use your CY8CKit-49-42xx.

                              • 13. Re: UART in Standard Mode Example Code

                                Check this article at http://eewiki.net/display/microcontroller/PSoC+Bootloaders it explains the issue very well.  I decided that if I was going to use one of these boards I would need the CY8CKIT-002 PSoC® MiniProg3 Program and Debug Kit as I want to be able to debug the projects.



                                • 14. Re: UART in Standard Mode Example Code

                                  The following bootloaders were tested on the PSoC4 Pioneer Kit (CY8CKIT-042). 

                                          Bootloader Files       
                                          Bootloader Pins       

                                  Bootloader waits 2 seconds for start signal from Host and then passes control to application code.  2.2k pull-up resistors are included on P4[1:0] on the PSoC4 Pioneer Board.

                                  Bootloader I2C rate is 100kbps.  I2C slave address is 0x08.


                                  P4[0]: I2C_SCL

                                  P4[1]: I2C_SDA


                                  Bootloader waits 2 seconds for start signal from Host and then passes control to application code.

                                  Bootloader UART operates at 56.7kbps, 8-bit data, no parity, 1 stop bit, no flow control.


                                  P0[4]: UART_RX

                                  P0[5]: UART_TX

                                  1 2 3 Previous Next