完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
使用:MPLAB X IDE v3.35HARMony2.00bPIC32MX340F512HI像这样配置SPI:驱动程序模式:中断模式SPI中断优先级:INT_PRIORITY_LEVEL1SPI中断子优先级:INT_SUBPRIORITY_LEVEL0.:主模式数据宽度:8位缓冲模式:标准允许空闲运行协议类型:DRV_SPI_PROTOCOL_TYPE_STANDARDClock使用:CLK_BUS_PERIPHERAL_2SPI点击率-Hz:1000000时钟模式:DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_RISE输入阶段:SPI_INPUT_SAMPLING_PHASE_IN_MIDDLEDON不使用队列中的DMAMax作业:10最小为实例保留的作业队列数量:1I像这样设置:PI作业:但是回调MCP3903A SistaBCB1从来没有运行过。当我在system_inter..c中添加断点时,我发现_IntHandlerSPIInstance0从不运行,因此DRV_SPI_Tasks从不被调用。但是,当我添加这样的SPI工作:…经过一些代码检查,我发现了代码的可疑差异:DRV_SPI_BufferAddWriteRead2DRV_SPI_BufferAddWrite2DRV_SPI_BufferAddWrite2DRV_SPI_BufferAddRead2是bug,还是我使用DRV_SPI_BufferAddWriteRead2不正确?
以上来自于百度翻译 以下为原文 Using:
// start SPI for ADC app_data.adc_spi = DRV_SPI_Open(DRV_SPI_INDEX_0, DRV_IO_INTENT_READWRITE); if (DRV_HANDLE_INVALID == app_data.adc_spi) { return; } DRV_SPI_CLIENT_DATA adc_spi_client_data = { .operationStarting = APP_adc_select, .operationEnded = APP_adc_unselect }; if (DRV_SPI_ClientConfigure(app_data.adc_spi, &adc_spi_client_data) < 0) { return; } Later, I add an SPI job: DRV_SPI_BufferAddWriteRead2(mcp3903_spi_handle, mcp3903_spi_tx_buffer, 13, mcp3903_spi_rx_buffer, 13, mcp3903_start_cb_1, NULL, NULL); But the callback mcp3903_start_cb_1 never runs. When I add a breakpoint in system_interrupt.c , I discovered that _IntHandlerSPIInstance0 never runs, so DRV_SPI_Tasks is never called. However, when I add the SPI job like this: DRV_SPI_BufferAddWrite2(mcp3903_spi_handle, mcp3903_spi_tx_buffer, 13, mcp3903_start_cb_1, NULL, NULL); ... the interrupt runs. After some code inspection, I found suspicious differences in code: DRV_SPI_BufferAddWriteRead2 if (pDrvObject->taskMode == DRV_SPI_TASK_MODE_ISR) { pDrvObject->txEnabled = true; SYS_INT_SourceEnable(pDrvObject->txInterruptSource); } DRV_SPI_BufferAddWrite2 if (pDrvObject->taskMode == DRV_SPI_TASK_MODE_ISR) { pDrvObject->txEnabled = true; pDrvObject->rxEnabled = true; SYS_INT_SourceEnable(pDrvObject->txInterruptSource); /* Trigger SPI interrupt for the first time for the devices which don't have persistent interrupt */ _DRV_SPI_INTERRUPT_TRIGGER(pDrvObject->txInterruptSource); } DRV_SPI_BufferAddRead2 if (pDrvObject->taskMode == DRV_SPI_TASK_MODE_ISR) { pDrvObject->rxEnabled = true; SYS_INT_SourceEnable(pDrvObject->rxInterruptSource); SYS_INT_SourceEnable(pDrvObject->txInterruptSource); /* Trigger SPI interrupt for the first time for the devices which don't have persistent interrupt */ _DRV_SPI_INTERRUPT_TRIGGER(pDrvObject->rxInterruptSource); } Is this a bug, or am I using DRV_SPI_BufferAddWriteRead2 incorrectly? |
|
相关推荐
1个回答
|
|
我砍了司机,所以它对我有用。我的框架的框架/驱动程序/ SPI/SRC/DRIV/DVVSPI.C附加。
以上来自于百度翻译 以下为原文 I hacked the driver so it works for me. My version of framework/driver/spi/src/dynamic/drv_spi.c is attached. Attachment(s) drv_spi.c (32.26 KB) - downloaded 421 times |
|
|
|
只有小组成员才能发言,加入小组>>
5189 浏览 9 评论
2009 浏览 8 评论
1933 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3181 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2232 浏览 5 评论
743浏览 1评论
629浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
642浏览 0评论
538浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 21:29 , Processed in 1.236226 second(s), Total 50, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号