Announcement

Collapse
No announcement yet.

Unable to get DEBUG to work with 18F27K40

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

  • Unable to get DEBUG to work with 18F27K40

    I have spent a day or so trying to get the DEBUG statement to work with an 18F27K40 processor. I am using PBP 3.1.1. Attached is a small part of a program to demonstrate the issue. I use to incorporate the use of DEBUG along with the normal hardware USART. I have reduced all of the USART code and still have a problem.
    Attached Files
    Dave Purola,
    N8NTA
    EN82fn

  • #2
    I also noticed today after many trials that the DATA or EEPROM statements go dot work either. I have run a version of my program and printing out the contents of eeprom when the program is run I notice that none of them are correct. I also looked at the eeprom data inside of the MPLABX IPE and it also does not seem right. After I use an WRITE command to the same location I can see the data is stored correctly. This means that I can not preset data in the program before I run it for the first time.
    Dave Purola,
    N8NTA
    EN82fn

    Comment


    • #3
      the mcc would use these settings for 64mhz clk,

      void OSCILLATOR_Initialize(void)
      {
      // NOSC HFINTOSC; NDIV 1;
      OSCCON1 = 0x60;
      // CSWHOLD may proceed; SOSCPWR Low power;
      OSCCON3 = 0x00;
      // MFOEN disabled; LFOEN disabled; ADOEN disabled; SOSCEN disabled; EXTOEN disabled; HFOEN disabled;
      OSCEN = 0x00;
      // HFFRQ 64_MHz;
      OSCFRQ = 0x08;
      // TUN 32;
      OSCTUNE = 0x20;
      }
      and in the config
      #pragma config FEXTOSC = OFF // External Oscillator mode Selection bits->Oscillator not enabled
      #pragma config RSTOSC = HFINTOSC_1MHZ // Power-up default value for COSC bits->HFINTOSC with HFFRQ = 4 MHz and CDIV = 4:1
      might be worth a try, I don't have one of those chips to verify these settings




      Comment


      • #4
        I don't think that's the issue as the normal USART operation on both channels is correct. All timing is correct with the interrupts enabled. It's just the DEBUG statements and the EEPROM/DATA statements that are not working as far as I can see at the moment. After reading the data sheet sheet for the last 2 day's all of the registers I have set are in the default state for 64Mhz.
        Dave Purola,
        N8NTA
        EN82fn

        Comment


        • #5
          If you have the A2 silicon this is probably due to the NVMREG errata.

          See item 3.1 in the errata doc DS80000713D

          Comment


          • #6
            Yes indead, I do have revision "a002".
            After looking at the .lst file for the compiled program, I thought this A2 silicon issue seemed to be taken care of but, the lines of assembly code seem to be commented out for some reason. I am using PBP 3.1.1 which I believe is the latest.
            Last edited by DavidP; 02-01-2018, 04:10 AM.
            Dave Purola,
            N8NTA
            EN82fn

            Comment


            • #7
              It does appear that the a002/NVMCON1 fix is commented. I think it was commented in the 3.1.0 release also. I suspect the only place it was implemented was the beta version of 3.1 published on this forum.

              It's been awhile, so I'll have to investigate and look for a reason for this. My first guess is that I just plain messed it up. Sorry about that.

              I have a short list of fixes that will be released as 3.1.2 soon.

              I've no idea why the DEBUG command would work any differently on the K40 if the output pin functions as normal I/O. I'll test it when I get a chance.
              Charles Leo
              ME Labs, Inc.
              http://melabs.com

              Comment


              • #8
                Charles, I'll put together some code tomorrow with the DEBUG and DATA/EEPROM statements together and get it off to you. Thanks for the reply.
                Dave Purola,
                N8NTA
                EN82fn

                Comment


                • #9
                  I also noticed today after many trials that the DATA or EEPROM statements do not work either
                  That might depend on what you use to program the part with. In the K40 (and some other new ones) mchip moved the EEPROM data section in the hex file.

                  It looks like PBP is placing it in the hex file correctly, so the newer mchip tools know where it is but some other tools may not see it.

                  Comment


                  • #10
                    Charles, Attached is a single pass program to load DATA into eeprom and then retrieve it then send it to the configured DEBUG port. I can see data on the port but the characters are unrecognizable, Possibly a baud rate issue? I tried all standard baud rates between 2400 and 57600. I also noticed the revision on the .lst file as: MPASM 5.71 and PICBASIC PRO(TM) Compiler 3.1.1.4.
                    Attached Files
                    Dave Purola,
                    N8NTA
                    EN82fn

                    Comment


                    • #11
                      Tumbleweed, I only use MPLAB ICD3 and Microchip PicKit-3 for flashing parts.
                      Dave Purola,
                      N8NTA
                      EN82fn

                      Comment


                      • #12
                        Charles, I have measured the single bit timing @ 34.72K baud.
                        Dave Purola,
                        N8NTA
                        EN82fn

                        Comment


                        • #13
                          Dave,

                          I haven't tried it, but from what I can tell PBP is putting the data into the hex file properly so if you use MPLABX IPE to program the chip it should be correct.

                          Comment


                          • #14
                            Well, I have found the root cause of one of the problems I thought I have uncovered. The DEBUG statement works just fine and as expected. I took a long walk away from the project and when I returned this weekend I feel like a FOOL. The problem was in the statement: DEFINE DEBUG_BAUD 34800. It should have been DEFINE DEBUG_BAUD 38400. An obvious typo or dyslexia on my part. Sorry Charles for any inconvenience I caused. I'll be waiting for any updates as far as the EEPROM / DATA issues. I really should have checked all of my settings after I posted "Charles, I have measured the single bit timing @ 34.72K baud." Dou.......
                            Dave Purola,
                            N8NTA
                            EN82fn

                            Comment


                            • #15
                              No worries Dave. Thanks for posting. I'll move on to the next thing.
                              Charles Leo
                              ME Labs, Inc.
                              http://melabs.com

                              Comment

                              Working...
                              X