完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨ST专家,
我正在尝试使用SPC5作为多通道PWM控制器。通常,对于这种应用,占空比计算将在中断中完成。对于100kHz PWM,允许的中断持续时间小于10uS,例如最大8uS。其余时间(10uS-8uS = 2uS)应保留用于其他过程,例如通信等。 由于多通道PWM有很多计算,因此必须最大限度地利用中断持续时间。但是,我发现输入一个中断需要> 1.2uS,然后再用1uS返回48MHz时钟的主程序。这意味着将浪费大约40%的中断持续时间。附件是用于测试中断持续时间和捕获波形的程序 - PIT通道1作为触发源; PC9是输出。 我的问题是为什么SPC5需要这么多时钟才能进入并离开中断,有没有办法减少这种不必要的时序? 谢谢! #intc 以上来自于谷歌翻译 以下为原文 Hi ST expert, I am trying to use SPC5 as a multi-channel PWM controller. Normally for this kind of application, the duty cycle calculation will be done in an interrupt. For 100kHz PWM, the allowed interrupt duration is <10uS, for example 8uS max. The rest of time (10uS-8uS=2uS) should be reserved for other processes, such as communication etc. As there is a lot calculation for multi-channel PWM, it is necessary to maximize the usage of the interrupt duration. However, I found it will take >1.2uS to enter an interrupt and take another 1uS to go back to the main routine for 48MHz clock. That means >40% of the interrupt duration will be wasted. Attached is my program used to test the interrupt duration and the captured waveform - PIT Channel 1 as the trigger source; PC9 is the output. My question here is why SPC5 needs so many clocks to enter and left the interrupt and is there any way to reduce such unnecessary timing? Thank you! #intc |
|
相关推荐
7个回答
|
|
你好BinBin,
我正在与应用团队核实。 你使用RLA / HAL /你自己的中断处理程序了吗? 最好的祝福 二万 以上来自于谷歌翻译 以下为原文 Hello BinBin , I am checking with Application team. did you use RLA / HAL / your own interruption handler? Best regards Erwan |
|
|
|
你好,Erwan,
感谢您的帮助。 我尝试了RLA和HAL中断处理程序,结果是一样的。当我在eMIO OPWMB模式下编写程序时,我发现了这个问题。后来我用PIT中断验证了它。随函附上我的简单程序及其结果供您参考。 再次感谢您,期待您的回复。 最好的祝福, 张彬彬(å¼æ-Œæ-Œ) Goldpower Tech Pte Ltd. 电话:+ 65-6294 7577 传真:+ 65-6294 7477 以上来自于谷歌翻译 以下为原文 Hello Erwan, Thank you for your help. I tried both RLA and HAL interruption handler and the result is the same. I found this problem when I worked on a program at eMIOs OPWMB mode. Later I verified it with PIT interruption. Attached herewith is my simple program and its result for your reference. Thank you again and look forward to your reply. Best Regards, ZHANG Binbin(å¼ æ–Œæ–Œ) Goldpower Tech Pte Ltd Tel: +65-6294 7577 Fax: +65-6294 7477 |
|
|
|
|
|
|
|
您可能希望查看编译器发出的汇编代码以及微控制器的架构详细信息。
以上来自于谷歌翻译 以下为原文 You might want to review the assembler code emitted by the compiler, and architectural details of the micro-controller. |
|
|
|
我试图使用UDE STK 4.8来查看代码。它显示每个中断以下面的代码结束:
IRQ_EPILOGUE(); } 0x000029B4:C5 01 SE_LWZ R0,0x14(R1) 0x000029B6:00 90 SE_MTLR R0 0x000029B8:C3 F1 SE_LWZ R31,0xC(R1) 0x000029BA:20 F1 SE_ADDI R1,0x10 0x000029BC:00 04 SE_BLR然后跳转到0X0000011A: 0x0000011A:7C 00 06 AC MBAR 0x0 0x0000011E:70 7F E7 F4 E_LIS R3,0xFFF4 0x00000122:70 70 C0 18 E_OR2I R3,0x8018 0x00000126:D0 33 SE_STW R3,0x0(R3) _ivor_exit: 0x00000128:18 01 10 20 E_LMWVGPRW 0x20(R1) 0x0000012C:18 21 10 10 E_LMVSPRW 0x10(R1) 0x00000130:18 81 10 08 E_LMVSRRW 0x8(R1) 0x00000134:18 21 80 50 E_ADDI R1,R1,0x50 0x00000138:00 08 SE_RFII有没有办法在进入中断之前查看代码?有没有办法缩短所有中断的输入和结束持续时间(> 2uS)? 以上来自于谷歌翻译 以下为原文 I tried to use UDE STK 4.8 to view the code. It showed that every interruption end with the following code: IRQ_EPILOGUE(); } 0x000029B4: C5 01 SE_LWZ R0,0x14(R1) 0x000029B6: 00 90 SE_MTLR R0 0x000029B8: C3 F1 SE_LWZ R31,0xC(R1) 0x000029BA: 20 F1 SE_ADDI R1,0x10 0x000029BC: 00 04 SE_BLRThen jump to 0X0000011A: 0x0000011A: 7C 00 06 AC MBAR 0x0 0x0000011E: 70 7F E7 F4 E_LIS R3,0xFFF4 0x00000122: 70 70 C0 18 E_OR2I R3,0x8018 0x00000126: D0 33 SE_STW R3,0x0(R3) _ivor_exit: 0x00000128: 18 01 10 20 E_LMWVGPRW 0x20(R1) 0x0000012C: 18 21 10 10 E_LMVSPRW 0x10(R1) 0x00000130: 18 81 10 08 E_LMVSRRW 0x8(R1) 0x00000134: 18 21 80 50 E_ADDI R1,R1,0x50 0x00000138: 00 08 SE_RFIIs there any way to view the code before entering the interruption? Is there any way to shorten the entering and ending duration (> 2uS) for all the interruption? |
|
|
|
你好Binbin,
中断处理程序在ivor.s中管理 (参见下面的代码) 你能增加PWM中断优先级并启用OSAL_ENABLE_IRQ_PREEMPTION(参见OSAL组件)吗? 最好的祝福 二万 以上来自于谷歌翻译 以下为原文 Hello Binbin , The Interrupt handler is managed in ivor.s (Cf Code below)
Could you increase PWM Interrupt priority and enable OSAL_ENABLE_IRQ_PREEMPTION (cf OSAL Component)? Best regards Erwan |
|
|
|
嗨彬彬
我想我在使用PIT时遇到了类似的问题。我试图每1.7uS产生一个定时器中断来切换GPIO,它似乎没有工作。事实上,任何定时器设置&lt; 4us都非常不稳定,我无法让定时器中断&lt; 4us。 2.5uS。我可以获得的稳定计时器的最低设置是~5us。 我认为这是因为它进入ISR并返回的周期数。 您是否能够通过提供更高的中断优先级或任何其他方式来解决问题? 谢谢 以上来自于谷歌翻译 以下为原文 Hi Binbin I think I am having a similar problem using the PIT. I am trying to generate a timer interrupt every 1.7uS to toggle a GPIO and it does not seem to be working. In fact any timer setting <4us is quite unstable and I cannot get the timer to interrupt < 2.5uS. The lowest setting for a stable timer I can get is ~5us. I believe it is because of the number of cycles its taking to get to the ISR and back. Were you able to solve the problem by giving it a higher interrupt priority or any other way? Thanks |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2747 浏览 1 评论
3244 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1813 浏览 1 评论
3655 浏览 6 评论
6045 浏览 21 评论
1342浏览 4评论
204浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
359浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
451浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
277浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 14:15 , Processed in 1.534036 second(s), Total 89, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号