标题:
关于SI4438的射频收发程序,包括四线SPI读写源程序
[打印本页]
作者:
NUAAII子林
时间:
2017-6-26 14:28
标题:
关于SI4438的射频收发程序,包括四线SPI读写源程序
这是SI4438的射频收发程序,使用STM系列MCU通过四线SPI实现对SI4438的读写操作。
源程序见附件。
0.png
(50.21 KB, 下载次数: 149)
下载附件
2017-6-26 18:09 上传
所有资料51hei提供下载:
SI4438 初始化 和收发函数.zip
(16.56 KB, 下载次数: 154)
2017-6-26 14:28 上传
点击文件名下载附件
下载积分: 黑币 -5
单片机源程序如下:
#include "SI4463_src.h"
/*********************************************************************
** Constant Declaration
*********************************************************************/
const u8 config_table[] = RADIO_CONFIGURATION_DATA_ARRAY;
const u8 config_10k[] = RADIO_CONFIGURATION_DATA_10K;
/*********************************************************************
** Nrf24l01_InterFace
*********************************************************************/
void SI4463_InterFace(void)
{
//init io pin
GPIO_Init(SI_SDN_GPIO,SI_SDN_PIN,GPIO_MODE_OUT_PP_HIGH_FAST);//SDN 引脚设置为输出
Init_SPI();
}
/*
=================================================================================
SI446X_CMD( );
Function : Send a command to the device
INTPUT : cmd, the buffer stores the command array
cmdsize, the size of the command array
OUTPUT : NONE
=================================================================================
*/
void SI446X_CMD( u8 *cmd, u8 cmdsize )
{
SI446X_WAIT_CTS( );
SS_LOW( );
while( cmdsize -- )
{
SPI_ExchangeByte( *cmd++ );
}
SS_HIGH( );
}
/*
=================================================================================
SI446X_POWER_UP( );
Function : Power up the device
INTPUT : f_xtal, the frequency of the external high-speed crystal
OUTPUT : NONE
=================================================================================
*/
void SI446X_POWER_UP( u32 f_xtal )
{
u8 cmd[7];
cmd[0] = POWER_UP;
cmd[1] = 0x01;
cmd[2] = 0x00;
cmd[3] = f_xtal>>24;
cmd[4] = f_xtal>>16;
cmd[5] = f_xtal>>8;
cmd[6] = f_xtal;
SI446X_CMD( cmd, 7 );
}
/*
=================================================================================
SI446X_READ_RESPONSE( );
Function : read a array of command response
INTPUT : buffer, a buffer, stores the data responsed
size, How many bytes should be read
OUTPUT : NONE
=================================================================================
*/
void SI446X_READ_RESPONSE( u8 *buffer, u8 size )
{
SI446X_WAIT_CTS( );
SS_LOW( );
SPI_ExchangeByte( READ_CMD_BUFF );
while( size -- )
{
*buffer++ = SPI_ExchangeByte( 0xFF );
}
SS_HIGH( );
}
/*
=================================================================================
SI446X_WAIT_CTS( );
Function : wait the device ready to response a command
INTPUT : NONE
OUTPUT : NONE
=================================================================================
*/
void SI446X_WAIT_CTS( void )
{
u8 cts;
for(u16 i=0xffff;i>0;i--) //5000次查询等待
{
SS_LOW( );
SPI_ExchangeByte( READ_CMD_BUFF );
cts = SPI_ExchangeByte( 0xFF );
SS_HIGH( );
if(cts == 0xFF)
break;
}
}
/*
=================================================================================
SI446X_NOP( );
Function : NO Operation command
INTPUT : NONE
OUTPUT : NONE
=================================================================================
*/
u8 SI446X_NOP( void )
{
u8 cts;
SS_LOW( );
cts = SPI_ExchangeByte( NOP );
SS_HIGH( );
return cts;
}
/*
=================================================================================
SI446X_PART_INFO( );
Function : Read the PART_INFO of the device, 8 bytes needed
INTPUT : buffer, the buffer stores the part information
OUTPUT : NONE
=================================================================================
*/
void SI446X_PART_INFO( u8 *buffer )
{
……………………
…………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
作者:
admin
时间:
2017-6-26 18:12
好资料,51黑有你更精彩!!!
作者:
fyp0303
时间:
2017-9-12 14:52
非常感谢楼主无私奉献,谢谢。
作者:
young182
时间:
2017-10-4 19:31
怎么没有主函数部分?
作者:
afa3161
时间:
2018-3-8 11:07
感谢楼主,学习一下
作者:
afa3161
时间:
2018-3-8 11:08
感谢楼主,正好需要这个学习一下
作者:
cnc2020
时间:
2018-3-10 11:59
不错,有用,谢谢楼主分享
作者:
Jetson
时间:
2018-3-22 16:43
好东西啊 正好有用
作者:
HiHiHiHi
时间:
2018-9-26 16:19
感谢楼主,正好需要这个学习一下
作者:
coobakl
时间:
2018-9-28 13:18
感谢楼主,正好需要这个学习一下
作者:
zqdl
时间:
2018-11-30 09:38
感谢楼主,正好需要这个学习一下
作者:
pm1981
时间:
2018-12-29 09:43
留着备用
作者:
周超然
时间:
2018-12-29 13:29
可以,现在可以用4463代替了,
麻烦楼主在写一份吧。
作者:
wjsxgd
时间:
2019-4-28 23:41
正好要学习。有一些问题想解决。楼主给大家提供了一个学习机会。谢谢。
作者:
kevin209
时间:
2019-7-20 15:16
谢谢分享!
作者:
helloworld86
时间:
2020-6-4 13:48
谢谢楼主分享
作者:
bigproblem
时间:
2022-2-6 22:14
多谢楼主分享,刷新一下,重复扣分。
作者:
zhang31
时间:
2024-7-9 16:15
感谢楼主 虽然还不会用 正在努力冲锋中
作者:
ybp589
时间:
2025-3-5 21:00
感谢楼主,学习一下
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1