当前位置:网站首页>6线SPI传输模式探索
6线SPI传输模式探索
2022-07-25 14:59:00 【王二车】
硬件环境
4G模块:FIBOCOM_AL940,基于MDM9628 CordX-A7 1.3 GHz单核,RAM 70M ROM 150M,包含两组spi接口,只能做主设备,最大支持50M时钟速率;
MCU单片机:RH850/F1K,包含两组spi接口,支持主从模式;从模式最大支持5M时钟速率;
4G模块做主模式,单片机做从设备,4线spi加2根同步线,master_ready输出,slave_ready输入;
主机时序
从机通过s_r从低到高电平变化通知主机发送时钟信号,时钟个数双方协商4K数据,主机通过改变m_r状态通知从机时钟信号开始:

调试过程
红色线s_r管脚,上升沿触发中断后,时钟信号没有出来,但当下降沿后时钟信号出来了,这时候单片机发送了一个字节的数据:

发送了一个字节数据后就没有继续发送数据,这里就很异常了。
查看单片机的6线spi模式说明手册如下,CSIHTRYO管脚作为输出,低电平忙状态,高电平收发数据状态,所以是上升沿触发4G模块发送时钟信号:



但从波形图看4G模块没有按照上升沿发送时钟,而是下降沿发送时钟,所以需要修改spi驱动来适配单片机的时序要求。
看4G模块的spi驱动是上升沿触发中断进行数据收发,怎么修改过来的驱动就是下降沿触发了呢,这里当时没有怀疑也没有进行确认导致了问题。
gpio_direction_input(fibo_spidev->gpio_slave_ready); //SPI_SRDY has external pull-up
status = request_irq(gpio_to_irq(fibo_spidev->gpio_slave_ready), spidev_slave_ready_irq_handler,
IRQF_TRIGGER_RISING | IRQF_DISABLED, "ql-spi", fibo_spidev);
if (status) {
printk("Fail to request gpio_slave_ready IRQ\n");
} else {
fibo_spidev->irq_slave_ready = gpio_to_irq(fibo_spidev->gpio_slave_ready);
disable_irq(fibo_spidev->irq_slave_ready);
}
}问题解决
4G模块spi驱动修改为上升沿触发发送时钟信号开始数据收发,6线功能就正常了,但m_r管脚没有使用到,单片机没有管理这个状态也能正常收发,目前测试一个晚上没有丢包的概率发生。
边栏推荐
- Unable to start web server when Nacos starts
- I2C设备驱动程序的层次结构
- How many ways can you assign initial values to a two-dimensional array?
- awk从入门到入土(24)提取指令网卡的ip
- LeetCode_ Factorization_ Simple_ 263. Ugly number
- Copy files / folders through Robocopy
- pkg_resources动态加载插件
- 06、类神经网络
- (original) customize a scrolling recyclerview
- Resource not found: rgbd_ Launch solution
猜你喜欢

"Ask every day" briefly talk about JMM / talk about your understanding of JMM

43 box model

D2. picking carrots (hard version) (one question per day)

"Ask every day" how locksupport realizes thread waiting and wakeup

Sudo rosdep init error ROS installation problem solution

English语法_不定代词 - other / another

SSH服务器拒绝了密码

The concept and operation rules of calculus of variations

27 classification of selectors

Share a department design method that avoids recursion
随机推荐
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
Nacos2.1.0 cluster construction
[Android] recyclerview caching mechanism, is it really difficult to understand? What level of cache is it?
When using jetty to run items, an error is reported: form too large or form too many keys
解决asp.net上传文件时文件太大导致的错误
Share a department design method that avoids recursion
Syntax summary of easygui
Overview of cloud security technology development
软件测试 -- 1 软件测试知识大纲梳理
SSM Advanced Integration
awk从入门到入土(24)提取指令网卡的ip
44 Sina navigation, Xiaomi sidebar exercise
Melody + realsense d435i configuration and error resolution
Writing standard of physical quantities and unit symbols
API health status self inspection
MySQL 45 talks about | 06 global locks and table locks: Why are there so many obstacles to adding a field to a table?
SQL优化的一些建议,希望可以帮到和我一样被SQL折磨的你
Deployment and simple use of PostgreSQL learning
变分(Calculus of variations)的概念及运算规则
Content type corresponding to office file