We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ce4ae1 commit 02e2c35Copy full SHA for 02e2c35
drivers/include/drivers/interfaces/InterfaceCAN.h
@@ -44,8 +44,6 @@ class CAN;
44
*/
45
46
/** CANMessage class
47
- *
48
- * @note Synchronization level: Thread safe
49
50
class CANMessage : public CAN_Message {
51
@@ -143,8 +141,6 @@ class CANMessage : public CAN_Message {
143
141
#if DEVICE_CAN_FD
144
142
145
/** CANFDMessage class
146
147
148
149
class CANFDMessage : public CANFD_Message {
150
drivers/source/CAN.cpp
@@ -36,6 +36,7 @@ CAN::CAN(PinName rd, PinName td, int hz, int data_hz) : _can(), _irq()
36
37
canfd_init_freq(&_can, rd, td, hz, data_hz);
38
#else
39
+ MBED_ASSERT(data_hz == 0);
40
can_init_freq(&_can, rd, td, hz);
41
#endif
42
can_irq_init(&_can, (&CAN::_irq_handler), reinterpret_cast<uintptr_t>(this));
@@ -54,6 +55,7 @@ CAN::CAN(const can_pinmap_t &pinmap, int hz, int data_hz) : _can(), _irq()
54
55
56
canfd_init_freq_direct(&_can, &pinmap, hz, data_hz);
57
58
59
can_init_freq_direct(&_can, &pinmap, hz);
60
61
@@ -77,6 +79,7 @@ int CAN::frequency(int f, int data_f)
77
79
78
80
int ret = canfd_frequency(&_can, f, data_f);
81
82
+ MBED_ASSERT(data_f == 0);
83
int ret = can_frequency(&_can, f);
84
85
unlock();
targets/TARGET_STM/TARGET_STM32L5/system_clock.c
@@ -193,7 +193,9 @@ uint8_t SetSysClock_PLL_MSI(void)
193
194
195
/* Enable MSI Auto calibration */
196
+#if MBED_CONF_TARGET_LSE_AVAILABLE
197
HAL_RCCEx_EnableMSIPLLMode();
198
+#endif
199
200
return 1; // OK
201
}
targets/TARGET_STM/TARGET_STM32U5/clock_cfg/system_clock.c
@@ -119,10 +119,11 @@ MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
119
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
120
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
121
122
- /* GPIO Ports Clock Enable */
123
- __HAL_RCC_GPIOH_CLK_ENABLE();
124
- __HAL_RCC_GPIOB_CLK_ENABLE();
125
__HAL_RCC_PWR_CLK_ENABLE();
+#if defined(UCPD1)
+ HAL_PWREx_DisableUCPDDeadBattery(); /* Disable the internal Pull-Up in Dead Battery pins of UCPD peripheral */
126
+ HAL_PWREx_EnableVddA();
127
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
128
return 0; // FAIL
129
@@ -190,6 +191,9 @@ uint8_t SetSysClock_PLL_HSI(void)
190
191
192
HAL_PWREx_EnableVddA();
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
targets/TARGET_STM/can_api.c
@@ -23,6 +23,7 @@
23
#include "pinmap.h"
24
#include "PeripheralPins.h"
25
#include "mbed_error.h"
26
+#include <memory.h>
27
28
// Some STM32G4 series (and others) have 3 FDCAN devices
29
// while others have 2
@@ -632,7 +633,7 @@ int canfd_write(can_t *obj, CANFD_Message msg, int cc)
632
633
TxHeader.DataLength = FDCAN_DLC_BYTES_64;
634
break;
635
default:
- error("Invalid message length for can_write\n");
636
+ error("Invalid message length for canfd_write\n");
637
return 0;
638
639
TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE;
@@ -658,7 +659,8 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
658
659
660
661
FDCAN_RxHeaderTypeDef RxHeader = {0};
- if (HAL_FDCAN_GetRxMessage(&obj->CanHandle, FDCAN_RX_FIFO0, &RxHeader, msg->data) != HAL_OK) {
662
+ unsigned char data[64];
663
+ if (HAL_FDCAN_GetRxMessage(&obj->CanHandle, FDCAN_RX_FIFO0, &RxHeader, data) != HAL_OK) {
664
error("HAL_FDCAN_GetRxMessage error\n"); // Should not occur as previous HAL_FDCAN_GetRxFifoFillLevel call reported some data
665
666
@@ -674,6 +676,12 @@ int can_read(can_t *obj, CAN_Message *msg, int handle)
674
676
RxHeader.DataLength >>= 16;
675
677
678
msg->len = RxHeader.DataLength;
679
+ if(msg->len > 8)
680
+ {
681
+ error("can_read unexpectedly received a FD frame\n");
682
+ return 0;
683
+ }
684
+ memcpy(msg->data, data, msg->len);
685
return 1;
686
687
targets/targets.json5
@@ -4922,6 +4922,11 @@ mode is recommended for target MCUs with small amounts of flash and RAM.",
4922
"value": "USE_PLL_MSI",
4923
"macro_name": "CLOCK_SOURCE"
4924
},
4925
+ "hse_value": {
4926
+ "help": "HSE default value is 16MHz in stm32u5xx_hal_conf.h",
4927
+ "value": "16000000",
4928
+ "macro_name": "HSE_VALUE"
4929
+ },
4930
"lpticker_lptim": {
4931
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
4932
"value": 1
0 commit comments