ICD and USB UART device


Closed Thread
Results 1 to 21 of 21
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979

    Question ICD and USB UART device

    Just received this device (FTDI USB UART IC FT232RL):
    https://www.amazon.ca/Adapter-Serial.../dp/B075N82CDL

    Has anyone been able to use a USB UART device to use ICD in Microcode Studio? Or any RS232 device for that matter?

    I'm using PBP v3.0.8.4, MCS+ v5.0.0.5 and a Blinky program on 16F877:

    Code:
    #CONFIG
        __config _HS_OSC & _WDT_OFF & _WRT_OFF & _BODEN_ON & _LVP_OFF  & _CPD_OFF & _PWRTE_OFF & _DEBUG_OFF
    #ENDCONFIG
    
    DEFINE  OSC     20
    
    ADCON1 = 7              ' A/D off, all digital
    
    TRISD = %00000000
    PORTD = %00000000
    
    START:  PORTD = %00100000
            PAUSE   500      
            PORTD = %00000000
            PAUSE   500      
            GOTO    START
    
    Finish: end
    I have GND connected, TX on device to RX on PIC, RX on device to TX on PIC.

    It compiles normally using ICD Compile/Program, I add a Break at PAUSE 500 to stop it, I select COM4 (confirmed in Device Manager, FTDI is there) and click RUN.

    It just sits there, until a window shows up with MCS offering me ideas on things to check.
    Last edited by Demon; - 11th April 2023 at 04:53.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,515


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Has anyone been able to use a USB UART device to use ICD in Microcode Studio? Or any RS232 device for that matter?
    never in a reliable way , ever

    apita making a separate model to suit every different osc and config variation for every chip i use .
    and after all that effort to be met errors or a stubborn refusal to connect or it only works for a few minutes , then you need to recompile to continue, just junk imo a total waste of time.
    xc8 mplabx , wonderful, better than arduino ide for debugging too
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Did you check the USB-UART if it works with a serial output from PIC to PC?

    Ioannis

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Quote Originally Posted by Ioannis View Post
    Did you check the USB-UART if it works with a serial output from PIC to PC?

    Ioannis
    I haven't done any serious test except plugging it on day 1 and trying it using ICD and MCS+5, like a kid on Christmas morning.

    The circuit has CTS, RTS, RXD, TXD, GND and VCC; that leads me to believe it's capable of the same communication as our old MAX232 ICs. It might even be faster for all I know; I have no docs on this device.

    It seems to be the new thing for UART communication over USB, but these boards all seem to love the FT232RL IC. Even Sparkfun likes it:
    https://learn.sparkfun.com/tutorials...et-the-ft232rl

    But you're right; I have no clue how this affects the serial component of USART comms. At this point, I mistrust myself as much as this new components (I've been out of the loop for so long).

    I was hoping one of us had used these with success. If all else fails, I'll do like before and resort to LEDs and LCDs to debug my project. I do remember something about USB and interrupts in general not liking ICD - or something of the sort, which sucks cause my project is mainly USB.

    My old 16F877 support both USART and UART comm, so does the SAM E70 in a PICKIT4. I don't see why this would be a problem, unless Microcode Studio absolutely needs serial, but again, I don't see why, since it's seeing the new COM4 from the PICKIT4.

    I'll try some basic serial exchanges with MCS once I get my LCD wired up. Right now I'm up to my eyeballs learning C++ and VB.NET using Visual Studio 2022.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Quote Originally Posted by Ioannis View Post
    Did you check the USB-UART if it works with a serial output from PIC to PC?

    Ioannis
    I might be doing a lot more testing on that UART device real soon. I was researching C++ code for Microsoft Flight Simulator 2020 and found this little gem.

    https://forums.flightsimulator.com/t...s2022/514651/2

    I can't believe I had never thought of using the UART device as my main commmunication device for my project, I was only planning on using it for ICD.

    Turns out I may not even have to bother with the whole generate-USB-code problem (MCS generates VB5, I'm using VB.NET - I don't even know yet how much code modifications that would require).

    I remember testing USART at relatively high speeds with decent success.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    I have not done anything yet with simulators but I think the data required is not that much. So Serial communication is enough for your needs.

    I do use regularly a small FTDI232 board that has Tx, Rx, GND and +5V as outputs with great success on Laptops that lack real serial ports. These little boards do not support other serial control lines though (CTS, RTS etc) and are made by a friend of mine here in Greece.

    In general I remember only one USB-2-Serial device that had problems. Can't remember what brand it was, but for sure it was a driver issue.

    I do not see why the MCS will not work. Just be sure that your adapter works with a simple test.

    I am glad you are delving into C++ and Visual Studio, something I always wanted to do but never had the nerve to.

    Ioannis

  7. #7
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    You mention learning C++ then reference VB v5 and VB.net. Are you learning a couple? I started with the PC programming using Visual Basic v2015. I don't use it that often, and must consult the 5 books I bought when I dove in trying to learn.

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    I'm forced to use whatever example code I can find for my purpose.

    So far C++ seems the top candidate.

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    I've put aside my UART device, and finished my programming cable for my Lab X1 board (parts finally came in). It was getting annoying switching the PIC from ZIF to Lab X1 all the time.

    Name:  PICkit4 cables.jpg
Views: 5378
Size:  51.0 KB

    The cable connections for the MeLabs 40-pin ZIF board are different than their Lab X1. At least I incorporated the pull-up resistor in the connector so my circuits can be programmed by another device if the need ever arrizes.
    Attached Images Attached Images  
    Last edited by Demon; - 26th April 2023 at 00:27.

  10. #10
    Join Date
    Aug 2011
    Posts
    442


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    At least I incorporated the pull-up resistor
    What "pull-up resistor" is that? Is there something missing from the X1 board?

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    The instructions seem a little vague, saying it can be configured for both ICSP and ICD. But it only mentions the pull-up in the ICD section.

    "The debugger system can be configured to use standard ICSP communication for both
    programming and debugging functions."


    So I hid one in the hotglue and the ICSP seems to run fine. The hotglue is not elegant, but it keeps all the fine wires separated and adds A LOT of strength to the connector.

    Name:  Pull-up res on PK4.png
Views: 4064
Size:  51.1 KB

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Quote Originally Posted by tumbleweed View Post
    What "pull-up resistor" is that? Is there something missing from the X1 board?
    The pull-up on the Lab X1 is only 1K, the PK4 wants 10-50K. So I slapped in something in the 20K range; whichever one I had the most.

    The 1K probably might have been enough, but I'm getting enough pesky problems without creating more of my own.

    Name:  Lab X1 pull-up.png
Views: 4046
Size:  44.2 KB


    Example of pesky problem: trying to get example code taken from the MSFS SDK docs to work. Except, the example code is missing a parameter.
    Took me a while to track down the problem. The DEVs were really helpful though. Had a few of these pesky problems since I started this project.

    Name:  SDK docs.png
Views: 3969
Size:  36.6 KB

  13. #13
    Join Date
    Aug 2011
    Posts
    442


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    The instructions seem a little vague, saying it can be configured for both ICSP and ICD. But it only mentions the pull-up in the ICD section.
    The PIC ICSP and debug connections are the same. In Table B-5, ignore the "debug" column (that's not for a PIC device) and just use the ICSP column connections.

    Whatever you add externally to the VPP/MCLR is just going to go in parallel with the 1K on the X1 board (lowering the R), so I'd remove it.

    Do you have the JP1 jumper installed? If you tell the PK to use target power then it must be connected as it uses the target VDD connection to power the output drivers of the ICSP lines.

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Quote Originally Posted by tumbleweed View Post
    The PIC ICSP and debug connections are the same. In Table B-5, ignore the "debug" column (that's not for a PIC device) and just use the ICSP column connections.
    Yeah, I realized that after I posted that pic and started googling those acronyms.


    Quote Originally Posted by tumbleweed
    Whatever you add externally to the VPP/MCLR is just going to go in parallel with the 1K on the X1 board (lowering the R), so I'd remove it.
    Having 1K in parallel with 20K shouldn<t have an impact when the allowable range is 10-50K, I would think.


    Quote Originally Posted by tumbleweed
    Do you have the JP1 jumper installed? If you tell the PK to use target power then it must be connected as it uses the target VDD connection to power the output drivers of the ICSP lines.
    Yup, JP1 is ON, I use an external power supply for the Lab X1. I have a fear of overloading USB ports on my PCs, practically a phobia.



    I'm taking a mental break from trying to get ICD working on my PK4. I still haven't investigated that other "ICD" command line that I found (although part of me is afraid that only works from MPLABX).



    I'm in the process of finishing up a tutorial on adding a COM port in Visual Studio to a basic GUI using C++. I have some MCP2221A-I/P coming in from Newark, so I'm going to investigate using UART. These USB ICs gets recognized as an ordinary serial port in Windows.

    I got frustrated with the pains of MCS+5 generating obsolete USB code in C++ version6 (that's like 25 years old). Despite DT's efforts to simplify matters in PBP, I just find the whole USB connectivity thing cumbersome.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  15. #15
    Join Date
    Aug 2011
    Posts
    442


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Having 1K in parallel with 20K shouldn<t have an impact when the allowable range is 10-50K, I would think.
    You might want to rethink that. What's 1K in parallel with 20K?

    Although to be honest, I've used 1K before without too many issues.

  16. #16
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Get rid off the 1K resistor. LABX1 was on a very safe side with this value and with 20K in parallel you are now less than 1K.

    Are you trying to have ICD with Basic?

    Ioannis

  17. #17
    Join Date
    Aug 2011
    Posts
    442


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Wouldn't it be better to just change the 1K to a 10K on the X1 and get rid of the extra resistor in the cable?
    That way you still have the MCLR pullup on the board.

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Robert said he had 20k in parallel with 1K. So a 20K I think is just fine.

    Ioannis

  19. #19
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Thanks for the ideas:

    I've made a new cable without any built-in resistors.

    I've also put aside my X1 for now, I'll change that 1K pull-up "soonday".

    For now, I'm sticking with breadboards for USART testing.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  20. #20
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,979


    Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Quote Originally Posted by Demon View Post
    I've put aside my UART device, and finished my programming cable for my Lab X1 board (parts finally came in). It was getting annoying switching the PIC from ZIF to Lab X1 all the time.

    Attachment 9363
    ...

    Guess what happens when you scroll to the very next page of the PK4 documentation?

    Name:  PK4 UART.png
Views: 3746
Size:  27.1 KB

  21. #21
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: ICD and USB UART device

    Well, seems you are hit by the RTFM thing!

    Ioannis

Similar Threads

  1. USB pic18f4550 USB COMPOSITE DEVICE
    By Saitama in forum USB
    Replies: 6
    Last Post: - 6th April 2023, 21:30
  2. Replies: 1
    Last Post: - 5th October 2011, 09:59
  3. MCP2200 - USB to UART Converter
    By pedja089 in forum USB
    Replies: 6
    Last Post: - 14th November 2010, 17:14
  4. usb - device not recognised
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2007, 18:47
  5. USB device
    By Haitham Rifai in forum USB
    Replies: 2
    Last Post: - 5th December 2005, 10:07

Members who have read this thread : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts