完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我想在BootLoader里通过SPI实现对外部Flash的读写,但是初始化完SPI想要手动拉低CS,发现通过GPIO控不管写0还是写1都会导致管脚被拉低。代码都是直接移植的Gpio.c的库函数。包括
/* 使能外设GPIOA */ voidSysCtlPeripheralEnable(uint32_t ui32Peripheral)[ // // Check the arguments. // ASSERT(_SysCtlPeripheralValid(ui32Peripheral)); // // Enable this peripheral. // HWREGBITW(SYSCTL_RCGCBASE + ((ui32Peripheral & 0xff00) >> 8), ui32Peripheral & 0xff) = 1;]/* 设置GPIO管脚模式,包括驱动能力和output */ voidGPIOPinTypeGPIOOutput(uint32_t ui32Port, uint8_t ui8Pins)[ // // Check the arguments. // ASSERT(_GPIOBaseValid(ui32Port)); // // Set the pad(s) for standard push-pull operation. // GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); // // Make the pin(s) be outputs. // GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_OUT);]控制GPIO直接用的底层函数 /* 拉低 */ HWREG(GPIO_PORTA_BASE + (GPIO_O_DATA + (SSI_CS << 2))) = 0; /* 拉高 */ HWREG(GPIO_PORTA_BASE + (GPIO_O_DATA + (SSI_CS << 2))) = 1; 但现在的情况是不管写0还是写1都会导致被拉低,且无法拉高 想问一下我的用法是不是有问题呢?或者最好是官方提供的BOOT代码中能直接控GPIO,或者SPI的SDK里有直接进行片选的方式? |
|
相关推荐
4 个讨论
|
|
|
您好,不知道您要看我这里的什么代码,这个输出输出我是从gpio.c里拷出来的
//*****************************************************************************////! Writes a value to the specified pin(s).//!//! param ui32Port is the base address of the GPIO port.//! param ui8Pins is the bit-packed representation of the pin(s).//! param ui8Val is the value to write to the pin(s).//!//! Writes the corresponding bit values to the output pin(s) specified by//! e ui8Pins. Writing to a pin configured as an input pin has no effect.//!//! The pin(s) are specified using a bit-packed byte, where each bit that is//! set identifies the pin to be accessed, and where bit 0 of the byte//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.//!//! return None.////*****************************************************************************voidGPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)[ // // Check the arguments. // ASSERT(_GPIOBaseValid(ui32Port)); // // Write the pins. // HWREG(ui32Port + (GPIO_O_DATA + (ui8Pins << 2))) = ui8Val;]用的时候就是写0写1啊...没有听说有别的用法... |
|
|
|
|
|
|
|
skdmmmmm 发表于 2019-9-6 15:00 好像不是这个样子的,你参考下gpio的例程,看看参数的配置,我这里手机,没法翻例程。不要只看函数原型 |
|
|
|
|
|
|
|
skdmmmmm 发表于 2019-9-6 15:00 http://bbs.21ic.com/icview-950404-1-1.html 你可以看看我这个帖子,确实不一样的。 |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
584 浏览 0 评论
1641 浏览 0 评论
2080 浏览 0 评论
为啥BQ7693003DBTR芯片在和BQ769X0盒子通讯时收不到信号?
1533 浏览 0 评论
DSP 28027F 开发板 XDS100v2调试探针诊断日志显示了 Error -150 (SC_ERR_FTDI_FAIL)如何解决
1372 浏览 0 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
1782浏览 29评论
2810浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
1742浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
1654浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
1672浏览 13评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-10 06:02 , Processed in 0.766692 second(s), Total 59, Slave 47 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1598