|
本帖最后由 sunsili 于 2021-11-25 00:49 编辑
[ERROR严重错误]BK3432_SDK里SPI驱动用的BK3435的寄存器定义
SDK里用的spi.c用是BK3435的寄存器定义
- ....
- #include "BK3435_reg.h"
- ......
复制代码
改到3432, 编译很多错误, 与BK3435的寄存器定义是由很多不同的, 位未定义等(顺带吐槽一下SDK有的代码示例没定义基本是直接数字移位, 基本看不懂, 要改的话查EXCEL寄存器定义, 没有名称地址定义, 要靠猜是哪一个, 可以看出厂家做事不认真)
- void spi_init(uint8_t frq_div)
- {
- ........
- // Enable GPIO P0.4, P0.5, P0.6, P0.7 peripheral function for spi
- GPIO_SPI_CFG &= ~((0x1<<GPIO_SPI_SCK_PIN) | (0x1<<GPIO_SPI_MOSI_PIN)
- | (0x1<<GPIO_SPI_MISO_PIN) | (0x1<<GPIO_SPI_NSS_PIN ));
- UART_PRINTF(,REG_APB2_SPI_CTRL);
- REG_APB2_SPI_CTRL = (01UL << BIT_SPI_CTRL_SPIEN) |( 0x1 << BIT_SPI_CTRL_MSTEN) \ //master mode
- | (CKPHA_CLK1 << BIT_SPI_CTRL_CKPHA) | (CKPOL_L << BIT_SPI_CTRL_CKPOL)\
- | (SPI_CHARFORMAT_8BIT << BIT_SPI_CTRL_BIT_WIDTH)| (0x03UL << BIT_SPI_CTRL_NSSMD)\
- | (freq_div << BIT_SPI_CTRL_SPI_CKR) | (8 << BIT_SPI_CTRL_SPI_CKR)\
- | (0x01UL << BIT_SPI_CTRL_RXINT_EN) | (0x00UL << BIT_SPI_CTRL_TXINT_EN)\
- | (0x00UL << BIT_SPI_CTRL_RXOVR_EN) | (0x00UL << BIT_SPI_CTRL_TXOVR_EN)\
- | (0x03UL << BIT_SPI_CTRL_RXINT_MODE)| (0x00UL << BIT_SPI_CTRL_TXINT_MODE);
- //这些都找不到定义<div align="left">
- ..........
- }
复制代码 连spi.h 初始化定义函数都是不对的
- void spi_init(uint32_t baud) ;
复制代码
是不是说没人用过的呢, 本来硬件就存问题, 我改好试试吧
其他的参照寄存器说明,已经改好
- // Close JTAG to release GPIO to normal function
- CLOSE_JTAG_MODE();
复制代码
后面我看看怎么改吧
|
+10
|