完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我正在阅读关于DSIC30F6014A的ADC通道的一些数据,我已经为每个通道实现了单独的任务(比如7个频道,7个任务)。我已经在开始时创建了所有的任务,我的堆大小是5120,我使用HeAPH4.4.C和我为每个任务分配的堆栈是StimeMalLas-STA。CK(即115)。这些任务正在连续地、周期性地运行(只是vtaskSuffEnter)和VTaskReSuMeMe(),在开始时,所有的任务都运行良好,但经过一段时间后,VApvestStCuffFuffHooCo()发生了,即堆栈溢出,有可能错误地处理内存吗?谢谢您。
以上来自于百度翻译 以下为原文 Hello, I'm reading some data on ADC channels of dsPIC30F6014A, for which i have implemented separate tasks for each channels(say 7-channels, 7-tasks). I have created all the tasks at the start only, My heap size is 5120, I'm using heap_4.c and I have allocated stack for each task is configMINIMAL_Stack(i.e. 115). These tasks are running continuously and periodically(just vTaskSuspend() and vTaskResume() is what I'm doing) At start all tasks are working fine but after some time vApplicationStackOverflowHook() occurs, i.e. stack gets overflowed. Is there any possibility of wrong handling of memory? thank you. Attachment(s) sample_code.txt (5.50 KB) - downloaded 159 times |
|
相关推荐
10个回答
|
|
好的,这不是一个完整的代码列表,所以它不能编译。FreRoTOS示例使用HeAPL1.CUE溢出堆栈,因此检查传递给Hook()的PCTaskNess以确定哪个任务溢出它的堆栈,然后从那里继续。作为快速检查,增加堆栈的大小。
以上来自于百度翻译 以下为原文 ok, this is not a complete code listing so it cannot be compiled. the freeRTOS examples use heap_1.c you are overflowing the stack, so inspect the pcTaskName passed to the hook() to determine which task is overflowing it's stack, then go on from there. as a quick check, increase the size of the stacks. |
|
|
|
每ADC输入创建一个任务似乎是浪费的。除了阅读ADC之外,还有哪些任务?我猜想您的任务非常接近它的堆栈的边缘,在某个时候,恰好在最大堆栈深度时发生中断并导致溢出。您可以定期调用一个HeRF=“http://www. FreRtoS.org/uxtaskgtStaskHythig水印.html”& gt;uxtaskgtStaskHygWestMax()和lt;/a & gt;以确定您已经达到了堆栈结束的距离。
以上来自于百度翻译 以下为原文 It would seem wasteful to create a task per ADC input. What else are the tasks doing other than reading the ADC? I would guess your task is very close to the edge of its stack and at some point you happen to get an interrupt just when you are at the maximum stack depth and that causes an overflow. You can make periodic calls to uxTaskGetStackHighWaterMark() to determine how close to the end of the stack you have reached. |
|
|
|
李察和博斯克感谢回答,因为Freltos内存管理页面说HeAPH1不允许内存被释放。正如你所建议的,我检查了里面的PCTASKNAME(),它说“IDL”,我也尝试增加堆栈大小,但是如果我的应用程序运行了几个小时,比如说10-11个小时(就要这样),栈最终会溢出吗????当我从多个ADC读取数据时,我正在轮询每个位,所以控制器有点被困在某个点上,这就是为什么我已经执行了不同的任务,所以如果它被卡住了,我可以在一段时间后暂停任务。如果我只创建和删除任务,那该怎么办?当需要时,它会在某种程度上解决问题吗?????
以上来自于百度翻译 以下为原文 @ Richard and @bosco-Thanks for reply, as freertos memory management page says heap_1 does not permit memory to be freed. As you suggested, I checked the pcTaskname inside hook() its saying "IDL" and i'm also trying with increasing stack size, but if my application runs for several hours say 10-11 hours(as it going to be) eventually stack will get overflow??? And as i'm reading data from multiple ADCs i am polling DONE bits of each, so there is slight possibility of controller being stuck at some point which is why i have implemented different tasks so that if it gets stuck i can suspend the task after some time. What if i just create and delete the task when ever needed, will it resolve problem at some extent???? |
|
|
|
问题是否取决于堆栈大小?如果没有其他帮助,检查你的硬件。去耦电容器,EMI…
以上来自于百度翻译 以下为原文 Does the problem depend on stack size? If nothing other helps, check your hardware. Decoupling capacitors, EMI... |
|
|
|
“NIKOLYAYPO,是的,它确实是(至少是我观察到的)),代码经过一段时间后进入“VApple StaskOffFuffHooCo()),这意味着堆栈正在溢出。我不认为硬件问题,因为我正在使用一个现成的板与DSPIC30 PIM。我也试图实现相同的逻辑在PIC24上,它的工作罚款,但我仍然需要在DSPIC30.ValueValpStAcExoFooFooCH(TaskHooLeTyt pxTebug,CHAR*PCTASKNAMY){(空)PCTaskNAME实现它;如果配置CaseQuoFixStaskIOp溢出定义为1或2,则执行(空)pxTease//*运行时堆栈溢出检查。如果检测到堆栈溢出,则调用此钩子函数。(/;){ASM(“CLRWDT”);显示(和;PCTASKNAME[ 0 ],第二行+ 12);//LCDCMDX写(0x01);显示(“-Stas-OV--”,FrastLe+ 5);}这是我在函数中所做的,它在LCD上显示“IDL”(当然是堆栈OV)。6014a)在FRIERTOS中分配堆栈时使用的事项?????
以上来自于百度翻译 以下为原文 @Nikolay_Po, Yes it does(at least thats what i observed) cause after a while the code goes into "vApplicationStackOverflowHook()", which means stack is getting overflow. I dont think of hardware problem cause i am using a ready made board with dsPIC30 PIM. i also tried to implement same logic on PIC24 on which its working fine but still i need to implement it on dsPIC30. void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) { ( void ) pcTaskName; ( void ) pxTask; /* Run time stack overflow checking is performed if configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); for( ;; ){ asm("clrwdt"); Display(&pcTaskName[0], SecondLine+12); //LCDCmd_Write(0x01); Display("--Stack OV--", FirstLine+5); } } This is what i have done in function, and its displaying "IDL" on LCD(and of course stack ov ). Does the memory size of controller(dsPIC30F6014A) being used matters while allocating stack in freertos???? |
|
|
|
谢谢大家的帮助。问题还没有解决,我猜DSPIC30F6014A(8KB RAM)没有足够的RAM来运行Fieltos(我想,如果我错了,请纠正我)。我正在考虑切换到其他控制器(DSPIC30或33系列),但不确定最小RAM和ROM是否需要。去港港????有没有芯片被推荐用于移植RTOS???????谢谢您!!!!!
以上来自于百度翻译 以下为原文 Thank you guys for your help. the issue is not resolved yet, i guess dsPIC30F6014A(8kb RAM) is not having sufficient RAM to run freertos(thats what i think, correct me if i am wrong). i am thinking of switching to other controller(dsPIC30 or 33 family), but not sure about minimum RAM and ROM required to port freertos???? Is there any chip by microchip recommended for porting rtos????? Thank you!!!! |
|
|
|
|
|
|
|
|
|
|
|
一个观察:你不能从中断服务程序调用VTaskCutlook,你必须使用XTaskReSuMuFuRMISMR。
以上来自于百度翻译 以下为原文 One observation: You can't call vTaskResume from an interrupt service routine, you have to use xTaskResumeFromISR. |
|
|
|
试试这个,简单,小而快。http://www-镶嵌代码…-PIC24PIC30和PIC33
以上来自于百度翻译 以下为原文 Try this, simple, small and fast. http://www.embeddedcodeso...-pic24-pic30-and-pic33 |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
787浏览 1评论
678浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
604浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 16:04 , Processed in 1.639837 second(s), Total 93, Slave 77 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号