完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我们正在开发自定义板使用18F25K50,与USB CDC。为此,我们尝试过MCC,但我们是不幸运的。然后我们遇到了vLoki先生发布的“LPCF-FSUBBJ-X-R3”。在我们的应用中,我们希望给USPCDC中断低优先级和应用中断高优先级。中断在文件“St.C”中定义,如下面附图所示的43-59行。对于高优先级和Low优先级中断的代码块的改变是否足够?或者我们需要修改其他USB堆栈文件中的中断相关代码,或者我们可以使用一个ISR,其中中断可以按照我们想要的顺序来检查吗?那样的话,我们应该在哪里兑换感谢呢?
以上来自于百度翻译 以下为原文 Hi, we are developing custom board using 18F25K50, with USB CDC. For this we have tried MCC, but we are unluckky. Then we came across "LPC_FSUSB_CDC-X-r3" released by Mr. vLoki. In our application, we want to give USB_CDC interrupt LOW-PRIORITY & application interrupts HIGH-PRIORITY. The interrupts are defined in file "system.c" at lines 43-59 as shown in image attached below. To change Interrupt priority, exchange of code blocks for High & Low priority interrupts is enough ? or do we need to modify interrupts related code in other u*** stack files. or can we use one ISR in which interrupts can be checked in the order we want?, in that case where shall we change the code with thanks, Attached Image(s) |
|
相关推荐
10个回答
|
|
不,你不能只交换代码,你还必须改变所有中断的优先级设置。最简单的做法是禁用中断优先级并使用一个向量。你只需要清除伊彭。很少需要中断优先级,但您没有解释使用什么样的时序要求的中断类型。
以上来自于百度翻译 以下为原文 No, you can't just swap the code, you'd also have to change the priority settings of all of the interrupts. The easiest thing to do would be to disable interrupt priorities and use a single vector. You'd only have to clear IPEN. Interrupt priorities are rarely needed, but you haven't explained what sort of interrupts you're using what sort of timing requirements they have. |
|
|
|
谢谢大家的建议。我们正在使用定时器、比较器中断以及USB中断。我们需要比其他人更高的计时器优先级。这意味着,我们可以使用ISR来替换ISR,我们根据需要检查中断。
以上来自于百度翻译 以下为原文 jtemples, thanks for the advice. we are using Timer, comparator interrupts along with USB interrupt. we need high priority for timer than others. It means, we can replace both those ISRs using single ISR, in which we check interrupts as per our need. |
|
|
|
嗨,改变只使用一个中断优先级,或者可能无法解决原来的问题。你可以检查和执行中断处理函数在任何你喜欢的顺序,但当一个函数来服务中断从任何特定的外设被调用,那么没有其他中断将被处理直到USB中断处理程序完成了它需要做的任何事情。在2级中断优先级启用之后,无论在低优先级ISR中发生什么,高优先级组中的任何中断都将立即进行控制。优先选择位。您可以让MPLAB Server通过您的项目的所有代码:IPR1 IPR2和IPR3寄存器,并且UBIPU在任何地方都不可能有任何设置,所有优先级位都是重置默认值的1。在其他安装动作为COMP之后,您可以进行必要的优先级调整。在启用GILL和GIEH的ITCCON寄存器之前。迈西尔米希尔
以上来自于百度翻译 以下为原文 Hi, Changing to use only a single interrupt priority may, or may not solve the original problem. You may check and perform interrupt handler functions in any sequence you prefer, But when a function to service the interrupt from any specific peripheral is called, then no other interrupt will be processed until the USB interrupt handler have completed whatever it need to do. With 2 level interrupt priority enabled, any interrupt in the high priority group will take control immediately, regardless of what is going on in low priority ISR. You may swap ...High with ...Low, But you must also change the settings of Priority selection bits. You may let MPLAB serarch thru all code of your project for: IPR1 IPR2 and IPR3 registers, and USBIP There may not be any settings anywhere, all priority bits are 1 as reset defaults. You may make the nessesary priority adjustments after other setup actions are completed, before enabling GIEL and GIEH in INTCON register. Mysil Mysil |
|
|
|
你好,Mysil,谢谢你的帮助。在上面提到的库中,中断是分开处理的。下面给出代码片段。[/CODE]空隙中断SysSythTythIk(){ /检查哪一个中断标志导致中断。//服务中断/ /清除中断标志/ /等。如果定义(UBS中断)UBDeVICEATSKS(),这个返回将是一个“ReffiFAST”,如果定义(α18F14K50)定义(α18F25J50)定义(α18F25K50)空隙中断低级优先级SysSysCuttLoW(){//检查哪个中断标志引起中断。//服务中断/ /清除中断标志/等} { } [/COD]这使得我的任务很困难,因为我必须基于计时器和服务来跳过警报等,这比UB-CDC服务更重要。下面的代码片段显示了我要如何组织我的代码。D中断高优先级中断(中断)管理器(空隙){//中断处理程序(如果是:InCONTITE=1和&;PMR1BIT.TMR1IE=1和&;TrMR1IF=1)//100MSEC{------PIR1BIT.TMR1IF=0;//清除中断}否则(ItCONBITS==1和ANP;PY2BITS C1I= =)1和&;Pr2BITS.C1IF=1){PI2BITS.C1IF=0;//清除中断} {{如果定义(UBSY中断)UBDeVICEATSKSH();γ} } } [/COD]只可以将所有中断插入到一个ISR中,如上面代码所示。是否需要检查USB中断标志来决定是否运行UBDE谢谢!
以上来自于百度翻译 以下为原文 Hi Mysil, Thanks for the help. In above mentioned library, Interrupts are handled seperately. The code snippet is given below. [/code] void interrupt SYS_InterruptHigh() { //Check which interrupt flag caused the interrupt. //Service the interrupt //Clear the interrupt flag //Etc. #if defined(USB_INTERRUPT) USBDeviceTasks(); #endif } //This return will be a "retfie fast" #if defined(__18F14K50) || defined(__18F4550) || defined(__18F27J50) || defined(__18F25K50) void interrupt low_priority SYS_InterruptLow() { //Check which interrupt flag caused the interrupt. //Service the interrupt //Clear the interrupt flag //Etc. } #endif [/code] This makes my task difficult, because i have to service tripping of alarms etc based on timer & this is more important to me than USB-CDC servicing. The following code snippet shows how i want to organize my code. [/code] void interrupt high_priority INTERRUPT_InterruptManager(void) { // interrupt handler if(INTCONbits.PEIE == 1 && PIE1bits.TMR1IE == 1 && PIR1bits.TMR1IF == 1) //100msec { ------ ------ PIR1bits.TMR1IF = 0; // Clear Interrupt } else if(INTCONbits.PEIE == 1 && PIE2bits.C1IE == 1 && PIR2bits.C1IF == 1) { ------ ------ PIR2bits.C1IF = 0; // Clear Interrupt } else { #if defined(USB_INTERRUPT) USBDeviceTasks(); #endif } } [/code] Can i club all the interrupts into one ISR only as shown in above code. Do i need to check USB interrupt flag to decide whether to run USBDeviceTasks(); with Thanks |
|
|
|
如果你把所有的中断都放在一个向量中(正如Mysil已经指出的那样),它们就不能相互中断。如果满足其中一个条件,就可以在处理另一个中断源之前完全处理这个问题。我认为最好遵循你的第一个意图。将USB中断移到低优先级。尝试修改文件UBSHalPIC18.h中的宏并将调用移动到低ISR定义的UsBeable中断(){RCONBITS。IPEN=1;IPR3BITS UBIIP=0;PIE3BITS UBIE=1;ItCONBITS。GIEH=1;}。
以上来自于百度翻译 以下为原文 If you put all the interrupts into one vector then (as Mysil already pointed out) they can not interrupt each other. If the condition of one of them is met, than this one is handled completely before another interrupt source can be handled. I think it would be better to follow your first intention and move the USB interrupt to low priority. Try to modify the macro in file u***_hal_pic18.h and move the call to the low ISR #define USBEnableInterrupts() {RCONbits.IPEN = 1;IPR3bits.USBIP = 0;PIE3bits.USBIE = 1;INTCONbits.GIEH = 1;} |
|
|
|
嗨,VLoKi,谢谢你告诉我的修改。那么我必须在Suff.C文件中使用UbDeVICETASKS()来实现低中断区。或者对代码进行任何其他修改?问候,
以上来自于百度翻译 以下为原文 Hi vloki, Thanks for the modification told by you. Then I have to USBDeviceTasks() in system.c file low interrupt area? or any other modifications to the code? With Regards, |
|
|
|
是的,将UbDeVICETASKS()调用到低向量。我不完全确定,但我认为它应该工作。
以上来自于百度翻译 以下为原文 Yes move the call of USBDeviceTasks() to the low vector. I'm not absolutely sure, but i think it should work. |
|
|
|
现在,ISR将是这样的。[/COD]中断中断,中断管理器(空隙){//中断处理程序,如果(ItNCONTITE=1和&;PMR1BIT.TMR1IE=1和&;PrimBITS。TMR1IF=1){-------PHIL1BIT.TMR1IF=0;//清除中断}否则(ItCONBITS==1和AMP;Py2BITS.C1IE=1和&;PI2BITS.C1IF=1){PI2BITS.C1IF=0;//清除中断}否则(ItNCONTITS=1和&;BE3BITS=1和&;PIR3BITS.UBIF=1){//O.I.如果定义(UBS中断)UBDeVICICETASKS();PrI3BITS.UBIF=0;
以上来自于百度翻译 以下为原文 Now the ISR will be like this. [/code] void interrupt INTERRUPT_InterruptManager(void) { // interrupt handler if(INTCONbits.PEIE == 1 && PIE1bits.TMR1IE == 1 && PIR1bits.TMR1IF == 1) { ------ ------ PIR1bits.TMR1IF = 0; // Clear Interrupt } else if(INTCONbits.PEIE == 1 && PIE2bits.C1IE == 1 && PIR2bits.C1IF == 1) { ------ ------ PIR2bits.C1IF = 0; // Clear Interrupt } else if(INTCONbits.PEIE == 1 && PIE3bits.USBIE == 1 && PIR3bits.USBIF == 1) { //#if defined(USB_INTERRUPT) USBDeviceTasks(); PIR3bits.USBIF = 0; //#endif } } [/code] Thanks |
|
|
|
嗨,vloki,我想使用TyTalm或类似的工具来测试第一个/故障阶段的串行传输。然后我可以跳过包的前两个条目,即UbOutSuff[[ 0 ] ]和UbOutSuff[[ 1 ] ]。我的意思是:我们可以将索引0(0)的数据存储在USPOutBuff[]中,还是从USPOutBuff[0 ]?NKS
以上来自于百度翻译 以下为原文 Hi vloki, I want to use Teraterm or similar tool to test serial transmission in the first/trouble shooting phase. Then can I skip first two entries of the packet, i.e. u***OutBuffer[0] and u***OutBuffer[1]. I mean : can we store data from index 0(zero) in u***OutBuffer[] or right from u***OutBuffer[0]. Thanks |
|
|
|
刚才注意到你检查佩伊。为什么?PS:如果启用优先级,则应该使用GILIN兼容模式,您有全局和外围中断(-GT,PEIE)。在优先级模式中,有高优先级和低优先级(-G.GIH,GIEL)。
以上来自于百度翻译 以下为原文 Just noticed that you check for PEIE. Why? PS: If priority is enabled, you should use the name GIEL In compatibility mode you have global and peripheral interrupts (-> GIE, PEIE). In priority mode there are high and low priority ones (-> GIEH, GIEL) |
|
|
|
只有小组成员才能发言,加入小组>>
5183 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3178 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2229 浏览 5 评论
739浏览 1评论
626浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
510浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
637浏览 0评论
535浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 23:05 , Processed in 1.558526 second(s), Total 97, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号