Announcement

Collapse
No announcement yet.

Problem with DEBUG and 16F18326 processor

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with DEBUG and 16F18326 processor

    I don't know how many people are using the new Enhanced 16F18326 processors but, I believe I have found an error using the DEBUG command.
    When using the DEBUG command with an 16F18326 processor I get NO output. My defines are as follows:

    DEFINE DEBUG_REG PORTC
    DEFINE DEBUG_BIT 4
    DEFINE DEBUG_MODE 0
    DEFINE DEBUG_BAUD 38400

    If I use the port as a full duplex uart at 38400 baud it works just fine. Here is the setup for the default pins:

    '---------------- PERIPHERAL PIN SELECT MODULE -----------------------
    RXPPS = %00010101 'UART RX INPUT TO PIN RC5
    RC4PPS = %00010100 'UART TX OUTPUT TO PIN RC4
    INTPPS = %00000010 'INTERRUPT INPUT TO PIN RA2
    T1GPPS = %00000100 'T1G INPUT TO PIN RA4
    Dave Purola,
    N8NTA
    EN82fn

  • #2
    The DEBUG command doesn't use the USART, so you want the output to be normal I/O. Try changing this:

    RC4PPS = %00000000
    Charles Leo
    ME Labs, Inc.
    http://melabs.com

    Comment


    • #3
      Actually Charles in the past I have used the hardware usart and the debug commands together in certain programs to save memory usage. I have done this:

      CASE $3f '"?" HELP MENU
      INTCON.7 = CLR 'CLEAR GIE
      RCSTA.7 = CLR 'DISABLE RECEIVER,CONTINUOUS
      DEBUG "xxxxxP = PROPORTIONAL",10,13
      DEBUG "xxxxxI = INTEGRAL",10,13
      DEBUG "xxxxxD = DERIVITIVE",10,13
      DEBUG "xxxF = LOW PASS FILTER",10,13
      DEBUG "xxxN = NEGATIVE INTEGRAL MULT",10,13
      DEBUG "xxx.xO = TEMPERATURE OFFSET",10,13
      ' DEBUG "xxxxxS = TEMPERATURE SLOPE",10,13
      DEBUG "xxx.xT = TEMPERATURE SETPOINT",10,13
      DEBUG "Z = CURRENT STATUS",10,13
      DEBUG "? = THIS HELP MENU SCREEN",10,13
      DEBUG "ctrl Z = WAIT 10 SEC. RE-BOOT",10,13
      RCSTA.7 = SET 'ENABLE RECEIVER,CONTINUOUS
      INTCON.7 = SET 'CLEAR GIE

      But now for some reason the debug does not work.
      Dave Purola,
      N8NTA
      EN82fn

      Comment


      • #4
        Charles, I seem to have found another possible problem with the 16F18326 processor and PBP3. When using the I2CWRITE or I2CREAD commands there are NO clock pulses produced on the designated port pin. The attached program is what I based my diagnosis on. No pulses on the scope.
        Attached Files
        Dave Purola,
        N8NTA
        EN82fn

        Comment


        • #5
          In that case, I think you need to manipulate the PPS setting at the same time you enable/disable the USART. The safe presumption is that if a pin is assigned to a peripheral with PPS, it won't function as normal I/O. In my limited experience with PPS, though, I've found that different families have different (undocumented) rules. As an experiment, try this:


          Code:
          CASE $3f '"?" HELP MENU
          INTCON.7 = CLR 'CLEAR GIE
          
          RCSTA.7 = CLR 'DISABLE RECEIVER,CONTINUOUS
          RC4PPS = %00000000 ' Set RC4 to normal I/O
          
          DEBUG "xxxxxP = PROPORTIONAL",10,13
          DEBUG "xxxxxI = INTEGRAL",10,13
          DEBUG "xxxxxD = DERIVITIVE",10,13
          DEBUG "xxxF = LOW PASS FILTER",10,13
          DEBUG "xxxN = NEGATIVE INTEGRAL MULT",10,13
          DEBUG "xxx.xO = TEMPERATURE OFFSET",10,13
          ' DEBUG "xxxxxS = TEMPERATURE SLOPE",10,13
          DEBUG "xxx.xT = TEMPERATURE SETPOINT",10,13
          DEBUG "Z = CURRENT STATUS",10,13
          DEBUG "? = THIS HELP MENU SCREEN",10,13
          DEBUG "ctrl Z = WAIT 10 SEC. RE-BOOT",10,13
          
          RCSTA.7 = SET 'ENABLE RECEIVER,CONTINUOUS
          RC4PPS = %00010100 'UART TX OUTPUT TO PIN RC4
          
          INTCON.7 = SET 'CLEAR GIE
          Charles Leo
          ME Labs, Inc.
          http://melabs.com

          Comment


          • #6
            That is exactly what I was thinking in the back of my mind. The PPS is probably not allowing an "OR" function with the pin. Once set to a peripheral input or output it can not be used as a normal port register.
            Dave Purola,
            N8NTA
            EN82fn

            Comment


            • #7
              Charles, Resetting the PPS for standard port use fixed the DEBUG problem. I probably should have tried that before saying anything. Now for the I2CWRITE and I2CREAD command issues.
              Dave Purola,
              N8NTA
              EN82fn

              Comment


              • #8
                I'll have to set up a test for the I2C problem. It will take a few days for me to get to it.

                Do you have pullup resistors on the I2C pins?

                I am suspect of the secondary oscillator on those pins. If it is enabled, it would explain the problem. Since it can be enabled automatically by other peripherals even though you've explicitly disabled it with OSCEN, it's hard to rule out.

                For example, on the 16F15345, the watchdog timer configuration affects it. Using the _CONFIG3 label _WDTCCS_HFINTOSC kills the output on RA4/RA5. This option isn't available on the 16F18326, so it may be irrelevant. Seems like a suspicious coincidence, though.
                Charles Leo
                ME Labs, Inc.
                http://melabs.com

                Comment


                • #9
                  Try adding _FEXTOSC_OFF to the _CONFIG1 statement and see if that helps.

                  Comment


                  • #10
                    Well Adding the config directive _FEXTOSC_OFF did the trick. Thanks Tumbleweed and Charles.... These new Enhanced parts leave a lot to be desired....
                    Dave Purola,
                    N8NTA
                    EN82fn

                    Comment

                    Working...
                    X