2021-1-1-半潜船项目探索
18周
1.6
这个项目比想象中要难
首先是沟通不够
我对半潜船模块化的概念理解不清楚,直到前天晚上的会议终于确定了外形
其次是组长能力有限,还真的需要人来带一下工作节奏
直到前天我才真正的意识到这个问题
此时已经开了两次低效率的会议了
前天的第三次在瑛瑶的要求下终于算是带了下会议方向
确实开下来感觉舒服了很多
能讨论出东西,也有了一个好的方向
目前进度是:
1、实现功能:打捞并运输无人机
2、具体结构:一个主体(动力驱动)、四个船体模块、连接通过卡槽链接同时管道也需要连接
3、未解决:①卡槽怎样才能卡紧以及模块间连接装置②接口防水怎么设置③选择什么机械臂,去固定或者抓捕无人机?④后续上岸、下水如何解决⑤传感器排布、种类、数量以及位置设置⑥整套给浮力舱给排水的装置的构想
2.7
这几天相继完善了技术书,也确定了F405这个stm32的选型
F405默认外部晶振的频率是25MHZ,不是8MHZ。在搜索有关资料后发现晶振频率高低与稳定性无关,只和晶振做工等方面有关
3.1
stm32的f1的Can的HAL库在1.7.3版本迎来重制
重制日志
翻译:
在HAL驱动程序上进行的以下更改需要基于较旧的HAL版本对应用程序代码进行更新
返工HAL CAN驱动程序(兼容性中断)
已使用新的API重新设计了新的HAL CAN驱动程序,以绕过先前HAL CAN驱动程序版本中存在的CAN Tx / Rx FIFO管理限制。
推荐使用新的HAL CAN驱动程序。它通常位于Drivers / STM32F4xx_HAL_Driver / Src和Drivers / STM32f4xx_HAL_Driver / Inc文件夹中。可以通过stm32f4xx_hal_conf.h中的开关HAL_CAN_MODULE_ENABLED启用它
由于软件兼容性的原因,旧版HAL CAN驱动程序也存在于Drivers / STM32F4xx_HAL_Driver / Src / Legacy和Drivers / STM32F4xx_HAL_Driver / Inc / Legacy文件夹的发行版中。不建议不推荐使用它。但是,可以通过stm32f4xx_hal_conf.h中的开关HAL_CAN_LEGACY_MODULE_ENABLED启用它
HAL CAN更新
修改了CAN_InitTypeDef结构的字段:
SJW到SyncJumpWidth,BS1到TimeSeg1,BS2到TimeSeg2,TTCM到TimeTriggeredMode,ABOM到AutoBusOff,AWUM到AutoWakeUp,NART到自动重传(反向),RFLM到ReceiveFifoLocked和TXFP到TransmitFifoPriority
HAL_CAN_Init()分为HAL_CAN_Init()和HAL_CAN_Start()API
将HAL_CAN_Transmit()替换为HAL_CAN_AddTxMessage()以放置Tx请求,然后放置HAL_CAN_GetTxMailboxesFreeLevel()进行轮询,直到完成。
将HAL_CAN_Transmit_IT()替换为HAL_CAN_ActivateNotification()以启用传输IT,然后使用HAL_CAN_AddTxMessage()进行位置Tx请求。
将HAL_CAN_Receive()替换为HAL_CAN_GetRxFifoFillLevel()以进行轮询,直到接收为止,然后使用HAL_CAN_GetRxMessage()
获取Rx消息。
将HAL_CAN_Receive_IT()替换为HAL_CAN_ActivateNotification()以启用接收IT,然后使用HAL_CAN_GetRxMessage()
在receivecallback中获取Rx消息
HAL_CAN_Slepp()重命名为HAL_CAN_RequestSleep()
HAL_CAN_TxCpltCallback()分为HAL_CAN_TxMailbox0CompleteCallback(),HAL_CAN_TxMailbox1CompleteCallback()和HAL_CAN_TxMailbox2CompleteCallback()。
HAL_CAN_RxCpltCallback分为HAL_CAN_RxFifo0MsgPendingCallback()和HAL_CAN_RxFifo1MsgPendingCallback()。
驱动程序标题部分本身中详细介绍了更完整的“如何使用新驱动程序”。
新版can库的How to you
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
(#) Initialize the CAN low level resources by implementing the
HAL_CAN_MspInit():
(++) Enable the CAN interface clock using __HAL_RCC_CANx_CLK_ENABLE()
(++) Configure CAN pins
(+++) Enable the clock for the CAN GPIOs
(+++) Configure CAN pins as alternate function open-drain
(++) In case of using interrupts (e.g. HAL_CAN_ActivateNotification())
(+++) Configure the CAN interrupt priority using
HAL_NVIC_SetPriority()
(+++) Enable the CAN IRQ handler using HAL_NVIC_EnableIRQ()
(+++) In CAN IRQ handler, call HAL_CAN_IRQHandler()
(#) Initialize the CAN peripheral using HAL_CAN_Init() function. This
function resorts to HAL_CAN_MspInit() for low-level initialization.
(#) Configure the reception filters using the following configuration
functions:
(++) HAL_CAN_ConfigFilter()
(#) Start the CAN module using HAL_CAN_Start() function. At this level
the node is active on the bus: it receive messages, and can send
messages.
(#) To manage messages transmission, the following Tx control functions
can be used:
(++) HAL_CAN_AddTxMessage() to request transmission of a new
message.
(++) HAL_CAN_AbortTxRequest() to abort transmission of a pending
message.
(++) HAL_CAN_GetTxMailboxesFreeLevel() to get the number of free Tx
mailboxes.
(++) HAL_CAN_IsTxMessagePending() to check if a message is pending
in a Tx mailbox.
(++) HAL_CAN_GetTxTimestamp() to get the timestamp of Tx message
sent, if time triggered communication mode is enabled.
(#) When a message is received into the CAN Rx FIFOs, it can be retrieved
using the HAL_CAN_GetRxMessage() function. The function
HAL_CAN_GetRxFifoFillLevel() allows to know how many Rx message are
stored in the Rx Fifo.
(#) Calling the HAL_CAN_Stop() function stops the CAN module.
(#) The deinitialization is achieved with HAL_CAN_DeInit() function.
*** Polling mode operation ***
==============================
[..]
(#) Reception:
(++) Monitor reception of message using HAL_CAN_GetRxFifoFillLevel()
until at least one message is received.
(++) Then get the message using HAL_CAN_GetRxMessage().
(#) Transmission:
(++) Monitor the Tx mailboxes availability until at least one Tx
mailbox is free, using HAL_CAN_GetTxMailboxesFreeLevel().
(++) Then request transmission of a message using
HAL_CAN_AddTxMessage().
*** Interrupt mode operation ***
================================
[..]
(#) Notifications are activated using HAL_CAN_ActivateNotification()
function. Then, the process can be controlled through the
available user callbacks: HAL_CAN_xxxCallback(), using same APIs
HAL_CAN_GetRxMessage() and HAL_CAN_AddTxMessage().
(#) Notifications can be deactivated using
HAL_CAN_DeactivateNotification() function.
(#) Special care should be taken for CAN_IT_RX_FIFO0_MSG_PENDING and
CAN_IT_RX_FIFO1_MSG_PENDING notifications. These notifications trig
the callbacks HAL_CAN_RxFIFO0MsgPendingCallback() and
HAL_CAN_RxFIFO1MsgPendingCallback(). User has two possible options
here.
(++) Directly get the Rx message in the callback, using
HAL_CAN_GetRxMessage().
(++) Or deactivate the notification in the callback without
getting the Rx message. The Rx message can then be got later
using HAL_CAN_GetRxMessage(). Once the Rx message have been
read, the notification can be activated again.
*** Sleep mode ***
==================
[..]
(#) The CAN peripheral can be put in sleep mode (low power), using
HAL_CAN_RequestSleep(). The sleep mode will be entered as soon as the
current CAN activity (transmission or reception of a CAN frame) will
be completed.
(#) A notification can be activated to be informed when the sleep mode
will be entered.
(#) It can be checked if the sleep mode is entered using
HAL_CAN_IsSleepActive().
Note that the CAN state (accessible from the API HAL_CAN_GetState())
is HAL_CAN_STATE_SLEEP_PENDING as soon as the sleep mode request is
submitted (the sleep mode is not yet entered), and become
HAL_CAN_STATE_SLEEP_ACTIVE when the sleep mode is effective.
(#) The wake-up from sleep mode can be trigged by two ways:
(++) Using HAL_CAN_WakeUp(). When returning from this function,
the sleep mode is exited (if return status is HAL_OK).
(++) When a start of Rx CAN frame is detected by the CAN peripheral,
if automatic wake up mode is enabled.
*** Callback registration ***
=============================================
The compilation define USE_HAL_CAN_REGISTER_CALLBACKS when set to 1
allows the user to configure dynamically the driver callbacks.
Use Function @ref HAL_CAN_RegisterCallback() to register an interrupt callback.
Function @ref HAL_CAN_RegisterCallback() allows to register following callbacks:
(+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback.
(+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback.
(+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback.
(+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback.
(+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback.
(+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback.
(+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback.
(+) RxFifo0FullCallback : Rx Fifo 0 Full Callback.
(+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback.
(+) RxFifo1FullCallback : Rx Fifo 1 Full Callback.
(+) SleepCallback : Sleep Callback.
(+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback.
(+) ErrorCallback : Error Callback.
(+) MspInitCallback : CAN MspInit.
(+) MspDeInitCallback : CAN MspDeInit.
This function takes as parameters the HAL peripheral handle, the Callback ID
and a pointer to the user callback function.
Use function @ref HAL_CAN_UnRegisterCallback() to reset a callback to the default
weak function.
@ref HAL_CAN_UnRegisterCallback takes as parameters the HAL peripheral handle,
and the Callback ID.
This function allows to reset following callbacks:
(+) TxMailbox0CompleteCallback : Tx Mailbox 0 Complete Callback.
(+) TxMailbox1CompleteCallback : Tx Mailbox 1 Complete Callback.
(+) TxMailbox2CompleteCallback : Tx Mailbox 2 Complete Callback.
(+) TxMailbox0AbortCallback : Tx Mailbox 0 Abort Callback.
(+) TxMailbox1AbortCallback : Tx Mailbox 1 Abort Callback.
(+) TxMailbox2AbortCallback : Tx Mailbox 2 Abort Callback.
(+) RxFifo0MsgPendingCallback : Rx Fifo 0 Message Pending Callback.
(+) RxFifo0FullCallback : Rx Fifo 0 Full Callback.
(+) RxFifo1MsgPendingCallback : Rx Fifo 1 Message Pending Callback.
(+) RxFifo1FullCallback : Rx Fifo 1 Full Callback.
(+) SleepCallback : Sleep Callback.
(+) WakeUpFromRxMsgCallback : Wake Up From Rx Message Callback.
(+) ErrorCallback : Error Callback.
(+) MspInitCallback : CAN MspInit.
(+) MspDeInitCallback : CAN MspDeInit.
By default, after the @ref HAL_CAN_Init() and when the state is HAL_CAN_STATE_RESET,
all callbacks are set to the corresponding weak functions:
example @ref HAL_CAN_ErrorCallback().
Exception done for MspInit and MspDeInit functions that are
reset to the legacy weak function in the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit() only when
these callbacks are null (not registered beforehand).
if not, MspInit or MspDeInit are not null, the @ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit()
keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
Callbacks can be registered/unregistered in HAL_CAN_STATE_READY state only.
Exception done MspInit/MspDeInit that can be registered/unregistered
in HAL_CAN_STATE_READY or HAL_CAN_STATE_RESET state,
thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
In that case first register the MspInit/MspDeInit user callbacks
using @ref HAL_CAN_RegisterCallback() before calling @ref HAL_CAN_DeInit()
or @ref HAL_CAN_Init() function.
When The compilation define USE_HAL_CAN_REGISTER_CALLBACKS is set to 0 or
not defined, the callback registration feature is not available and all callbacks
are set to the corresponding weak functions.
翻译:
================================================== ===========================
#####如何使用此驱动程序#####
================================================== ===========================
[..]
(#)通过实施
HAL_CAN_MspInit():
(++)使用__HAL_RCC_CANx_CLK_ENABLE()启用CAN接口时钟
(++)配置CAN引脚
(+++)启用CAN GPIO的时钟
(+++)将CAN引脚配置为备用功能漏极开路
(++)使用中断时(例如HAL_CAN_ActivateNotification())
(+++)使用以下命令配置CAN中断优先级
HAL_NVIC_SetPriority()
(+++)使用HAL_NVIC_EnableIRQ()启用CAN IRQ处理程序
(+++)在CAN IRQ处理程序中,调用HAL_CAN_IRQHandler()
(#)使用HAL_CAN_Init()函数初始化CAN外设。这
函数求助于HAL_CAN_MspInit()进行低级初始化。
(#)使用以下配置来配置接收过滤器
功能:
(++)HAL_CAN_ConfigFilter()
(#)使用HAL_CAN_Start()函数启动CAN模块。在这个水平
该节点在总线上处于活动状态:它接收消息并可以发送
消息。
(#)要管理消息传输,请使用以下Tx控制功能
可以使用:
(++)HAL_CAN_AddTxMessage()请求发送新的
信息。
(++)HAL_CAN_AbortTxRequest()中止挂起的传输
信息。
(++)HAL_CAN_GetTxMailboxesFreeLevel()获取空闲的Tx数
邮箱。
(++)HAL_CAN_IsTxMessagePending()检查消息是否未决
在Tx邮箱中。
(++)HAL_CAN_GetTxTimestamp()获取Tx消息的时间戳
如果启用了时间触发的通信模式,则发送。
(#)当一条消息被接收到CAN Rx FIFO中时,可以对其进行检索
使用HAL_CAN_GetRxMessage()函数。功能
HAL_CAN_GetRxFifoFillLevel()允许知道有多少Rx消息
存储在Rx Fifo中。
(#)调用HAL_CAN_Stop()函数将停止CAN模块。
(#)使用HAL_CAN_DeInit()函数可以完成初始化。
***轮询模式操作***
=============================
[..]
(#) 接待:
(++)使用HAL_CAN_GetRxFifoFillLevel()监视消息的接收
直到至少收到一条消息。
(++)然后使用HAL_CAN_GetRxMessage()获取消息。
(#) 传播:
(++)监视Tx邮箱的可用性,直到至少一个Tx
使用HAL_CAN_GetTxMailboxesFreeLevel(),邮箱是免费的。
(++)然后使用
HAL_CAN_AddTxMessage()。
***中断模式操作***
===============================
[..]
(#)使用HAL_CAN_ActivateNotification()激活通知
功能。然后,可以通过
可用的用户回调:HAL_CAN_xxxCallback(),使用相同的API
HAL_CAN_GetRxMessage()和HAL_CAN_AddTxMessage()。
(#)可以使用以下方式停用通知
HAL_CAN_DeactivateNotification()函数。
(#)对于CAN_IT_RX_FIFO0_MSG_PENDING和
CAN_IT_RX_FIFO1_MSG_PENDING通知。这些通知触发
回调HAL_CAN_RxFIFO0MsgPendingCallback()和
HAL_CAN_RxFIFO1MsgPendingCallback()。用户有两个可能的选择
这里。
(++)使用以下命令直接在回调中获取Rx消息
HAL_CAN_GetRxMessage()。
(++)或在不启用回调的情况下停用通知
获取Rx消息。稍后可以获取Rx消息
使用HAL_CAN_GetRxMessage()。一旦收到Rx消息
读取后,可以再次激活通知。
*** 睡眠模式 ***
==================
[..]
(#)可以使用以下命令将CAN外设置于睡眠模式(低功耗)
HAL_CAN_RequestSleep()。睡眠模式将在进入后立即进入
当前的CAN活动(CAN帧的发送或接收)将
完成。
(#)可以激活一个通知,以便在睡眠模式下得到通知
将被输入。
(#)可以检查是否使用进入了睡眠模式
HAL_CAN_IsSleepActive()。
请注意,CAN状态(可从API HAL_CAN_GetState()访问)
进入睡眠模式请求后立即为HAL_CAN_STATE_SLEEP_PENDING
提交(尚未进入睡眠模式),并成为
HAL_CAN_STATE_SLEEP_ACTIVE何时入睡
模式有效。
(#)可以通过两种方式触发从睡眠模式唤醒:
(++)使用HAL_CAN_WakeUp()。从此函数返回时,
退出睡眠模式(如果返回状态为HAL_OK)。
(++)当CAN外设检测到Rx CAN帧的开始时,
如果启用了自动唤醒模式。
***回调注册***
============================================
设置为1时,编译定义USE_HAL_CAN_REGISTER_CALLBACKS
允许用户动态配置驱动程序回调。
使用函数@ref HAL_CAN_RegisterCallback()注册中断回调。
函数@ref HAL_CAN_RegisterCallback()允许注册以下回调:
(+)TxMailbox0CompleteCallback:Tx邮箱0完成回调。
(+)TxMailbox1CompleteCallback:Tx邮箱1完成回调。
(+)TxMailbox2CompleteCallback:Tx邮箱2完成回调。
(+)TxMailbox0AbortCallback:Tx邮箱0中止回调。
(+)TxMailbox1AbortCallback:Tx邮箱1中止回调。
(+)TxMailbox2AbortCallback:Tx邮箱2中止回调。
(+)RxFifo0MsgPendingCallback:Rx Fifo 0消息待处理回调。
(+)RxFifo0FullCallback:Rx Fifo 0完全回调。
(+)RxFifo1MsgPendingCallback:Rx Fifo 1消息待处理回调。
(+)RxFifo1FullCallback:Rx Fifo 1完全回调。
(+)SleepCallback:睡眠回调。
(+)WakeUpFromRxMsgCallback:从Rx消息回调中唤醒。
(+)ErrorCallback:错误回调。
(+)MspInitCallback:CAN MspInit。
(+)MspDeInitCallback:CAN MspDeInit。
该函数将HAL外设句柄,回叫ID作为参数
以及指向用户回调函数的指针。
使用函数@ref HAL_CAN_UnRegisterCallback()将回调重置为默认值
功能薄弱。
@ref HAL_CAN_UnRegisterCallback将HAL外设句柄作为参数,
和回调ID。
此函数允许重置以下回调:
(+)TxMailbox0CompleteCallback:Tx邮箱0完成回调。
(+)TxMailbox1CompleteCallback:Tx邮箱1完成回调。
(+)TxMailbox2CompleteCallback:Tx邮箱2完成回调。
(+)TxMailbox0AbortCallback:Tx邮箱0中止回调。
(+)TxMailbox1AbortCallback:Tx邮箱1中止回调。
(+)TxMailbox2AbortCallback:Tx邮箱2中止回调。
(+)RxFifo0MsgPendingCallback:Rx Fifo 0消息待处理回调。
(+)RxFifo0FullCallback:Rx Fifo 0完全回调。
(+)RxFifo1MsgPendingCallback:Rx Fifo 1消息待处理回调。
(+)RxFifo1FullCallback:Rx Fifo 1完全回调。
(+)SleepCallback:睡眠回调。
(+)WakeUpFromRxMsgCallback:从Rx消息回调中唤醒。
(+)ErrorCallback:错误回调。
(+)MspInitCallback:CAN MspInit。
(+)MspDeInitCallback:CAN MspDeInit。
默认情况下,在@ref HAL_CAN_Init()之后且状态为HAL_CAN_STATE_RESET时,
所有回调均设置为相应的弱函数:
示例@ref HAL_CAN_ErrorCallback()。
MspInit和MspDeInit函数的异常已完成
仅在以下情况下重置为@ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit()中的旧版弱函数:
这些回调为null(未预先注册)。
如果不是,则MspInit或MspDeInit不为null,则@ref HAL_CAN_Init()/ @ref HAL_CAN_DeInit()
保留并使用用户MspInit / MspDeInit回调(预先注册)
回调只能在HAL_CAN_STATE_READY状态下进行注册/注销。
MspInit / MspDeInit已完成的异常可以注册/取消注册
在HAL_CAN_STATE_READY或HAL_CAN_STATE_RESET状态下,
因此,可以在Init / DeInit期间使用注册的(用户)MspInit / DeInit回调。
在这种情况下,请先注册MspInit / MspDeInit用户回调
在调用@ref HAL_CAN_DeInit()之前使用@ref HAL_CAN_RegisterCallback()
或@ref HAL_CAN_Init()函数。
当编译定义USE_HAL_CAN_REGISTER_CALLBACKS设置为0或
未定义,回调注册功能不可用,并且所有回调
设置为相应的弱函数。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步