嗨,XXULTZ,我在你发布的2个项目目录上做了一个WiDiff,唯一的差异在NBProject目录中。它显示了这些项目是在不同的MPLAX版本下运行的:可能性:我在最新的MPLAB X版本中有严重的问题,特别是使用USB COMM库。在MPLAX网站上甚至有一个下载解决方案,但它让我警惕应用程序中的任何USB问题。所以我把我的项目转换成了Mac,现在一切似乎都很好。请查看MPLAX论坛了解更多信息。我不能在我的系统上运行你的项目,因为我们有不同的硬件和和声版本。因此,我可以查看所有的源文件,并将其与我的项目进行比较,该项目还使用了我的以太网启动器工具包II的BSP选项(与您的CPU相同)。这是我从您的项目中的源代码对我的PRPPETE源代码文件.StultSuiIn.c:1的视觉审查中找到的。配置位是不同的,特别是时钟设置。但是,如果这些设置工作,它们对于BSP选项应该相同。但是,您可能需要尝试我的设置,看看结果是否有任何变化。** DeFCFG0**/*ApRigab-TracMIG-COMFIG调试= =关于AXSPLACMA配置文件ICSIL=ICSU-PGX2α-PrAPMA配置PWP=Off-TracMA配置文件BWP=Off-AX-PracMA配置Cp= OF/**DEVCFG1***/AX-PracMA配置FFNC=PrPrLL PrimaMatg配置FSOCEO=在X-TraceMatlab配置文件中,OXCIOMAGCOMIG-COMPIMACONFIGOFIMAG=FIMPODIG1,PFIDEMA=DIVIG1,PrimMa1,PracMeCo,FCKSM=CSEMME=PracMa配置,WDTPS=PS1048 57 6μ* Prima配置文件FWDTEN=OF/**DEVCFG2****/A*PrimaFig=FIPLIDEV=DIVIZ2O.PracMA配置FPLLMUL=Mule2020 TracMA配置FP n=关于α-PrimaMac配置1- PrimaMeqMaql2,PrimaMy2,Ap**DeFrg3********************************PrimFiff.Fr.Trima7。洛迪夫;编辑倍数>2。USB设备描述符设置是不同的,但应该是可以的。我使用双端口演示描述符。3。我的USB中断优先级设置为Leave1,SuiSuPrRyTyIsLealIO.0。不知道这是否有任何影响。我怀疑这一点。我有一些更多的包含文件,但不应该是。App.C1。唯一的“奇怪”代码是在USB设备事件处理程序中,CASE=UBS.DeVice。在ChannLyd上有一个调用PLIB PosisSpPoSET的线路。我假设是用一个LED来显示你执行了那个案例。现在对于混乱的信息:我能够破解我的项目,这样我就可以检查和取消检查“使用BSP”选项。我首先删除了我的App.c中所有的LED和开关的引用,所以程序将编译和加载。我可以看到我的Mac上CoolTerm上出现了港口。接下来,我取消了“使用BSP”选项,重新编译并重新加载,CoolTerm上没有出现端口。所以我看到了你做过的同样的事情(我想我还是这样做了)。我把问题追溯到MHC,把我的时钟设置在DeVCFG1中变成了我不认识的东西。这是MHC中的一个缺陷,应该报告给Microchip。当我将DEVCFG1重置为正确的设置时,生成一个新的库,编译并重新加载,串行端口出现在CaleTalk上。注意:它确实需要了几个电源周期和重试才能使它正确,但我能够检查和取消检查BSP选项并使应用程序工作。现在是坏消息。我重新检查了您的两个项目配置设置,AMD对于两个项目都是相同的,所以我仍然不知道是什么导致了您的问题。对不起的。如果我相信我的电脑,我可以尝试在PC(Windows 10)上复制所有这些,但我想你可能想先看看这个帖子。-比利
以上来自于百度翻译
以下为原文
Hi xxultz,
I did a WinDiff on the 2 project directories you posted and the only differences were in the nbproject directory. It showed these projects were run under different MPLAB X versions.
Possibility: I have had serious problems with the latest MPLAB X versions specifically with the USB comm libraries. There is even a download fix on the MPLAB X website, but it made me wary of any USB problems in the application. So I switched my project to a MAC and everything seems OK now. Check the MPLAB X forum for more info on this.
I could not run your project on my system because we have different hardware and Harmony versions. So I could view all the source files and compare them to my project which also used the bsp option for my Ethernet Starter Kit II (same CPU as yours).
Here is what I found from my visual review of the source code in your project vs. my prpject source code files.
system_init.c:
1. The configuration bits are different, especially the clock settings. However, if these settings work, they should be the same for either bsp option. However, you might want to try my settings to see if there is any change in the results.
*** DEVCFG0 ***/
#pragma config DEBUG = ON
#pragma config ICESEL = ICS_PGx2
#pragma config PWP = OFF
#pragma config BWP = OFF
#pragma config CP = OFF
/*** DEVCFG1 ***/
#pragma config FNOSC = PRIPLL
#pragma config FSOSCEN = ON
#pragma config IESO = ON
#pragma config POSCMOD = XT
#pragma config OSCIOFNC = OFF
#pragma config FPBDIV = DIV_1
#pragma config FCKSM = CSECME
#pragma config WDTPS = PS1048576
#pragma config FWDTEN = OFF
/*** DEVCFG2 ***/
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1
#pragma config UPLLIDIV = DIV_2
#pragma config UPLLEN = ON
/*** DEVCFG3 ***/
#pragma config USERID = 0xffff
#pragma config FSRSSEL = PRIORITY_7
#pragma config FMIIEN = OFF
#pragma config FETHIO = OFF
#pragma config FCANIO = OFF
#pragma config FUSBIDIO = OFF
#pragma config FVBUSONIO = OFF
//
2. The USB device descriptor settings are different, but that should be OK. I am using the dual port demo descriptors.
3. My USB interrupt priority is set to LEVEL_1, SUB_PRIORITY_LEVEL_0. Don’t know if that has any effect here. I doubt it.
app.h
1. I have a few more include files, but that should not matter.
app.c
1. The only "strange" code was in the USB device event handler, case = USB_DEVICE_EVENT_CONFIGURED. There is a line calling PLIB_PORTS_PinSet on CHANNEL_D. I assume that was to light an LED to show that you executed that case.
Now for the confusing info:
I was able to hack my project so I could check and uncheck the “use BSP” option. I first removed all the references to the LEDs and switches in my app.c so the program would compile and load. I could see the ports show up on CoolTerm on my MAC. Next, I unchecked the “use BSP” option, recompiled and reloaded and the ports did NOT appear on CoolTerm. So I saw the same thing you did (I think I did anyway).
I traced the problem to MHC changing my clock settings in DEVCFG1 to something I did not recognize.
This is a bug in MHC and should be reported to Microchip. When I reset DEVCFG1 to the correct settings, generated a new library, compiled and reloaded, the serial ports showed up on CoolTerm. Note: it did take a few power cycles and retries to get it right, but I was able to check and uncheck the BSP option and have the application work.
Now the bad news. I rechecked your two project configuration settings amd they are the same for both of your projects, so I still do not know what is causing your problem. Sorry. If I trusted my PC, I could try to reproduce all of this on the PC (Windows 10), but I thought you might want to see this posting first.
-BillP