Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lgt8f328p 的 SPI 不正常 #21

Open
happysoul opened this issue Sep 13, 2022 · 2 comments
Open

lgt8f328p 的 SPI 不正常 #21

happysoul opened this issue Sep 13, 2022 · 2 comments

Comments

@happysoul
Copy link

同样的arduino代码,用来控制595读取eeprom芯片,spi控制595连接eeprom的地址线,lgt8f328p的io连接eeprom的数据pin
使用arduino的spi库,连接3片74hc595,使用spi模式发送地址数据
使用atmega168pa没有问题,使用lgt8f328p的片不行
32M内置晶振 16M频率,串口收发正常
调用 SPI.transfer(addr & 0xff); 方法向595发送数据控制595输出异常
3片595串联,addr=0时候,0-6是low低电平,7是高,后面的也是高。
换了atmega168pa的片之后一切正常,可以正常控制595连接的地址线,读取来芯片的数据
先提交个bug,后面我再试试只用1片595连led看看情况再来反馈

@happysoul
Copy link
Author

51AADB38356F1CA5F727D52CCC96DC22
使用CH552G 的SPI可以正常点亮2片74HC595连接的LED,换成LGT8F328P一直不行,同样的代码和板子换成Atmega就没问题
已经不知道是芯片问题还是这个库有问题了。。。
测试过32M RC 16M、8M、1M的cpu速度,外置16M晶振16M cpu一样无法驱动spi
无论使用SPI库、shiftOut方法,还是avr的寄存器控制都无法正常运行
有人有同样的问题么。。。这个芯片太坑爹了。。。

@nulllaborg
Copy link
Owner

LGT的 SPI库是重写了,你要用LGT 软件包下的 SPI库来试下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants