From 44c2029cd39b3e4907efa62d51c3739105caa423 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 7 Oct 2023 12:24:19 +0200 Subject: [PATCH 001/429] Add MSP commands for ublox passthrough --- src/main/msp/msp_protocol_v2_inav.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/msp/msp_protocol_v2_inav.h b/src/main/msp/msp_protocol_v2_inav.h index f746f5c8ff3..2c69d404f57 100755 --- a/src/main/msp/msp_protocol_v2_inav.h +++ b/src/main/msp/msp_protocol_v2_inav.h @@ -91,4 +91,5 @@ #define MSP2_INAV_LED_STRIP_CONFIG_EX 0x2048 #define MSP2_INAV_SET_LED_STRIP_CONFIG_EX 0x2049 - +#define MSP2_INAV_GPS_UBLOX_COMMAND 0x2050 +#define MSP2_INAV_GPS_UBLOX_COMMAND_RESULT 0x2051 From 70aa0e34db97b966d4e5574a7384831caaef34b0 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:39:40 +0200 Subject: [PATCH 002/429] Foundation for passthrough ublox commands --- src/main/fc/fc_msp.c | 8 ++++++++ src/main/io/gps_ublox.c | 28 +++++++++++++++++++++++++++- src/main/io/gps_ublox.h | 3 +++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 8b62fdba391..bf82ab59cc4 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -85,6 +85,7 @@ #include "io/asyncfatfs/asyncfatfs.h" #include "io/flashfs.h" #include "io/gps.h" +#include "io/gps_ublox.h" #include "io/opflow.h" #include "io/rangefinder.h" #include "io/ledstrip.h" @@ -3039,6 +3040,13 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) } break; #endif + case MSP2_INAV_GPS_UBLOX_COMMAND: + if(dataSize < 8 || !isGpsUblox()) { + return MSP_RESULT_ERROR; + } + + gpsUbloxSendCommand(src->ptr, dataSize, 0); + break; default: return MSP_RESULT_ERROR; diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index d03c3390776..7125afcd41b 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -128,7 +128,7 @@ static struct { // Send buffer -static union { +static union send_buffer_t { ubx_message message; uint8_t bytes[58]; } send_buffer; @@ -212,6 +212,23 @@ static uint8_t gpsMapFixType(bool fixValid, uint8_t ubloxFixType) return GPS_NO_FIX; } +bool gpsUbloxSendCommand(uint8_t *rawCommand, uint16_t commandLen, uint16_t timeout) +{ + serialWriteBuf(gpsState.gpsPort, rawCommand, commandLen); + + union send_buffer_t *sb = (union send_buffer_t *)(rawCommand); + + _ack_waiting_msg = sb->message.header.msg_id; + _ack_state = UBX_ACK_WAITING; + + UNUSED(timeout); + //if (timeout > 0) { + // ptWait(_ack_state == UBX_ACK_GOT_ACK); + //} + + return true; +} + static void sendConfigMessageUBLOX(void) { uint8_t ck_a=0, ck_b=0; @@ -1100,4 +1117,13 @@ void gpsHandleUBLOX(void) } } +bool isGpsUblox(void) +{ + if(gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) { + return true; + } + + return false; +} + #endif diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 00b42eeb2b7..232bbf8697e 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -422,6 +422,9 @@ bool gpsUbloxGlonassDefault(void); bool gpsUbloxGalileoEnabled(void); bool gpsUbloxBeidouEnabled(void); bool gpsUbloxGlonassEnabled(void); +bool gpsUbloxSendCommand(uint8_t *rawCommand, uint16_t commandLen, uint16_t timeout); + +bool isGpsUblox(void); #ifdef __cplusplus From 69a0ad14aaf02cba24ec3ce5aef0b4d0fa2242e8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 7 Oct 2023 18:36:48 +0200 Subject: [PATCH 003/429] Add a script to test firmware --- .gitignore | 3 ++ src/utils/assistnow.py | 102 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100755 src/utils/assistnow.py diff --git a/.gitignore b/.gitignore index b2c3b9ff546..e89a159c49c 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ make/local.mk launch.json .vscode/tasks.json .vscode/c_cpp_properties.json + +# Assitnow token files for test script +tokens.yaml diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py new file mode 100755 index 00000000000..f498da39d12 --- /dev/null +++ b/src/utils/assistnow.py @@ -0,0 +1,102 @@ +#!/usr/bin/python3 +# https://developer.thingstream.io/guides/location-services/assistnow-user-guide +# +# Create a file named tokens.yaml +# Add your assist now tokens +# assistnow_online: XXXXXXXXXXX +# assistnow_offline: XXXXXXXXXXX + +import requests +import yaml +import sys +import serial +import getopt + +online_token = "" +offline_token = "" +token_file = "tokens.yaml" +serial_port = None + +def loadTokens(file): + global online_token + global offline_token + yaml_config = {} + + with open(file, "r") as stream: + try: + yaml_config = yaml.safe_load(stream) + online_token = yaml_config['assistnow_online'] + offline_token = yaml_config['assistnow_online'] + except yaml.YAMLError as exc: + print(exc) + stream.close() + + +def usage(): + print ("assist-now.py -s /dev/ttyS0 [-t tokens.yaml]") + +try: + opts, args = getopt.getopt(sys.argv[1:], "s:t:", ["serial=", "tokens="]) +except getopt.GetoptError as err: + # print help information and exit: + print(err) # will print something like "option -a not recognized" + usage() + sys.exit(2) + +for o, a in opts: + if o in ("-s", "--serial"): + serial_port = a + elif o in ("-t", "--tokens="): + token_file = a + else: + usage() + sys.exit(2) + +if serial_port == None: + usage() + sys.exit(2) + +loadTokens(token_file) + +#s = serial.Serial(serial_port, 115200) + +#s.write(b"#\r\n") +#s.write(b"gpspassrhtrough\r\n"); + +#m8 only +fmt="mga" +gnss="gps,gal,bds,glo,qzss" +offline_gnss="gps,gal,bds,glo" +#m8 only +alm="gps,qzss,gal,bds,glo" + +online_servers = ['online-live1.services.u-blox.com', 'online-live2.services.u-blox.com'] +#m8 format = mga +#m7 format = aid +url = "https://online-live1.services.u-blox.com/GetOnlineData.ashx?token=" + online_token + ";gnss=" + gnss + ";datatype=eph,alm,aux,pos;format=" + fmt + ";" +online_req = requests.get(url) + +print (online_req) +#print (online_req.content) +print (len(online_req.content)) +#s.write(online_req.content); +of = open("aon.ubx", "wb") +of.write(online_req.content) +of.close() + +period = "5" + +offline_servers = ['offline-live1.services.u-blox.com', 'offline-live2.services.u-blox.com'] +offline_url = "https://offline-live1.services.u-blox.com/GetOfflineData.ashx?token=" + offline_token + ";gnss=" + offline_gnss + ";format=" + fmt + ";period=" + period + ";resolution=1;alm=" + alm + ";" +offline_req = requests.get(offline_url) + +print(offline_req) +#print(offline_req.content) +print(len(offline_req.content)) + +#s.write(offline_req.content); + +of = open("aoff.ubx", "wb") +of.write(offline_req.content) +of.close() + From edf2c3d186faeeda370329807789e13437c1facb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 7 Oct 2023 20:14:04 +0200 Subject: [PATCH 004/429] Parse ublox commands so we can send them over msp --- .gitignore | 3 +- src/utils/assistnow.py | 121 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e89a159c49c..f0fc36f5026 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,6 @@ launch.json .vscode/tasks.json .vscode/c_cpp_properties.json -# Assitnow token files for test script +# Assitnow token and files for test script tokens.yaml +*.ubx diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index f498da39d12..0e3a13345b6 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/local/bin/python3 # https://developer.thingstream.io/guides/location-services/assistnow-user-guide # # Create a file named tokens.yaml @@ -11,12 +11,119 @@ import sys import serial import getopt +import io online_token = "" offline_token = "" token_file = "tokens.yaml" serial_port = None + +# UBX frame +# 0xB5 +# 0x62 +# 0x?? class +# 0x?? id +# 0x?? len low +# 0x?? len high +# 0x?? len bytes payload +# 0x?? crc1 +# 0x?? crc2 +# Total len = 8 + len + +hasFirstHeader = False +hasSecondHeader = False +ubxClass = False +ubxId = False +lenLow = False +lenHigh = False +payloadLen = 0 +skipped = 0 +currentCommand = [] + +def resetUbloxState(): + global hasFirstHeader + global hasSecondHeader + global ubxClass + global ubxId + global lenLow + global lenHigh + global payloadLen + global skipped + global currentCommand + + hasFirstHeader = False + hasSecondHeader = False + ubxClass = False + ubxId = False + lenLow = False + lenHigh = False + payloadLen = 0 + skipped = 0 + currentCommand = [] + +def splitUbloxCommands(ubxBytes): + ubxCommands = [] + global hasFirstHeader + global hasSecondHeader + global ubxClass + global ubxId + global lenLow + global lenHigh + global payloadLen + global skipped + global currentCommand + + resetUbloxState() + + print("%s" % (type(ubxBytes))) + print("len: %i" % (len(ubxBytes))) + + for i in range(len(ubxBytes)): + if not hasFirstHeader: + if ubxBytes[i] == 0xb5: + hasFirstHeader = True + currentCommand.append(ubxBytes[i]) + continue + else: + resetUbloxState() + continue + if not hasSecondHeader: + if ubxBytes[i] == 0x62: + hasSecondHeader = True + currentCommand.append(ubxBytes[i]) + continue + else: + resetUbloxState() + continue + if not ubxClass: + ubxClass = True + currentCommand.append(ubxBytes[i]) + continue + if not ubxId: + ubxId = True + currentCommand.append(ubxBytes[i]) + continue + if not lenLow: + lenLow = True + payloadLen = int(ubxBytes[i]) + currentCommand.append(ubxBytes[i]) + continue + if not lenHigh: + lenHigh = True + payloadLen = (int(ubxBytes[i]) << 8) | payloadLen + payloadLen += 2 # add crc bytes + currentCommand.append(ubxBytes[i]) + continue + if skipped < payloadLen: + skipped = skipped + 1 + currentCommand.append(ubxBytes[i]) + continue + ubxCommands.append(currentCommand) + resetUbloxState() + + return ubxCommands + def loadTokens(file): global online_token global offline_token @@ -33,7 +140,7 @@ def loadTokens(file): def usage(): - print ("assist-now.py -s /dev/ttyS0 [-t tokens.yaml]") + print ("assistnow.py -s /dev/ttyS0 [-t tokens.yaml]") try: opts, args = getopt.getopt(sys.argv[1:], "s:t:", ["serial=", "tokens="]) @@ -78,7 +185,11 @@ def usage(): print (online_req) #print (online_req.content) -print (len(online_req.content)) +#print (len(online_req.content)) +online = io.BytesIO(online_req.content) +online_bytes = online.read() +online_cmds = splitUbloxCommands(online_bytes) +print ("AssitnowOnline: %i" % (len(online_cmds))) #s.write(online_req.content); of = open("aon.ubx", "wb") of.write(online_req.content) @@ -92,7 +203,11 @@ def usage(): print(offline_req) #print(offline_req.content) +off = io.BytesIO(offline_req.content) print(len(offline_req.content)) +offline_bytes = off.read() +offline_cmds = splitUbloxCommands(offline_bytes) +print ("AssitnowOffline: %i" % (len(offline_cmds))) #s.write(offline_req.content); From 524563d5a1bf51cd47a09e95b7a00d87c0e78243 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:44:49 +0200 Subject: [PATCH 005/429] almost working. Getting some random disconnects from usb port that needs to be investigated. Also need to check if gps is getting sent the correct ublox messages. --- src/utils/assistnow.py | 51 +++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index 0e3a13345b6..2a042b08cc3 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -12,6 +12,7 @@ import serial import getopt import io +import time online_token = "" offline_token = "" @@ -138,10 +139,47 @@ def loadTokens(file): print(exc) stream.close() +def crc8_dvb_s2( crc:int, b:int) -> int: + crc ^= b + for ii in range(8): + if (crc & 0x80) == 0x80: + crc = ((crc << 1) ^ 0xD5) & 0xFF + else: + crc = (crc << 1) & 0xFF + + return int(crc & 0xFF) + +def ubloxToMsp(ubxCmd): + ubloxLen = len(ubxCmd) + msp = bytearray(b'$X>\x00\x50\x20') + msp.append(ubloxLen & 0xFF) + msp.append((ubloxLen >> 8) & 0xFF) + + for i in range(ubloxLen): + msp.append(ubxCmd[i]) + + crc = 0 + for i in range(ubloxLen + 5): + crc = crc8_dvb_s2(crc, int(msp[i + 3])) + + #print ("msp: %s" % (bytes(msp))) + + return bytes(msp) + def usage(): print ("assistnow.py -s /dev/ttyS0 [-t tokens.yaml]") +def sendMessages(s, ubxMessages): + printed = 0 + for cmd in ubxMessages: + msp = ubloxToMsp(cmd) + printed += 1 + if(len(msp) > 8): + print ("%i/%i msp: %i ubx: %i" % (printed, len(ubxMessages), len(msp), len(cmd))) + s.write(msp) + time.sleep(0.2) + try: opts, args = getopt.getopt(sys.argv[1:], "s:t:", ["serial=", "tokens="]) except getopt.GetoptError as err: @@ -165,10 +203,6 @@ def usage(): loadTokens(token_file) -#s = serial.Serial(serial_port, 115200) - -#s.write(b"#\r\n") -#s.write(b"gpspassrhtrough\r\n"); #m8 only fmt="mga" @@ -185,12 +219,12 @@ def usage(): print (online_req) #print (online_req.content) -#print (len(online_req.content)) +print (len(online_req.content)) online = io.BytesIO(online_req.content) online_bytes = online.read() online_cmds = splitUbloxCommands(online_bytes) print ("AssitnowOnline: %i" % (len(online_cmds))) -#s.write(online_req.content); + of = open("aon.ubx", "wb") of.write(online_req.content) of.close() @@ -209,9 +243,10 @@ def usage(): offline_cmds = splitUbloxCommands(offline_bytes) print ("AssitnowOffline: %i" % (len(offline_cmds))) -#s.write(offline_req.content); - of = open("aoff.ubx", "wb") of.write(offline_req.content) of.close() +s = serial.Serial(serial_port, 230400) +sendMessages(s, online_cmds) +sendMessages(s, offline_cmds) \ No newline at end of file From 49208dc581d59cb50eb58a5847dbd365fbee9659 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 8 Oct 2023 13:02:50 +0200 Subject: [PATCH 006/429] Debugging why I get disconnects with my speedybeef405wing --- src/utils/assistnow.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index 2a042b08cc3..c3498d7a821 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -77,8 +77,8 @@ def splitUbloxCommands(ubxBytes): resetUbloxState() - print("%s" % (type(ubxBytes))) - print("len: %i" % (len(ubxBytes))) + #print("%s" % (type(ubxBytes))) + #print("len: %i" % (len(ubxBytes))) for i in range(len(ubxBytes)): if not hasFirstHeader: @@ -177,8 +177,14 @@ def sendMessages(s, ubxMessages): printed += 1 if(len(msp) > 8): print ("%i/%i msp: %i ubx: %i" % (printed, len(ubxMessages), len(msp), len(cmd))) - s.write(msp) - time.sleep(0.2) + try: + s.write(msp) + except serial.SerialException as err: + print (err) + print (cmd) + print (msp) + break + time.sleep(1.0) try: opts, args = getopt.getopt(sys.argv[1:], "s:t:", ["serial=", "tokens="]) @@ -248,5 +254,5 @@ def sendMessages(s, ubxMessages): of.close() s = serial.Serial(serial_port, 230400) -sendMessages(s, online_cmds) -sendMessages(s, offline_cmds) \ No newline at end of file +sendMessages(s, offline_cmds) +sendMessages(s, online_cmds) \ No newline at end of file From f75da29e464f3aadb5411766d3f222a09507d3bd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:58:40 +0200 Subject: [PATCH 007/429] Add gpspassthrough option --- src/utils/assistnow.py | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index c3498d7a821..f87208781ff 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python3 +#!/usr/bin/env python3 # https://developer.thingstream.io/guides/location-services/assistnow-user-guide # # Create a file named tokens.yaml @@ -16,6 +16,7 @@ online_token = "" offline_token = "" +passthrough = False token_file = "tokens.yaml" serial_port = None @@ -170,7 +171,22 @@ def ubloxToMsp(ubxCmd): def usage(): print ("assistnow.py -s /dev/ttyS0 [-t tokens.yaml]") -def sendMessages(s, ubxMessages): +def sendUbxMessages(s, ubxMessages): + printed = 0 + for cmd in ubxMessages: + printed += 1 + if(len(msp) > 8): + print ("%i/%i ubx: %i" % (printed, len(ubxMessages), len(cmd))) + try: + s.write(cmd) + except serial.SerialException as err: + print (err) + print (cmd) + break + time.sleep(1.0) + + +def sendMspMessages(s, ubxMessages): printed = 0 for cmd in ubxMessages: msp = ubloxToMsp(cmd) @@ -187,7 +203,7 @@ def sendMessages(s, ubxMessages): time.sleep(1.0) try: - opts, args = getopt.getopt(sys.argv[1:], "s:t:", ["serial=", "tokens="]) + opts, args = getopt.getopt(sys.argv[1:], "s:t:p", ["serial=", "tokens=", "passthrough"]) except getopt.GetoptError as err: # print help information and exit: print(err) # will print something like "option -a not recognized" @@ -195,10 +211,12 @@ def sendMessages(s, ubxMessages): sys.exit(2) for o, a in opts: - if o in ("-s", "--serial"): + if o in ("-s", "--serial="): serial_port = a elif o in ("-t", "--tokens="): token_file = a + elif o in ("-p", "--passthrough"): + passthrough = True else: usage() sys.exit(2) @@ -254,5 +272,12 @@ def sendMessages(s, ubxMessages): of.close() s = serial.Serial(serial_port, 230400) -sendMessages(s, offline_cmds) -sendMessages(s, online_cmds) \ No newline at end of file + +if not passthrough: + sendMspMessages(s, offline_cmds) + sendMspMessages(s, online_cmds) +else: + serial.write('#\r\n') + serial.write('gpspassthrough\r\n') + sendUbxMessages(s, offline_cmds) + sendUbxMessages(s, online_cmds) From 86afe137baa0577c91b5dcf0a2a88bc7b159900e Mon Sep 17 00:00:00 2001 From: Roman Lut <11955117+RomanLut@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:03:40 +0100 Subject: [PATCH 008/429] fixed: SITL accelerometer/mag data is not processed when using SITL with HITL plugin --- src/main/fc/fc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index a61204dee90..3248e4a9bf7 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -905,7 +905,7 @@ void taskMainPidLoop(timeUs_t currentTimeUs) } #if defined(SITL_BUILD) - if (lockMainPID()) { + if (ARMING_FLAG(SIMULATOR_MODE_HITL) || lockMainPID()) { #endif gyroFilter(); From d993c26f1c074e8a038c3a0c358b9c4038b283bf Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:02:34 +0100 Subject: [PATCH 009/429] Fix ublox splitting --- src/utils/assistnow.py | 55 ++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index f87208781ff..066029b4320 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -19,6 +19,7 @@ passthrough = False token_file = "tokens.yaml" serial_port = None +dry_run = False # UBX frame @@ -100,10 +101,12 @@ def splitUbloxCommands(ubxBytes): continue if not ubxClass: ubxClass = True + #print ("ubxClass: %02x" % (ubxBytes[i])) currentCommand.append(ubxBytes[i]) continue if not ubxId: ubxId = True + #print ("ubxId: %02x" % (ubxBytes[i])) currentCommand.append(ubxBytes[i]) continue if not lenLow: @@ -114,15 +117,20 @@ def splitUbloxCommands(ubxBytes): if not lenHigh: lenHigh = True payloadLen = (int(ubxBytes[i]) << 8) | payloadLen + #print ("Payload len %i" % (payloadLen)) payloadLen += 2 # add crc bytes currentCommand.append(ubxBytes[i]) continue - if skipped < payloadLen: + if skipped < payloadLen - 1: skipped = skipped + 1 currentCommand.append(ubxBytes[i]) continue - ubxCommands.append(currentCommand) - resetUbloxState() + if skipped == payloadLen - 1: + skipped = skipped + 1 + currentCommand.append(ubxBytes[i]) + ubxCommands.append(currentCommand) + resetUbloxState() + continue; return ubxCommands @@ -203,7 +211,7 @@ def sendMspMessages(s, ubxMessages): time.sleep(1.0) try: - opts, args = getopt.getopt(sys.argv[1:], "s:t:p", ["serial=", "tokens=", "passthrough"]) + opts, args = getopt.getopt(sys.argv[1:], "s:t:pd", ["serial=", "tokens=", "passthrough", "dry-run"]) except getopt.GetoptError as err: # print help information and exit: print(err) # will print something like "option -a not recognized" @@ -217,11 +225,13 @@ def sendMspMessages(s, ubxMessages): token_file = a elif o in ("-p", "--passthrough"): passthrough = True + elif o in ("-d", "--dry-run"): + dry_run = True else: usage() sys.exit(2) -if serial_port == None: +if serial_port == None and not dry_run: usage() sys.exit(2) @@ -249,6 +259,15 @@ def sendMspMessages(s, ubxMessages): online_cmds = splitUbloxCommands(online_bytes) print ("AssitnowOnline: %i" % (len(online_cmds))) +max_payload = 0 +max_msp_payload = 0 +for cmd in online_cmds: + if len(cmd) > max_payload: + max_payload = len(cmd) + max_msp_payload = len(ubloxToMsp(cmd)) + print ("Max ubx payload: %i" % (max_payload)) + print ("Max msp payload: %i" % (max_msp_payload)) + of = open("aon.ubx", "wb") of.write(online_req.content) of.close() @@ -267,17 +286,27 @@ def sendMspMessages(s, ubxMessages): offline_cmds = splitUbloxCommands(offline_bytes) print ("AssitnowOffline: %i" % (len(offline_cmds))) +for cmd in offline_cmds: + if len(cmd) > max_payload: + max_payload = len(cmd) + print ("Max ubx payload: %i" % (max_payload)) + max_msp_payload = len(ubloxToMsp(cmd)) + print ("Max msp payload: %i" % (max_msp_payload)) + of = open("aoff.ubx", "wb") of.write(offline_req.content) of.close() s = serial.Serial(serial_port, 230400) -if not passthrough: - sendMspMessages(s, offline_cmds) - sendMspMessages(s, online_cmds) -else: - serial.write('#\r\n') - serial.write('gpspassthrough\r\n') - sendUbxMessages(s, offline_cmds) - sendUbxMessages(s, online_cmds) +if not dry_run: + if not passthrough: + print ("Offline cmds...") + sendMspMessages(s, offline_cmds) + print ("Online cmds...") + sendMspMessages(s, online_cmds) + else: + serial.write('#\r\n') + serial.write('gpspassthrough\r\n') + sendUbxMessages(s, offline_cmds) + sendUbxMessages(s, online_cmds) From a625e83534d42245875c4bee93981e2859d995fb Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 30 Mar 2024 22:01:40 +0100 Subject: [PATCH 010/429] Increase allowed speeds in NAV modes on multirotors --- src/main/fc/settings.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 106a830decc..52c727b846f 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2510,7 +2510,7 @@ groups: table: nav_fw_wp_turn_smoothing - name: nav_auto_speed description: "Speed in fully autonomous modes (RTH, WP) [cm/s]. Used for WP mode when no specific WP speed set. [Multirotor only]" - default_value: 300 + default_value: 600 field: general.auto_speed min: 10 max: 2000 @@ -2522,13 +2522,13 @@ groups: max: 50 - name: nav_max_auto_speed description: "Maximum speed allowed in fully autonomous modes (RTH, WP) [cm/s] [Multirotor only]" - default_value: 1000 + default_value: 1200 field: general.max_auto_speed min: 10 max: 2000 - name: nav_manual_speed description: "Maximum speed allowed when processing pilot input for POSHOLD/CRUISE control mode [cm/s] [Multirotor only]" - default_value: 500 + default_value: 1000 field: general.max_manual_speed min: 10 max: 2000 From 890147770019da9f6dd2e2a2c6d49b7fbb548026 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 30 Mar 2024 22:05:58 +0100 Subject: [PATCH 011/429] Increase bank angles --- docs/Settings.md | 12 ++++++------ src/main/fc/settings.yaml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index fefcc927f20..40490808c83 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -2388,7 +2388,7 @@ Maximum inclination in level (angle) mode (PITCH axis). 100=10° | Default | Min | Max | | --- | --- | --- | -| 300 | 100 | 900 | +| 450 | 100 | 900 | --- @@ -2398,7 +2398,7 @@ Maximum inclination in level (angle) mode (ROLL axis). 100=10° | Default | Min | Max | | --- | --- | --- | -| 300 | 100 | 900 | +| 450 | 100 | 900 | --- @@ -2758,7 +2758,7 @@ Speed in fully autonomous modes (RTH, WP) [cm/s]. Used for WP mode when no speci | Default | Min | Max | | --- | --- | --- | -| 300 | 10 | 2000 | +| 600 | 10 | 2000 | --- @@ -3418,7 +3418,7 @@ Maximum speed allowed when processing pilot input for POSHOLD/CRUISE control mod | Default | Min | Max | | --- | --- | --- | -| 500 | 10 | 2000 | +| 1000 | 10 | 2000 | --- @@ -3438,7 +3438,7 @@ Maximum speed allowed in fully autonomous modes (RTH, WP) [cm/s] [Multirotor onl | Default | Min | Max | | --- | --- | --- | -| 1000 | 10 | 2000 | +| 1200 | 10 | 2000 | --- @@ -3478,7 +3478,7 @@ Maximum banking angle (deg) that multicopter navigation is allowed to set. Machi | Default | Min | Max | | --- | --- | --- | -| 30 | 15 | 45 | +| 40 | 15 | 45 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 52c727b846f..71964891ce9 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1913,13 +1913,13 @@ groups: max: RPYL_PID_MAX - name: max_angle_inclination_rll description: "Maximum inclination in level (angle) mode (ROLL axis). 100=10°" - default_value: 300 + default_value: 450 field: max_angle_inclination[FD_ROLL] min: 100 max: 900 - name: max_angle_inclination_pit description: "Maximum inclination in level (angle) mode (PITCH axis). 100=10°" - default_value: 300 + default_value: 450 field: max_angle_inclination[FD_PITCH] min: 100 max: 900 @@ -2704,7 +2704,7 @@ groups: max: 120 - name: nav_mc_bank_angle description: "Maximum banking angle (deg) that multicopter navigation is allowed to set. Machine must be able to satisfy this angle without loosing altitude" - default_value: 30 + default_value: 40 field: mc.max_bank_angle min: 15 max: 45 From 93a636d3f1d8fec4af5c6effdc6aee3de06171dd Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 31 Mar 2024 18:21:08 +0200 Subject: [PATCH 012/429] Compute RMS of filtered gyro data --- .vscode/c_cpp_properties.json | 3 +- cmake/at32.cmake | 3 ++ cmake/stm32.cmake | 3 ++ src/main/CMakeLists.txt | 2 + src/main/build/debug.h | 1 + src/main/fc/fc_tasks.c | 13 ++++++ src/main/fc/settings.yaml | 2 +- src/main/flight/adaptive_filter.c | 77 +++++++++++++++++++++++++++++++ src/main/flight/adaptive_filter.h | 32 +++++++++++++ src/main/scheduler/scheduler.h | 3 ++ src/main/sensors/gyro.c | 3 ++ src/main/target/common.h | 6 +++ 12 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 src/main/flight/adaptive_filter.c create mode 100644 src/main/flight/adaptive_filter.h diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 6e7d914b25a..a2c5f582e1c 100755 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -57,7 +57,8 @@ "USE_SDCARD_SDIO", "USE_SDCARD", "USE_Q_TUNE", - "USE_GYRO_FFT_FILTER" + "USE_GYRO_FFT_FILTER", + "USE_ADAPTIVE_FILTER", ], "configurationProvider": "ms-vscode.cmake-tools" } diff --git a/cmake/at32.cmake b/cmake/at32.cmake index 54e178deb7b..79efcfc0f17 100644 --- a/cmake/at32.cmake +++ b/cmake/at32.cmake @@ -18,6 +18,7 @@ set(CMSIS_DSP_SRC BasicMathFunctions/arm_scale_f32.c BasicMathFunctions/arm_sub_f32.c BasicMathFunctions/arm_mult_f32.c + BasicMathFunctions/arm_offset_f32.c TransformFunctions/arm_rfft_fast_f32.c TransformFunctions/arm_cfft_f32.c TransformFunctions/arm_rfft_fast_init_f32.c @@ -26,6 +27,8 @@ set(CMSIS_DSP_SRC CommonTables/arm_common_tables.c ComplexMathFunctions/arm_cmplx_mag_f32.c StatisticsFunctions/arm_max_f32.c + StatisticsFunctions/arm_rms_f32.c + StatisticsFunctions/arm_mean_f32.c ) list(TRANSFORM CMSIS_DSP_SRC PREPEND "${CMSIS_DSP_DIR}/Source/") diff --git a/cmake/stm32.cmake b/cmake/stm32.cmake index f02185e9aff..256f8d09bef 100644 --- a/cmake/stm32.cmake +++ b/cmake/stm32.cmake @@ -19,6 +19,7 @@ set(CMSIS_DSP_SRC BasicMathFunctions/arm_scale_f32.c BasicMathFunctions/arm_sub_f32.c BasicMathFunctions/arm_mult_f32.c + BasicMathFunctions/arm_offset_f32.c TransformFunctions/arm_rfft_fast_f32.c TransformFunctions/arm_cfft_f32.c TransformFunctions/arm_rfft_fast_init_f32.c @@ -27,6 +28,8 @@ set(CMSIS_DSP_SRC CommonTables/arm_common_tables.c ComplexMathFunctions/arm_cmplx_mag_f32.c StatisticsFunctions/arm_max_f32.c + StatisticsFunctions/arm_rms_f32.c + StatisticsFunctions/arm_mean_f32.c ) list(TRANSFORM CMSIS_DSP_SRC PREPEND "${CMSIS_DSP_DIR}/Source/") diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 98a43854cf2..7b3a22006f7 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -343,6 +343,8 @@ main_sources(COMMON_SRC flight/dynamic_lpf.h flight/ez_tune.c flight/ez_tune.h + flight/adaptive_filter.c + flight/adaptive_filter.h io/adsb.c io/beeper.c diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 3a09da50daf..60b22df27bc 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -72,5 +72,6 @@ typedef enum { DEBUG_RATE_DYNAMICS, DEBUG_LANDING, DEBUG_POS_EST, + DEBUG_ADAPTIVE_FILTER, DEBUG_COUNT } debugType_e; diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 246d65c0a7e..74be2f42258 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -51,6 +51,7 @@ #include "flight/rpm_filter.h" #include "flight/servos.h" #include "flight/wind_estimator.h" +#include "flight/adaptive_filter.h" #include "navigation/navigation.h" @@ -421,6 +422,10 @@ void fcTasksInit(void) #if defined(USE_SMARTPORT_MASTER) setTaskEnabled(TASK_SMARTPORT_MASTER, true); #endif + +#ifdef USE_ADAPTIVE_FILTER + setTaskEnabled(TASK_ADAPTIVE_FILTER, true); +#endif } cfTask_t cfTasks[TASK_COUNT] = { @@ -672,4 +677,12 @@ cfTask_t cfTasks[TASK_COUNT] = { .desiredPeriod = TASK_PERIOD_HZ(TASK_AUX_RATE_HZ), // 100Hz @10ms .staticPriority = TASK_PRIORITY_HIGH, }, +#ifdef USE_ADAPTIVE_FILTER + [TASK_ADAPTIVE_FILTER] = { + .taskName = "ADAPTIVE_FILTER", + .taskFunc = adaptiveFilterTask, + .desiredPeriod = TASK_PERIOD_HZ(ADAPTIVE_FILTER_RATE_HZ), // 100Hz @10ms + .staticPriority = TASK_PRIORITY_LOW, + }, +#endif }; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 106a830decc..8c2ed270d35 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -88,7 +88,7 @@ tables: values: ["NONE", "AGL", "FLOW_RAW", "FLOW", "ALWAYS", "SAG_COMP_VOLTAGE", "VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC", "NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE", - "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST"] + "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER"] - name: aux_operator values: ["OR", "AND"] enum: modeActivationOperator_e diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c new file mode 100644 index 00000000000..cb057ad5cfb --- /dev/null +++ b/src/main/flight/adaptive_filter.c @@ -0,0 +1,77 @@ +/* + * This file is part of INAV Project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public License Version 3, as described below: + * + * This file is free software: you may copy, redistribute and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#include "platform.h" + +#ifdef USE_ADAPTIVE_FILTER + +#include +#include "flight/adaptive_filter.h" +#include "arm_math.h" +#include +#include "common/maths.h" +#include "common/axis.h" +#include "build/debug.h" + +static float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; +static uint8_t adaptiveFilterSampleIndex = 0; + +void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) { + //Push new sample to the buffer so later we can compute RMS and other measures + adaptiveFilterSamples[index][adaptiveFilterSampleIndex] = value; + adaptiveFilterSampleIndex = (adaptiveFilterSampleIndex + 1) % ADAPTIVE_FILTER_BUFFER_SIZE; +} + +void adaptiveFilterTask(timeUs_t currentTimeUs) { + UNUSED(currentTimeUs); + + //Compute RMS for each axis + for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { + + //Copy axis samples to a temporary buffer + float32_t tempBuffer[ADAPTIVE_FILTER_BUFFER_SIZE]; + //Use memcpy to copy the samples to the temporary buffer + memcpy(tempBuffer, adaptiveFilterSamples[axis], sizeof(adaptiveFilterSamples[axis])); + + //Use arm_mean_f32 to compute the mean of the samples + float32_t mean; + arm_mean_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &mean); + + float32_t normalizedBuffer[ADAPTIVE_FILTER_BUFFER_SIZE]; + + //Use arm_offset_f32 to subtract the mean from the samples + arm_offset_f32(tempBuffer, -mean, normalizedBuffer, ADAPTIVE_FILTER_BUFFER_SIZE); + + //Compute RMS from normalizedBuffer using arm_rms_f32 + float32_t rms; + arm_rms_f32(normalizedBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); + + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis, rms * 1000.0f); + } + + +} + + +#endif /* USE_ADAPTIVE_FILTER */ \ No newline at end of file diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h new file mode 100644 index 00000000000..9999f17105d --- /dev/null +++ b/src/main/flight/adaptive_filter.h @@ -0,0 +1,32 @@ +/* + * This file is part of INAV Project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public License Version 3, as described below: + * + * This file is free software: you may copy, redistribute and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#include "common/axis.h" +#include "common/time.h" + +#define ADAPTIVE_FILTER_BUFFER_SIZE 32 +#define ADAPTIVE_FILTER_RATE_HZ 100 + +void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); +void adaptiveFilterTask(timeUs_t currentTimeUs); diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index 0d91876cb72..c1e0ab6bb53 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -121,6 +121,9 @@ typedef enum { #endif #ifdef USE_IRLOCK TASK_IRLOCK, +#endif +#ifdef USE_ADAPTIVE_FILTER + TASK_ADAPTIVE_FILTER, #endif /* Count of real tasks */ TASK_COUNT, diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index a586ce6df6b..5873c9d7950 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -68,6 +68,7 @@ #include "flight/gyroanalyse.h" #include "flight/rpm_filter.h" #include "flight/kalman.h" +#include "flight/adaptive_filter.h" #ifdef USE_HARDWARE_REVISION_DETECTION #include "hardware_revision.h" @@ -453,6 +454,8 @@ void FAST_CODE NOINLINE gyroFilter(void) gyroADCf = gyroLpf2ApplyFn((filter_t *) &gyroLpf2State[axis], gyroADCf); + adaptiveFilterPush(axis, gyroADCf); + #ifdef USE_DYNAMIC_FILTERS if (dynamicGyroNotchState.enabled) { gyroDataAnalysePush(&gyroAnalyseState, axis, gyroADCf); diff --git a/src/main/target/common.h b/src/main/target/common.h index 8bbaadef718..63a03b59851 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -203,3 +203,9 @@ #define MAX_MIXER_PROFILE_COUNT 1 #endif #define USE_EZ_TUNE + +#ifdef STM32H7 + +#define USE_ADAPTIVE_FILTER + +#endif From e99563deaebb0a02f4f226f2fcf8e4ccdb46a378 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 31 Mar 2024 21:34:59 +0200 Subject: [PATCH 013/429] Add a filter --- src/main/flight/adaptive_filter.c | 20 ++++++++++++++++++-- src/main/flight/adaptive_filter.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index cb057ad5cfb..31078b95ba9 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -32,10 +32,15 @@ #include #include "common/maths.h" #include "common/axis.h" +#include "common/filter.h" #include "build/debug.h" -static float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; -static uint8_t adaptiveFilterSampleIndex = 0; +STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; +STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; + +STATIC_FASTRAM pt1Filter_t rmsFilter[XYZ_AXIS_COUNT]; + +STATIC_FASTRAM uint8_t adaptiveFilterInitialized = 0; void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) { //Push new sample to the buffer so later we can compute RMS and other measures @@ -46,6 +51,14 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) void adaptiveFilterTask(timeUs_t currentTimeUs) { UNUSED(currentTimeUs); + if (!adaptiveFilterInitialized) { + //Initialize the filter + for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { + pt1FilterInit(&rmsFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); + } + adaptiveFilterInitialized = 1; + } + //Compute RMS for each axis for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { @@ -67,7 +80,10 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { float32_t rms; arm_rms_f32(normalizedBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); + float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis, rms * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis + XYZ_AXIS_COUNT, filteredRms * 1000.0f); } diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 9999f17105d..1b61c769a97 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -27,6 +27,7 @@ #define ADAPTIVE_FILTER_BUFFER_SIZE 32 #define ADAPTIVE_FILTER_RATE_HZ 100 +#define ADAPTIVE_FILTER_LPF_HZ 1 void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); void adaptiveFilterTask(timeUs_t currentTimeUs); From 4c46e519c518711f507adf6d076631ccd6bd9c70 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 31 Mar 2024 22:47:06 +0200 Subject: [PATCH 014/429] Change formating --- src/main/flight/adaptive_filter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 31078b95ba9..2ec4e9780bc 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -86,7 +86,6 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis + XYZ_AXIS_COUNT, filteredRms * 1000.0f); } - } From 64cfdba5befa792d806aa87bd4e57f62cbefc4bf Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 2 Apr 2024 13:02:09 +0200 Subject: [PATCH 015/429] Use HPF on samples instead of buffer mean value --- src/main/flight/adaptive_filter.c | 30 +++++++++++++++++++----------- src/main/flight/adaptive_filter.h | 1 + 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 2ec4e9780bc..d402369c910 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -34,17 +34,34 @@ #include "common/axis.h" #include "common/filter.h" #include "build/debug.h" +#include "fc/config.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; STATIC_FASTRAM pt1Filter_t rmsFilter[XYZ_AXIS_COUNT]; +STATIC_FASTRAM pt1Filter_t hpfFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM uint8_t adaptiveFilterInitialized = 0; +STATIC_FASTRAM uint8_t hpfFilterInitialized = 0; +/** + * This function is called at pid rate, so has to be initialized at PID loop frequency +*/ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) { + + if (!hpfFilterInitialized) { + //Initialize the filter + for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { + pt1FilterInit(&hpfFilter[axis], ADAPTIVE_FILTER_HPF_HZ, US2S(getLooptime())); + } + hpfFilterInitialized = 1; + } + + const float filteredGyro = value - pt1FilterApply(&hpfFilter[index], value); + //Push new sample to the buffer so later we can compute RMS and other measures - adaptiveFilterSamples[index][adaptiveFilterSampleIndex] = value; + adaptiveFilterSamples[index][adaptiveFilterSampleIndex] = filteredGyro; adaptiveFilterSampleIndex = (adaptiveFilterSampleIndex + 1) % ADAPTIVE_FILTER_BUFFER_SIZE; } @@ -67,18 +84,9 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { //Use memcpy to copy the samples to the temporary buffer memcpy(tempBuffer, adaptiveFilterSamples[axis], sizeof(adaptiveFilterSamples[axis])); - //Use arm_mean_f32 to compute the mean of the samples - float32_t mean; - arm_mean_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &mean); - - float32_t normalizedBuffer[ADAPTIVE_FILTER_BUFFER_SIZE]; - - //Use arm_offset_f32 to subtract the mean from the samples - arm_offset_f32(tempBuffer, -mean, normalizedBuffer, ADAPTIVE_FILTER_BUFFER_SIZE); - //Compute RMS from normalizedBuffer using arm_rms_f32 float32_t rms; - arm_rms_f32(normalizedBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); + arm_rms_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 1b61c769a97..9a9d4dc88fb 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -28,6 +28,7 @@ #define ADAPTIVE_FILTER_BUFFER_SIZE 32 #define ADAPTIVE_FILTER_RATE_HZ 100 #define ADAPTIVE_FILTER_LPF_HZ 1 +#define ADAPTIVE_FILTER_HPF_HZ 15 void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); void adaptiveFilterTask(timeUs_t currentTimeUs); From 3585f889296ea882139dd43aa2f4284f37c9f2be Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 2 Apr 2024 14:58:04 +0200 Subject: [PATCH 016/429] Compute combined RMS --- src/main/flight/adaptive_filter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index d402369c910..0c4767e293f 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -76,6 +76,8 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { adaptiveFilterInitialized = 1; } + float combinedRms = 0.0f; + //Compute RMS for each axis for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { @@ -90,10 +92,14 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis, rms * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis + XYZ_AXIS_COUNT, filteredRms * 1000.0f); + combinedRms += filteredRms; } + combinedRms /= XYZ_AXIS_COUNT; + + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedRms); + + } From 49aba32044d2a7de3cb373ed0003b91855e5c1ec Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 2 Apr 2024 15:04:10 +0200 Subject: [PATCH 017/429] Compute task dT --- src/main/flight/adaptive_filter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 0c4767e293f..52f82ec72bb 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -66,7 +66,8 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) } void adaptiveFilterTask(timeUs_t currentTimeUs) { - UNUSED(currentTimeUs); + static timeUs_t previousUpdateTimeUs; + const float dT = US2S(currentTimeUs - previousUpdateTimeUs); if (!adaptiveFilterInitialized) { //Initialize the filter @@ -96,8 +97,8 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { } combinedRms /= XYZ_AXIS_COUNT; - - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedRms); + + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedRms * 1000.0f); } From 9f72d0744af7a91802c18859d6d81f9a1cd8dae5 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 2 Apr 2024 17:36:32 +0200 Subject: [PATCH 018/429] Change filtering rules --- src/main/flight/adaptive_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 52f82ec72bb..bb35557f317 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -94,11 +94,13 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); combinedRms += filteredRms; + + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis, filteredRms * 1000.0f); } combinedRms /= XYZ_AXIS_COUNT; - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedRms * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, combinedRms * 1000.0f); } From bc8446fd0ebdfc8d3d436d57a74b71e3906de33b Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 2 Apr 2024 21:17:03 +0200 Subject: [PATCH 019/429] Compute RMS and STD --- cmake/at32.cmake | 1 + cmake/stm32.cmake | 1 + src/main/flight/adaptive_filter.c | 29 +++++++++++++++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/cmake/at32.cmake b/cmake/at32.cmake index 79efcfc0f17..ef5041a8267 100644 --- a/cmake/at32.cmake +++ b/cmake/at32.cmake @@ -28,6 +28,7 @@ set(CMSIS_DSP_SRC ComplexMathFunctions/arm_cmplx_mag_f32.c StatisticsFunctions/arm_max_f32.c StatisticsFunctions/arm_rms_f32.c + StatisticsFunctions/arm_std_f32.c StatisticsFunctions/arm_mean_f32.c ) list(TRANSFORM CMSIS_DSP_SRC PREPEND "${CMSIS_DSP_DIR}/Source/") diff --git a/cmake/stm32.cmake b/cmake/stm32.cmake index 256f8d09bef..bbb9c3b8dc9 100644 --- a/cmake/stm32.cmake +++ b/cmake/stm32.cmake @@ -29,6 +29,7 @@ set(CMSIS_DSP_SRC ComplexMathFunctions/arm_cmplx_mag_f32.c StatisticsFunctions/arm_max_f32.c StatisticsFunctions/arm_rms_f32.c + StatisticsFunctions/arm_std_f32.c StatisticsFunctions/arm_mean_f32.c ) list(TRANSFORM CMSIS_DSP_SRC PREPEND "${CMSIS_DSP_DIR}/Source/") diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index bb35557f317..22a9809fbdc 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -37,8 +37,10 @@ #include "fc/config.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; +STATIC_FASTRAM float32_t adaptiveFilterRaw[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; +STATIC_FASTRAM pt1Filter_t stdFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM pt1Filter_t rmsFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM pt1Filter_t hpfFilter[XYZ_AXIS_COUNT]; @@ -62,6 +64,7 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) //Push new sample to the buffer so later we can compute RMS and other measures adaptiveFilterSamples[index][adaptiveFilterSampleIndex] = filteredGyro; + adaptiveFilterRaw[index][adaptiveFilterSampleIndex] = value; adaptiveFilterSampleIndex = (adaptiveFilterSampleIndex + 1) % ADAPTIVE_FILTER_BUFFER_SIZE; } @@ -73,11 +76,14 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { //Initialize the filter for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { pt1FilterInit(&rmsFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); + pt1FilterInit(&stdFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); } adaptiveFilterInitialized = 1; } float combinedRms = 0.0f; + float combinedStd = 0.0f; + float combinedStdRaw = 0.0f; //Compute RMS for each axis for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { @@ -91,18 +97,33 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { float32_t rms; arm_rms_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); + float32_t std; + memcpy(tempBuffer, adaptiveFilterRaw[axis], sizeof(adaptiveFilterRaw[axis])); + arm_std_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &std); + float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); + float32_t filteredStd = pt1FilterApply(&stdFilter[axis], std); combinedRms += filteredRms; - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, axis, filteredRms * 1000.0f); + combinedStd += filteredStd; + combinedStdRaw += std; + + if (axis == 0) { + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, rms * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, filteredRms * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, std * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, filteredStd * 1000.0f); + } } combinedRms /= XYZ_AXIS_COUNT; + combinedStd /= XYZ_AXIS_COUNT; + combinedStdRaw /= XYZ_AXIS_COUNT; - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, combinedRms * 1000.0f); - - + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, combinedRms * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, combinedStdRaw * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 6, combinedStd * 1000.0f); } From f86365ba5f43d5dcf8fc8df20925608e6053a106 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 4 Apr 2024 13:14:11 +0200 Subject: [PATCH 020/429] Settle only on Standard Deviation on high pass filter gyro data --- .vscode/c_cpp_properties.json | 33 +++++-------------------------- src/main/flight/adaptive_filter.c | 31 +++++------------------------ 2 files changed, 10 insertions(+), 54 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a2c5f582e1c..3a8d8d1c8ca 100755 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -3,24 +3,19 @@ { "name": "Linux", "includePath": [ - "${workspaceRoot}/src/main/**", - "${workspaceRoot}/lib/main/**", - "/usr/include/**" + "${workspaceRoot}", + "${workspaceRoot}/src/main/**" ], "browse": { "limitSymbolsToIncludedHeaders": false, "path": [ - "${workspaceRoot}/src/main/**", - "${workspaceRoot}/lib/main/**" + "${workspaceRoot}/**" ] }, - "intelliSenseMode": "linux-gcc-arm", + "intelliSenseMode": "msvc-x64", "cStandard": "c11", "cppStandard": "c++17", "defines": [ - "MCU_FLASH_SIZE 512", - "USE_NAV", - "NAV_FIXED_WING_LANDING", "USE_OSD", "USE_GYRO_NOTCH_1", "USE_GYRO_NOTCH_2", @@ -34,31 +29,13 @@ "USE_RPM_FILTER", "USE_GLOBAL_FUNCTIONS", "USE_DYNAMIC_FILTERS", - "USE_IMU_BNO055", - "USE_SECONDARY_IMU", "USE_DSHOT", "FLASH_SIZE 480", "USE_I2C_IO_EXPANDER", "USE_PCF8574", "USE_ESC_SENSOR", - "USE_PROGRAMMING_FRAMEWORK", - "USE_SERIALRX_GHST", - "USE_TELEMETRY_GHST", - "USE_CMS", - "USE_DJI_HD_OSD", - "USE_GYRO_KALMAN", - "USE_RANGEFINDER", - "USE_RATE_DYNAMICS", - "USE_SMITH_PREDICTOR", - "USE_ALPHA_BETA_GAMMA_FILTER", - "USE_MAG_VCM5883", - "USE_TELEMETRY_JETIEXBUS", - "USE_NAV", - "USE_SDCARD_SDIO", - "USE_SDCARD", - "USE_Q_TUNE", - "USE_GYRO_FFT_FILTER", "USE_ADAPTIVE_FILTER", + "MCU_FLASH_SIZE 1024", ], "configurationProvider": "ms-vscode.cmake-tools" } diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 22a9809fbdc..b6a584f92db 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -37,7 +37,6 @@ #include "fc/config.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; -STATIC_FASTRAM float32_t adaptiveFilterRaw[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; STATIC_FASTRAM pt1Filter_t stdFilter[XYZ_AXIS_COUNT]; @@ -60,11 +59,11 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) hpfFilterInitialized = 1; } + //Apply high pass filter, we are not interested in slowly changing values, only noise const float filteredGyro = value - pt1FilterApply(&hpfFilter[index], value); //Push new sample to the buffer so later we can compute RMS and other measures adaptiveFilterSamples[index][adaptiveFilterSampleIndex] = filteredGyro; - adaptiveFilterRaw[index][adaptiveFilterSampleIndex] = value; adaptiveFilterSampleIndex = (adaptiveFilterSampleIndex + 1) % ADAPTIVE_FILTER_BUFFER_SIZE; } @@ -75,54 +74,34 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { if (!adaptiveFilterInitialized) { //Initialize the filter for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { - pt1FilterInit(&rmsFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); pt1FilterInit(&stdFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); } adaptiveFilterInitialized = 1; } - float combinedRms = 0.0f; float combinedStd = 0.0f; - float combinedStdRaw = 0.0f; //Compute RMS for each axis for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { //Copy axis samples to a temporary buffer float32_t tempBuffer[ADAPTIVE_FILTER_BUFFER_SIZE]; - //Use memcpy to copy the samples to the temporary buffer - memcpy(tempBuffer, adaptiveFilterSamples[axis], sizeof(adaptiveFilterSamples[axis])); - - //Compute RMS from normalizedBuffer using arm_rms_f32 - float32_t rms; - arm_rms_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &rms); - + + //Copute STD from buffer using arm_std_f32 float32_t std; - memcpy(tempBuffer, adaptiveFilterRaw[axis], sizeof(adaptiveFilterRaw[axis])); + memcpy(tempBuffer, adaptiveFilterSamples[axis], sizeof(adaptiveFilterSamples[axis])); arm_std_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &std); - float32_t filteredRms = pt1FilterApply(&rmsFilter[axis], rms); float32_t filteredStd = pt1FilterApply(&stdFilter[axis], std); - combinedRms += filteredRms; - - combinedStd += filteredStd; - combinedStdRaw += std; + combinedStd += std; if (axis == 0) { - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, rms * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, filteredRms * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, std * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, filteredStd * 1000.0f); } } - combinedRms /= XYZ_AXIS_COUNT; combinedStd /= XYZ_AXIS_COUNT; - combinedStdRaw /= XYZ_AXIS_COUNT; - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, combinedRms * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, combinedStdRaw * 1000.0f); DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 6, combinedStd * 1000.0f); } From 369613643de343e35f8903966577b69dd3e004a9 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 4 Apr 2024 16:04:08 +0200 Subject: [PATCH 021/429] Compute the integator of adaptive filter --- src/main/flight/adaptive_filter.c | 43 +++++++++++++++++++++++++++---- src/main/flight/adaptive_filter.h | 1 + src/main/flight/pid.c | 3 +++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index b6a584f92db..448e37fd782 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -40,12 +40,21 @@ STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_B STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; STATIC_FASTRAM pt1Filter_t stdFilter[XYZ_AXIS_COUNT]; -STATIC_FASTRAM pt1Filter_t rmsFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM pt1Filter_t hpfFilter[XYZ_AXIS_COUNT]; +/* + We want to run adaptive filter only when UAV is commanded to stay stationary + Any rotation request on axis will add noise that we are not interested in as it will + automatically cause LPF frequency to be lowered +*/ +STATIC_FASTRAM float axisAttenuationFactor[XYZ_AXIS_COUNT]; + STATIC_FASTRAM uint8_t adaptiveFilterInitialized = 0; STATIC_FASTRAM uint8_t hpfFilterInitialized = 0; +STATIC_FASTRAM float adaptiveFilterIntegrator; +STATIC_FASTRAM float adaptiveIntegratorTarget; + /** * This function is called at pid rate, so has to be initialized at PID loop frequency */ @@ -67,11 +76,19 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) adaptiveFilterSampleIndex = (adaptiveFilterSampleIndex + 1) % ADAPTIVE_FILTER_BUFFER_SIZE; } +void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rate, const uint8_t configRate) { + const float maxRate = configRate * 10.0f; + axisAttenuationFactor[index] = scaleRangef(fabsf(rate), 0.0f, maxRate, 1.0f, 0.0f); + axisAttenuationFactor[index] = constrainf(axisAttenuationFactor[index], 0.0f, 1.0f); +} + void adaptiveFilterTask(timeUs_t currentTimeUs) { - static timeUs_t previousUpdateTimeUs; - const float dT = US2S(currentTimeUs - previousUpdateTimeUs); + static timeUs_t previousUpdateTimeUs = 0; if (!adaptiveFilterInitialized) { + adaptiveIntegratorTarget = 3.5f; + previousUpdateTimeUs = currentTimeUs; + //Initialize the filter for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { pt1FilterInit(&stdFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); @@ -79,6 +96,8 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { adaptiveFilterInitialized = 1; } + const float dT = US2S(currentTimeUs - previousUpdateTimeUs); + float combinedStd = 0.0f; //Compute RMS for each axis @@ -92,17 +111,31 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { memcpy(tempBuffer, adaptiveFilterSamples[axis], sizeof(adaptiveFilterSamples[axis])); arm_std_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &std); - float32_t filteredStd = pt1FilterApply(&stdFilter[axis], std); + const float filteredStd = pt1FilterApply(&stdFilter[axis], std); + + const float error = filteredStd - adaptiveIntegratorTarget; + + const float adjustedError = error * axisAttenuationFactor[axis]; + + const float timeAdjustedError = adjustedError * dT; + + //Put into integrator + adaptiveFilterIntegrator += timeAdjustedError; combinedStd += std; if (axis == 0) { + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, filteredStd * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, error * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, adjustedError * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, timeAdjustedError * 1000.0f); } } combinedStd /= XYZ_AXIS_COUNT; - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 6, combinedStd * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedStd * 1000.0f); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, adaptiveFilterIntegrator); } diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 9a9d4dc88fb..2885023bbd6 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -31,4 +31,5 @@ #define ADAPTIVE_FILTER_HPF_HZ 15 void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); +void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rate, const uint8_t configRate); void adaptiveFilterTask(timeUs_t currentTimeUs); diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 3da150e39dc..d1dbb75ce67 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -47,6 +47,7 @@ #include "flight/rpm_filter.h" #include "flight/kalman.h" #include "flight/smith_predictor.h" +#include "flight/adaptive_filter.h" #include "io/gps.h" @@ -1168,6 +1169,8 @@ void FAST_CODE pidController(float dT) // Limit desired rate to something gyro can measure reliably pidState[axis].rateTarget = constrainf(rateTarget, -GYRO_SATURATION_LIMIT, +GYRO_SATURATION_LIMIT); + adaptiveFilterPushRate(axis, pidState[axis].rateTarget, currentControlRateProfile->stabilized.rates[axis]); + #ifdef USE_GYRO_KALMAN gyroKalmanUpdateSetpoint(axis, pidState[axis].rateTarget); #endif From 561f7b8be254bc049524ada5d6582ea2022e3028 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 4 Apr 2024 16:39:25 +0200 Subject: [PATCH 022/429] Compute integrator --- src/main/flight/adaptive_filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 448e37fd782..3a453679af3 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -85,6 +85,7 @@ void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rat void adaptiveFilterTask(timeUs_t currentTimeUs) { static timeUs_t previousUpdateTimeUs = 0; + //Initialization procedure, filter setup etc. if (!adaptiveFilterInitialized) { adaptiveIntegratorTarget = 3.5f; previousUpdateTimeUs = currentTimeUs; @@ -96,7 +97,9 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { adaptiveFilterInitialized = 1; } + //Prepare time delta to normalize time factor of the integrator const float dT = US2S(currentTimeUs - previousUpdateTimeUs); + previousUpdateTimeUs = currentTimeUs; float combinedStd = 0.0f; From ac242b566a07e96d61705940248b9514f26e826c Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 4 Apr 2024 21:01:39 +0200 Subject: [PATCH 023/429] Basic approach to adaptive filter. --- src/main/flight/adaptive_filter.c | 55 +++++++++++++++++++++++++++---- src/main/flight/adaptive_filter.h | 3 ++ src/main/sensors/gyro.c | 4 +++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 3a453679af3..7501d0b5d3d 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -35,6 +35,7 @@ #include "common/filter.h" #include "build/debug.h" #include "fc/config.h" +#include "sensors/gyro.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; STATIC_FASTRAM uint8_t adaptiveFilterSampleIndex = 0; @@ -52,6 +53,12 @@ STATIC_FASTRAM float axisAttenuationFactor[XYZ_AXIS_COUNT]; STATIC_FASTRAM uint8_t adaptiveFilterInitialized = 0; STATIC_FASTRAM uint8_t hpfFilterInitialized = 0; +//Defines if current, min and max values for the filter were set and filter is ready to work +STATIC_FASTRAM uint8_t targetsSet = 0; +STATIC_FASTRAM float currentLpf; +STATIC_FASTRAM float minLpf; +STATIC_FASTRAM float maxLpf; + STATIC_FASTRAM float adaptiveFilterIntegrator; STATIC_FASTRAM float adaptiveIntegratorTarget; @@ -82,7 +89,24 @@ void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rat axisAttenuationFactor[index] = constrainf(axisAttenuationFactor[index], 0.0f, 1.0f); } +void adaptiveFilterResetIntegrator(void) { + adaptiveFilterIntegrator = 0.0f; +} + +void adaptiveFilterSetDefaultFrequency(int lpf, int min, int max) { + currentLpf = lpf; + minLpf = min; + maxLpf = max; + targetsSet = 1; +} + void adaptiveFilterTask(timeUs_t currentTimeUs) { + + //If we don't have current, min and max values for the filter, we can't run it yet + if (!targetsSet) { + return; + } + static timeUs_t previousUpdateTimeUs = 0; //Initialization procedure, filter setup etc. @@ -127,18 +151,37 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { combinedStd += std; - if (axis == 0) { - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, filteredStd * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, error * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, adjustedError * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, timeAdjustedError * 1000.0f); - } + // if (axis == 0) { + // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, filteredStd * 1000.0f); + // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, error * 1000.0f); + // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, adjustedError * 1000.0f); + // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, timeAdjustedError * 1000.0f); + // } } + //TODO filter gets updated only when ARMED + + if (adaptiveFilterIntegrator > ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD) { + //In this case there is too much noise, we need to lower the LPF frequency + currentLpf = constrainf(currentLpf - 1.0f, minLpf, maxLpf); + gyroUpdateDynamicLpf(currentLpf); + adaptiveFilterResetIntegrator(); + } else if (adaptiveFilterIntegrator < -ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD) { + //In this case there is too little noise, we can to increase the LPF frequency + currentLpf = constrainf(currentLpf + 1.0f, minLpf, maxLpf); + gyroUpdateDynamicLpf(currentLpf); + adaptiveFilterResetIntegrator(); + } + + // if (ARMING_FLAG(ARMED)) { + // // + // } + combinedStd /= XYZ_AXIS_COUNT; DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedStd * 1000.0f); DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, adaptiveFilterIntegrator); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, currentLpf); } diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 2885023bbd6..725f992a665 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -29,7 +29,10 @@ #define ADAPTIVE_FILTER_RATE_HZ 100 #define ADAPTIVE_FILTER_LPF_HZ 1 #define ADAPTIVE_FILTER_HPF_HZ 15 +#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD 20.0f void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rate, const uint8_t configRate); +void adaptiveFilterResetIntegrator(void); +void adaptiveFilterSetDefaultFrequency(int lpf, int min, int max); void adaptiveFilterTask(timeUs_t currentTimeUs); diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 5873c9d7950..0a9c8be96fd 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -264,6 +264,10 @@ static void gyroInitFilters(void) //Second gyro LPF runnig and PID frequency - this filter is dynamic when gyro_use_dyn_lpf = ON initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_type, gyroConfig()->gyro_main_lpf_hz, getLooptime()); +#ifdef USE_ADAPTIVE_FILTER + adaptiveFilterSetDefaultFrequency(gyroConfig()->gyro_main_lpf_hz, 50, 150); +#endif + #ifdef USE_GYRO_KALMAN if (gyroConfig()->kalmanEnabled) { gyroKalmanInitialize(gyroConfig()->kalman_q); From 63993ba7ff868ff5f2078c5e296ec7851790b9dd Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 4 Apr 2024 21:04:38 +0200 Subject: [PATCH 024/429] Compilation fix --- src/main/flight/pid.c | 4 +++- src/main/sensors/gyro.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index d1dbb75ce67..61a5083dfe0 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -1168,8 +1168,10 @@ void FAST_CODE pidController(float dT) // Limit desired rate to something gyro can measure reliably pidState[axis].rateTarget = constrainf(rateTarget, -GYRO_SATURATION_LIMIT, +GYRO_SATURATION_LIMIT); - + +#ifdef USE_ADAPTIVE_FILTER adaptiveFilterPushRate(axis, pidState[axis].rateTarget, currentControlRateProfile->stabilized.rates[axis]); +#endif #ifdef USE_GYRO_KALMAN gyroKalmanUpdateSetpoint(axis, pidState[axis].rateTarget); diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 0a9c8be96fd..c439f8659ee 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -458,7 +458,9 @@ void FAST_CODE NOINLINE gyroFilter(void) gyroADCf = gyroLpf2ApplyFn((filter_t *) &gyroLpf2State[axis], gyroADCf); +#ifdef USE_ADAPTIVE_FILTER adaptiveFilterPush(axis, gyroADCf); +#endif #ifdef USE_DYNAMIC_FILTERS if (dynamicGyroNotchState.enabled) { From 731f0608c46e2f218585d4226b8516456f40959c Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 7 Apr 2024 14:22:30 +0200 Subject: [PATCH 025/429] Run damping of FW with stick movements --- src/main/flight/pid.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 3da150e39dc..d6c8fe81f39 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -758,16 +758,19 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh { const float rateTarget = getFlightAxisRateOverride(axis, pidState->rateTarget); + const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; + const float dampingFactor = bellCurve(MIN(rateTarget, maxRate), maxRate); + const float rateError = rateTarget - pidState->gyroRate; - const float newPTerm = pTermProcess(pidState, rateError, dT); - const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv); + const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactor; + const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * dampingFactor; const float newFFTerm = rateTarget * pidState->kFF; /* * Integral should be updated only if axis Iterm is not frozen */ if (!pidState->itermFreezeActive) { - pidState->errorGyroIf += rateError * pidState->kI * dT; + pidState->errorGyroIf += rateError * pidState->kI * dT * dampingFactor; } applyItermLimiting(pidState); From 1f723837e96e37ea05e0aba99b983d91c1d87152 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 7 Apr 2024 20:28:45 +0200 Subject: [PATCH 026/429] Improve attenuation --- src/main/common/maths.c | 18 +++++++++++++++++- src/main/common/maths.h | 2 ++ src/main/flight/pid.c | 4 +++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/common/maths.c b/src/main/common/maths.c index 1bc61ae4c36..eed7b863bae 100644 --- a/src/main/common/maths.c +++ b/src/main/common/maths.c @@ -516,9 +516,25 @@ bool sensorCalibrationSolveForScale(sensorCalibrationState_t * state, float resu return sensorCalibrationValidateResult(result); } +float gaussian(const float x, const float mu, const float sigma) { + return exp(-pow(x - mu, 2) / (2 * pow(sigma, 2))); +} + float bellCurve(const float x, const float curveWidth) { - return powf(M_Ef, -sq(x) / (2.0f * sq(curveWidth))); + return gaussian(x, 0.0f, curveWidth); +} + +/** + * @brief Calculate the attenuation of a value using a Gaussian function. + * Retuns 1 for input 0 and ~0 for input width. + * @param input The input value. + * @param width The width of the Gaussian function. + * @return The attenuation of the input value. +*/ +float attenuation(const float input, const float width) { + const float sigma = width / 2.35482f; // Approximately width / sqrt(2 * ln(2)) + return gaussian(input, 0.0f, sigma); } float fast_fsqrtf(const float value) { diff --git a/src/main/common/maths.h b/src/main/common/maths.h index f3f2fd62746..ce96b7064fd 100644 --- a/src/main/common/maths.h +++ b/src/main/common/maths.h @@ -195,6 +195,8 @@ float acos_approx(float x); void arraySubInt32(int32_t *dest, int32_t *array1, int32_t *array2, int count); float bellCurve(const float x, const float curveWidth); +float attenuation(const float input, const float width); +float gaussian(const float x, const float mu, const float sigma); float fast_fsqrtf(const float value); float calc_length_pythagorean_2D(const float firstElement, const float secondElement); float calc_length_pythagorean_3D(const float firstElement, const float secondElement, const float thirdElement); diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index d6c8fe81f39..9e50522ae3f 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -759,7 +759,9 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh const float rateTarget = getFlightAxisRateOverride(axis, pidState->rateTarget); const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; - const float dampingFactor = bellCurve(MIN(rateTarget, maxRate), maxRate); + const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); + + DEBUG_SET(DEBUG_ALWAYS, axis, dampingFactor * 1000); const float rateError = rateTarget - pidState->gyroRate; const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactor; From 37bb8580db0f7cadf109bbeba079bd2999aa1556 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 7 Apr 2024 21:46:36 +0200 Subject: [PATCH 027/429] Fix compilation for SITL --- src/main/common/maths.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/common/maths.c b/src/main/common/maths.c index eed7b863bae..b8ec59c33a2 100644 --- a/src/main/common/maths.c +++ b/src/main/common/maths.c @@ -517,7 +517,7 @@ bool sensorCalibrationSolveForScale(sensorCalibrationState_t * state, float resu } float gaussian(const float x, const float mu, const float sigma) { - return exp(-pow(x - mu, 2) / (2 * pow(sigma, 2))); + return exp(-pow((double)(x - mu), 2) / (2 * pow((double)sigma, 2))); } float bellCurve(const float x, const float curveWidth) From 5f4dbb79138eab5c5c1f598c6ca338fb89dffe5c Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 7 Apr 2024 21:54:04 +0200 Subject: [PATCH 028/429] Drop no longer previous generation dampening solution --- src/main/fc/settings.yaml | 6 ------ src/main/flight/pid.c | 27 ++++----------------------- src/main/flight/pid.h | 1 - 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index cb586eacf06..a3b117d7a3b 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1934,12 +1934,6 @@ groups: field: fixedWingCoordinatedPitchGain min: 0 max: 2 - - name: fw_iterm_limit_stick_position - description: "Iterm is not allowed to grow when stick position is above threshold. This solves the problem of bounceback or followthrough when full stick deflection is applied on poorely tuned fixed wings. In other words, stabilization is partialy disabled when pilot is actively controlling the aircraft and active when sticks are not touched. `0` mean stick is in center position, `1` means it is fully deflected to either side" - default_value: 0.5 - field: fixedWingItermLimitOnStickPosition - min: 0 - max: 1 - name: fw_yaw_iterm_freeze_bank_angle description: "Yaw Iterm is frozen when bank angle is above this threshold [degrees]. This solves the problem of the rudder counteracting turns by partially disabling yaw stabilization when making banked turns. Setting to 0 (the default) disables this feature. Only applies when autopilot is not active and TURN ASSIST is disabled." default_value: 0 diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 9e50522ae3f..b92aec705f2 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -158,7 +158,6 @@ static EXTENDED_FASTRAM uint8_t usedPidControllerType; typedef void (*pidControllerFnPtr)(pidState_t *pidState, flight_dynamics_index_t axis, float dT, float dT_inv); static EXTENDED_FASTRAM pidControllerFnPtr pidControllerApplyFn; static EXTENDED_FASTRAM filterApplyFnPtr dTermLpfFilterApplyFn; -static EXTENDED_FASTRAM bool levelingEnabled = false; static EXTENDED_FASTRAM bool restartAngleHoldMode = true; static EXTENDED_FASTRAM bool angleHoldIsLevel = false; @@ -170,7 +169,7 @@ static EXTENDED_FASTRAM bool angleHoldIsLevel = false; static EXTENDED_FASTRAM float fixedWingLevelTrim; static EXTENDED_FASTRAM pidController_t fixedWingLevelTrimController; -PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 6); +PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 7); PG_RESET_TEMPLATE(pidProfile_t, pidProfile, .bank_mc = { @@ -271,7 +270,6 @@ PG_RESET_TEMPLATE(pidProfile_t, pidProfile, .fixedWingReferenceAirspeed = SETTING_FW_REFERENCE_AIRSPEED_DEFAULT, .fixedWingCoordinatedYawGain = SETTING_FW_TURN_ASSIST_YAW_GAIN_DEFAULT, .fixedWingCoordinatedPitchGain = SETTING_FW_TURN_ASSIST_PITCH_GAIN_DEFAULT, - .fixedWingItermLimitOnStickPosition = SETTING_FW_ITERM_LIMIT_STICK_POSITION_DEFAULT, .fixedWingYawItermBankFreeze = SETTING_FW_YAW_ITERM_FREEZE_BANK_ANGLE_DEFAULT, .navVelXyDTermLpfHz = SETTING_NAV_MC_VEL_XY_DTERM_LPF_HZ_DEFAULT, @@ -672,19 +670,6 @@ static void pidApplySetpointRateLimiting(pidState_t *pidState, flight_dynamics_i } } -bool isFixedWingItermLimitActive(float stickPosition) -{ - /* - * Iterm anti windup whould be active only when pilot controls the rotation - * velocity directly, not when ANGLE or HORIZON are used - */ - if (levelingEnabled) { - return false; - } - - return fabsf(stickPosition) > pidProfile()->fixedWingItermLimitOnStickPosition; -} - static float pTermProcess(pidState_t *pidState, float rateError, float dT) { float newPTerm = rateError * pidState->kP; @@ -1050,11 +1035,9 @@ static void pidApplyFpvCameraAngleMix(pidState_t *pidState, uint8_t fpvCameraAng void checkItermLimitingActive(pidState_t *pidState) { - bool shouldActivate; - if (usedPidControllerType == PID_TYPE_PIFF) { - shouldActivate = isFixedWingItermLimitActive(pidState->stickPosition); - } else - { + bool shouldActivate = false; + + if (usedPidControllerType == PID_TYPE_PID) { shouldActivate = mixerIsOutputSaturated(); //just in case, since it is already managed by itermWindupPointPercent } @@ -1184,7 +1167,6 @@ void FAST_CODE pidController(float dT) // Step 3: Run control for ANGLE_MODE, HORIZON_MODE and ANGLEHOLD_MODE const float horizonRateMagnitude = FLIGHT_MODE(HORIZON_MODE) ? calcHorizonRateMagnitude() : 0.0f; - levelingEnabled = false; angleHoldIsLevel = false; for (uint8_t axis = FD_ROLL; axis <= FD_PITCH; axis++) { @@ -1204,7 +1186,6 @@ void FAST_CODE pidController(float dT) // Apply the Level PID controller pidLevel(angleTarget, &pidState[axis], axis, horizonRateMagnitude, dT); canUseFpvCameraMix = false; // FPVANGLEMIX is incompatible with ANGLE/HORIZON - levelingEnabled = true; } else { restartAngleHoldMode = true; } diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index e0a8b9d310b..2e28848d3cc 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -123,7 +123,6 @@ typedef struct pidProfile_s { float fixedWingReferenceAirspeed; // Reference tuning airspeed for the airplane - the speed for which PID gains are tuned float fixedWingCoordinatedYawGain; // This is the gain of the yaw rate required to keep the yaw rate consistent with the turn rate for a coordinated turn. float fixedWingCoordinatedPitchGain; // This is the gain of the pitch rate to keep the pitch angle constant during coordinated turns. - float fixedWingItermLimitOnStickPosition; //Do not allow Iterm to grow when stick position is above this point uint16_t fixedWingYawItermBankFreeze; // Freeze yaw Iterm when bank angle is more than this many degrees float navVelXyDTermLpfHz; From 292db1f14c9bac72fbe7ac17963f6c2a4b21e36e Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 8 Apr 2024 15:39:33 +0200 Subject: [PATCH 029/429] Allo only gradual relaxation of the Axis factor --- src/main/flight/pid.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index b92aec705f2..19708b50f00 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -107,6 +107,8 @@ typedef struct { pt3Filter_t rateTargetFilter; smithPredictor_t smithPredictor; + + float dampingFactor; } pidState_t; STATIC_FASTRAM bool pidFiltersConfigured = false; @@ -746,7 +748,16 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); - DEBUG_SET(DEBUG_ALWAYS, axis, dampingFactor * 1000); + if (fabsf(dampingFactor) < fabsf(pidState->dampingFactor)) { + pidState->dampingFactor = dampingFactor; + } else { + pidState->dampingFactor = pidState->dampingFactor + (dampingFactor - pidState->dampingFactor) * dT * 10; + } + + float newDF = pidState->dampingFactor; + + DEBUG_SET(DEBUG_ALWAYS, axis * 2, dampingFactor * 1000); + DEBUG_SET(DEBUG_ALWAYS, (axis * 2) + 1, newDF * 1000); const float rateError = rateTarget - pidState->gyroRate; const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactor; @@ -1262,6 +1273,8 @@ void pidInit(void) for (uint8_t axis = FD_ROLL; axis <= FD_YAW; axis++) { + pidState[axis].dampingFactor = 1.0f; + #ifdef USE_D_BOOST // Rate * 10 * 10. First 10 is to convert stick to DPS. Second 10 is to convert target to acceleration. // We assume, max acceleration is when pilot deflects the stick fully in 100ms From cf10c071e072589527d072b5fa381b7e416bb148 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 8 Apr 2024 15:40:21 +0200 Subject: [PATCH 030/429] Docs update --- docs/Settings.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index b6fd431d950..c33efe6ef9d 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1292,16 +1292,6 @@ Fixed-wing rate stabilisation I-gain for YAW --- -### fw_iterm_limit_stick_position - -Iterm is not allowed to grow when stick position is above threshold. This solves the problem of bounceback or followthrough when full stick deflection is applied on poorely tuned fixed wings. In other words, stabilization is partialy disabled when pilot is actively controlling the aircraft and active when sticks are not touched. `0` mean stick is in center position, `1` means it is fully deflected to either side - -| Default | Min | Max | -| --- | --- | --- | -| 0.5 | 0 | 1 | - ---- - ### fw_level_pitch_gain I-gain for the pitch trim for self-leveling flight modes. Higher values means that AUTOTRIM will be faster but might introduce oscillations From c41abacd2a37fee7e0ef2af0aabcb4d818a96f5b Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 8 Apr 2024 19:53:11 +0200 Subject: [PATCH 031/429] Reset adaptive filter on disarm --- src/main/flight/adaptive_filter.c | 29 +++++++++++++++-------------- src/main/flight/adaptive_filter.h | 3 ++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 7501d0b5d3d..138203a6b0e 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -35,6 +35,7 @@ #include "common/filter.h" #include "build/debug.h" #include "fc/config.h" +#include "fc/runtime_config.h" #include "sensors/gyro.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; @@ -56,6 +57,7 @@ STATIC_FASTRAM uint8_t hpfFilterInitialized = 0; //Defines if current, min and max values for the filter were set and filter is ready to work STATIC_FASTRAM uint8_t targetsSet = 0; STATIC_FASTRAM float currentLpf; +STATIC_FASTRAM float initialLpf; STATIC_FASTRAM float minLpf; STATIC_FASTRAM float maxLpf; @@ -97,6 +99,8 @@ void adaptiveFilterSetDefaultFrequency(int lpf, int min, int max) { currentLpf = lpf; minLpf = min; maxLpf = max; + initialLpf = currentLpf; + targetsSet = 1; } @@ -121,6 +125,14 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { adaptiveFilterInitialized = 1; } + //If not armed, leave this routine but reset integrator and set default LPF + if (!ARMING_FLAG(ARMED)) { + currentLpf = initialLpf; + adaptiveFilterResetIntegrator(); + gyroUpdateDynamicLpf(currentLpf); + return; + } + //Prepare time delta to normalize time factor of the integrator const float dT = US2S(currentTimeUs - previousUpdateTimeUs); previousUpdateTimeUs = currentTimeUs; @@ -150,37 +162,26 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { adaptiveFilterIntegrator += timeAdjustedError; combinedStd += std; - - // if (axis == 0) { - // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, filteredStd * 1000.0f); - // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 3, error * 1000.0f); - // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 4, adjustedError * 1000.0f); - // DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 5, timeAdjustedError * 1000.0f); - // } } //TODO filter gets updated only when ARMED - if (adaptiveFilterIntegrator > ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD) { + if (adaptiveFilterIntegrator > ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH) { //In this case there is too much noise, we need to lower the LPF frequency currentLpf = constrainf(currentLpf - 1.0f, minLpf, maxLpf); gyroUpdateDynamicLpf(currentLpf); adaptiveFilterResetIntegrator(); - } else if (adaptiveFilterIntegrator < -ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD) { + } else if (adaptiveFilterIntegrator < ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW) { //In this case there is too little noise, we can to increase the LPF frequency currentLpf = constrainf(currentLpf + 1.0f, minLpf, maxLpf); gyroUpdateDynamicLpf(currentLpf); adaptiveFilterResetIntegrator(); } - // if (ARMING_FLAG(ARMED)) { - // // - // } - combinedStd /= XYZ_AXIS_COUNT; DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 0, combinedStd * 1000.0f); - DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, adaptiveFilterIntegrator); + DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 1, adaptiveFilterIntegrator * 10.0f); DEBUG_SET(DEBUG_ADAPTIVE_FILTER, 2, currentLpf); } diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 725f992a665..0a8696d90dd 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -29,7 +29,8 @@ #define ADAPTIVE_FILTER_RATE_HZ 100 #define ADAPTIVE_FILTER_LPF_HZ 1 #define ADAPTIVE_FILTER_HPF_HZ 15 -#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD 20.0f +#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH 5.0f +#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW -2.0f void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rate, const uint8_t configRate); From 6fd60772510f2351ca667d138b506e470bdb0119 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 8 Apr 2024 20:03:57 +0200 Subject: [PATCH 032/429] Run the filter only if throttle is raised --- src/main/flight/adaptive_filter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index 138203a6b0e..e94df2d19fe 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -36,6 +36,7 @@ #include "build/debug.h" #include "fc/config.h" #include "fc/runtime_config.h" +#include "fc/rc_controls.h" #include "sensors/gyro.h" STATIC_FASTRAM float32_t adaptiveFilterSamples[XYZ_AXIS_COUNT][ADAPTIVE_FILTER_BUFFER_SIZE]; @@ -133,6 +134,11 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { return; } + //Do not run adaptive filter when throttle is low + if (rcCommand[THROTTLE] < 1200) { + return; + } + //Prepare time delta to normalize time factor of the integrator const float dT = US2S(currentTimeUs - previousUpdateTimeUs); previousUpdateTimeUs = currentTimeUs; From 3005c69f8f99616f3822056baebfa9f6cae980a8 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 9 Apr 2024 10:30:36 +0200 Subject: [PATCH 033/429] Some progress --- src/main/flight/pid.c | 50 ++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 19708b50f00..50c67c86074 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -108,7 +108,10 @@ typedef struct { smithPredictor_t smithPredictor; - float dampingFactor; + float dampingFactorPrevious; + float dampingFactorLockValue; + float dampingFactotLockUntilMs; + pt1Filter_t dampingFactorFilter; } pidState_t; STATIC_FASTRAM bool pidFiltersConfigured = false; @@ -322,6 +325,7 @@ bool pidInitFilters(void) for (int i = 0; i < XYZ_AXIS_COUNT; i++) { pt1FilterInit(&windupLpf[i], pidProfile()->iterm_relax_cutoff, US2S(refreshRate)); + pt1FilterInit(&pidState[i].dampingFactorFilter, 2.0f, US2S(refreshRate)); } #ifdef USE_ANTIGRAVITY @@ -748,27 +752,49 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); - if (fabsf(dampingFactor) < fabsf(pidState->dampingFactor)) { - pidState->dampingFactor = dampingFactor; + float dampingFactorP; + float dampingFactorD; + float dampingFactorI; + + if (fabsf(dampingFactor) <= fabsf(pidState->dampingFactorPrevious)) { + dampingFactorP = dampingFactor; + dampingFactorD = dampingFactor; + dampingFactorI = dampingFactor; + + pidState->dampingFactotLockUntilMs = millis() + scaleRangef(fabsf(dampingFactor), 1.0f, 0.0f, 0, 300); + pidState->dampingFactorLockValue = dampingFactor; + + // pt1FilterReset(&pidState->dampingFactorFilter, pidState->dampingFactorPrevious); + pidState->dampingFactorPrevious = dampingFactor; } else { - pidState->dampingFactor = pidState->dampingFactor + (dampingFactor - pidState->dampingFactor) * dT * 10; + dampingFactorP = dampingFactor; + dampingFactorD = dampingFactor; + + if (millis() > pidState->dampingFactorLockValue) { + dampingFactorI = dampingFactor; + pidState->dampingFactorPrevious = dampingFactor; + } else { + dampingFactorI = pidState->dampingFactorLockValue; + } } - float newDF = pidState->dampingFactor; - - DEBUG_SET(DEBUG_ALWAYS, axis * 2, dampingFactor * 1000); - DEBUG_SET(DEBUG_ALWAYS, (axis * 2) + 1, newDF * 1000); + if (axis == FD_ROLL) { + DEBUG_SET(DEBUG_ALWAYS, 0, pidState->dampingFactorPrevious * 1000); + DEBUG_SET(DEBUG_ALWAYS, 1, dampingFactorP * 1000); + DEBUG_SET(DEBUG_ALWAYS, 2, dampingFactorI * 1000); + DEBUG_SET(DEBUG_ALWAYS, 3, dampingFactorD * 1000); + } const float rateError = rateTarget - pidState->gyroRate; - const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactor; - const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * dampingFactor; + const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactorP; + const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * dampingFactorD; const float newFFTerm = rateTarget * pidState->kFF; /* * Integral should be updated only if axis Iterm is not frozen */ if (!pidState->itermFreezeActive) { - pidState->errorGyroIf += rateError * pidState->kI * dT * dampingFactor; + pidState->errorGyroIf += rateError * pidState->kI * dT * dampingFactorI; } applyItermLimiting(pidState); @@ -1273,7 +1299,7 @@ void pidInit(void) for (uint8_t axis = FD_ROLL; axis <= FD_YAW; axis++) { - pidState[axis].dampingFactor = 1.0f; + pidState[axis].dampingFactorPrevious = 1.0f; #ifdef USE_D_BOOST // Rate * 10 * 10. First 10 is to convert stick to DPS. Second 10 is to convert target to acceleration. From bff23ee0e5b23110a8225535478177ed9824f88e Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 9 Apr 2024 13:53:25 +0200 Subject: [PATCH 034/429] Some updates --- src/main/flight/pid.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 50c67c86074..90a31a4aa16 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -756,9 +756,16 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh float dampingFactorD; float dampingFactorI; + /* + TODO conditions have to be reworked + when drowing, damp + when releasing, lock + locking procedure has to be separated from action + + + */ + if (fabsf(dampingFactor) <= fabsf(pidState->dampingFactorPrevious)) { - dampingFactorP = dampingFactor; - dampingFactorD = dampingFactor; dampingFactorI = dampingFactor; pidState->dampingFactotLockUntilMs = millis() + scaleRangef(fabsf(dampingFactor), 1.0f, 0.0f, 0, 300); @@ -767,9 +774,7 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh // pt1FilterReset(&pidState->dampingFactorFilter, pidState->dampingFactorPrevious); pidState->dampingFactorPrevious = dampingFactor; } else { - dampingFactorP = dampingFactor; - dampingFactorD = dampingFactor; - + if (millis() > pidState->dampingFactorLockValue) { dampingFactorI = dampingFactor; pidState->dampingFactorPrevious = dampingFactor; @@ -778,6 +783,10 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh } } + //P & D damping factors are always the same and based on current damping factor + dampingFactorP = dampingFactor; + dampingFactorD = dampingFactor; + if (axis == FD_ROLL) { DEBUG_SET(DEBUG_ALWAYS, 0, pidState->dampingFactorPrevious * 1000); DEBUG_SET(DEBUG_ALWAYS, 1, dampingFactorP * 1000); From aef3fbe3b966696cdd3fe5555d35dfce99749a71 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 9 Apr 2024 18:42:20 +0200 Subject: [PATCH 035/429] New conditions for Iterm dampener --- src/main/flight/pid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 90a31a4aa16..436e4b17471 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -757,12 +757,12 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh float dampingFactorI; /* - TODO conditions have to be reworked - when drowing, damp - when releasing, lock - locking procedure has to be separated from action - + New idea.... + Iterm damping is applied (down to 0) when: + abs(error) > 10% rate and sticks were moved in the last 500ms (hard stop at this mark) + itermAttenuation = MIN(curve(setpoint), (abs(error) > 10%) && (sticks were deflected in 500ms) ? 0 : 1) + */ if (fabsf(dampingFactor) <= fabsf(pidState->dampingFactorPrevious)) { From 3eece0a3773e5dc27dfe454f6199cc5ec541d41d Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 10 Apr 2024 12:39:32 +0200 Subject: [PATCH 036/429] Commit switch to longer buffer --- src/main/flight/adaptive_filter.c | 3 --- src/main/flight/adaptive_filter.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index e94df2d19fe..a8e3dec0293 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -157,11 +157,8 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { arm_std_f32(tempBuffer, ADAPTIVE_FILTER_BUFFER_SIZE, &std); const float filteredStd = pt1FilterApply(&stdFilter[axis], std); - const float error = filteredStd - adaptiveIntegratorTarget; - const float adjustedError = error * axisAttenuationFactor[axis]; - const float timeAdjustedError = adjustedError * dT; //Put into integrator diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 0a8696d90dd..76117850d3e 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -25,7 +25,7 @@ #include "common/axis.h" #include "common/time.h" -#define ADAPTIVE_FILTER_BUFFER_SIZE 32 +#define ADAPTIVE_FILTER_BUFFER_SIZE 64 #define ADAPTIVE_FILTER_RATE_HZ 100 #define ADAPTIVE_FILTER_LPF_HZ 1 #define ADAPTIVE_FILTER_HPF_HZ 15 From 9ac3b540a1eabdb83ef6a4af2103667f9b898614 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 11 Apr 2024 11:59:06 +0200 Subject: [PATCH 037/429] Make the filter configurable --- src/main/fc/config.c | 10 ++++++ src/main/fc/settings.yaml | 55 +++++++++++++++++++++++++++++++ src/main/flight/adaptive_filter.c | 10 +++--- src/main/flight/adaptive_filter.h | 4 --- src/main/sensors/gyro.c | 16 +++++++-- src/main/sensors/gyro.h | 10 ++++++ 6 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index c9a50c60a25..c403b0cfefd 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -190,6 +190,16 @@ uint32_t getGyroLooptime(void) void validateAndFixConfig(void) { + + // gyroConfig()->adaptiveFilterMinHz has to be at least 5 units lower than gyroConfig()->gyro_main_lpf_hz + if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { + gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; + } + //gyroConfig()->adaptiveFilterMaxHz has to be at least 5 units higher than gyroConfig()->gyro_main_lpf_hz + if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { + gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; + } + if (accelerometerConfig()->acc_notch_cutoff >= accelerometerConfig()->acc_notch_hz) { accelerometerConfigMutable()->acc_notch_hz = 0; } diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 9fd6c10e860..4196a7cefc3 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -330,6 +330,61 @@ groups: field: gravity_cmss_cal min: 0 max: 2000 + - name: gyro_adaptive_filter + description: "Enable adaptive filter for gyro data" + default_value: OFF + field: adaptiveFilterEnabled + type: bool + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_target + description: "Target value for adaptive filter" + default_value: 3.5 + field: adaptiveFilterTarget + min: 2 + max: 6 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_min_hz + description: "Minimum frequency for adaptive filter" + default_value: 50 + field: adaptiveFilterMinHz + min: 30 + max: 250 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_max_hz + description: "Maximum frequency for adaptive filter" + default_value: 150 + field: adaptiveFilterMaxHz + min: 100 + max: 500 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_std_lpf_hz + description: "Standard deviation low pass filter cutoff frequency" + default_value: 1 + field: adaptiveFilterStdLpfHz + min: 0 + max: 5 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_hpf_hz + description: "High pass filter cutoff frequency" + default_value: 15 + field: adaptiveFilterHpfHz + min: 1 + max: 50 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_integrator_threshold_high + description: "High threshold for adaptive filter integrator" + default_value: 5 + field: adaptiveFilterIntegratorThresholdHigh + min: 1 + max: 10 + condition: USE_ADAPTIVE_FILTER + - name: gyro_adaptive_filter_integrator_threshold_low + description: "Low threshold for adaptive filter integrator" + default_value: -2 + field: adaptiveFilterIntegratorThresholdLow + min: -10 + max: 0 + condition: USE_ADAPTIVE_FILTER - name: PG_ADC_CHANNEL_CONFIG type: adcChannelConfig_t diff --git a/src/main/flight/adaptive_filter.c b/src/main/flight/adaptive_filter.c index a8e3dec0293..4770e9763ab 100644 --- a/src/main/flight/adaptive_filter.c +++ b/src/main/flight/adaptive_filter.c @@ -73,7 +73,7 @@ void adaptiveFilterPush(const flight_dynamics_index_t index, const float value) if (!hpfFilterInitialized) { //Initialize the filter for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { - pt1FilterInit(&hpfFilter[axis], ADAPTIVE_FILTER_HPF_HZ, US2S(getLooptime())); + pt1FilterInit(&hpfFilter[axis], gyroConfig()->adaptiveFilterHpfHz, US2S(getLooptime())); } hpfFilterInitialized = 1; } @@ -121,7 +121,7 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { //Initialize the filter for (flight_dynamics_index_t axis = 0; axis < XYZ_AXIS_COUNT; axis++) { - pt1FilterInit(&stdFilter[axis], ADAPTIVE_FILTER_LPF_HZ, 1.0f / ADAPTIVE_FILTER_RATE_HZ); + pt1FilterInit(&stdFilter[axis], gyroConfig()->adaptiveFilterStdLpfHz, 1.0f / ADAPTIVE_FILTER_RATE_HZ); } adaptiveFilterInitialized = 1; } @@ -167,14 +167,12 @@ void adaptiveFilterTask(timeUs_t currentTimeUs) { combinedStd += std; } - //TODO filter gets updated only when ARMED - - if (adaptiveFilterIntegrator > ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH) { + if (adaptiveFilterIntegrator > gyroConfig()->adaptiveFilterIntegratorThresholdHigh) { //In this case there is too much noise, we need to lower the LPF frequency currentLpf = constrainf(currentLpf - 1.0f, minLpf, maxLpf); gyroUpdateDynamicLpf(currentLpf); adaptiveFilterResetIntegrator(); - } else if (adaptiveFilterIntegrator < ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW) { + } else if (adaptiveFilterIntegrator < gyroConfig()->adaptiveFilterIntegratorThresholdLow) { //In this case there is too little noise, we can to increase the LPF frequency currentLpf = constrainf(currentLpf + 1.0f, minLpf, maxLpf); gyroUpdateDynamicLpf(currentLpf); diff --git a/src/main/flight/adaptive_filter.h b/src/main/flight/adaptive_filter.h index 76117850d3e..c8696a91f8a 100644 --- a/src/main/flight/adaptive_filter.h +++ b/src/main/flight/adaptive_filter.h @@ -27,10 +27,6 @@ #define ADAPTIVE_FILTER_BUFFER_SIZE 64 #define ADAPTIVE_FILTER_RATE_HZ 100 -#define ADAPTIVE_FILTER_LPF_HZ 1 -#define ADAPTIVE_FILTER_HPF_HZ 15 -#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH 5.0f -#define ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW -2.0f void adaptiveFilterPush(const flight_dynamics_index_t index, const float value); void adaptiveFilterPushRate(const flight_dynamics_index_t index, const float rate, const uint8_t configRate); diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 8585d3a0522..fd2036ef9a2 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -96,7 +96,7 @@ EXTENDED_FASTRAM secondaryDynamicGyroNotchState_t secondaryDynamicGyroNotchState #endif -PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 8); +PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 9); PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_anti_aliasing_lpf_hz = SETTING_GYRO_ANTI_ALIASING_LPF_HZ_DEFAULT, @@ -123,6 +123,16 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .init_gyro_cal_enabled = SETTING_INIT_GYRO_CAL_DEFAULT, .gyro_zero_cal = {SETTING_GYRO_ZERO_X_DEFAULT, SETTING_GYRO_ZERO_Y_DEFAULT, SETTING_GYRO_ZERO_Z_DEFAULT}, .gravity_cmss_cal = SETTING_INS_GRAVITY_CMSS_DEFAULT, +#ifdef USE_ADAPTIVE_FILTER + .adaptiveFilterEnabled = SETTING_GYRO_ADAPTIVE_FILTER_DEFAULT, + .adaptiveFilterTarget = SETTING_GYRO_ADAPTIVE_FILTER_TARGET_DEFAULT, + .adaptiveFilterMinHz = SETTING_GYRO_ADAPTIVE_FILTER_MIN_HZ_DEFAULT, + .adaptiveFilterMaxHz = SETTING_GYRO_ADAPTIVE_FILTER_MAX_HZ_DEFAULT, + .adaptiveFilterStdLpfHz = SETTING_GYRO_ADAPTIVE_FILTER_STD_LPF_HZ_DEFAULT, + .adaptiveFilterHpfHz = SETTING_GYRO_ADAPTIVE_FILTER_HPF_HZ_DEFAULT, + .adaptiveFilterIntegratorThresholdHigh = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH_DEFAULT, + .adaptiveFilterIntegratorThresholdLow = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW_DEFAULT, +#endif ); STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHardware) @@ -251,7 +261,9 @@ static void gyroInitFilters(void) initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime()); #ifdef USE_ADAPTIVE_FILTER - adaptiveFilterSetDefaultFrequency(gyroConfig()->gyro_main_lpf_hz, 50, 150); + if (gyroConfig()->adaptiveFilterEnabled) { + adaptiveFilterSetDefaultFrequency(gyroConfig()->gyro_main_lpf_hz, gyroConfig()->adaptiveFilterMinHz, gyroConfig()->adaptiveFilterMaxHz); + } #endif #ifdef USE_GYRO_KALMAN diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 2ea70c589da..75ff7983372 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -87,6 +87,16 @@ typedef struct gyroConfig_s { bool init_gyro_cal_enabled; int16_t gyro_zero_cal[XYZ_AXIS_COUNT]; float gravity_cmss_cal; +#ifdef USE_ADAPTIVE_FILTER + uint8_t adaptiveFilterEnabled; + float adaptiveFilterTarget; + uint16_t adaptiveFilterMinHz; + uint16_t adaptiveFilterMaxHz; + float adaptiveFilterStdLpfHz; + float adaptiveFilterHpfHz; + float adaptiveFilterIntegratorThresholdHigh; + float adaptiveFilterIntegratorThresholdLow; +#endif } gyroConfig_t; PG_DECLARE(gyroConfig_t, gyroConfig); From 8c8840f432f730f9985812ef528bd4ccd4c3d7c3 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 11 Apr 2024 15:05:09 +0200 Subject: [PATCH 038/429] Update defaults --- src/main/fc/settings.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 4196a7cefc3..a495e691cbc 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -340,7 +340,7 @@ groups: description: "Target value for adaptive filter" default_value: 3.5 field: adaptiveFilterTarget - min: 2 + min: 1 max: 6 condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_min_hz @@ -359,21 +359,21 @@ groups: condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_std_lpf_hz description: "Standard deviation low pass filter cutoff frequency" - default_value: 1 + default_value: 2 field: adaptiveFilterStdLpfHz min: 0 - max: 5 + max: 10 condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_hpf_hz description: "High pass filter cutoff frequency" - default_value: 15 + default_value: 10 field: adaptiveFilterHpfHz min: 1 max: 50 condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_integrator_threshold_high description: "High threshold for adaptive filter integrator" - default_value: 5 + default_value: 4 field: adaptiveFilterIntegratorThresholdHigh min: 1 max: 10 From 02d4a52d5da9329b005e62f1445716c80e14e755 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 15 Apr 2024 11:44:25 +0200 Subject: [PATCH 039/429] Enable adaptive filter for all targets --- src/main/target/common.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/target/common.h b/src/main/target/common.h index 09f1b71e7e2..a6da8c5a1d3 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -211,9 +211,4 @@ #endif #define USE_EZ_TUNE - -#ifdef STM32H7 - #define USE_ADAPTIVE_FILTER - -#endif From d27f3fdaa0e5b9f676a7f4e94a1c90e659e43703 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 17 Apr 2024 15:18:09 +0200 Subject: [PATCH 040/429] Updated Iterm locking mechanism --- src/main/flight/pid.c | 61 ++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index ae51385cf11..941e08a1a2e 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -107,10 +107,8 @@ typedef struct { smithPredictor_t smithPredictor; - float dampingFactorPrevious; - float dampingFactorLockValue; - float dampingFactotLockUntilMs; - pt1Filter_t dampingFactorFilter; + timeMs_t targetOverThresholdTimeMs; + } pidState_t; STATIC_FASTRAM bool pidFiltersConfigured = false; @@ -322,7 +320,6 @@ bool pidInitFilters(void) for (int i = 0; i < XYZ_AXIS_COUNT; i++) { pt1FilterInit(&windupLpf[i], pidProfile()->iterm_relax_cutoff, US2S(refreshRate)); - pt1FilterInit(&pidState[i].dampingFactorFilter, 2.0f, US2S(refreshRate)); } #ifdef USE_ANTIGRAVITY @@ -745,53 +742,43 @@ static void nullRateController(pidState_t *pidState, flight_dynamics_index_t axi static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, flight_dynamics_index_t axis, float dT, float dT_inv) { const float rateTarget = getFlightAxisRateOverride(axis, pidState->rateTarget); + const float rateError = rateTarget - pidState->gyroRate; const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); - float dampingFactorP; - float dampingFactorD; - float dampingFactorI; - /* - New idea.... - Iterm damping is applied (down to 0) when: - abs(error) > 10% rate and sticks were moved in the last 500ms (hard stop at this mark) + * Iterm damping is applied (down to 0) when: + * abs(error) > 10% rate and sticks were moved in the last 500ms (hard stop at this mark) - itermAttenuation = MIN(curve(setpoint), (abs(error) > 10%) && (sticks were deflected in 500ms) ? 0 : 1) - - */ + * itermAttenuation = MIN(curve(setpoint), (abs(error) > 10%) && (sticks were deflected in 500ms) ? 0 : 1) + */ - if (fabsf(dampingFactor) <= fabsf(pidState->dampingFactorPrevious)) { - dampingFactorI = dampingFactor; + //If error is greater than 10% or max rate + const bool errorThresholdReached = fabsf(rateError) > maxRate * 0.1f; - pidState->dampingFactotLockUntilMs = millis() + scaleRangef(fabsf(dampingFactor), 1.0f, 0.0f, 0, 300); - pidState->dampingFactorLockValue = dampingFactor; + //If stick (setpoint) was moved above threshold in the last 500ms + if (fabsf(rateTarget) > maxRate * 0.2f) { + pidState->targetOverThresholdTimeMs = millis(); + } - // pt1FilterReset(&pidState->dampingFactorFilter, pidState->dampingFactorPrevious); - pidState->dampingFactorPrevious = dampingFactor; - } else { - - if (millis() > pidState->dampingFactorLockValue) { - dampingFactorI = dampingFactor; - pidState->dampingFactorPrevious = dampingFactor; - } else { - dampingFactorI = pidState->dampingFactorLockValue; - } + //If error is below threshold, we no longer track time for lock mechanism + if (!errorThresholdReached) { + pidState->targetOverThresholdTimeMs = 0; } + const float dampingFactorI = MIN(dampingFactor, (errorThresholdReached && (millis() - pidState->targetOverThresholdTimeMs) < 500) ? 0.0f : 1.0f); + //P & D damping factors are always the same and based on current damping factor - dampingFactorP = dampingFactor; - dampingFactorD = dampingFactor; + const float dampingFactorP = dampingFactor; + const float dampingFactorD = dampingFactor; if (axis == FD_ROLL) { - DEBUG_SET(DEBUG_ALWAYS, 0, pidState->dampingFactorPrevious * 1000); - DEBUG_SET(DEBUG_ALWAYS, 1, dampingFactorP * 1000); - DEBUG_SET(DEBUG_ALWAYS, 2, dampingFactorI * 1000); - DEBUG_SET(DEBUG_ALWAYS, 3, dampingFactorD * 1000); + DEBUG_SET(DEBUG_ALWAYS, 0, dampingFactorP * 1000); + DEBUG_SET(DEBUG_ALWAYS, 1, dampingFactorI * 1000); + DEBUG_SET(DEBUG_ALWAYS, 2, dampingFactorD * 1000); } - const float rateError = rateTarget - pidState->gyroRate; const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactorP; const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * dampingFactorD; const float newFFTerm = rateTarget * pidState->kFF; @@ -1309,8 +1296,6 @@ void pidInit(void) for (uint8_t axis = FD_ROLL; axis <= FD_YAW; axis++) { - pidState[axis].dampingFactorPrevious = 1.0f; - #ifdef USE_D_BOOST // Rate * 10 * 10. First 10 is to convert stick to DPS. Second 10 is to convert target to acceleration. // We assume, max acceleration is when pilot deflects the stick fully in 100ms From b810f99b310e6bae1840d1068eb954cab7fac101 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 17 Apr 2024 16:45:40 +0200 Subject: [PATCH 041/429] Refactor to contain logic in a single function --- src/main/flight/pid.c | 51 ++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 941e08a1a2e..805450ca3e6 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -65,6 +65,14 @@ #include "programming/logic_condition.h" +typedef struct { + float aP; + float aI; + float aD; + float aFF; + timeMs_t targetOverThresholdTimeMs; +} fwPidAttenuation_t; + typedef struct { uint8_t axis; float kP; // Proportional gain @@ -107,8 +115,7 @@ typedef struct { smithPredictor_t smithPredictor; - timeMs_t targetOverThresholdTimeMs; - + fwPidAttenuation_t attenuation; } pidState_t; STATIC_FASTRAM bool pidFiltersConfigured = false; @@ -739,12 +746,8 @@ static void nullRateController(pidState_t *pidState, flight_dynamics_index_t axi UNUSED(dT_inv); } -static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, flight_dynamics_index_t axis, float dT, float dT_inv) -{ - const float rateTarget = getFlightAxisRateOverride(axis, pidState->rateTarget); - const float rateError = rateTarget - pidState->gyroRate; - - const float maxRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f; +static void fwRateAttenuation(pidState_t *pidState, const float rateTarget, const float rateError) { + const float maxRate = currentControlRateProfile->stabilized.rates[pidState->axis] * 10.0f; const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); /* @@ -759,35 +762,43 @@ static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, fligh //If stick (setpoint) was moved above threshold in the last 500ms if (fabsf(rateTarget) > maxRate * 0.2f) { - pidState->targetOverThresholdTimeMs = millis(); + pidState->attenuation.targetOverThresholdTimeMs = millis(); } //If error is below threshold, we no longer track time for lock mechanism if (!errorThresholdReached) { - pidState->targetOverThresholdTimeMs = 0; + pidState->attenuation.targetOverThresholdTimeMs = 0; } - const float dampingFactorI = MIN(dampingFactor, (errorThresholdReached && (millis() - pidState->targetOverThresholdTimeMs) < 500) ? 0.0f : 1.0f); + pidState->attenuation.aI = MIN(dampingFactor, (errorThresholdReached && (millis() - pidState->attenuation.targetOverThresholdTimeMs) < 500) ? 0.0f : 1.0f); //P & D damping factors are always the same and based on current damping factor - const float dampingFactorP = dampingFactor; - const float dampingFactorD = dampingFactor; + pidState->attenuation.aP = dampingFactor; + pidState->attenuation.aD = dampingFactor; - if (axis == FD_ROLL) { - DEBUG_SET(DEBUG_ALWAYS, 0, dampingFactorP * 1000); - DEBUG_SET(DEBUG_ALWAYS, 1, dampingFactorI * 1000); - DEBUG_SET(DEBUG_ALWAYS, 2, dampingFactorD * 1000); + if (pidState->axis == FD_ROLL) { + DEBUG_SET(DEBUG_ALWAYS, 0, pidState->attenuation.aP * 1000); + DEBUG_SET(DEBUG_ALWAYS, 1, pidState->attenuation.aI * 1000); + DEBUG_SET(DEBUG_ALWAYS, 2, pidState->attenuation.aD * 1000); } +} + +static void NOINLINE pidApplyFixedWingRateController(pidState_t *pidState, flight_dynamics_index_t axis, float dT, float dT_inv) +{ + const float rateTarget = getFlightAxisRateOverride(axis, pidState->rateTarget); + const float rateError = rateTarget - pidState->gyroRate; + + fwRateAttenuation(pidState, rateTarget, rateError); - const float newPTerm = pTermProcess(pidState, rateError, dT) * dampingFactorP; - const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * dampingFactorD; + const float newPTerm = pTermProcess(pidState, rateError, dT) * pidState->attenuation.aP; + const float newDTerm = dTermProcess(pidState, rateTarget, dT, dT_inv) * pidState->attenuation.aD; const float newFFTerm = rateTarget * pidState->kFF; /* * Integral should be updated only if axis Iterm is not frozen */ if (!pidState->itermFreezeActive) { - pidState->errorGyroIf += rateError * pidState->kI * dT * dampingFactorI; + pidState->errorGyroIf += rateError * pidState->kI * dT * pidState->attenuation.aI; } applyItermLimiting(pidState); From 14755bdd566014bcff0786b0e8f75cea9f0241ed Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 29 Apr 2024 19:48:50 +0200 Subject: [PATCH 042/429] Unify the gyro filter settings --- docs/Settings.md | 88 +++++++++++++++++++++++++++++++---- src/main/fc/settings.yaml | 19 ++++---- src/main/flight/dynamic_lpf.c | 2 +- src/main/flight/ez_tune.c | 2 +- src/main/sensors/gyro.c | 7 ++- src/main/sensors/gyro.h | 9 +++- 6 files changed, 99 insertions(+), 28 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 7ed9437ced1..3c6037fc31c 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1562,6 +1562,76 @@ For developer ground test use. Disables motors, sets heading status = Trusted on --- +### gyro_adaptive_filter_hpf_hz + +High pass filter cutoff frequency + +| Default | Min | Max | +| --- | --- | --- | +| 10 | 1 | 50 | + +--- + +### gyro_adaptive_filter_integrator_threshold_high + +High threshold for adaptive filter integrator + +| Default | Min | Max | +| --- | --- | --- | +| 4 | 1 | 10 | + +--- + +### gyro_adaptive_filter_integrator_threshold_low + +Low threshold for adaptive filter integrator + +| Default | Min | Max | +| --- | --- | --- | +| -2 | -10 | 0 | + +--- + +### gyro_adaptive_filter_max_hz + +Maximum frequency for adaptive filter + +| Default | Min | Max | +| --- | --- | --- | +| 150 | 100 | 500 | + +--- + +### gyro_adaptive_filter_min_hz + +Minimum frequency for adaptive filter + +| Default | Min | Max | +| --- | --- | --- | +| 50 | 30 | 250 | + +--- + +### gyro_adaptive_filter_std_lpf_hz + +Standard deviation low pass filter cutoff frequency + +| Default | Min | Max | +| --- | --- | --- | +| 2 | 0 | 10 | + +--- + +### gyro_adaptive_filter_target + +Target value for adaptive filter + +| Default | Min | Max | +| --- | --- | --- | +| 3.5 | 1 | 6 | + +--- + ### gyro_anti_aliasing_lpf_hz Gyro processing anti-aliasing filter cutoff frequency. In normal operation this filter setting should never be changed. In Hz @@ -1602,33 +1672,33 @@ Minimum frequency of the gyro Dynamic LPF --- -### gyro_main_lpf_hz +### gyro_filter_mode -Software based gyro main lowpass filter. Value is cutoff frequency (Hz) +Specifies the type of the software LPF of the gyro signals. | Default | Min | Max | | --- | --- | --- | -| 60 | 0 | 500 | +| STATIC | | | --- -### gyro_to_use +### gyro_main_lpf_hz -On multi-gyro targets, allows to choose which gyro to use. 0 = first gyro, 1 = second gyro +Software based gyro main lowpass filter. Value is cutoff frequency (Hz) | Default | Min | Max | | --- | --- | --- | -| 0 | 0 | 2 | +| 60 | 0 | 500 | --- -### gyro_use_dyn_lpf +### gyro_to_use -Use Dynamic LPF instead of static gyro stage1 LPF. Dynamic Gyro LPF updates gyro LPF based on the throttle position. +On multi-gyro targets, allows to choose which gyro to use. 0 = first gyro, 1 = second gyro | Default | Min | Max | | --- | --- | --- | -| OFF | OFF | ON | +| 0 | 0 | 2 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 40ca93c829d..f5e8df233e3 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -191,6 +191,9 @@ tables: - name: led_pin_pwm_mode values: ["SHARED_LOW", "SHARED_HIGH", "LOW", "HIGH"] enum: led_pin_pwm_mode_e + - name: gyro_filter_mode + values: ["STATIC", "DYNAMIC", "ADAPTIVE"] + enum: gyroFilterType_e constants: RPYL_PID_MIN: 0 @@ -226,11 +229,11 @@ groups: field: gyro_main_lpf_hz min: 0 max: 500 - - name: gyro_use_dyn_lpf - description: "Use Dynamic LPF instead of static gyro stage1 LPF. Dynamic Gyro LPF updates gyro LPF based on the throttle position." - default_value: OFF - field: useDynamicLpf - type: bool + - name: gyro_filter_mode + description: "Specifies the type of the software LPF of the gyro signals." + default_value: "STATIC" + field: gyroFilterMode + table: gyro_filter_mode - name: gyro_dyn_lpf_min_hz description: "Minimum frequency of the gyro Dynamic LPF" default_value: 200 @@ -330,12 +333,6 @@ groups: field: gravity_cmss_cal min: 0 max: 2000 - - name: gyro_adaptive_filter - description: "Enable adaptive filter for gyro data" - default_value: OFF - field: adaptiveFilterEnabled - type: bool - condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_target description: "Target value for adaptive filter" default_value: 3.5 diff --git a/src/main/flight/dynamic_lpf.c b/src/main/flight/dynamic_lpf.c index 0e5b4f6ef28..31e594312ab 100644 --- a/src/main/flight/dynamic_lpf.c +++ b/src/main/flight/dynamic_lpf.c @@ -37,7 +37,7 @@ static float dynLpfCutoffFreq(float throttle, uint16_t dynLpfMin, uint16_t dynLp void dynamicLpfGyroTask(void) { - if (!gyroConfig()->useDynamicLpf) { + if (!gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_DYNAMIC) { return; } diff --git a/src/main/flight/ez_tune.c b/src/main/flight/ez_tune.c index 4bde5b645e8..e67e3fe9b47 100644 --- a/src/main/flight/ez_tune.c +++ b/src/main/flight/ez_tune.c @@ -109,7 +109,7 @@ void ezTuneUpdate(void) { #endif //Disable dynamic LPF - gyroConfigMutable()->useDynamicLpf = 0; + gyroConfigMutable()->gyroFilterMode = GYRO_FILTER_MODE_STATIC; //Setup PID controller diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index fd2036ef9a2..7f7d1d171d9 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -96,7 +96,7 @@ EXTENDED_FASTRAM secondaryDynamicGyroNotchState_t secondaryDynamicGyroNotchState #endif -PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 9); +PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 10); PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_anti_aliasing_lpf_hz = SETTING_GYRO_ANTI_ALIASING_LPF_HZ_DEFAULT, @@ -105,7 +105,6 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_to_use = SETTING_GYRO_TO_USE_DEFAULT, #endif .gyro_main_lpf_hz = SETTING_GYRO_MAIN_LPF_HZ_DEFAULT, - .useDynamicLpf = SETTING_GYRO_USE_DYN_LPF_DEFAULT, .gyroDynamicLpfMinHz = SETTING_GYRO_DYN_LPF_MIN_HZ_DEFAULT, .gyroDynamicLpfMaxHz = SETTING_GYRO_DYN_LPF_MAX_HZ_DEFAULT, .gyroDynamicLpfCurveExpo = SETTING_GYRO_DYN_LPF_CURVE_EXPO_DEFAULT, @@ -124,7 +123,6 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_zero_cal = {SETTING_GYRO_ZERO_X_DEFAULT, SETTING_GYRO_ZERO_Y_DEFAULT, SETTING_GYRO_ZERO_Z_DEFAULT}, .gravity_cmss_cal = SETTING_INS_GRAVITY_CMSS_DEFAULT, #ifdef USE_ADAPTIVE_FILTER - .adaptiveFilterEnabled = SETTING_GYRO_ADAPTIVE_FILTER_DEFAULT, .adaptiveFilterTarget = SETTING_GYRO_ADAPTIVE_FILTER_TARGET_DEFAULT, .adaptiveFilterMinHz = SETTING_GYRO_ADAPTIVE_FILTER_MIN_HZ_DEFAULT, .adaptiveFilterMaxHz = SETTING_GYRO_ADAPTIVE_FILTER_MAX_HZ_DEFAULT, @@ -132,6 +130,7 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .adaptiveFilterHpfHz = SETTING_GYRO_ADAPTIVE_FILTER_HPF_HZ_DEFAULT, .adaptiveFilterIntegratorThresholdHigh = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH_DEFAULT, .adaptiveFilterIntegratorThresholdLow = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW_DEFAULT, + .gyroFilterMode = SETTING_GYRO_FILTER_MODE_DEFAULT, #endif ); @@ -261,7 +260,7 @@ static void gyroInitFilters(void) initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime()); #ifdef USE_ADAPTIVE_FILTER - if (gyroConfig()->adaptiveFilterEnabled) { + if (gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE) { adaptiveFilterSetDefaultFrequency(gyroConfig()->gyro_main_lpf_hz, gyroConfig()->adaptiveFilterMinHz, gyroConfig()->adaptiveFilterMaxHz); } #endif diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 75ff7983372..7f767e370d1 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -52,6 +52,12 @@ typedef enum { DYNAMIC_NOTCH_MODE_3D } dynamicGyroNotchMode_e; +typedef enum { + GYRO_FILTER_MODE_STATIC = 0, + GYRO_FILTER_MODE_DYNAMIC = 1, + GYRO_FILTER_MODE_ADAPTIVE = 2 +} gyroFilterMode_e; + typedef struct gyro_s { bool initialized; uint32_t targetLooptime; @@ -69,7 +75,6 @@ typedef struct gyroConfig_s { uint8_t gyro_to_use; #endif uint16_t gyro_main_lpf_hz; - uint8_t useDynamicLpf; uint16_t gyroDynamicLpfMinHz; uint16_t gyroDynamicLpfMaxHz; uint8_t gyroDynamicLpfCurveExpo; @@ -88,7 +93,6 @@ typedef struct gyroConfig_s { int16_t gyro_zero_cal[XYZ_AXIS_COUNT]; float gravity_cmss_cal; #ifdef USE_ADAPTIVE_FILTER - uint8_t adaptiveFilterEnabled; float adaptiveFilterTarget; uint16_t adaptiveFilterMinHz; uint16_t adaptiveFilterMaxHz; @@ -96,6 +100,7 @@ typedef struct gyroConfig_s { float adaptiveFilterHpfHz; float adaptiveFilterIntegratorThresholdHigh; float adaptiveFilterIntegratorThresholdLow; + uint8_t gyroFilterMode; #endif } gyroConfig_t; From fe0f08959db5e5a43e29737f9f8fcf3b5d2b052f Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 30 Apr 2024 15:22:02 +0200 Subject: [PATCH 043/429] Compiloation fix --- src/main/flight/dynamic_lpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/flight/dynamic_lpf.c b/src/main/flight/dynamic_lpf.c index 31e594312ab..2c10613ede7 100644 --- a/src/main/flight/dynamic_lpf.c +++ b/src/main/flight/dynamic_lpf.c @@ -37,7 +37,7 @@ static float dynLpfCutoffFreq(float throttle, uint16_t dynLpfMin, uint16_t dynLp void dynamicLpfGyroTask(void) { - if (!gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_DYNAMIC) { + if (gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_DYNAMIC) { return; } From ab07785fa9c14d05f37ccdc490b61260027df60e Mon Sep 17 00:00:00 2001 From: Manuel Ilg <29724064+manuelilg@users.noreply.github.com> Date: Sun, 5 May 2024 13:35:12 +0200 Subject: [PATCH 044/429] Fix channel selection for DMA2 Stream6. To use Channel6 which is only for TIM1_CH3 instead of the Channel0 which is for TIM1_CH1, TIM1_CH2 and TIM1_CH3. --- src/main/target/DALRCF405/target.c | 2 +- src/main/target/FLYWOOF411/target.c | 4 ++-- src/main/target/HAKRCF405V2/target.c | 2 +- src/main/target/HAKRCF722V2/target.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/target/DALRCF405/target.c b/src/main/target/DALRCF405/target.c index 816ad3cdeca..e428504c1bc 100644 --- a/src/main/target/DALRCF405/target.c +++ b/src/main/target/DALRCF405/target.c @@ -26,7 +26,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 (1,7) DEF_TIM(TIM8, CH1, PC6, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 (2,2) - DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 (2,6) + DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 1), // S3 (2,6) DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S4 (2,1) (2.3 2.6) DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 1), // S5 (2,4) (2.2) DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 (1,2) diff --git a/src/main/target/FLYWOOF411/target.c b/src/main/target/FLYWOOF411/target.c index 3946ad0b404..764d29e3144 100644 --- a/src/main/target/FLYWOOF411/target.c +++ b/src/main/target/FLYWOOF411/target.c @@ -39,8 +39,8 @@ timerHardware_t timerHardware[] = { #else DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S1_OUT 2,1 DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 1), // S2_OUT 2,2 - DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S3_OUT 2,6 - DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR , 0, 0), // S4_OUT 1,7 + DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 1), // S3_OUT 2,6 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR , 0, 0), // S4_OUT 1,7 DEF_TIM(TIM3, CH4, PB1, TIM_USE_ANY, 0, 0), // RSSI 1,2 DEF_TIM(TIM5, CH4, PA3, TIM_USE_ANY, 0, 1), // RX2 1,0 diff --git a/src/main/target/HAKRCF405V2/target.c b/src/main/target/HAKRCF405V2/target.c index a44aabc0142..a0e79ff5b88 100644 --- a/src/main/target/HAKRCF405V2/target.c +++ b/src/main/target/HAKRCF405V2/target.c @@ -26,7 +26,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT D2_ST7 DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S3_OUT D2_ST1 DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 1), // S4_OUT D2_ST2 - DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT D2_ST6 + DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 1), // S5_OUT D2_ST6 DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT D1_ST4 DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S7_OUT D1_ST7 DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S8_OUT D1_ST2 diff --git a/src/main/target/HAKRCF722V2/target.c b/src/main/target/HAKRCF722V2/target.c index 02098ce755d..9738db56d0c 100644 --- a/src/main/target/HAKRCF722V2/target.c +++ b/src/main/target/HAKRCF722V2/target.c @@ -39,7 +39,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 1), // S4 DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 - DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 + DEF_TIM(TIM1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0, 1), // S7 DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 DEF_TIM(TIM2, CH2, PB3, TIM_USE_LED, 0, 0), // 2812LED From d251b2eca3db7cdee04a9e739290503b7efd9e52 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 11 May 2024 20:54:44 +0200 Subject: [PATCH 045/429] First round of changes Need to make sure it shows up in configurator --- src/main/drivers/pwm_mapping.c | 7 +++++++ src/main/drivers/timer.h | 1 + src/main/fc/cli.c | 3 +++ src/main/flight/mixer.h | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index 0486eb5ac19..3f9b713c6cd 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -47,6 +47,7 @@ enum { MAP_TO_NONE, MAP_TO_MOTOR_OUTPUT, MAP_TO_SERVO_OUTPUT, + MAP_TO_LED_OUTPUT }; typedef struct { @@ -335,6 +336,8 @@ void pwmBuildTimerOutputList(timMotorServoHardware_t * timOutputs, bool isMixerU type = MAP_TO_SERVO_OUTPUT; } else if (TIM_IS_MOTOR(timHw->usageFlags) && !pwmHasServoOnTimer(timOutputs, timHw->tim)) { type = MAP_TO_MOTOR_OUTPUT; + } else if (TIM_IS_LED(timHw->usageFlags) && !pwmHasMotorOnTimer(timOutputs, timHw->tim) && !pwmHasServoOnTimer(timOutputs, timHw->tim)) { + type = MAP_TO_LED_OUTPUT; } switch(type) { @@ -348,6 +351,10 @@ void pwmBuildTimerOutputList(timMotorServoHardware_t * timOutputs, bool isMixerU timOutputs->timServos[timOutputs->maxTimServoCount++] = timHw; pwmClaimTimer(timHw->tim, timHw->usageFlags); break; + case MAP_TO_LED_OUTPUT: + timHw->usageFlags &= TIM_USE_LED; + pwmClaimTimer(timHw->tim, timHw->usageFlags); + break; default: break; } diff --git a/src/main/drivers/timer.h b/src/main/drivers/timer.h index a207aff0c56..dec602f3c93 100644 --- a/src/main/drivers/timer.h +++ b/src/main/drivers/timer.h @@ -123,6 +123,7 @@ typedef enum { #define TIM_IS_MOTOR(flags) ((flags) & TIM_USE_MOTOR) #define TIM_IS_SERVO(flags) ((flags) & TIM_USE_SERVO) +#define TIM_IS_LED(flags) ((flags) & TIM_USE_LED) #define TIM_IS_MOTOR_ONLY(flags) (TIM_IS_MOTOR(flags) && !TIM_IS_SERVO(flags)) #define TIM_IS_SERVO_ONLY(flags) (!TIM_IS_MOTOR(flags) && TIM_IS_SERVO(flags)) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 97de1bd6ed1..3bedf7d324d 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -163,6 +163,7 @@ static const char * outputModeNames[] = { "AUTO", "MOTORS", "SERVOS", + "LED", NULL }; @@ -2821,6 +2822,8 @@ static void cliTimerOutputMode(char *cmdline) mode = OUTPUT_MODE_MOTORS; } else if(!sl_strcasecmp("SERVOS", tok)) { mode = OUTPUT_MODE_SERVOS; + } else if(!sl_strcasecmp("LED", tok)) { + mode = OUTPUT_MODE_LED; } else { cliShowParseError(); return; diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index 0d40fdc11ec..8af82173069 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -48,7 +48,8 @@ typedef enum { typedef enum { OUTPUT_MODE_AUTO = 0, OUTPUT_MODE_MOTORS, - OUTPUT_MODE_SERVOS + OUTPUT_MODE_SERVOS, + OUTPUT_MODE_LED } outputMode_e; typedef struct motorAxisCorrectionLimits_s { From f82b3fc26ebfa5ba8b09cb2666e6b78e3351ea66 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 11 May 2024 23:48:51 +0200 Subject: [PATCH 046/429] Allow led pin to be re-used as servo or motor more easily. --- src/main/drivers/pwm_mapping.c | 16 ++++++++-------- src/main/drivers/timer.h | 6 +++--- src/main/fc/fc_msp.c | 11 +++++++++++ src/main/msp/msp_protocol_v2_inav.h | 1 + 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index 3f9b713c6cd..b9ce0624592 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -214,16 +214,16 @@ static bool checkPwmTimerConflicts(const timerHardware_t *timHw) static void timerHardwareOverride(timerHardware_t * timer) { switch (timerOverrides(timer2id(timer->tim))->outputMode) { case OUTPUT_MODE_MOTORS: - if (TIM_IS_SERVO(timer->usageFlags)) { - timer->usageFlags &= ~TIM_USE_SERVO; - timer->usageFlags |= TIM_USE_MOTOR; - } + timer->usageFlags &= ~(TIM_USE_SERVO|TIM_USE_LED); + timer->usageFlags |= TIM_USE_MOTOR; break; case OUTPUT_MODE_SERVOS: - if (TIM_IS_MOTOR(timer->usageFlags)) { - timer->usageFlags &= ~TIM_USE_MOTOR; - timer->usageFlags |= TIM_USE_SERVO; - } + timer->usageFlags &= ~(TIM_USE_MOTOR|TIM_USE_LED); + timer->usageFlags |= TIM_USE_SERVO; + break; + case OUTPUT_MODE_LED: + timer->usageFlags &= ~(TIM_USE_MOTOR|TIM_USE_SERVO); + timer->usageFlags |= TIM_USE_LED; break; } } diff --git a/src/main/drivers/timer.h b/src/main/drivers/timer.h index dec602f3c93..d87e0400d52 100644 --- a/src/main/drivers/timer.h +++ b/src/main/drivers/timer.h @@ -113,9 +113,9 @@ typedef enum { TIM_USE_MOTOR = (1 << 2), // Motor output TIM_USE_SERVO = (1 << 3), // Servo output TIM_USE_MC_CHNFW = (1 << 4), // Deprecated and not used after removal of CHANNEL_FORWARDING feature - //TIM_USE_FW_MOTOR = (1 << 5), // We no longer differentiate mc from fw on pwm allocation - //TIM_USE_FW_SERVO = (1 << 6), - TIM_USE_LED = (1 << 24), + //TIM_USE_FW_MOTOR = (1 << 5), // We no longer differentiate mc from fw on pwm allocation + //TIM_USE_FW_SERVO = (1 << 6), + TIM_USE_LED = (1 << 24), // Remapping needs to be in the lower 8 bits. TIM_USE_BEEPER = (1 << 25), } timerUsageFlag_e; diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index d44a6e1fcad..2c0210617e8 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1586,6 +1586,17 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU8(dst, timerHardware[i].usageFlags); } break; + case MSP2_INAV_OUTPUT_MAPPING_EXT2: + for (uint8_t i = 0; i < timerHardwareCount; ++i) + if (!(timerHardware[i].usageFlags & (TIM_USE_PPM | TIM_USE_PWM))) { + #if defined(SITL_BUILD) + sbufWriteU8(dst, i); + #else + sbufWriteU8(dst, timer2id(timerHardware[i].tim)); + #endif + sbufWriteU32(dst, timerHardware[i].usageFlags); + } + break; case MSP2_INAV_MC_BRAKING: #ifdef USE_MR_BRAKING_MODE diff --git a/src/main/msp/msp_protocol_v2_inav.h b/src/main/msp/msp_protocol_v2_inav.h index 3312e5bc25d..1b64b3f604d 100755 --- a/src/main/msp/msp_protocol_v2_inav.h +++ b/src/main/msp/msp_protocol_v2_inav.h @@ -34,6 +34,7 @@ #define MSP2_INAV_OUTPUT_MAPPING_EXT 0x200D #define MSP2_INAV_TIMER_OUTPUT_MODE 0x200E #define MSP2_INAV_SET_TIMER_OUTPUT_MODE 0x200F +#define MSP2_INAV_OUTPUT_MAPPING_EXT2 0x210D #define MSP2_INAV_MIXER 0x2010 #define MSP2_INAV_SET_MIXER 0x2011 From ce9ea2d8fcb17c946f26cab49a0b906fc205c849 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 12 May 2024 11:08:53 +0200 Subject: [PATCH 047/429] Add obsolete warning to MSP2_INAV_OUTPUT_MAPPING_EXT --- src/main/fc/fc_msp.c | 2 ++ src/main/msp/msp_protocol_v2_inav.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index e099d11f648..75e18ef3681 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1575,6 +1575,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF } break; + // Obsolete, replaced by MSP2_INAV_OUTPUT_MAPPING_EXT2 case MSP2_INAV_OUTPUT_MAPPING_EXT: for (uint8_t i = 0; i < timerHardwareCount; ++i) if (!(timerHardware[i].usageFlags & (TIM_USE_PPM | TIM_USE_PWM))) { @@ -1583,6 +1584,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF #else sbufWriteU8(dst, timer2id(timerHardware[i].tim)); #endif + // usageFlags is u32, cuts out the higher 24bits sbufWriteU8(dst, timerHardware[i].usageFlags); } break; diff --git a/src/main/msp/msp_protocol_v2_inav.h b/src/main/msp/msp_protocol_v2_inav.h index 1b64b3f604d..7c10a4df990 100755 --- a/src/main/msp/msp_protocol_v2_inav.h +++ b/src/main/msp/msp_protocol_v2_inav.h @@ -31,7 +31,7 @@ #define MSP2_INAV_OUTPUT_MAPPING 0x200A #define MSP2_INAV_MC_BRAKING 0x200B #define MSP2_INAV_SET_MC_BRAKING 0x200C -#define MSP2_INAV_OUTPUT_MAPPING_EXT 0x200D +#define MSP2_INAV_OUTPUT_MAPPING_EXT 0x200D // Obsolete, replaced by MSP2_INAV_OUTPUT_MAPPING_EXT2 #define MSP2_INAV_TIMER_OUTPUT_MODE 0x200E #define MSP2_INAV_SET_TIMER_OUTPUT_MODE 0x200F #define MSP2_INAV_OUTPUT_MAPPING_EXT2 0x210D From ac3277656142d63d3c43c46729c53647da6a41a5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 12 May 2024 13:21:11 +0200 Subject: [PATCH 048/429] vimrx synthax on by default --- .vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.vimrc b/.vimrc index 547d37812cb..4808f6bb38d 100644 --- a/.vimrc +++ b/.vimrc @@ -5,5 +5,6 @@ set expandtab set bs=2 set sw=4 set ts=4 +syn on From 4f6220b0fe7ef3cf264f3660caaaabe7421b09d1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 12 May 2024 13:21:29 +0200 Subject: [PATCH 049/429] Change conflict checking to rely on timerUsageFlag Previously it used IO_TAG to check for the LED pin directly --- src/main/drivers/pwm_mapping.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index b9ce0624592..e953c86b96e 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -168,10 +168,16 @@ static bool checkPwmTimerConflicts(const timerHardware_t *timHw) #if defined(USE_LED_STRIP) if (feature(FEATURE_LED_STRIP)) { - const timerHardware_t * ledTimHw = timerGetByTag(IO_TAG(WS2811_PIN), TIM_USE_ANY); - if (ledTimHw != NULL && timHw->tim == ledTimHw->tim) { - return true; + for (int i = 0; i < timerHardwareCount; i++) { + if (timHw->tim == timerHardware[i].tim && timerHardware[i].usageFlags & TIM_USE_LED) { + return true; + } } + + //const timerHardware_t * ledTimHw = timerGetByTag(IO_TAG(WS2811_PIN), TIM_USE_ANY); + //if (ledTimHw != NULL && timHw->tim == ledTimHw->tim) { + // return true; + //} } #endif From 1dd0d873da670c2a9074e923ba4d8eef6cdef571 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 13 May 2024 01:11:48 +0200 Subject: [PATCH 050/429] Prefer default LED pin This changes led hardware setup to prefer original led pin, but fall back to reassigned LED pin if that was changed to something else. --- src/main/drivers/light_ws2811strip.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/light_ws2811strip.c b/src/main/drivers/light_ws2811strip.c index cb56a7fe79a..fe5f405d032 100644 --- a/src/main/drivers/light_ws2811strip.c +++ b/src/main/drivers/light_ws2811strip.c @@ -124,6 +124,10 @@ void ws2811LedStripInit(void) { const timerHardware_t * timHw = timerGetByTag(IO_TAG(WS2811_PIN), TIM_USE_ANY); + if (!(timHw->usageFlags & TIM_USE_LED)) { // Check if it has not been reassigned + timHw = timerGetByUsageFlag(TIM_USE_LED); // Get first pin marked as LED + } + if (timHw == NULL) { return; } @@ -133,14 +137,14 @@ void ws2811LedStripInit(void) return; } - ws2811IO = IOGetByTag(IO_TAG(WS2811_PIN)); + ws2811IO = IOGetByTag(timHw->tag); //IOGetByTag(IO_TAG(WS2811_PIN)); IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0); IOConfigGPIOAF(ws2811IO, IOCFG_AF_PP_FAST, timHw->alternateFunction); - if ( ledPinConfig()->led_pin_pwm_mode == LED_PIN_PWM_MODE_LOW ) { + if (ledPinConfig()->led_pin_pwm_mode == LED_PIN_PWM_MODE_LOW) { ledConfigurePWM(); *timerCCR(ws2811TCH) = 0; - } else if ( ledPinConfig()->led_pin_pwm_mode == LED_PIN_PWM_MODE_HIGH ) { + } else if (ledPinConfig()->led_pin_pwm_mode == LED_PIN_PWM_MODE_HIGH) { ledConfigurePWM(); *timerCCR(ws2811TCH) = 100; } else { From 6aeb5c3e7c0dcf2a7afe3166849c094ac3149477 Mon Sep 17 00:00:00 2001 From: Julio Cesar Date: Mon, 13 May 2024 21:58:30 -0300 Subject: [PATCH 051/429] Make the 'declination.py' file generate Declination, Inclination and Intensity. --- .../navigation/navigation_declination_gen.c | 120 +++--- src/main/target/common.h | 2 - src/utils/declination.py | 345 ++++++++++++------ 3 files changed, 299 insertions(+), 168 deletions(-) diff --git a/src/main/navigation/navigation_declination_gen.c b/src/main/navigation/navigation_declination_gen.c index c7d632cd87c..65b44cfcbcb 100644 --- a/src/main/navigation/navigation_declination_gen.c +++ b/src/main/navigation/navigation_declination_gen.c @@ -1,63 +1,77 @@ /* this file is automatically generated by src/utils/declination.py - DO NOT EDIT! */ -/* Updated on 2024-04-19 12:54:15.842704 */ +/* Updated on 2024-05-13 21:53:14.731603 */ -#include +const float SAMPLING_RES = 10; +const float SAMPLING_MIN_LAT = -90; +const float SAMPLING_MAX_LAT = 90; +const float SAMPLING_MIN_LON = -180; +const float SAMPLING_MAX_LON = 180; - - -#if defined(NAV_AUTO_MAG_DECLINATION_PRECISE) -#define SAMPLING_RES 10.00000f -#define SAMPLING_MIN_LON -180.00000f -#define SAMPLING_MAX_LON 180.00000f -#define SAMPLING_MIN_LAT -90.00000f -#define SAMPLING_MAX_LAT 90.00000f - -static const float declination_table[19][37] = { - {148.63040f,138.63040f,128.63040f,118.63040f,108.63040f,98.63040f,88.63040f,78.63040f,68.63040f,58.63040f,48.63040f,38.63040f,28.63040f,18.63040f,8.63040f,-1.36960f,-11.36960f,-21.36960f,-31.36960f,-41.36960f,-51.36960f,-61.36960f,-71.36960f,-81.36960f,-91.36960f,-101.36960f,-111.36960f,-121.36960f,-131.36960f,-141.36960f,-151.36960f,-161.36960f,-171.36960f,178.63040f,168.63040f,158.63040f,148.63040f}, - {128.87816f,116.70769f,105.62443f,95.48127f,86.09683f,77.29367f,68.91718f,60.84302f,52.97822f,45.25811f,37.64003f,30.09478f,22.59702f,15.11676f,7.61418f,0.03947f,-7.66207f,-15.54157f,-23.63819f,-31.97410f,-40.55489f,-49.37538f,-58.42917f,-67.71936f,-77.26833f,-87.12519f,-97.37007f,-108.11458f,-119.49579f,-131.65830f,-144.71588f,-158.68662f,-173.41452f,171.47213f,156.49935f,142.18469f,128.87816f}, - {85.86755f,77.88182f,71.42849f,65.89217f,60.86962f,56.04972f,51.17842f,46.06489f,40.60132f,34.77619f,28.67056f,22.43282f,16.23087f,10.18755f,4.31917f,-1.49067f,-7.45797f,-13.81467f,-20.71641f,-28.18762f,-36.12471f,-44.34676f,-52.66473f,-60.93937f,-69.11381f,-77.22546f,-85.41334f,-93.94372f,-103.29064f,-114.35005f,-128.97727f,-151.06023f,174.83520f,137.67818f,112.23020f,96.52063f,85.86756f}, - {48.43188f,46.98353f,45.36982f,43.80186f,42.32760f,40.82382f,38.99678f,36.46379f,32.90329f,28.18877f,22.45599f,16.10387f,9.71432f,3.86202f,-1.14650f,-5.45997f,-9.64078f,-14.38658f,-20.18766f,-27.11174f,-34.80967f,-42.71859f,-50.31107f,-57.23008f,-63.28782f,-68.39719f,-72.47622f,-75.31221f,-76.30788f,-73.74072f,-61.55512f,-18.96160f,29.20071f,44.46666f,48.67974f,49.28540f,48.43188f}, - {31.58850f,31.74835f,31.39924f,30.87678f,30.43574f,30.19800f,29.98360f,29.24010f,27.23113f,23.37602f,17.54538f,10.24099f,2.57680f,-4.11819f,-8.98330f,-12.08874f,-14.32383f,-16.91831f,-20.97106f,-26.92020f,-34.17714f,-41.56631f,-48.09571f,-53.19469f,-56.53278f,-57.82558f,-56.66031f,-52.27310f,-43.55594f,-29.95085f,-13.24765f,2.54212f,14.60798f,22.72224f,27.72553f,30.44935f,31.58850f}, - {22.79850f,23.32533f,23.34746f,23.05694f,22.66226f,22.42885f,22.46289f,22.41289f,21.37705f,18.23370f,12.30982f,4.02530f,-4.93197f,-12.42012f,-17.23389f,-19.62803f,-20.56810f,-20.93312f,-21.98947f,-25.41090f,-31.19026f,-37.44166f,-42.49725f,-45.51856f,-46.02918f,-43.74555f,-38.55838f,-30.56411f,-20.73773f,-11.07131f,-2.79308f,4.21937f,10.21441f,15.15242f,18.92948f,21.44642f,22.79850f}, - {17.16987f,17.68582f,17.85385f,17.73377f,17.34906f,16.86130f,16.52747f,16.34574f,15.56790f,12.74839f,6.74610f,-2.00418f,-11.22826f,-18.37193f,-22.46233f,-24.19496f,-24.47888f,-23.22908f,-20.72783f,-19.60150f,-21.98233f,-26.43395f,-30.43203f,-32.35125f,-31.47499f,-27.95264f,-22.40690f,-15.51422f,-8.63620f,-3.35146f,0.42144f,3.87188f,7.48128f,10.95260f,13.91406f,16.01563f,17.16987f}, - {13.46149f,13.75829f,13.85281f,13.81813f,13.52893f,12.94281f,12.32698f,11.88976f,11.00215f,8.11359f,1.99478f,-6.62228f,-15.08744f,-21.05798f,-23.92224f,-24.34577f,-23.04831f,-19.84546f,-14.88685f,-10.38631f,-9.06427f,-11.31395f,-15.06340f,-17.65505f,-17.71488f,-15.54256f,-11.89991f,-7.27581f,-2.87289f,-0.16517f,1.24684f,2.97092f,5.51371f,8.29954f,10.80542f,12.58786f,13.46149f}, - {11.19370f,11.20122f,11.07257f,11.02175f,10.82482f,10.26986f,9.62418f,9.09716f,7.97068f,4.77978f,-1.35469f,-9.31946f,-16.55524f,-21.15274f,-22.50861f,-21.01857f,-17.63827f,-13.15823f,-8.29683f,-4.01764f,-1.51484f,-1.87967f,-4.62279f,-7.47003f,-8.63091f,-8.05888f,-6.24442f,-3.42551f,-0.62936f,0.67783f,0.89029f,1.80510f,3.93778f,6.48671f,8.83523f,10.50781f,11.19370f}, - {9.96310f,9.79689f,9.46606f,9.40362f,9.31492f,8.84240f,8.22130f,7.55735f,6.02850f,2.43377f,-3.55150f,-10.60044f,-16.54723f,-19.75861f,-19.59018f,-16.58982f,-12.16100f,-7.67553f,-3.93189f,-0.91522f,1.34973f,1.87637f,0.22653f,-2.15228f,-3.61566f,-3.90720f,-3.29932f,-1.83286f,-0.23997f,0.20367f,-0.19418f,0.32122f,2.29252f,4.85536f,7.33778f,9.21090f,9.96310f}, - {9.18888f,9.24336f,8.98253f,9.05281f,9.17191f,8.83598f,8.10836f,7.00345f,4.80464f,0.69064f,-5.15618f,-11.30079f,-15.93916f,-17.74937f,-16.42349f,-12.86230f,-8.44857f,-4.38855f,-1.42704f,0.70613f,2.51072f,3.31152f,2.34785f,0.48172f,-0.89199f,-1.49634f,-1.59901f,-1.18437f,-0.66243f,-0.94842f,-1.78088f,-1.62463f,0.11657f,2.73547f,5.55820f,7.95812f,9.18888f}, - {8.09034f,8.95675f,9.30400f,9.80188f,10.27100f,10.13647f,9.19791f,7.38846f,4.25004f,-0.60600f,-6.53915f,-11.93135f,-15.26054f,-15.79066f,-13.79060f,-10.27561f,-6.25103f,-2.56551f,0.07346f,1.80766f,3.24155f,4.05015f,3.51428f,2.10305f,0.93136f,0.25053f,-0.27213f,-0.70545f,-1.24346f,-2.37500f,-3.75122f,-4.07408f,-2.71911f,-0.15132f,2.99380f,6.02278f,8.09034f}, - {6.27792f,8.37723f,9.88296f,11.16334f,12.08487f,12.15767f,11.03142f,8.51947f,4.34248f,-1.47518f,-7.78911f,-12.71269f,-15.01118f,-14.61457f,-12.25578f,-8.87216f,-5.13675f,-1.63793f,0.99774f,2.71417f,3.98293f,4.78698f,4.67468f,3.82712f,2.93970f,2.18792f,1.25958f,-0.01231f,-1.71794f,-3.92282f,-6.03566f,-6.90283f,-5.95491f,-3.51614f,-0.20102f,3.30598f,6.27792f}, - {4.15672f,7.47883f,10.31556f,12.59798f,14.06987f,14.34572f,13.08042f,9.97537f,4.77447f,-2.16465f,-9.14687f,-14.00316f,-15.77819f,-14.88455f,-12.28640f,-8.84845f,-5.11869f,-1.55612f,1.34605f,3.41756f,4.91977f,6.01696f,6.56254f,6.51350f,6.02774f,5.09138f,3.48456f,1.07344f,-2.08240f,-5.60383f,-8.56486f,-9.89888f,-9.20525f,-6.83312f,-3.41374f,0.42499f,4.15672f}, - {2.38746f,6.60961f,10.51138f,13.76537f,15.94256f,16.59043f,15.27093f,11.52705f,5.06990f,-3.36003f,-11.36932f,-16.51244f,-18.15167f,-17.03678f,-14.21651f,-10.51524f,-6.47146f,-2.49805f,1.03216f,3.92789f,6.27640f,8.24229f,9.81368f,10.78355f,10.85070f,9.68870f,7.04509f,2.91449f,-2.25894f,-7.44786f,-11.30963f,-12.92043f,-12.20858f,-9.70263f,-6.08438f,-1.92562f,2.38746f}, - {1.14371f,5.95768f,10.55039f,14.56595f,17.51248f,18.77049f,17.56825f,12.99646f,4.54568f,-6.33792f,-15.91121f,-21.43028f,-22.88293f,-21.44177f,-18.22110f,-13.99911f,-9.28961f,-4.46489f,0.18470f,4.47851f,8.37200f,11.87759f,14.90388f,17.13814f,18.04159f,16.93503f,13.18748f,6.66358f,-1.56678f,-9.20492f,-14.20053f,-15.96059f,-14.99797f,-12.15657f,-8.19328f,-3.64820f,1.14371f}, - {-0.35955f,4.92766f,9.99739f,14.51863f,17.99503f,19.64821f,18.23668f,11.99980f,-0.09657f,-14.74873f,-25.55246f,-30.33910f,-30.58104f,-28.00627f,-23.75441f,-18.51083f,-12.70165f,-6.61593f,-0.46628f,5.58665f,11.41580f,16.88997f,21.81133f,25.83916f,28.40134f,28.57592f,24.99531f,16.28607f,3.28542f,-9.10495f,-16.59733f,-19.05958f,-18.04316f,-14.91590f,-10.58486f,-5.61478f,-0.35955f}, - {-5.35521f,-0.10619f,4.69597f,8.54683f,10.65268f,9.65875f,3.42678f,-9.71040f,-26.04578f,-37.63969f,-42.28407f,-42.02380f,-38.82980f,-33.88684f,-27.86664f,-21.16414f,-14.02720f,-6.62426f,0.91924f,8.49972f,16.02040f,23.37681f,30.43782f,37.01500f,42.80483f,47.26542f,49.32663f,46.69337f,34.75696f,10.85970f,-10.89085f,-20.36338f,-21.94791f,-19.71753f,-15.63466f,-10.66363f,-5.35521f}, - {-166.99999f,-156.99999f,-146.99999f,-136.99999f,-126.99999f,-116.99999f,-106.99999f,-96.99999f,-86.99999f,-76.99999f,-66.99999f,-56.99999f,-46.99999f,-36.99999f,-26.99999f,-16.99999f,-6.99999f,3.00001f,13.00001f,23.00001f,33.00000f,43.00000f,53.00000f,63.00000f,73.00000f,83.00000f,93.00000f,103.00000f,113.00000f,123.00000f,133.00000f,143.00000f,153.00000f,163.00000f,173.00000f,-177.00000f,-167.00000f} +const float declination_table[19][37] = { + {148.83402f,138.83401f,128.83401f,118.83402f,108.83402f,98.83402f,88.83402f,78.83402f,68.83402f,58.83402f,48.83402f,38.83402f,28.83402f,18.83402f,8.83402f,-1.16598f,-11.16598f,-21.16598f,-31.16598f,-41.16598f,-51.16598f,-61.16598f,-71.16598f,-81.16598f,-91.16598f,-101.16598f,-111.16598f,-121.16598f,-131.16598f,-141.16598f,-151.16598f,-161.16598f,-171.16598f,178.83402f,168.83402f,158.83402f,148.83402f}, + {129.09306f,116.89412f,105.78898f,95.63017f,86.23504f,77.42476f,69.04348f,60.96591f,53.09841f,45.37592f,37.75568f,30.20867f,22.70998f,15.23027f,7.73037f,0.16098f,-7.53238f,-15.40109f,-23.48496f,-31.80703f,-40.37375f,-49.18062f,-58.22152f,-67.49946f,-77.03640f,-86.88079f,-97.11212f,-107.84156f,-119.20626f,-131.35191f,-144.39481f,-158.35719f,-173.08769f,171.78274f,156.78187f,142.43310f,129.09306f}, + {85.81367f,77.83602f,71.40003f,65.88433f,60.88263f,56.08204f,51.22755f,46.12774f,40.67419f,34.85457f,28.74909f,22.50583f,16.29363f,10.23812f,4.36029f,-1.45095f,-7.40778f,-13.74178f,-20.61213f,-28.04922f,-35.95530f,-44.15322f,-52.45486f,-60.71951f,-68.88732f,-76.99183f,-85.16746f,-93.67473f,-102.97950f,-113.96429f,-128.46293f,-150.36073f,175.55488f,138.00554f,112.28051f,96.48319f,85.81367f}, + {48.22805f,46.81921f,45.24300f,43.71189f,42.27245f,40.80022f,39.00177f,36.49549f,32.95972f,28.26545f,22.54379f,16.18846f,9.77818f,3.88971f,-1.16066f,-5.50500f,-9.68832f,-14.40052f,-20.13990f,-26.99385f,-34.63319f,-42.50584f,-50.08478f,-57.00760f,-63.07978f,-68.20773f,-72.30336f,-75.14845f,-76.14220f,-73.56875f,-61.46573f,-19.66028f,28.39616f,43.98783f,48.35027f,49.03265f,48.22805f}, + {31.42931f,31.60530f,31.28145f,30.79047f,30.38024f,30.16777f,29.97487f,29.25597f,27.27948f,23.46202f,17.66378f,10.37176f,2.68673f,-4.06559f,-9.01317f,-12.19989f,-14.47861f,-17.04830f,-21.00672f,-26.83158f,-33.98769f,-41.32654f,-47.85214f,-52.97945f,-56.36644f,-57.72068f,-56.62201f,-52.29959f,-43.64045f,-30.08348f,-13.41611f,2.35315f,14.41455f,22.53506f,27.54777f,30.28028f,31.42931f}, + {22.67985f,23.21169f,23.25494f,22.99742f,22.63545f,22.42369f,22.46877f,22.43187f,21.42571f,18.33186f,12.46440f,4.21692f,-4.75068f,-12.30560f,-17.22721f,-19.74039f,-20.77499f,-21.16946f,-22.14607f,-25.39336f,-31.01102f,-37.19196f,-42.26227f,-45.34969f,-45.95366f,-43.77299f,-38.67388f,-30.72261f,-20.87969f,-11.16390f,-2.84711f,4.17466f,10.15622f,15.07307f,18.83144f,21.33469f,22.67985f}, + {17.07334f,17.59062f,17.77934f,17.69577f,17.34929f,16.88674f,16.56217f,16.38656f,15.63204f,12.86517f,6.93562f,-1.75751f,-10.98436f,-18.20308f,-22.41588f,-24.27993f,-24.67590f,-23.50719f,-21.00605f,-19.72369f,-21.87960f,-26.21214f,-30.23195f,-32.25069f,-31.49417f,-28.07385f,-22.58093f,-15.67611f,-8.73630f,-3.38117f,0.43868f,3.90117f,7.49078f,10.92679f,13.85484f,15.93237f,17.07334f}, + {13.37426f,13.67217f,13.78744f,13.78998f,13.54222f,12.98780f,12.38852f,11.96065f,11.09372f,8.25499f,2.21162f,-6.34723f,-14.82596f,-20.89032f,-23.89434f,-24.45752f,-23.26867f,-20.14461f,-15.21492f,-10.62227f,-9.09952f,-11.18829f,-14.91638f,-17.58833f,-17.75073f,-15.65321f,-12.03643f,-7.38772f,-2.92537f,-0.15156f,1.30857f,3.04660f,5.56513f,8.30463f,10.76538f,12.51642f,13.37426f}, + {11.10969f,11.11944f,11.01236f,10.99728f,10.84097f,10.32286f,9.70494f,9.19687f,8.09157f,4.94277f,-1.12864f,-9.05484f,-16.32980f,-21.04376f,-22.55109f,-21.19496f,-17.89373f,-13.44411f,-8.58084f,-4.24867f,-1.62827f,-1.86509f,-4.55045f,-7.42469f,-8.64775f,-8.12536f,-6.32716f,-3.48850f,-0.64489f,0.72027f,0.97976f,1.90952f,4.01623f,6.51266f,8.80749f,10.44185f,11.10969f}, + {9.88349f,9.72040f,9.41289f,9.38439f,9.33291f,8.89921f,8.31537f,7.68011f,6.17272f,2.60695f,-3.33977f,-10.37899f,-16.38823f,-19.72660f,-19.70115f,-16.80477f,-12.41185f,-7.91607f,-4.15177f,-1.10381f,1.22204f,1.82879f,0.23517f,-2.13784f,-3.62813f,-3.94630f,-3.34494f,-1.85961f,-0.22644f,0.26762f,-0.08803f,0.44077f,2.38763f,4.89878f,7.32401f,9.15291f,9.88349f}, + {9.12464f,9.18177f,8.94457f,9.04553f,9.19618f,8.89744f,8.21223f,7.14260f,4.96349f,0.86055f,-4.97931f,-11.14357f,-15.85640f,-17.78532f,-16.57645f,-13.08478f,-8.67898f,-4.59243f,-1.60427f,0.55144f,2.39028f,3.23916f,2.31654f,0.46434f,-0.91732f,-1.53003f,-1.62589f,-1.18564f,-0.62403f,-0.86624f,-1.66562f,-1.50145f,0.21812f,2.79294f,5.56329f,7.91823f,9.12464f}, + {8.06290f,8.93172f,9.29767f,9.81684f,10.30693f,10.20311f,9.30721f,7.53634f,4.41412f,-0.45099f,-6.41113f,-11.85029f,-15.25565f,-15.88209f,-13.96742f,-10.49677f,-6.46933f,-2.75504f,-0.08743f,1.66921f,3.12874f,3.96903f,3.45981f,2.05876f,0.88578f,0.20951f,-0.29117f,-0.68669f,-1.18101f,-2.27487f,-3.63054f,-3.95562f,-2.62221f,-0.08793f,3.01927f,6.01454f,8.06290f}, + {6.31041f,8.41617f,9.93058f,11.21483f,12.13996f,12.23034f,11.14011f,8.66524f,4.49928f,-1.34733f,-7.71989f,-12.71272f,-15.08305f,-14.75641f,-12.45343f,-9.09705f,-5.35725f,-1.83470f,0.82823f,2.57001f,3.86519f,4.69588f,4.60243f,3.76104f,2.87601f,2.13967f,1.24833f,0.02788f,-1.62859f,-3.80231f,-5.90990f,-6.79346f,-5.87079f,-3.45535f,-0.15720f,3.34006f,6.31041f}, + {4.26294f,7.59975f,10.43666f,12.70491f,14.16020f,14.43398f,13.18770f,10.10768f,4.90586f,-2.08386f,-9.15208f,-14.09196f,-15.93051f,-15.08268f,-12.51517f,-9.09089f,-5.35759f,-1.77919f,1.14514f,3.24292f,4.77489f,5.90082f,6.46683f,6.42854f,5.95440f,5.04613f,3.49019f,1.14215f,-1.96091f,-5.46021f,-8.43365f,-9.79880f,-9.13330f,-6.77311f,-3.34752f,0.50970f,4.26294f}, + {2.57464f,6.81988f,10.72127f,13.95370f,16.10049f,16.72460f,15.39548f,11.64478f,5.15172f,-3.36781f,-11.49173f,-16.72206f,-18.40831f,-17.31430f,-14.50140f,-10.79977f,-6.74992f,-2.76545f,0.78143f,3.70100f,6.08013f,8.07892f,9.67963f,10.67456f,10.77058f,9.65347f,7.07600f,3.02043f,-2.09809f,-7.27683f,-11.16806f,-12.81861f,-12.13043f,-9.62141f,-5.97603f,-1.77704f,2.57464f}, + {1.43503f,6.27921f,10.88019f,14.88261f,17.80063f,19.02158f,17.77297f,13.12636f,4.53718f,-6.54055f,-16.27050f,-21.85552f,-23.31365f,-21.85455f,-18.61101f,-14.36797f,-9.64057f,-4.79964f,-0.13239f,4.18385f,8.10605f,11.64519f,14.70734f,16.97990f,17.92977f,16.88820f,13.23164f,6.81146f,-1.34665f,-8.97876f,-14.01257f,-15.81005f,-14.85926f,-12.00033f,-7.99733f,-3.40265f,1.43502f}, + {0.13094f,5.45479f,10.54962f,15.08235f,18.55436f,20.17754f,18.67574f,12.20150f,-0.36226f,-15.49225f,-26.46004f,-31.19380f,-31.33251f,-28.66356f,-24.33699f,-19.03627f,-13.18344f,-7.06335f,-0.88475f,5.19490f,11.05071f,16.55252f,21.50321f,25.56424f,28.16988f,28.41286f,24.95220f,16.43585f,3.63861f,-8.67079f,-16.18909f,-18.69045f,-17.68753f,-14.54612f,-10.18137f,-5.16795f,0.13094f}, + {-4.14830f,1.12345f,5.96040f,9.84415f,11.94596f,10.80871f,4.02869f,-10.36405f,-27.94912f,-39.79617f,-44.16477f,-43.57950f,-40.12657f,-34.99189f,-28.83083f,-22.02403f,-14.80922f,-7.34799f,0.23881f,7.85050f,15.39197f,22.75942f,29.82156f,36.38924f,42.15868f,46.59144f,48.63821f,46.09967f,34.72041f,12.13936f,-8.98865f,-18.65098f,-20.47841f,-18.40133f,-14.39834f,-9.45818f,-4.14830f}, + {-169.79948f,-159.79948f,-149.79948f,-139.79948f,-129.79948f,-119.79948f,-109.79948f,-99.79948f,-89.79948f,-79.79948f,-69.79948f,-59.79948f,-49.79948f,-39.79948f,-29.79948f,-19.79948f,-9.79948f,0.20052f,10.20052f,20.20052f,30.20052f,40.20052f,50.20052f,60.20052f,70.20052f,80.20052f,90.20052f,100.20052f,110.20052f,120.20052f,130.20052f,140.20052f,150.20052f,160.20052f,170.20052f,-179.79948f,-169.79948f} }; -#else /* !NAV_AUTO_MAG_DECLINATION_PRECISE */ -#define SAMPLING_RES 10.00000f -#define SAMPLING_MIN_LON -180.00000f -#define SAMPLING_MAX_LON 180.00000f -#define SAMPLING_MIN_LAT -60.00000f -#define SAMPLING_MAX_LAT 60.00000f - -static const int8_t declination_table[13][37] = { - {48,47,45,44,42,41,39,36,33,28,22,16,10,4,-1,-5,-10,-14,-20,-27,-35,-43,-50,-57,-63,-68,-72,-75,-76,-74,-62,-19,29,44,49,49,48}, - {32,32,31,31,30,30,30,29,27,23,18,10,3,-4,-9,-12,-14,-17,-21,-27,-34,-42,-48,-53,-57,-58,-57,-52,-44,-30,-13,3,15,23,28,30,32}, - {23,23,23,23,23,22,22,22,21,18,12,4,-5,-12,-17,-20,-21,-21,-22,-25,-31,-37,-42,-46,-46,-44,-39,-31,-21,-11,-3,4,10,15,19,21,23}, - {17,18,18,18,17,17,17,16,16,13,7,-2,-11,-18,-22,-24,-24,-23,-21,-20,-22,-26,-30,-32,-31,-28,-22,-16,-9,-3,0,4,7,11,14,16,17}, - {13,14,14,14,14,13,12,12,11,8,2,-7,-15,-21,-24,-24,-23,-20,-15,-10,-9,-11,-15,-18,-18,-16,-12,-7,-3,0,1,3,6,8,11,13,13}, - {11,11,11,11,11,10,10,9,8,5,-1,-9,-17,-21,-23,-21,-18,-13,-8,-4,-2,-2,-5,-7,-9,-8,-6,-3,-1,1,1,2,4,6,9,11,11}, - {10,10,9,9,9,9,8,8,6,2,-4,-11,-17,-20,-20,-17,-12,-8,-4,-1,1,2,0,-2,-4,-4,-3,-2,0,0,0,0,2,5,7,9,10}, - {9,9,9,9,9,9,8,7,5,1,-5,-11,-16,-18,-16,-13,-8,-4,-1,1,3,3,2,0,-1,-1,-2,-1,-1,-1,-2,-2,0,3,6,8,9}, - {8,9,9,10,10,10,9,7,4,-1,-7,-12,-15,-16,-14,-10,-6,-3,0,2,3,4,4,2,1,0,0,-1,-1,-2,-4,-4,-3,0,3,6,8}, - {6,8,10,11,12,12,11,9,4,-1,-8,-13,-15,-15,-12,-9,-5,-2,1,3,4,5,5,4,3,2,1,0,-2,-4,-6,-7,-6,-4,0,3,6}, - {4,7,10,13,14,14,13,10,5,-2,-9,-14,-16,-15,-12,-9,-5,-2,1,3,5,6,7,7,6,5,3,1,-2,-6,-9,-10,-9,-7,-3,0,4}, - {2,7,11,14,16,17,15,12,5,-3,-11,-17,-18,-17,-14,-11,-6,-2,1,4,6,8,10,11,11,10,7,3,-2,-7,-11,-13,-12,-10,-6,-2,2}, - {1,6,11,15,18,19,18,13,5,-6,-16,-21,-23,-21,-18,-14,-9,-4,0,4,8,12,15,17,18,17,13,7,-2,-9,-14,-16,-15,-12,-8,-4,1} +const float inclination_table[19][37] = { + {-72.02070f,-72.02071f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02070f,-72.02071f,-72.02070f,-72.02071f}, + {-78.23208f,-77.46612f,-76.54604f,-75.51344f,-74.40408f,-73.25043f,-72.08420f,-70.93779f,-69.84384f,-68.83332f,-67.93241f,-67.15960f,-66.52407f,-66.02648f,-65.66205f,-65.42519f,-65.31392f,-65.33255f,-65.49161f,-65.80511f,-66.28626f,-66.94289f,-67.77395f,-68.76776f,-69.90201f,-71.14489f,-72.45664f,-73.79090f,-75.09549f,-76.31306f,-77.38240f,-78.24183f,-78.83644f,-79.12876f,-79.10879f,-78.79618f,-78.23208f}, + {-80.80007f,-78.97830f,-77.14756f,-75.29021f,-73.38193f,-71.40769f,-69.37743f,-67.33857f,-65.37896f,-63.61481f,-62.16302f,-61.10460f,-60.45316f,-60.14557f,-60.06470f,-60.08698f,-60.13217f,-60.19219f,-60.32958f,-60.65151f,-61.27183f,-62.27481f,-63.69257f,-65.50302f,-67.64474f,-70.03800f,-72.60073f,-75.25455f,-77.92173f,-80.51496f,-82.91263f,-84.88736f,-85.95658f,-85.63251f,-84.30522f,-82.60297f,-80.80007f}, + {-77.45516f,-75.43606f,-73.49604f,-71.57699f,-69.59653f,-67.45749f,-65.08505f,-62.48902f,-59.81600f,-57.35291f,-55.46368f,-54.46054f,-54.44855f,-55.23685f,-56.40404f,-57.49090f,-58.18917f,-58.42457f,-58.34278f,-58.24952f,-58.51231f,-59.42525f,-61.10217f,-63.46936f,-66.34503f,-69.53469f,-72.88656f,-76.29320f,-79.66218f,-82.88130f,-85.73520f,-87.38955f,-86.36194f,-84.15583f,-81.83294f,-79.58616f,-77.45517f}, + {-71.58214f,-69.61565f,-67.71488f,-65.86479f,-64.01505f,-62.04510f,-59.77482f,-57.07400f,-54.02405f,-51.03212f,-48.80491f,-48.09823f,-49.26412f,-51.92460f,-55.16562f,-58.07793f,-60.10267f,-61.01513f,-60.84749f,-59.97822f,-59.15799f,-59.18575f,-60.45940f,-62.86069f,-65.97595f,-69.36736f,-72.71868f,-75.80268f,-78.35851f,-80.06262f,-80.67983f,-80.25871f,-79.08901f,-77.46953f,-75.59576f,-73.59787f,-71.58215f}, + {-64.39807f,-62.40221f,-60.40960f,-58.42549f,-56.48151f,-54.55795f,-52.49863f,-50.03954f,-47.03044f,-43.80319f,-41.39118f,-41.16169f,-43.78688f,-48.51954f,-53.83971f,-58.60413f,-62.35170f,-64.81766f,-65.60605f,-64.62579f,-62.64650f,-61.08659f,-61.05364f,-62.68316f,-65.34905f,-68.24163f,-70.78236f,-72.62117f,-73.51797f,-73.52965f,-73.02048f,-72.24528f,-71.21594f,-69.88980f,-68.25886f,-66.38361f,-64.39807f}, + {-55.02826f,-52.87120f,-50.69073f,-48.44731f,-46.19513f,-44.04849f,-42.00465f,-39.74123f,-36.79801f,-33.33110f,-30.77621f,-31.26765f,-35.68330f,-42.58861f,-49.78570f,-56.05256f,-61.22645f,-65.24992f,-67.52021f,-67.43115f,-65.26549f,-62.35447f,-60.45735f,-60.49007f,-61.96843f,-63.81210f,-65.26064f,-65.90429f,-65.53604f,-64.51130f,-63.52424f,-62.77292f,-61.94296f,-60.76846f,-59.16172f,-57.17787f,-55.02826f}, + {-42.23934f,-39.72248f,-37.30606f,-34.84704f,-32.29950f,-29.84715f,-27.62882f,-25.25073f,-22.02346f,-18.13398f,-15.56621f,-17.09131f,-23.52381f,-32.78684f,-42.11183f,-49.91489f,-55.93881f,-60.34177f,-62.85919f,-63.04596f,-60.93631f,-57.41244f,-54.21948f,-52.82417f,-53.10885f,-54.02972f,-54.81946f,-54.92826f,-53.94911f,-52.38029f,-51.27875f,-50.79557f,-50.20937f,-49.05107f,-47.23568f,-44.84941f,-42.23934f}, + {-25.31616f,-22.26353f,-19.64432f,-17.13765f,-14.48794f,-11.90452f,-9.56551f,-6.93532f,-3.35246f,0.62534f,2.69744f,0.20162f,-7.49683f,-18.49333f,-29.80260f,-38.99555f,-45.22087f,-48.81124f,-50.28975f,-49.88122f,-47.49942f,-43.57896f,-39.80201f,-37.81589f,-37.58213f,-38.12733f,-38.79073f,-38.91636f,-37.84560f,-36.15384f,-35.28930f,-35.35164f,-35.11620f,-33.90633f,-31.71407f,-28.67497f,-25.31616f}, + {-5.22365f,-1.68002f,0.98130f,3.28459f,5.73141f,8.13291f,10.33797f,12.92226f,16.28019f,19.52644f,20.64919f,17.75076f,10.26968f,-0.68527f,-12.39654f,-21.81573f,-27.55757f,-29.98547f,-30.24089f,-29.18412f,-26.62224f,-22.51726f,-18.50023f,-16.36665f,-16.02599f,-16.47452f,-17.18522f,-17.56335f,-16.82114f,-15.49276f,-15.21405f,-16.04947f,-16.38744f,-15.33409f,-12.92178f,-9.31548f,-5.22365f}, + {14.65727f,18.24457f,20.73560f,22.68750f,24.74090f,26.83478f,28.82717f,31.06453f,33.64927f,35.73650f,35.91607f,33.06931f,26.82267f,17.82545f,8.14938f,0.35249f,-4.22224f,-5.65846f,-5.08244f,-3.67265f,-1.30171f,2.36894f,6.00997f,7.96495f,8.31670f,8.01335f,7.45026f,6.96852f,7.19717f,7.76654f,7.31456f,5.77666f,4.68883f,5.07867f,7.05547f,10.50432f,14.65727f}, + {31.00203f,34.03206f,36.22486f,37.93041f,39.71929f,41.67672f,43.64451f,45.63057f,47.51149f,48.64179f,48.13476f,45.46014f,40.64785f,34.34474f,27.90343f,22.77471f,19.78522f,19.08118f,19.96093f,21.39191f,23.28877f,25.96005f,28.61507f,30.09860f,30.42073f,30.29938f,30.04062f,29.74069f,29.65970f,29.53545f,28.53162f,26.62276f,24.91817f,24.37385f,25.31100f,27.72542f,31.00203f}, + {43.33608f,45.45851f,47.28808f,48.92364f,50.69187f,52.68920f,54.75852f,56.70372f,58.24993f,58.87748f,58.03709f,55.61656f,52.01961f,47.93440f,44.13769f,41.24459f,39.61639f,39.39065f,40.22833f,41.47069f,42.89022f,44.59331f,46.23881f,47.24171f,47.57154f,47.63935f,47.66249f,47.62919f,47.50096f,47.00810f,45.71114f,43.68014f,41.65440f,40.38784f,40.27252f,41.37670f,43.33608f}, + {53.10131f,54.36161f,55.82606f,57.45873f,59.32146f,61.39014f,63.50628f,65.43734f,66.85905f,67.31408f,66.44780f,64.38450f,61.68268f,58.96721f,56.68844f,55.08044f,54.25566f,54.24982f,54.89128f,55.82780f,56.83438f,57.87845f,58.85920f,59.59271f,60.06042f,60.40887f,60.71534f,60.90716f,60.81057f,60.15911f,58.74748f,56.73559f,54.64618f,53.02448f,52.20550f,52.28132f,53.10131f}, + {61.90363f,62.59082f,63.73000f,65.25974f,67.10373f,69.13404f,71.16923f,72.97878f,74.24745f,74.58969f,73.79370f,72.08739f,69.99806f,68.01780f,66.44167f,65.38391f,64.86230f,64.84287f,65.21557f,65.80372f,66.46017f,67.12970f,67.80720f,68.49179f,69.18909f,69.89166f,70.52514f,70.92481f,70.86509f,70.14456f,68.73300f,66.86155f,64.92449f,63.29260f,62.20331f,61.74779f,61.90363f}, + {70.57319f,70.97549f,71.81891f,73.05700f,74.60513f,76.33503f,78.07584f,79.60158f,80.60606f,80.76720f,79.99878f,78.58008f,76.92858f,75.37566f,74.11340f,73.22087f,72.70518f,72.52979f,72.62677f,72.91213f,73.31657f,73.81370f,74.42101f,75.17239f,76.07666f,77.07532f,78.01176f,78.63384f,78.66938f,77.98598f,76.70086f,75.10445f,73.50638f,72.14451f,71.16426f,70.63412f,70.57319f}, + {78.82351f,79.06440f,79.60559f,80.41612f,81.44382f,82.60991f,83.79747f,84.82323f,85.41014f,85.29919f,84.52961f,83.39228f,82.15604f,80.99185f,79.99787f,79.22370f,78.68527f,78.37555f,78.27394f,78.35635f,78.60546f,79.01788f,79.60326f,80.37283f,81.31875f,82.38760f,83.44917f,84.26774f,84.54142f,84.12292f,83.18704f,82.03917f,80.91872f,79.97342f,79.28584f,78.89722f,78.82351f}, + {85.92404f,85.99807f,86.21370f,86.55320f,86.98729f,87.46743f,87.90712f,88.15645f,88.05609f,87.61718f,86.98684f,86.28678f,85.58976f,84.94098f,84.37090f,83.90045f,83.54357f,83.30879f,83.20077f,83.22179f,83.37274f,83.65354f,84.06234f,84.59369f,85.23581f,85.96691f,86.74942f,87.51716f,88.14109f,88.39226f,88.15089f,87.63861f,87.08412f,86.59723f,86.22810f,86.00055f,85.92404f}, + {88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f,88.21420f} }; -#endif +const float intensity_table[19][37] = { + {0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f,0.54507f}, + {0.60562f,0.59923f,0.59133f,0.58213f,0.57184f,0.56070f,0.54892f,0.53679f,0.52458f,0.51262f,0.50121f,0.49067f,0.48128f,0.47330f,0.46697f,0.46249f,0.46006f,0.45986f,0.46203f,0.46665f,0.47372f,0.48312f,0.49460f,0.50778f,0.52217f,0.53717f,0.55217f,0.56652f,0.57964f,0.59102f,0.60027f,0.60715f,0.61152f,0.61342f,0.61294f,0.61026f,0.60562f}, + {0.62993f,0.61663f,0.60163f,0.58513f,0.56721f,0.54792f,0.52741f,0.50597f,0.48417f,0.46274f,0.44252f,0.42424f,0.40840f,0.39524f,0.38483f,0.37722f,0.37262f,0.37149f,0.37444f,0.38211f,0.39496f,0.41303f,0.43591f,0.46271f,0.49220f,0.52288f,0.55321f,0.58160f,0.60660f,0.62705f,0.64217f,0.65166f,0.65569f,0.65477f,0.64966f,0.64113f,0.62993f}, + {0.61859f,0.59954f,0.57951f,0.55859f,0.53652f,0.51281f,0.48703f,0.45921f,0.43010f,0.40125f,0.37460f,0.35184f,0.33383f,0.32034f,0.31043f,0.30313f,0.29816f,0.29624f,0.29887f,0.30789f,0.32478f,0.35003f,0.38290f,0.42162f,0.46385f,0.50716f,0.54918f,0.58755f,0.62009f,0.64502f,0.66138f,0.66918f,0.66921f,0.66276f,0.65127f,0.63614f,0.61859f}, + {0.58434f,0.56134f,0.53820f,0.51511f,0.49174f,0.46715f,0.44010f,0.40984f,0.37699f,0.34382f,0.31364f,0.28967f,0.27359f,0.26453f,0.25966f,0.25610f,0.25262f,0.24997f,0.25053f,0.25779f,0.27518f,0.30435f,0.34417f,0.39141f,0.44206f,0.49253f,0.54000f,0.58194f,0.61593f,0.64015f,0.65395f,0.65794f,0.65353f,0.64245f,0.62626f,0.60641f,0.58434f}, + {0.53921f,0.51448f,0.48995f,0.46595f,0.44250f,0.41888f,0.39359f,0.36521f,0.33366f,0.30097f,0.27115f,0.24895f,0.23726f,0.23477f,0.23677f,0.23885f,0.23920f,0.23803f,0.23691f,0.23986f,0.25296f,0.28060f,0.32245f,0.37391f,0.42855f,0.48085f,0.52753f,0.56643f,0.59562f,0.61429f,0.62316f,0.62341f,0.61626f,0.60311f,0.58508f,0.56327f,0.53921f}, + {0.48785f,0.46379f,0.43988f,0.41636f,0.39367f,0.37182f,0.34998f,0.32674f,0.30099f,0.27346f,0.24780f,0.22959f,0.22251f,0.22507f,0.23198f,0.23916f,0.24558f,0.25057f,0.25278f,0.25389f,0.26060f,0.28058f,0.31692f,0.36595f,0.41928f,0.46891f,0.51065f,0.54231f,0.56238f,0.57214f,0.57493f,0.57236f,0.56426f,0.55095f,0.53309f,0.51149f,0.48785f}, + {0.43209f,0.41089f,0.38995f,0.36941f,0.34979f,0.33155f,0.31470f,0.29826f,0.28044f,0.26067f,0.24164f,0.22828f,0.22418f,0.22862f,0.23770f,0.24867f,0.26122f,0.27397f,0.28296f,0.28650f,0.28895f,0.29863f,0.32271f,0.36133f,0.40653f,0.44908f,0.48374f,0.50731f,0.51774f,0.51826f,0.51530f,0.51075f,0.50252f,0.48985f,0.47321f,0.45336f,0.43209f}, + {0.37890f,0.36283f,0.34739f,0.33271f,0.31922f,0.30724f,0.29696f,0.28780f,0.27809f,0.26658f,0.25432f,0.24439f,0.23994f,0.24247f,0.25117f,0.26398f,0.27930f,0.29517f,0.30771f,0.31403f,0.31546f,0.31823f,0.33068f,0.35590f,0.38846f,0.42051f,0.44683f,0.46322f,0.46680f,0.46142f,0.45465f,0.44832f,0.43950f,0.42721f,0.41228f,0.39568f,0.37890f}, + {0.34114f,0.33192f,0.32348f,0.31616f,0.31061f,0.30672f,0.30410f,0.30225f,0.29980f,0.29492f,0.28700f,0.27755f,0.26956f,0.26653f,0.27083f,0.28123f,0.29446f,0.30791f,0.31935f,0.32678f,0.32987f,0.33216f,0.33985f,0.35562f,0.37648f,0.39779f,0.41572f,0.42632f,0.42691f,0.42012f,0.41134f,0.40209f,0.39087f,0.37775f,0.36429f,0.35181f,0.34114f}, + {0.32818f,0.32516f,0.32319f,0.32283f,0.32517f,0.32980f,0.33535f,0.34062f,0.34397f,0.34296f,0.33615f,0.32475f,0.31211f,0.30265f,0.30010f,0.30443f,0.31265f,0.32241f,0.33228f,0.34067f,0.34700f,0.35327f,0.36224f,0.37416f,0.38773f,0.40158f,0.41356f,0.42060f,0.42076f,0.41455f,0.40362f,0.38928f,0.37303f,0.35700f,0.34334f,0.33369f,0.32818f}, + {0.33981f,0.34000f,0.34266f,0.34809f,0.35721f,0.36937f,0.38240f,0.39400f,0.40180f,0.40293f,0.39568f,0.38157f,0.36502f,0.35110f,0.34343f,0.34233f,0.34605f,0.35337f,0.36304f,0.37282f,0.38187f,0.39163f,0.40273f,0.41394f,0.42487f,0.43601f,0.44625f,0.45294f,0.45399f,0.44803f,0.43420f,0.41393f,0.39124f,0.37028f,0.35389f,0.34377f,0.33981f}, + {0.37236f,0.37289f,0.37826f,0.38816f,0.40237f,0.41956f,0.43724f,0.45274f,0.46333f,0.46592f,0.45864f,0.44316f,0.42447f,0.40808f,0.39741f,0.39283f,0.39339f,0.39860f,0.40735f,0.41725f,0.42701f,0.43745f,0.44902f,0.46095f,0.47308f,0.48570f,0.49764f,0.50631f,0.50895f,0.50305f,0.48719f,0.46316f,0.43591f,0.41060f,0.39068f,0.37789f,0.37236f}, + {0.42245f,0.42215f,0.42846f,0.44064f,0.45724f,0.47601f,0.49435f,0.50993f,0.52038f,0.52304f,0.51631f,0.50148f,0.48288f,0.46550f,0.45264f,0.44515f,0.44269f,0.44488f,0.45083f,0.45875f,0.46742f,0.47714f,0.48867f,0.50225f,0.51759f,0.53373f,0.54863f,0.55948f,0.56339f,0.55795f,0.54232f,0.51859f,0.49131f,0.46537f,0.44426f,0.42977f,0.42245f}, + {0.48319f,0.48226f,0.48758f,0.49842f,0.51308f,0.52913f,0.54416f,0.55622f,0.56358f,0.56459f,0.55836f,0.54575f,0.52954f,0.51323f,0.49956f,0.48985f,0.48445f,0.48324f,0.48569f,0.49085f,0.49796f,0.50710f,0.51894f,0.53390f,0.55144f,0.56981f,0.58634f,0.59810f,0.60259f,0.59827f,0.58527f,0.56571f,0.54318f,0.52144f,0.50331f,0.49032f,0.48319f}, + {0.53929f,0.53799f,0.54070f,0.54691f,0.55552f,0.56497f,0.57363f,0.58010f,0.58328f,0.58236f,0.57702f,0.56775f,0.55586f,0.54317f,0.53137f,0.52173f,0.51505f,0.51167f,0.51159f,0.51458f,0.52039f,0.52900f,0.54059f,0.55506f,0.57159f,0.58845f,0.60334f,0.61392f,0.61846f,0.61626f,0.60790f,0.59512f,0.58032f,0.56589f,0.55363f,0.54459f,0.53929f}, + {0.57278f,0.57090f,0.57068f,0.57187f,0.57403f,0.57656f,0.57878f,0.58007f,0.57991f,0.57795f,0.57409f,0.56849f,0.56162f,0.55414f,0.54681f,0.54040f,0.53554f,0.53271f,0.53223f,0.53423f,0.53873f,0.54564f,0.55475f,0.56559f,0.57735f,0.58891f,0.59900f,0.60643f,0.61040f,0.61066f,0.60758f,0.60203f,0.59514f,0.58801f,0.58156f,0.57637f,0.57278f}, + {0.57900f,0.57728f,0.57584f,0.57463f,0.57360f,0.57263f,0.57160f,0.57039f,0.56890f,0.56707f,0.56489f,0.56241f,0.55976f,0.55710f,0.55465f,0.55263f,0.55127f,0.55074f,0.55121f,0.55273f,0.55530f,0.55883f,0.56314f,0.56798f,0.57300f,0.57785f,0.58216f,0.58562f,0.58802f,0.58928f,0.58943f,0.58865f,0.58716f,0.58523f,0.58309f,0.58097f,0.57900f}, + {0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f,0.56830f} +}; \ No newline at end of file diff --git a/src/main/target/common.h b/src/main/target/common.h index b550df42d0f..0b878067c45 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -117,8 +117,6 @@ #define NAV_NON_VOLATILE_WAYPOINT_CLI -#define NAV_AUTO_MAG_DECLINATION_PRECISE - #define USE_D_BOOST #define USE_ANTIGRAVITY diff --git a/src/utils/declination.py b/src/utils/declination.py index 44f5c9f21db..da0f805b392 100755 --- a/src/utils/declination.py +++ b/src/utils/declination.py @@ -1,133 +1,252 @@ -#!/usr/bin/env python - -# Ported from https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Declination/generate -# Run this script with python3! -# To install the igrf module, use python3 -m pip install --user igrf12 -# Note that it requires a fortran compiler - -''' -generate field tables from IGRF12 +#!/usr/bin/env python3 ''' +generate field tables from IGRF13. Note that this requires python3 -import collections -import datetime -import pathlib -import sys - -import igrf -import numpy as np +To run the generator you need the igrf module. Install like this: -SAMPLING_RES = 10 -SAMPLING_MIN_LAT = -90 -SAMPLING_MAX_LAT = 90 -SAMPLING_MIN_LON = -180 -SAMPLING_MAX_LON = 180 + python3 -m pip install --user igrf -# This is used for flash constrained environments. We limit -# the latitude range to [-60, 60], so the values fit in an int8_t -SAMPLING_COMPACT_MIN_LAT = -60 -SAMPLING_COMPACT_MAX_LAT = 60 +And run: -PREPROCESSOR_SYMBOL = 'NAV_AUTO_MAG_DECLINATION_PRECISE' + python3 src/utils/declination.py -Query = collections.namedtuple('Query', ['date', 'res', 'min_lat', 'max_lat', 'min_lon', 'max_lon']) -Result = collections.namedtuple('Result', ['query', 'lats', 'lons', 'declination', 'inclination', 'intensity']) +It will updates the navigation_declination_gen.c code +''' -def write_table(f, name, table, compact): +import igrf +import numpy as np +import datetime +import pathlib +from math import sin, cos, sqrt +import math + +class Vector3(object): + '''a vector''' + def __init__(self, x=None, y=None, z=None): + if x is not None and y is not None and z is not None: + self.x = float(x) + self.y = float(y) + self.z = float(z) + elif x is not None and len(x) == 3: + self.x = float(x[0]) + self.y = float(x[1]) + self.z = float(x[2]) + elif x is not None: + raise ValueError('bad initializer') + else: + self.x = float(0) + self.y = float(0) + self.z = float(0) + + def length(self): + return sqrt(self.x**2 + self.y**2 + self.z**2) + + def __sub__(self, other): + return Vector3(self.x - other.x, self.y - other.y, self.z - other.z) + + def __mul__(self, other): + if isinstance(other, (int, float)): + return Vector3(self.x * other, self.y * other, self.z * other) + elif isinstance(other, Vector3): + return self.x * other.x + self.y * other.y + self.z * other.z + else: + raise ValueError('Multiplication with unsupported type') + +class Matrix3(object): + '''a 3x3 matrix, intended as a rotation matrix''' + def __init__(self, a=None, b=None, c=None): + if a is not None and b is not None and c is not None: + self.a = a.copy() + self.b = b.copy() + self.c = c.copy() + else: + self.identity() + + def identity(self): + self.a = Vector3(1,0,0) + self.b = Vector3(0,1,0) + self.c = Vector3(0,0,1) + + def from_euler(self, roll, pitch, yaw): + '''fill the matrix from Euler angles in radians''' + cp = cos(pitch) + sp = sin(pitch) + sr = sin(roll) + cr = cos(roll) + sy = sin(yaw) + cy = cos(yaw) + + self.a.x = cp * cy + self.a.y = (sr * sp * cy) - (cr * sy) + self.a.z = (cr * sp * cy) + (sr * sy) + self.b.x = cp * sy + self.b.y = (sr * sp * sy) + (cr * cy) + self.b.z = (cr * sp * sy) - (sr * cy) + self.c.x = -sp + self.c.y = sr * cp + self.c.z = cr * cp + + def __mul__(self, vector): + if isinstance(vector, Vector3): + x = self.a.x * vector.x + self.a.y * vector.y + self.a.z * vector.z + y = self.b.x * vector.x + self.b.y * vector.y + self.b.z * vector.z + z = self.c.x * vector.x + self.c.y * vector.y + self.c.z * vector.z + return Vector3(x, y, z) + else: + raise ValueError('Multiplication with unsupported type') + +def write_table(f, name, table): '''write one table''' - - if compact: - format_entry = lambda x: '%d' % round(x) - table_type = 'int8_t' - else: - table_type = 'float' - format_entry = lambda x: '%.5ff' % x - - num_lat = len(table) - num_lon = len(table[0]) - - f.write("static const %s %s[%u][%u] = {\n" % - (table_type, name, num_lat, num_lon)) - for i in range(num_lat): + f.write("const float %s[%u][%u] = {\n" % + (name, NUM_LAT, NUM_LON)) + for i in range(NUM_LAT): f.write(" {") - for j in range(num_lon): - f.write(format_entry(table[i][j])) - if j != num_lon - 1: + for j in range(NUM_LON): + f.write("%.5ff" % table[i][j]) + if j != NUM_LON-1: f.write(",") f.write("}") - if i != num_lat - 1: + if i != NUM_LAT-1: f.write(",") f.write("\n") f.write("};\n\n") -def declination_tables(query): - lats = np.arange(query.min_lat, query.max_lat + query.res, query.res) - lons = np.arange(query.min_lon, query.max_lon + query.res, query.res) - - num_lat = lats.size - num_lon = lons.size - - intensity = np.empty((num_lat, num_lon)) - inclination = np.empty((num_lat, num_lon)) - declination = np.empty((num_lat, num_lon)) - - for i, lat in enumerate(lats): - for j, lon in enumerate(lons): - mag = igrf.igrf(date, glat=lat, glon=lon, alt_km=0., isv=0, itype=1) - intensity[i][j] = mag.total / 1e5 - inclination[i][j] = mag.incl - declination[i][j] = mag.decl - - return Result(query=query, lats=lats, lons=lons, - declination=declination, inclination=inclination, intensity=intensity) - -def generate_constants(f, query): - f.write('#define SAMPLING_RES\t\t%.5ff\n' % query.res) - f.write('#define SAMPLING_MIN_LON\t%.5ff\n' % query.min_lon) - f.write('#define SAMPLING_MAX_LON\t%.5ff\n' % query.max_lon) - f.write('#define SAMPLING_MIN_LAT\t%.5ff\n' % query.min_lat) - f.write('#define SAMPLING_MAX_LAT\t%.5ff\n' % query.max_lat) - f.write('\n') - -def generate_tables(f, query, compact): - result = declination_tables(query) - write_table(f, 'declination_table', result.declination, compact) - - # We're not using these tables for now - #if not compact: - # write_table(f, 'inclination_table', result.inclination, False) - # write_table(f, 'intensity_table', result.intensity, False) - -def generate_code(f, date): - - compact_query = Query(date=date, res=SAMPLING_RES, - min_lat=SAMPLING_COMPACT_MIN_LAT, max_lat=SAMPLING_COMPACT_MAX_LAT, - min_lon=SAMPLING_MIN_LON, max_lon=SAMPLING_MAX_LON) +date = datetime.datetime.now() - precise_query = Query(date=date, res=SAMPLING_RES, - min_lat=SAMPLING_MIN_LAT, max_lat=SAMPLING_MAX_LAT, - min_lon=SAMPLING_MIN_LON, max_lon=SAMPLING_MAX_LON) +SAMPLING_RES = 10 +SAMPLING_MIN_LAT = -90 +SAMPLING_MAX_LAT = 90 +SAMPLING_MIN_LON = -180 +SAMPLING_MAX_LON = 180 +lats = np.arange(SAMPLING_MIN_LAT, SAMPLING_MAX_LAT+SAMPLING_RES, SAMPLING_RES) +lons = np.arange(SAMPLING_MIN_LON, SAMPLING_MAX_LON+SAMPLING_RES, SAMPLING_RES) + +NUM_LAT = lats.size +NUM_LON = lons.size + +intensity_table = np.empty((NUM_LAT, NUM_LON)) +inclination_table = np.empty((NUM_LAT, NUM_LON)) +declination_table = np.empty((NUM_LAT, NUM_LON)) + +max_error = 0 +max_error_pos = None +max_error_field = None + +def get_igrf(lat, lon): + '''return field as [declination_deg, inclination_deg, intensity_gauss]''' + mag = igrf.igrf(date, glat=lat, glon=lon, alt_km=0., isv=0, itype=1) + intensity = float(mag.total/1e5) + inclination = float(mag.incl) + declination = float(mag.decl) + return [declination, inclination, intensity] + +def interpolate_table(table, latitude_deg, longitude_deg): + '''interpolate inside a table for a given lat/lon in degrees''' + # round down to nearest sampling resolution + min_lat = int(math.floor(latitude_deg / SAMPLING_RES) * SAMPLING_RES) + min_lon = int(math.floor(longitude_deg / SAMPLING_RES) * SAMPLING_RES) + + # find index of nearest low sampling point + min_lat_index = int(math.floor((min_lat - SAMPLING_MIN_LAT) / SAMPLING_RES)) + min_lon_index = int(math.floor((min_lon - SAMPLING_MIN_LON) / SAMPLING_RES)) + + # calculate intensity + data_sw = table[min_lat_index][min_lon_index] + data_se = table[min_lat_index][min_lon_index + 1] + data_ne = table[min_lat_index + 1][min_lon_index + 1] + data_nw = table[min_lat_index + 1][min_lon_index] + + # perform bilinear interpolation on the four grid corners + data_min = ((longitude_deg - min_lon) / SAMPLING_RES) * (data_se - data_sw) + data_sw + data_max = ((longitude_deg - min_lon) / SAMPLING_RES) * (data_ne - data_nw) + data_nw + + value = ((latitude_deg - min_lat) / SAMPLING_RES) * (data_max - data_min) + data_min + return value + +def interpolate_field(latitude_deg, longitude_deg): + '''calculate magnetic field intensity and orientation, interpolating in tables + + returns array [declination_deg, inclination_deg, intensity] or None''' + # limit to table bounds + if latitude_deg < SAMPLING_MIN_LAT or latitude_deg >= SAMPLING_MAX_LAT: + return None + if longitude_deg < SAMPLING_MIN_LON or longitude_deg >= SAMPLING_MAX_LON: + return None + + intensity_gauss = interpolate_table(intensity_table, latitude_deg, longitude_deg) + declination_deg = interpolate_table(declination_table, latitude_deg, longitude_deg) + inclination_deg = interpolate_table(inclination_table, latitude_deg, longitude_deg) + + return [declination_deg, inclination_deg, intensity_gauss] + +def field_to_Vector3(mag): + '''return mGauss field from dec, inc and intensity''' + R = Matrix3() + mag_ef = Vector3(mag[2]*1000.0, 0.0, 0.0) + R.from_euler(0.0, -math.radians(mag[1]), math.radians(mag[0])) + return R * mag_ef + +def test_error(lat, lon): + '''check for error from lat, lon''' + global max_error, max_error_pos, max_error_field + mag1 = get_igrf(lat, lon) + mag2 = interpolate_field(lat, lon) + if mag2 is None: + return + ef1 = field_to_Vector3(mag1) + ef2 = field_to_Vector3(mag2) + err = (ef1 - ef2).length() + if err > max_error or err > 100: + print(lat, lon, err, ef1, ef2) + max_error = err + max_error_pos = (lat, lon) + max_error_field = ef1 - ef2 + +def test_max_error(lat, lon): + '''check for maximum error from lat, lon over SAMPLING_RES range''' + steps = 3 + delta = SAMPLING_RES/steps + for i in range(steps): + for j in range(steps): + lat2 = lat + i * delta + lon2 = lon + j * delta + if lat2 > SAMPLING_MAX_LAT or lon2 > SAMPLING_MAX_LON: + continue + if lat2 < SAMPLING_MIN_LAT or lon2 < SAMPLING_MIN_LON: + continue + test_error(lat2, lon2) + +for i, lat in enumerate(lats): + for j, lon in enumerate(lons): + mag = get_igrf(lat, lon) + declination_table[i][j] = mag[0] + inclination_table[i][j] = mag[1] + intensity_table[i][j] = mag[2] + +with open(pathlib.Path(__file__).parent / '..' / 'main' / 'navigation' / 'navigation_declination_gen.c', 'w') as f: f.write('/* this file is automatically generated by src/utils/declination.py - DO NOT EDIT! */\n\n\n') f.write('/* Updated on %s */\n\n\n' % date) - f.write('#include \n\n') - - - f.write('\n\n#if defined(%s)\n' % PREPROCESSOR_SYMBOL) - generate_constants(f, precise_query) - generate_tables(f, precise_query, False) - # We're not using these tables for now - # write_table(f, 'inclination_table', inclination_table) - # write_table(f, 'intensity_table', intensity_table) - f.write('#else /* !%s */\n' % PREPROCESSOR_SYMBOL) - generate_constants(f, compact_query) - generate_tables(f, compact_query, True) - f.write('#endif\n') - -if __name__ == '__main__': - - output = pathlib.PurePath(__file__).parent / '..' / 'main' / 'navigation' / 'navigation_declination_gen.c' - date = datetime.datetime.now() - with open(output, 'w') as f: - generate_code(f, date) + f.write('''const float SAMPLING_RES = %u; +const float SAMPLING_MIN_LAT = %u; +const float SAMPLING_MAX_LAT = %u; +const float SAMPLING_MIN_LON = %u; +const float SAMPLING_MAX_LON = %u; + +''' % (SAMPLING_RES, + SAMPLING_MIN_LAT, + SAMPLING_MAX_LAT, + SAMPLING_MIN_LON, + SAMPLING_MAX_LON)) + + write_table(f, 'declination_table', declination_table) + write_table(f, 'inclination_table', inclination_table) + write_table(f, 'intensity_table', intensity_table) + +print("Checking for maximum error") +for lat in range(-60, 60, 1): + for lon in range(-180, 180, 1): + test_max_error(lat, lon) +print("Generated with max error %.2f %s at (%.2f,%.2f)" % ( + max_error, max_error_field, max_error_pos[0], max_error_pos[1])) From c9779c2dee475b3627d8cfa469963e2e27a5ea1c Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 14 May 2024 11:42:13 +0100 Subject: [PATCH 052/429] rth trackback tweaks --- src/main/navigation/navigation.c | 8 ++------ src/main/navigation/rth_trackback.c | 15 ++++++++------- src/main/navigation/rth_trackback.h | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index c776ce13f54..cc4e269ef4b 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -301,10 +301,6 @@ bool validateRTHSanityChecker(void); void updateHomePosition(void); bool abortLaunchAllowed(void); -// static bool rthAltControlStickOverrideCheck(unsigned axis); -// static void updateRthTrackback(bool forceSaveTrackPoint); -// static fpVector3_t * rthGetTrackbackPos(void); - #ifdef USE_FW_AUTOLAND static float getLandAltitude(void); static int32_t calcWindDiff(int32_t heading, int32_t windHeading); @@ -1449,7 +1445,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_INITIALIZE(navigati } else { // Switch to RTH trackback - if (rthTrackBackIsActive() && rth_trackback.activePointIndex >= 0 && !isWaypointMissionRTHActive()) { + if (rthTrackBackCanBeActivated() && rth_trackback.activePointIndex >= 0 && !isWaypointMissionRTHActive()) { rthTrackBackUpdate(true); // save final trackpoint for altitude and max trackback distance reference posControl.flags.rthTrackbackActive = true; calculateAndSetActiveWaypointToLocalPosition(getRthTrackBackPosition()); @@ -1568,7 +1564,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_TRACKBACK(navigatio return NAV_FSM_EVENT_SWITCH_TO_EMERGENCY_LANDING; } - if (rthTrackBackSetNewPosition()) { + if (!rthTrackBackSetNewPosition()) { return NAV_FSM_EVENT_SWITCH_TO_NAV_STATE_RTH_INITIALIZE; } diff --git a/src/main/navigation/rth_trackback.c b/src/main/navigation/rth_trackback.c index 37467d9b385..dfdcf801f7c 100644 --- a/src/main/navigation/rth_trackback.c +++ b/src/main/navigation/rth_trackback.c @@ -37,9 +37,10 @@ rth_trackback_t rth_trackback; -bool rthTrackBackIsActive(void) +bool rthTrackBackCanBeActivated(void) { - return navConfig()->general.flags.rth_trackback_mode == RTH_TRACKBACK_ON || (navConfig()->general.flags.rth_trackback_mode == RTH_TRACKBACK_FS && posControl.flags.forcedRTHActivated); + return posControl.flags.estPosStatus >= EST_USABLE && + (navConfig()->general.flags.rth_trackback_mode == RTH_TRACKBACK_ON || (navConfig()->general.flags.rth_trackback_mode == RTH_TRACKBACK_FS && posControl.flags.forcedRTHActivated)); } void rthTrackBackUpdate(bool forceSaveTrackPoint) @@ -127,7 +128,7 @@ void rthTrackBackUpdate(bool forceSaveTrackPoint) bool rthTrackBackSetNewPosition(void) { if (posControl.flags.estPosStatus == EST_NONE) { - return false; + return false; // will fall back to RTH initialize allowing full RTH to handle position loss correctly } const int32_t distFromStartTrackback = CENTIMETERS_TO_METERS(calculateDistanceToDestination(&rth_trackback.pointsList[rth_trackback.lastSavedIndex])); @@ -142,7 +143,7 @@ bool rthTrackBackSetNewPosition(void) if (rth_trackback.activePointIndex < 0 || cancelTrackback) { rth_trackback.WrapAroundCounter = rth_trackback.activePointIndex = -1; posControl.flags.rthTrackbackActive = false; - return true; // Procede to home after final trackback point + return false; // No more trackback points to set, procede to home } if (isWaypointReached(&posControl.activeWaypoint.pos, &posControl.activeWaypoint.bearing)) { @@ -161,7 +162,7 @@ bool rthTrackBackSetNewPosition(void) setDesiredPosition(getRthTrackBackPosition(), 0, NAV_POS_UPDATE_XY | NAV_POS_UPDATE_Z | NAV_POS_UPDATE_BEARING); } - return false; + return true; } fpVector3_t *getRthTrackBackPosition(void) @@ -174,9 +175,9 @@ fpVector3_t *getRthTrackBackPosition(void) return &rth_trackback.pointsList[rth_trackback.activePointIndex]; } -void resetRthTrackBack(void) +void resetRthTrackBack(void) { rth_trackback.activePointIndex = -1; posControl.flags.rthTrackbackActive = false; - rth_trackback.WrapAroundCounter = -1; + rth_trackback.WrapAroundCounter = -1; } \ No newline at end of file diff --git a/src/main/navigation/rth_trackback.h b/src/main/navigation/rth_trackback.h index e3c71d0d45e..f3337bb4b79 100644 --- a/src/main/navigation/rth_trackback.h +++ b/src/main/navigation/rth_trackback.h @@ -35,7 +35,7 @@ typedef struct extern rth_trackback_t rth_trackback; -bool rthTrackBackIsActive(void); +bool rthTrackBackCanBeActivated(void); bool rthTrackBackSetNewPosition(void); void rthTrackBackUpdate(bool forceSaveTrackPoint); fpVector3_t *getRthTrackBackPosition(void); From 9c64e9b65d1321af35acace2696001a2aff58f40 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Wed, 15 May 2024 11:44:47 +0100 Subject: [PATCH 053/429] baro altitude estimation fix --- docs/Settings.md | 10 ------ src/main/fc/fc_msp_box.c | 2 +- src/main/fc/settings.yaml | 5 --- src/main/navigation/navigation.h | 2 -- .../navigation/navigation_pos_estimator.c | 31 +++++++++++-------- 5 files changed, 19 insertions(+), 31 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 30533330adf..14eb3b3dfce 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1812,16 +1812,6 @@ Allows to chose when the home position is reset. Can help prevent resetting home --- -### inav_use_gps_no_baro - -Defines if INAV should use only use GPS data for altitude estimation when barometer is not available. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed. - -| Default | Min | Max | -| --- | --- | --- | -| ON | OFF | ON | - ---- - ### inav_w_acc_bias Weight for accelerometer drift estimation diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 2745f7e041b..7ffbbefd95e 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -215,7 +215,7 @@ void initActiveBoxIds(void) bool navReadyAltControl = getHwBarometerStatus() != HW_SENSOR_NONE; #ifdef USE_GPS - navReadyAltControl = navReadyAltControl || (feature(FEATURE_GPS) && (STATE(AIRPLANE) || positionEstimationConfig()->use_gps_no_baro)); + navReadyAltControl = navReadyAltControl || feature(FEATURE_GPS); const bool navFlowDeadReckoning = sensors(SENSOR_OPFLOW) && sensors(SENSOR_ACC) && positionEstimationConfig()->allow_dead_reckoning; bool navReadyPosControl = sensors(SENSOR_ACC) && feature(FEATURE_GPS); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index dfa7bb97d35..898c1b7be7a 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2271,11 +2271,6 @@ groups: field: gravity_calibration_tolerance min: 0 max: 255 - - name: inav_use_gps_no_baro - description: "Defines if INAV should use only use GPS data for altitude estimation when barometer is not available. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed." - field: use_gps_no_baro - type: bool - default_value: ON - name: inav_allow_dead_reckoning description: "Defines if INAV will dead-reckon over short GPS outages. May also be useful for indoors OPFLOW navigation" default_value: OFF diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 0613a19c24e..276fb61cc1e 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -260,8 +260,6 @@ typedef struct positionEstimationConfig_s { float max_eph_epv; // Max estimated position error acceptable for estimation (cm) float baro_epv; // Baro position error - uint8_t use_gps_no_baro; - #ifdef USE_GPS_FIX_ESTIMATION uint8_t allow_gps_fix_estimation; #endif diff --git a/src/main/navigation/navigation_pos_estimator.c b/src/main/navigation/navigation_pos_estimator.c index 19018983cc5..30fa4012e46 100755 --- a/src/main/navigation/navigation_pos_estimator.c +++ b/src/main/navigation/navigation_pos_estimator.c @@ -56,7 +56,7 @@ navigationPosEstimator_t posEstimator; static float initialBaroAltitudeOffset = 0.0f; -PG_REGISTER_WITH_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, PG_POSITION_ESTIMATION_CONFIG, 6); +PG_REGISTER_WITH_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, PG_POSITION_ESTIMATION_CONFIG, 7); PG_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, // Inertial position estimator parameters @@ -64,7 +64,6 @@ PG_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig, .reset_altitude_type = SETTING_INAV_RESET_ALTITUDE_DEFAULT, .reset_home_type = SETTING_INAV_RESET_HOME_DEFAULT, .gravity_calibration_tolerance = SETTING_INAV_GRAVITY_CAL_TOLERANCE_DEFAULT, // 5 cm/s/s calibration error accepted (0.5% of gravity) - .use_gps_no_baro = SETTING_INAV_USE_GPS_NO_BARO_DEFAULT, // Use GPS altitude if no baro is available on all aircrafts .allow_dead_reckoning = SETTING_INAV_ALLOW_DEAD_RECKONING_DEFAULT, .max_surface_altitude = SETTING_INAV_MAX_SURFACE_ALTITUDE_DEFAULT, @@ -180,12 +179,12 @@ void onNewGPSData(void) newLLH.lon = gpsSol.llh.lon; newLLH.alt = gpsSol.llh.alt; - if (sensors(SENSOR_GPS) + if (sensors(SENSOR_GPS) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) #endif ) { - if (!(STATE(GPS_FIX) + if (!(STATE(GPS_FIX) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) #endif @@ -553,15 +552,20 @@ static bool estimationCalculateCorrection_Z(estimationContext_t * ctx) DEBUG_SET(DEBUG_ALTITUDE, 7, accGetClipCount()); // Clip count bool correctOK = false; - - //ignore baro if difference is too big, baro is probably wrong - const float gpsBaroResidual = ctx->newFlags & EST_GPS_Z_VALID ? fabsf(posEstimator.gps.pos.z - posEstimator.baro.alt) : 0.0f; - //fade out the baro to prevent sudden jump - const float start_epv = positionEstimationConfig()->max_eph_epv; - const float end_epv = positionEstimationConfig()->max_eph_epv * 2.0f; - const float wBaro = scaleRangef(constrainf(gpsBaroResidual, start_epv, end_epv), start_epv, end_epv, 1.0f, 0.0f); - //use both baro and gps - if ((ctx->newFlags & EST_BARO_VALID) && (!positionEstimationConfig()->use_gps_no_baro) && (wBaro > 0.01f)) { + + float wBaro = 0.0f; + if (ctx->newFlags & EST_BARO_VALID) { + // Ignore baro if difference is too big, baro is probably wrong + const float gpsBaroResidual = ctx->newFlags & EST_GPS_Z_VALID ? fabsf(posEstimator.gps.pos.z - posEstimator.baro.alt) : 0.0f; + + // Fade out the baro to prevent sudden jump + const float start_epv = positionEstimationConfig()->max_eph_epv; + const float end_epv = positionEstimationConfig()->max_eph_epv * 2.0f; + wBaro = scaleRangef(constrainf(gpsBaroResidual, start_epv, end_epv), start_epv, end_epv, 1.0f, 0.0f); + } + + // Always use Baro if no GPS otherwise only use if accuracy OK compared to GPS + if (wBaro > 0.01f) { timeUs_t currentTimeUs = micros(); if (!ARMING_FLAG(ARMED)) { @@ -597,6 +601,7 @@ static bool estimationCalculateCorrection_Z(estimationContext_t * ctx) correctOK = true; } + if (ctx->newFlags & EST_GPS_Z_VALID) { // Reset current estimate to GPS altitude if estimate not valid if (!(ctx->newFlags & EST_Z_VALID)) { From 283baa7c0a28685ec184dd1f57a822009c46480b Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Wed, 15 May 2024 20:01:08 +0100 Subject: [PATCH 054/429] Initial changes --- src/main/CMakeLists.txt | 4 +- src/main/drivers/osd.h | 4 +- src/main/drivers/osd_symbols.h | 6 +- src/main/io/bf_osd_symbols.h | 163 ---- src/main/io/displayport_msp_bf_compat.c | 748 ------------------ src/main/io/displayport_msp_dji_compat.c | 713 +++++++++++++++++ ..._compat.h => displayport_msp_dji_compat.h} | 12 +- src/main/io/displayport_msp_osd.c | 18 +- src/main/io/dji_osd_symbols.h | 164 ++++ src/main/io/osd.c | 127 +-- src/main/io/osd_grid.c | 8 +- src/main/io/osd_hud.c | 4 +- src/main/io/osd_utils.c | 4 +- 13 files changed, 948 insertions(+), 1027 deletions(-) delete mode 100644 src/main/io/bf_osd_symbols.h delete mode 100644 src/main/io/displayport_msp_bf_compat.c create mode 100644 src/main/io/displayport_msp_dji_compat.c rename src/main/io/{displayport_msp_bf_compat.h => displayport_msp_dji_compat.h} (69%) create mode 100644 src/main/io/dji_osd_symbols.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 28c068966f8..c87abc1782d 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -500,8 +500,8 @@ main_sources(COMMON_SRC io/displayport_max7456.h io/displayport_msp.c io/displayport_msp.h - io/displayport_msp_bf_compat.c - io/displayport_msp_bf_compat.h + io/displayport_msp_dji_compat.c + io/displayport_msp_dji_compat.h io/displayport_oled.c io/displayport_oled.h io/displayport_msp_osd.c diff --git a/src/main/drivers/osd.h b/src/main/drivers/osd.h index e9ae4d5ef3f..a8b0bbc8e42 100644 --- a/src/main/drivers/osd.h +++ b/src/main/drivers/osd.h @@ -49,8 +49,8 @@ typedef enum { VIDEO_SYSTEM_HDZERO, VIDEO_SYSTEM_DJIWTF, VIDEO_SYSTEM_AVATAR, - VIDEO_SYSTEM_BFCOMPAT, - VIDEO_SYSTEM_BFCOMPAT_HD + VIDEO_SYSTEM_DJICOMPAT, + VIDEO_SYSTEM_DJICOMPAT_HD } videoSystem_e; typedef enum { diff --git a/src/main/drivers/osd_symbols.h b/src/main/drivers/osd_symbols.h index 91cdcbb5f6b..90c0bc97131 100644 --- a/src/main/drivers/osd_symbols.h +++ b/src/main/drivers/osd_symbols.h @@ -44,9 +44,9 @@ #define SYM_DBM 0x13 // 019 dBm #define SYM_SNR 0x14 // 020 SNR -#define SYM_AH_DIRECTION_UP 0x15 // 021 Arrow up AHI -#define SYM_AH_DIRECTION_DOWN 0x16 // 022 Arrow down AHI -#define SYM_DIRECTION 0x17 // 023 to 030, directional little arrows +#define SYM_AH_DECORATION_UP 0x15 // 021 Arrow up AHI +#define SYM_AH_DECORATION_DOWN 0x16 // 022 Arrow down AHI +#define SYM_DECORATION 0x17 // 023 to 030, directional little arrows #define SYM_VOLT 0x1F // 031 VOLTS #define SYM_MAH 0x99 // 153 mAh diff --git a/src/main/io/bf_osd_symbols.h b/src/main/io/bf_osd_symbols.h deleted file mode 100644 index a63b9470fb3..00000000000 --- a/src/main/io/bf_osd_symbols.h +++ /dev/null @@ -1,163 +0,0 @@ -/* @file max7456_symbols.h - * @brief max7456 symbols for the mwosd font set - * - * @author Nathan Tsoi nathan@vertile.com - * - * Copyright (C) 2016 Nathan Tsoi - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ - -#pragma once - -//Misc -#define BF_SYM_NONE 0x00 -#define BF_SYM_END_OF_FONT 0xFF -#define BF_SYM_BLANK 0x20 -#define BF_SYM_HYPHEN 0x2D -#define BF_SYM_BBLOG 0x10 -#define BF_SYM_HOMEFLAG 0x11 -#define BF_SYM_RPM 0x12 -#define BF_SYM_ROLL 0x14 -#define BF_SYM_PITCH 0x15 -#define BF_SYM_TEMPERATURE 0x7A - -// GPS and navigation -#define BF_SYM_LAT 0x89 -#define BF_SYM_LON 0x98 -#define BF_SYM_ALTITUDE 0x7F -#define BF_SYM_TOTAL_DISTANCE 0x71 -#define BF_SYM_OVER_HOME 0x05 - -// RSSI -#define BF_SYM_RSSI 0x01 -#define BF_SYM_LINK_QUALITY 0x7B - -// Throttle Position (%) -#define BF_SYM_THR 0x04 - -// Unit Icons (Metric) -#define BF_SYM_M 0x0C -#define BF_SYM_KM 0x7D -#define BF_SYM_C 0x0E - -// Unit Icons (Imperial) -#define BF_SYM_FT 0x0F -#define BF_SYM_MILES 0x7E -#define BF_SYM_F 0x0D - -// Heading Graphics -#define BF_SYM_HEADING_N 0x18 -#define BF_SYM_HEADING_S 0x19 -#define BF_SYM_HEADING_E 0x1A -#define BF_SYM_HEADING_W 0x1B -#define BF_SYM_HEADING_DIVIDED_LINE 0x1C -#define BF_SYM_HEADING_LINE 0x1D - -// AH Center screen Graphics -#define BF_SYM_AH_CENTER_LINE 0x72 -#define BF_SYM_AH_CENTER 0x73 -#define BF_SYM_AH_CENTER_LINE_RIGHT 0x74 -#define BF_SYM_AH_RIGHT 0x02 -#define BF_SYM_AH_LEFT 0x03 -#define BF_SYM_AH_DECORATION 0x13 - -// Satellite Graphics -#define BF_SYM_SAT_L 0x1E -#define BF_SYM_SAT_R 0x1F - -// Direction arrows -#define BF_SYM_ARROW_SOUTH 0x60 -#define BF_SYM_ARROW_2 0x61 -#define BF_SYM_ARROW_3 0x62 -#define BF_SYM_ARROW_4 0x63 -#define BF_SYM_ARROW_EAST 0x64 -#define BF_SYM_ARROW_6 0x65 -#define BF_SYM_ARROW_7 0x66 -#define BF_SYM_ARROW_8 0x67 -#define BF_SYM_ARROW_NORTH 0x68 -#define BF_SYM_ARROW_10 0x69 -#define BF_SYM_ARROW_11 0x6A -#define BF_SYM_ARROW_12 0x6B -#define BF_SYM_ARROW_WEST 0x6C -#define BF_SYM_ARROW_14 0x6D -#define BF_SYM_ARROW_15 0x6E -#define BF_SYM_ARROW_16 0x6F - -#define BF_SYM_ARROW_SMALL_UP 0x75 -#define BF_SYM_ARROW_SMALL_DOWN 0x76 - -// AH Bars -#define BF_SYM_AH_BAR9_0 0x80 -#define BF_SYM_AH_BAR9_1 0x81 -#define BF_SYM_AH_BAR9_2 0x82 -#define BF_SYM_AH_BAR9_3 0x83 -#define BF_SYM_AH_BAR9_4 0x84 -#define BF_SYM_AH_BAR9_5 0x85 -#define BF_SYM_AH_BAR9_6 0x86 -#define BF_SYM_AH_BAR9_7 0x87 -#define BF_SYM_AH_BAR9_8 0x88 - -// Progress bar -#define BF_SYM_PB_START 0x8A -#define BF_SYM_PB_FULL 0x8B -#define BF_SYM_PB_HALF 0x8C -#define BF_SYM_PB_EMPTY 0x8D -#define BF_SYM_PB_END 0x8E -#define BF_SYM_PB_CLOSE 0x8F - -// Batt evolution -#define BF_SYM_BATT_FULL 0x90 -#define BF_SYM_BATT_5 0x91 -#define BF_SYM_BATT_4 0x92 -#define BF_SYM_BATT_3 0x93 -#define BF_SYM_BATT_2 0x94 -#define BF_SYM_BATT_1 0x95 -#define BF_SYM_BATT_EMPTY 0x96 - -// Batt Icons -#define BF_SYM_MAIN_BATT 0x97 - -// Voltage and amperage -#define BF_SYM_VOLT 0x06 -#define BF_SYM_AMP 0x9A -#define BF_SYM_MAH 0x07 -#define BF_SYM_WATT 0x57 // 0x57 is 'W' - -// Time -#define BF_SYM_ON_M 0x9B -#define BF_SYM_FLY_M 0x9C - -// Speed -#define BF_SYM_SPEED 0x70 -#define BF_SYM_KPH 0x9E -#define BF_SYM_MPH 0x9D -#define BF_SYM_MPS 0x9F -#define BF_SYM_FTPS 0x99 - -// Menu cursor -#define BF_SYM_CURSOR BF_SYM_AH_LEFT - -// Stick overlays -#define BF_SYM_STICK_OVERLAY_SPRITE_HIGH 0x08 -#define BF_SYM_STICK_OVERLAY_SPRITE_MID 0x09 -#define BF_SYM_STICK_OVERLAY_SPRITE_LOW 0x0A -#define BF_SYM_STICK_OVERLAY_CENTER 0x0B -#define BF_SYM_STICK_OVERLAY_VERTICAL 0x16 -#define BF_SYM_STICK_OVERLAY_HORIZONTAL 0x17 - -// GPS degree/minute/second symbols -#define BF_SYM_GPS_DEGREE BF_SYM_STICK_OVERLAY_SPRITE_HIGH // kind of looks like the degree symbol -#define BF_SYM_GPS_MINUTE 0x27 // ' -#define BF_SYM_GPS_SECOND 0x22 // " diff --git a/src/main/io/displayport_msp_bf_compat.c b/src/main/io/displayport_msp_bf_compat.c deleted file mode 100644 index e7f75ec2fa5..00000000000 --- a/src/main/io/displayport_msp_bf_compat.c +++ /dev/null @@ -1,748 +0,0 @@ -/* - * This file is part of INAV Project. - * - * INAV is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Cleanflight is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cleanflight. If not, see . - */ - -#include "platform.h" - -#if defined(USE_OSD) && defined(USE_MSP_DISPLAYPORT) - -#ifndef DISABLE_MSP_BF_COMPAT - -#include "io/displayport_msp_bf_compat.h" -#include "io/bf_osd_symbols.h" -#include "drivers/osd_symbols.h" - -uint8_t getBfCharacter(uint8_t ch, uint8_t page) -{ - uint16_t ech = ch | ((page & 0x3)<< 8) ; - - if (ech >= 0x20 && ech <= 0x5F) { // ASCII range - return ch; - } - - if (ech >= SYM_AH_DECORATION_MIN && ech <= SYM_AH_DECORATION_MAX) { - return BF_SYM_AH_DECORATION; - } - - switch (ech) { - case SYM_RSSI: - return BF_SYM_RSSI; - - case SYM_LQ: - return BF_SYM_LINK_QUALITY; - - case SYM_LAT: - return BF_SYM_LAT; - - case SYM_LON: - return BF_SYM_LON; - - case SYM_SAT_L: - return BF_SYM_SAT_L; - - case SYM_SAT_R: - return BF_SYM_SAT_R; - - case SYM_HOME_NEAR: - return BF_SYM_HOMEFLAG; - - case SYM_DEGREES: - return BF_SYM_GPS_DEGREE; - -/* - case SYM_HEADING: - return BF_SYM_HEADING; - - case SYM_SCALE: - return BF_SYM_SCALE; - - case SYM_HDP_L: - return BF_SYM_HDP_L; - - case SYM_HDP_R: - return BF_SYM_HDP_R; -*/ - case SYM_HOME: - return BF_SYM_HOMEFLAG; - - case SYM_2RSS: - return BF_SYM_RSSI; - -/* - case SYM_DB: - return BF_SYM_DB - - case SYM_DBM: - return BF_SYM_DBM; - - case SYM_SNR: - return BF_SYM_SNR; - - case SYM_AH_DECORATION_UP: - return BF_SYM_AH_DECORATION_UP; - - case SYM_AH_DECORATION_DOWN: - return BF_SYM_AH_DECORATION_DOWN; -*/ - case SYM_DIRECTION: - return BF_SYM_ARROW_NORTH; - - case SYM_DIRECTION + 1: // NE pointing arrow - return BF_SYM_ARROW_7; - - case SYM_DIRECTION + 2: // E pointing arrow - return BF_SYM_ARROW_EAST; - - case SYM_DIRECTION + 3: // SE pointing arrow - return BF_SYM_ARROW_3; - - case SYM_DIRECTION + 4: // S pointing arrow - return BF_SYM_ARROW_SOUTH; - - case SYM_DIRECTION + 5: // SW pointing arrow - return BF_SYM_ARROW_15; - - case SYM_DIRECTION + 6: // W pointing arrow - return BF_SYM_ARROW_WEST; - - case SYM_DIRECTION + 7: // NW pointing arrow - return BF_SYM_ARROW_11; - - case SYM_VOLT: - return BF_SYM_VOLT; - - case SYM_MAH: - return BF_SYM_MAH; - - case SYM_AH_KM: - return BF_SYM_KM; - - case SYM_AH_MI: - return BF_SYM_MILES; -/* - case SYM_VTX_POWER: - return BF_SYM_VTX_POWER; - - case SYM_AH_NM: - return BF_SYM_AH_NM; - - case SYM_MAH_NM_0: - return BF_SYM_MAH_NM_0; - - case SYM_MAH_NM_1: - return BF_SYM_MAH_NM_1; - - case SYM_MAH_KM_0: - return BF_SYM_MAH_KM_0; - - case SYM_MAH_KM_1: - return BF_SYM_MAH_KM_1; - - case SYM_MILLIOHM: - return BF_SYM_MILLIOHM; -*/ - case SYM_BATT_FULL: - return BF_SYM_BATT_FULL; - - case SYM_BATT_5: - return BF_SYM_BATT_5; - - case SYM_BATT_4: - return BF_SYM_BATT_4; - - case SYM_BATT_3: - return BF_SYM_BATT_3; - - case SYM_BATT_2: - return BF_SYM_BATT_2; - - case SYM_BATT_1: - return BF_SYM_BATT_1; - - case SYM_BATT_EMPTY: - return BF_SYM_BATT_EMPTY; - - case SYM_AMP: - return BF_SYM_AMP; -/* - case SYM_WH: - return BF_SYM_WH; - - case SYM_WH_KM: - return BF_SYM_WH_KM; - - case SYM_WH_MI: - return BF_SYM_WH_MI; - - case SYM_WH_NM: - return BF_SYM_WH_NM; -*/ - case SYM_WATT: - return BF_SYM_WATT; -/* - case SYM_MW: - return BF_SYM_MW; - - case SYM_KILOWATT: - return BF_SYM_KILOWATT; -*/ - case SYM_FT: - return BF_SYM_FT; - - case SYM_ALT_FT: - return BF_SYM_FT; - - case SYM_ALT_M: - return BF_SYM_M; - - case SYM_TOTAL: - return BF_SYM_TOTAL_DISTANCE; -/* - case SYM_ALT_KM: - return BF_SYM_ALT_KM; - - case SYM_ALT_KFT: - return BF_SYM_ALT_KFT; - - case SYM_DIST_M: - return BF_SYM_DIST_M; - - case SYM_DIST_KM: - return BF_SYM_DIST_KM; - - case SYM_DIST_FT: - return BF_SYM_DIST_FT; - - case SYM_DIST_MI: - return BF_SYM_DIST_MI; - - case SYM_DIST_NM: - return BF_SYM_DIST_NM; -*/ - case SYM_M: - return BF_SYM_M; - - case SYM_KM: - return BF_SYM_KM; - - case SYM_MI: - return BF_SYM_MILES; -/* - case SYM_NM: - return BF_SYM_NM; -*/ - case SYM_WIND_HORIZONTAL: - return 'W'; // W for wind - -/* - case SYM_WIND_VERTICAL: - return BF_SYM_WIND_VERTICAL; - - case SYM_3D_KT: - return BF_SYM_3D_KT; -*/ - case SYM_AIR: - return 'A'; // A for airspeed - - case SYM_3D_KMH: - return BF_SYM_KPH; - - case SYM_3D_MPH: - return BF_SYM_MPH; - - case SYM_RPM: - return BF_SYM_RPM; - - case SYM_FTS: - return BF_SYM_FTPS; -/* - case SYM_100FTM: - return BF_SYM_100FTM; -*/ - case SYM_MS: - return BF_SYM_MPS; - - case SYM_KMH: - return BF_SYM_KPH; - - case SYM_MPH: - return BF_SYM_MPH; -/* - case SYM_KT: - return BF_SYM_KT - - case SYM_MAH_MI_0: - return BF_SYM_MAH_MI_0; - - case SYM_MAH_MI_1: - return BF_SYM_MAH_MI_1; -*/ - case SYM_THR: - return BF_SYM_THR; - - case SYM_TEMP_F: - return BF_SYM_F; - - case SYM_TEMP_C: - return BF_SYM_C; - - case SYM_BLANK: - return BF_SYM_BLANK; -/* - case SYM_ON_H: - return BF_SYM_ON_H; - - case SYM_FLY_H: - return BF_SYM_FLY_H; -*/ - case SYM_ON_M: - return BF_SYM_ON_M; - - case SYM_FLY_M: - return BF_SYM_FLY_M; -/* - case SYM_GLIDESLOPE: - return BF_SYM_GLIDESLOPE; - - case SYM_WAYPOINT: - return BF_SYM_WAYPOINT; - - case SYM_CLOCK: - return BF_SYM_CLOCK; - - case SYM_ZERO_HALF_TRAILING_DOT: - return BF_SYM_ZERO_HALF_TRAILING_DOT; - - case SYM_ZERO_HALF_LEADING_DOT: - return BF_SYM_ZERO_HALF_LEADING_DOT; -*/ - - case SYM_AUTO_THR0: - return 'A'; - - case SYM_AUTO_THR1: - return BF_SYM_THR; - - case SYM_ROLL_LEFT: - return BF_SYM_ROLL; - - case SYM_ROLL_LEVEL: - return BF_SYM_ROLL; - - case SYM_ROLL_RIGHT: - return BF_SYM_ROLL; - - case SYM_PITCH_UP: - return BF_SYM_PITCH; - - case SYM_PITCH_DOWN: - return BF_SYM_PITCH; - - case SYM_GFORCE: - return 'G'; - -/* - case SYM_GFORCE_X: - return BF_SYM_GFORCE_X; - - case SYM_GFORCE_Y: - return BF_SYM_GFORCE_Y; - - case SYM_GFORCE_Z: - return BF_SYM_GFORCE_Z; - - case SYM_BARO_TEMP: - return BF_SYM_BARO_TEMP; - - case SYM_IMU_TEMP: - return BF_SYM_IMU_TEMP; - - case SYM_TEMP: - return BF_SYM_TEMP; - - case SYM_TEMP_SENSOR_FIRST: - return BF_SYM_TEMP_SENSOR_FIRST; - - case SYM_ESC_TEMP: - return BF_SYM_ESC_TEMP; - - case SYM_TEMP_SENSOR_LAST: - return BF_SYM_TEMP_SENSOR_LAST; - - case TEMP_SENSOR_SYM_COUNT: - return BF_TEMP_SENSOR_SYM_COUNT; -*/ - case SYM_HEADING_N: - return BF_SYM_HEADING_N; - - case SYM_HEADING_S: - return BF_SYM_HEADING_S; - - case SYM_HEADING_E: - return BF_SYM_HEADING_E; - - case SYM_HEADING_W: - return BF_SYM_HEADING_W; - - case SYM_HEADING_DIVIDED_LINE: - return BF_SYM_HEADING_DIVIDED_LINE; - - case SYM_HEADING_LINE: - return BF_SYM_HEADING_LINE; -/* - case SYM_MAX: - return BF_SYM_MAX; - - case SYM_PROFILE: - return BF_SYM_PROFILE; - - case SYM_SWITCH_INDICATOR_LOW: - return BF_SYM_SWITCH_INDICATOR_LOW; - - case SYM_SWITCH_INDICATOR_MID: - return BF_SYM_SWITCH_INDICATOR_MID; - - case SYM_SWITCH_INDICATOR_HIGH: - return BF_SYM_SWITCH_INDICATOR_HIGH; - - case SYM_AH: - return BF_SYM_AH; - - case SYM_GLIDE_DIST: - return BF_SYM_GLIDE_DIST; - - case SYM_GLIDE_MINS: - return BF_SYM_GLIDE_MINS; - - case SYM_AH_V_FT_0: - return BF_SYM_AH_V_FT_0; - - case SYM_AH_V_FT_1: - return BF_SYM_AH_V_FT_1; - - case SYM_AH_V_M_0: - return BF_SYM_AH_V_M_0; - - case SYM_AH_V_M_1: - return BF_SYM_AH_V_M_1; - - case SYM_FLIGHT_MINS_REMAINING: - return BF_SYM_FLIGHT_MINS_REMAINING; - - case SYM_FLIGHT_HOURS_REMAINING: - return BF_SYM_FLIGHT_HOURS_REMAINING; - - case SYM_GROUND_COURSE: - return BF_SYM_GROUND_COURSE; - - case SYM_CROSS_TRACK_ERROR: - return BF_SYM_CROSS_TRACK_ERROR; - - case SYM_LOGO_START: - return BF_SYM_LOGO_START; - - case SYM_LOGO_WIDTH: - return BF_SYM_LOGO_WIDTH; - - case SYM_LOGO_HEIGHT: - return BF_SYM_LOGO_HEIGHT; -*/ - case SYM_AH_LEFT: - return BF_SYM_AH_LEFT; - - case SYM_AH_RIGHT: - return BF_SYM_AH_RIGHT; - -/* - case SYM_AH_DECORATION_COUNT: - return BF_SYM_AH_DECORATION_COUNT; -*/ - case SYM_AH_CH_LEFT: - case SYM_AH_CH_TYPE3: - case SYM_AH_CH_TYPE4: - case SYM_AH_CH_TYPE5: - case SYM_AH_CH_TYPE6: - case SYM_AH_CH_TYPE7: - case SYM_AH_CH_TYPE8: - case SYM_AH_CH_AIRCRAFT1: - return BF_SYM_AH_CENTER_LINE; - - case SYM_AH_CH_RIGHT: - case (SYM_AH_CH_TYPE3+2): - case (SYM_AH_CH_TYPE4+2): - case (SYM_AH_CH_TYPE5+2): - case (SYM_AH_CH_TYPE6+2): - case (SYM_AH_CH_TYPE7+2): - case (SYM_AH_CH_TYPE8+2): - case SYM_AH_CH_AIRCRAFT3: - return BF_SYM_AH_CENTER_LINE_RIGHT; - - case SYM_AH_CH_AIRCRAFT0: - case SYM_AH_CH_AIRCRAFT4: - return ' '; - - case SYM_ARROW_UP: - return BF_SYM_ARROW_NORTH; - - case SYM_ARROW_2: - return BF_SYM_ARROW_8; - - case SYM_ARROW_3: - return BF_SYM_ARROW_7; - - case SYM_ARROW_4: - return BF_SYM_ARROW_6; - - case SYM_ARROW_RIGHT: - return BF_SYM_ARROW_EAST; - - case SYM_ARROW_6: - return BF_SYM_ARROW_4; - - case SYM_ARROW_7: - return BF_SYM_ARROW_3; - - case SYM_ARROW_8: - return BF_SYM_ARROW_2; - - case SYM_ARROW_DOWN: - return BF_SYM_ARROW_SOUTH; - - case SYM_ARROW_10: - return BF_SYM_ARROW_16; - - case SYM_ARROW_11: - return BF_SYM_ARROW_15; - - case SYM_ARROW_12: - return BF_SYM_ARROW_14; - - case SYM_ARROW_LEFT: - return BF_SYM_ARROW_WEST; - - case SYM_ARROW_14: - return BF_SYM_ARROW_12; - - case SYM_ARROW_15: - return BF_SYM_ARROW_11; - - case SYM_ARROW_16: - return BF_SYM_ARROW_10; - - case SYM_AH_H_START: - return BF_SYM_AH_BAR9_0; - - case (SYM_AH_H_START+1): - return BF_SYM_AH_BAR9_1; - - case (SYM_AH_H_START+2): - return BF_SYM_AH_BAR9_2; - - case (SYM_AH_H_START+3): - return BF_SYM_AH_BAR9_3; - - case (SYM_AH_H_START+4): - return BF_SYM_AH_BAR9_4; - - case (SYM_AH_H_START+5): - return BF_SYM_AH_BAR9_5; - - case (SYM_AH_H_START+6): - return BF_SYM_AH_BAR9_6; - - case (SYM_AH_H_START+7): - return BF_SYM_AH_BAR9_7; - - case (SYM_AH_H_START+8): - return BF_SYM_AH_BAR9_8; - - // BF does not have vertical artificial horizon. replace with middle horizontal one - case SYM_AH_V_START: - case (SYM_AH_V_START+1): - case (SYM_AH_V_START+2): - case (SYM_AH_V_START+3): - case (SYM_AH_V_START+4): - case (SYM_AH_V_START+5): - return BF_SYM_AH_BAR9_4; - - // BF for ESP_RADAR Symbols - case SYM_HUD_CARDINAL: - return BF_SYM_ARROW_SOUTH; - case SYM_HUD_CARDINAL + 1: - return BF_SYM_ARROW_16; - case SYM_HUD_CARDINAL + 2: - return BF_SYM_ARROW_15; - case SYM_HUD_CARDINAL + 3: - return BF_SYM_ARROW_WEST; - case SYM_HUD_CARDINAL + 4: - return BF_SYM_ARROW_12; - case SYM_HUD_CARDINAL + 5: - return BF_SYM_ARROW_11; - case SYM_HUD_CARDINAL + 6: - return BF_SYM_ARROW_NORTH; - case SYM_HUD_CARDINAL + 7: - return BF_SYM_ARROW_7; - case SYM_HUD_CARDINAL + 8: - return BF_SYM_ARROW_6; - case SYM_HUD_CARDINAL + 9: - return BF_SYM_ARROW_EAST; - case SYM_HUD_CARDINAL + 10: - return BF_SYM_ARROW_3; - case SYM_HUD_CARDINAL + 11: - return BF_SYM_ARROW_2; - - case SYM_HUD_ARROWS_R3: - return BF_SYM_AH_RIGHT; - case SYM_HUD_ARROWS_L3: - return BF_SYM_AH_LEFT; - - case SYM_HUD_SIGNAL_0: - return BF_SYM_AH_BAR9_1; - case SYM_HUD_SIGNAL_1: - return BF_SYM_AH_BAR9_3; - case SYM_HUD_SIGNAL_2: - return BF_SYM_AH_BAR9_4; - case SYM_HUD_SIGNAL_3: - return BF_SYM_AH_BAR9_5; - case SYM_HUD_SIGNAL_4: - return BF_SYM_AH_BAR9_7; -/* - case SYM_VARIO_UP_2A: - return BF_SYM_VARIO_UP_2A; - - case SYM_VARIO_UP_1A: - return BF_SYM_VARIO_UP_1A; - - case SYM_VARIO_DOWN_1A: - return BF_SYM_VARIO_DOWN_1A; - - case SYM_VARIO_DOWN_2A: - return BF_SYM_VARIO_DOWN_2A; -*/ - case SYM_ALT: - return BF_SYM_ALTITUDE; -/* - case SYM_HUD_SIGNAL_0: - return BF_SYM_HUD_SIGNAL_0; - - case SYM_HUD_SIGNAL_1: - return BF_SYM_HUD_SIGNAL_1; - - case SYM_HUD_SIGNAL_2: - return BF_SYM_HUD_SIGNAL_2; - - case SYM_HUD_SIGNAL_3: - return BF_SYM_HUD_SIGNAL_3; - - case SYM_HUD_SIGNAL_4: - return BF_SYM_HUD_SIGNAL_4; - - case SYM_HOME_DIST: - return BF_SYM_HOME_DIST; -*/ - - case SYM_AH_CH_CENTER: - case (SYM_AH_CH_TYPE3+1): - case (SYM_AH_CH_TYPE4+1): - case (SYM_AH_CH_TYPE5+1): - case (SYM_AH_CH_TYPE6+1): - case (SYM_AH_CH_TYPE7+1): - case (SYM_AH_CH_TYPE8+1): - case SYM_AH_CH_AIRCRAFT2: - return BF_SYM_AH_CENTER; -/* - case SYM_FLIGHT_DIST_REMAINING: - return BF_SYM_FLIGHT_DIST_REMAINING; - - case SYM_AH_CH_TYPE3: - return BF_SYM_AH_CH_TYPE3; - - case SYM_AH_CH_TYPE4: - return BF_SYM_AH_CH_TYPE4; - - case SYM_AH_CH_TYPE5: - return BF_SYM_AH_CH_TYPE5; - - case SYM_AH_CH_TYPE6: - return BF_SYM_AH_CH_TYPE6; - - case SYM_AH_CH_TYPE7: - return BF_SYM_AH_CH_TYPE7; - - case SYM_AH_CH_TYPE8: - return BF_SYM_AH_CH_TYPE8; - - case SYM_AH_CH_AIRCRAFT0: - return BF_SYM_AH_CH_AIRCRAFT0; - - case SYM_AH_CH_AIRCRAFT1: - return BF_SYM_AH_CH_AIRCRAFT1; - - case SYM_AH_CH_AIRCRAFT2: - return BF_SYM_AH_CH_AIRCRAFT2; - - case SYM_AH_CH_AIRCRAFT3: - return BF_SYM_AH_CH_AIRCRAFT3; - - case SYM_AH_CH_AIRCRAFT4: - return BF_SYM_AH_CH_AIRCRAFT4; - - case SYM_HUD_ARROWS_L1: - return BF_SYM_HUD_ARROWS_L1; - - case SYM_HUD_ARROWS_L2: - return BF_SYM_HUD_ARROWS_L2; - - case SYM_HUD_ARROWS_L3: - return BF_SYM_HUD_ARROWS_L3; - - case SYM_HUD_ARROWS_R1: - return BF_SYM_HUD_ARROWS_R1; - - case SYM_HUD_ARROWS_R2: - return BF_SYM_HUD_ARROWS_R2; - - case SYM_HUD_ARROWS_R3: - return BF_SYM_HUD_ARROWS_R3; - - case SYM_HUD_ARROWS_U1: - return BF_SYM_HUD_ARROWS_U1; - - case SYM_HUD_ARROWS_U2: - return BF_SYM_HUD_ARROWS_U2; - - case SYM_HUD_ARROWS_U3: - return BF_SYM_HUD_ARROWS_U3; - - case SYM_HUD_ARROWS_D1: - return BF_SYM_HUD_ARROWS_D1; - - case SYM_HUD_ARROWS_D2: - return BF_SYM_HUD_ARROWS_D2; - - case SYM_HUD_ARROWS_D3: - return BF_SYM_HUD_ARROWS_D3; -*/ - default: - break; - } - - return '?'; // Missing/not mapped character -} - -#endif - -#endif diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c new file mode 100644 index 00000000000..de4fa8656fa --- /dev/null +++ b/src/main/io/displayport_msp_dji_compat.c @@ -0,0 +1,713 @@ +/* + * This file is part of INAV Project. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include "platform.h" + +#if defined(USE_OSD) && defined(USE_MSP_DISPLAYPORT) + +#ifndef DISABLE_MSP_DJI_COMPAT + +#include "io/displayport_msp_dji_compat.h" +#include "io/dji_osd_symbols.h" +#include "drivers/osd_symbols.h" + +uint8_t getDJICharacter(uint8_t ch, uint8_t page) +{ + uint16_t ech = ch | ((page & 0x3)<< 8) ; + + if (ech >= 0x20 && ech <= 0x5F) { // ASCII range + return ch; + } + + if (ech >= SYM_AH_DECORATION_MIN && ech <= SYM_AH_DECORATION_MAX) { + return DJI_SYM_AH_DECORATION; + } + + switch (ech) { + case SYM_RSSI: + return DJI_SYM_RSSI; + +/* + case SYM_LQ: + return DJI_SYM_LINK_QUALITY; +*/ + + case SYM_LAT: + return DJI_SYM_LAT; + + case SYM_LON: + return DJI_SYM_LON; + + case SYM_SAT_L: + return DJI_SYM_SAT_L; + + case SYM_SAT_R: + return DJI_SYM_SAT_R; + + case SYM_HOME_NEAR: + return DJI_SYM_HOMEFLAG; + + case SYM_DEGREES: + return DJI_SYM_GPS_DEGREE; + +/* + case SYM_HEADING: + return DJI_SYM_HEADING; + + case SYM_SCALE: + return DJI_SYM_SCALE; + + case SYM_HDP_L: + return DJI_SYM_HDP_L; + + case SYM_HDP_R: + return DJI_SYM_HDP_R; +*/ + case SYM_HOME: + return DJI_SYM_HOMEFLAG; + + case SYM_2RSS: + return DJI_SYM_RSSI; + +/* + case SYM_DB: + return DJI_SYM_DB + + case SYM_DBM: + return DJI_SYM_DBM; + + case SYM_SNR: + return DJI_SYM_SNR; +*/ + + case SYM_AH_DECORATION_UP: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_AH_DECORATION_DOWN: + return DJI_SYM_ARROW_SMALL_DOWN; + + case SYM_DECORATION: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_DECORATION + 1: // NE pointing arrow + return DJI_SYM_ARROW_7; + + case SYM_DECORATION + 2: // E pointing arrow + return DJI_SYM_ARROW_EAST; + + case SYM_DECORATION + 3: // SE pointing arrow + return DJI_SYM_ARROW_3; + + case SYM_DECORATION + 4: // S pointing arrow + return DJI_SYM_ARROW_SOUTH; + + case SYM_DECORATION + 5: // SW pointing arrow + return DJI_SYM_ARROW_15; + + case SYM_DECORATION + 6: // W pointing arrow + return DJI_SYM_ARROW_WEST; + + case SYM_DECORATION + 7: // NW pointing arrow + return DJI_SYM_ARROW_11; + + case SYM_VOLT: + return DJI_SYM_VOLT; + + case SYM_MAH: + return DJI_SYM_MAH; + + case SYM_AH_KM: + return 'K'; + + case SYM_AH_MI: + return 'M'; +/* + case SYM_VTX_POWER: + return DJI_SYM_VTX_POWER; + + case SYM_AH_NM: + return DJI_SYM_AH_NM; + + case SYM_MAH_NM_0: + return DJI_SYM_MAH_NM_0; + + case SYM_MAH_NM_1: + return DJI_SYM_MAH_NM_1; + + case SYM_MAH_KM_0: + return DJI_SYM_MAH_KM_0; + + case SYM_MAH_KM_1: + return DJI_SYM_MAH_KM_1; + + case SYM_MILLIOHM: + return DJI_SYM_MILLIOHM; +*/ + case SYM_BATT_FULL: + return DJI_SYM_BATT_FULL; + + case SYM_BATT_5: + return DJI_SYM_BATT_5; + + case SYM_BATT_4: + return DJI_SYM_BATT_4; + + case SYM_BATT_3: + return DJI_SYM_BATT_3; + + case SYM_BATT_2: + return DJI_SYM_BATT_2; + + case SYM_BATT_1: + return DJI_SYM_BATT_1; + + case SYM_BATT_EMPTY: + return DJI_SYM_BATT_EMPTY; + + case SYM_AMP: + return DJI_SYM_AMP; +/* + case SYM_WH: + return DJI_SYM_WH; + + case SYM_WH_KM: + return DJI_SYM_WH_KM; + + case SYM_WH_MI: + return DJI_SYM_WH_MI; + + case SYM_WH_NM: + return DJI_SYM_WH_NM; +*/ + case SYM_WATT: + return DJI_SYM_WATT; +/* + case SYM_MW: + return DJI_SYM_MW; + + case SYM_KILOWATT: + return DJI_SYM_KILOWATT; +*/ + case SYM_FT: + return DJI_SYM_FT; + + case SYM_ALT_FT: + return DJI_SYM_FT; + + case SYM_ALT_M: + return DJI_SYM_M; + + case SYM_TOTAL: + return DJI_SYM_FLY_H; +/* + + case SYM_ALT_KM: + return DJI_SYM_ALT_KM; + + case SYM_ALT_KFT: + return DJI_SYM_ALT_KFT; + + case SYM_DIST_M: + return DJI_SYM_DIST_M; + + case SYM_DIST_KM: + return DJI_SYM_DIST_KM; + + case SYM_DIST_FT: + return DJI_SYM_DIST_FT; + + case SYM_DIST_MI: + return DJI_SYM_DIST_MI; + + case SYM_DIST_NM: + return DJI_SYM_DIST_NM; +*/ + case SYM_M: + return DJI_SYM_M; + + case SYM_KM: + return 'K'; + + case SYM_MI: + return 'M'; +/* + case SYM_NM: + return DJI_SYM_NM; +*/ + case SYM_WIND_HORIZONTAL: + return 'W'; // W for wind + +/* + case SYM_WIND_VERTICAL: + return DJI_SYM_WIND_VERTICAL; + + case SYM_3D_KT: + return DJI_SYM_3D_KT; +*/ + case SYM_AIR: + return 'A'; // A for airspeed + + case SYM_3D_KMH: + return DJI_SYM_KPH; + + case SYM_3D_MPH: + return DJI_SYM_MPH; + + case SYM_RPM: + return DJI_SYM_RPM; + + case SYM_FTS: + return DJI_SYM_FTPS; +/* + case SYM_100FTM: + return DJI_SYM_100FTM; +*/ + case SYM_MS: + return DJI_SYM_MPS; + + case SYM_KMH: + return DJI_SYM_KPH; + + case SYM_MPH: + return DJI_SYM_MPH; +/* + case SYM_KT: + return DJI_SYM_KT + + case SYM_MAH_MI_0: + return DJI_SYM_MAH_MI_0; + + case SYM_MAH_MI_1: + return DJI_SYM_MAH_MI_1; +*/ + case SYM_THR: + return DJI_SYM_THR; + + case SYM_TEMP_F: + return DJI_SYM_F; + + case SYM_TEMP_C: + return DJI_SYM_C; + + case SYM_BLANK: + return DJI_SYM_BLANK; + + case SYM_ON_H: + return DJI_SYM_ON_H; + + case SYM_FLY_H: + return DJI_SYM_FLY_H; + + case SYM_ON_M: + return DJI_SYM_ON_M; + + case SYM_FLY_M: + return DJI_SYM_FLY_M; +/* + case SYM_GLIDESLOPE: + return DJI_SYM_GLIDESLOPE; + + case SYM_WAYPOINT: + return DJI_SYM_WAYPOINT; + + case SYM_CLOCK: + return DJI_SYM_CLOCK; + + case SYM_ZERO_HALF_TRAILING_DOT: + return DJI_SYM_ZERO_HALF_TRAILING_DOT; + + case SYM_ZERO_HALF_LEADING_DOT: + return DJI_SYM_ZERO_HALF_LEADING_DOT; +*/ + + case SYM_AUTO_THR0: + return 'A'; + + case SYM_AUTO_THR1: + return DJI_SYM_THR; + + case SYM_ROLL_LEFT: + return DJI_SYM_ROLL; + + case SYM_ROLL_LEVEL: + return DJI_SYM_ROLL; + + case SYM_ROLL_RIGHT: + return DJI_SYM_ROLL; + + case SYM_PITCH_UP: + return DJI_SYM_PITCH; + + case SYM_PITCH_DOWN: + return DJI_SYM_PITCH; + + case SYM_GFORCE: + return 'G'; + +/* + case SYM_GFORCE_X: + return DJI_SYM_GFORCE_X; + + case SYM_GFORCE_Y: + return DJI_SYM_GFORCE_Y; + + case SYM_GFORCE_Z: + return DJI_SYM_GFORCE_Z; +*/ + case SYM_BARO_TEMP: + return DJI_SYM_TEMPERATURE; + + case SYM_IMU_TEMP: + return DJI_SYM_TEMPERATURE; + + case SYM_TEMP: + return DJI_SYM_TEMPERATURE; + + case SYM_ESC_TEMP: + return DJI_SYM_TEMPERATURE; +/* + case SYM_TEMP_SENSOR_FIRST: + return DJI_SYM_TEMP_SENSOR_FIRST; + + case SYM_TEMP_SENSOR_LAST: + return DJI_SYM_TEMP_SENSOR_LAST; + + case TEMP_SENSOR_SYM_COUNT: + return DJI_TEMP_SENSOR_SYM_COUNT; +*/ + case SYM_HEADING_N: + return DJI_SYM_HEADING_N; + + case SYM_HEADING_S: + return DJI_SYM_HEADING_S; + + case SYM_HEADING_E: + return DJI_SYM_HEADING_E; + + case SYM_HEADING_W: + return DJI_SYM_HEADING_W; + + case SYM_HEADING_DIVIDED_LINE: + return DJI_SYM_HEADING_DIVIDED_LINE; + + case SYM_HEADING_LINE: + return DJI_SYM_HEADING_LINE; + + case SYM_MAX: + return DJI_SYM_MAX; +/* + case SYM_PROFILE: + return DJI_SYM_PROFILE; +*/ + case SYM_SWITCH_INDICATOR_LOW: + return DJI_SYM_STICK_OVERLAY_SPRITE_LOW; + + case SYM_SWITCH_INDICATOR_MID: + return DJI_SYM_STICK_OVERLAY_SPRITE_MID; + + case SYM_SWITCH_INDICATOR_HIGH: + return DJI_SYM_STICK_OVERLAY_SPRITE_HIGH; +/* + case SYM_AH: + return DJI_SYM_AH; + + case SYM_GLIDE_DIST: + return DJI_SYM_GLIDE_DIST; + + case SYM_GLIDE_MINS: + return DJI_SYM_GLIDE_MINS; + + case SYM_AH_V_FT_0: + return DJI_SYM_AH_V_FT_0; + + case SYM_AH_V_FT_1: + return DJI_SYM_AH_V_FT_1; + + case SYM_AH_V_M_0: + return DJI_SYM_AH_V_M_0; + + case SYM_AH_V_M_1: + return DJI_SYM_AH_V_M_1; + + case SYM_FLIGHT_MINS_REMAINING: + return DJI_SYM_FLIGHT_MINS_REMAINING; + + case SYM_FLIGHT_HOURS_REMAINING: + return DJI_SYM_FLIGHT_HOURS_REMAINING; + + case SYM_GROUND_COURSE: + return DJI_SYM_GROUND_COURSE; + + case SYM_CROSS_TRACK_ERROR: + return DJI_SYM_CROSS_TRACK_ERROR; + + case SYM_LOGO_START: + return DJI_SYM_LOGO_START; + + case SYM_LOGO_WIDTH: + return DJI_SYM_LOGO_WIDTH; + + case SYM_LOGO_HEIGHT: + return DJI_SYM_LOGO_HEIGHT; +*/ + case SYM_AH_LEFT: + return DJI_SYM_AH_LEFT; + + case SYM_AH_RIGHT: + return DJI_SYM_AH_RIGHT; + +/* + case SYM_AH_DECORATION_COUNT: + return DJI_SYM_AH_DECORATION_COUNT; +*/ + case SYM_AH_CH_LEFT: + case SYM_AH_CH_TYPE3: + case SYM_AH_CH_TYPE4: + case SYM_AH_CH_TYPE5: + case SYM_AH_CH_TYPE6: + case SYM_AH_CH_TYPE7: + case SYM_AH_CH_TYPE8: + case SYM_AH_CH_AIRCRAFT1: + return DJI_SYM_CROSSHAIR_LEFT; + + case SYM_AH_CH_CENTER: + case (SYM_AH_CH_TYPE3+1): + case (SYM_AH_CH_TYPE4+1): + case (SYM_AH_CH_TYPE5+1): + case (SYM_AH_CH_TYPE6+1): + case (SYM_AH_CH_TYPE7+1): + case (SYM_AH_CH_TYPE8+1): + case SYM_AH_CH_AIRCRAFT2: + return DJI_SYM_CROSSHAIR_CENTRE; + + case SYM_AH_CH_RIGHT: + case (SYM_AH_CH_TYPE3+2): + case (SYM_AH_CH_TYPE4+2): + case (SYM_AH_CH_TYPE5+2): + case (SYM_AH_CH_TYPE6+2): + case (SYM_AH_CH_TYPE7+2): + case (SYM_AH_CH_TYPE8+2): + case SYM_AH_CH_AIRCRAFT3: + return DJI_SYM_CROSSHAIR_RIGHT; + + case SYM_AH_CH_AIRCRAFT0: + case SYM_AH_CH_AIRCRAFT4: + return DJI_SYM_BLANK; + + case SYM_ARROW_UP: + return DJI_SYM_ARROW_NORTH; + + case SYM_ARROW_2: + return DJI_SYM_ARROW_8; + + case SYM_ARROW_3: + return DJI_SYM_ARROW_7; + + case SYM_ARROW_4: + return DJI_SYM_ARROW_6; + + case SYM_ARROW_RIGHT: + return DJI_SYM_ARROW_EAST; + + case SYM_ARROW_6: + return DJI_SYM_ARROW_4; + + case SYM_ARROW_7: + return DJI_SYM_ARROW_3; + + case SYM_ARROW_8: + return DJI_SYM_ARROW_2; + + case SYM_ARROW_DOWN: + return DJI_SYM_ARROW_SOUTH; + + case SYM_ARROW_10: + return DJI_SYM_ARROW_16; + + case SYM_ARROW_11: + return DJI_SYM_ARROW_15; + + case SYM_ARROW_12: + return DJI_SYM_ARROW_14; + + case SYM_ARROW_LEFT: + return DJI_SYM_ARROW_WEST; + + case SYM_ARROW_14: + return DJI_SYM_ARROW_12; + + case SYM_ARROW_15: + return DJI_SYM_ARROW_11; + + case SYM_ARROW_16: + return DJI_SYM_ARROW_10; + + case SYM_AH_H_START: + return DJI_SYM_AH_BAR9_0; + + case (SYM_AH_H_START+1): + return DJI_SYM_AH_BAR9_1; + + case (SYM_AH_H_START+2): + return DJI_SYM_AH_BAR9_2; + + case (SYM_AH_H_START+3): + return DJI_SYM_AH_BAR9_3; + + case (SYM_AH_H_START+4): + return DJI_SYM_AH_BAR9_4; + + case (SYM_AH_H_START+5): + return DJI_SYM_AH_BAR9_5; + + case (SYM_AH_H_START+6): + return DJI_SYM_AH_BAR9_6; + + case (SYM_AH_H_START+7): + return DJI_SYM_AH_BAR9_7; + + case (SYM_AH_H_START+8): + return DJI_SYM_AH_BAR9_8; + + // DJI does not have vertical artificial horizon. replace with middle horizontal one + case SYM_AH_V_START: + case (SYM_AH_V_START+1): + case (SYM_AH_V_START+2): + case (SYM_AH_V_START+3): + case (SYM_AH_V_START+4): + case (SYM_AH_V_START+5): + return DJI_SYM_AH_BAR9_4; + + // DJI for ESP_RADAR Symbols + case SYM_HUD_CARDINAL: + return DJI_SYM_ARROW_SOUTH; + case SYM_HUD_CARDINAL + 1: + return DJI_SYM_ARROW_16; + case SYM_HUD_CARDINAL + 2: + return DJI_SYM_ARROW_15; + case SYM_HUD_CARDINAL + 3: + return DJI_SYM_ARROW_WEST; + case SYM_HUD_CARDINAL + 4: + return DJI_SYM_ARROW_12; + case SYM_HUD_CARDINAL + 5: + return DJI_SYM_ARROW_11; + case SYM_HUD_CARDINAL + 6: + return DJI_SYM_ARROW_NORTH; + case SYM_HUD_CARDINAL + 7: + return DJI_SYM_ARROW_7; + case SYM_HUD_CARDINAL + 8: + return DJI_SYM_ARROW_6; + case SYM_HUD_CARDINAL + 9: + return DJI_SYM_ARROW_EAST; + case SYM_HUD_CARDINAL + 10: + return DJI_SYM_ARROW_3; + case SYM_HUD_CARDINAL + 11: + return DJI_SYM_ARROW_2; + + case SYM_HUD_SIGNAL_0: + return DJI_SYM_AH_BAR9_1; + case SYM_HUD_SIGNAL_1: + return DJI_SYM_AH_BAR9_3; + case SYM_HUD_SIGNAL_2: + return DJI_SYM_AH_BAR9_4; + case SYM_HUD_SIGNAL_3: + return DJI_SYM_AH_BAR9_5; + case SYM_HUD_SIGNAL_4: + return DJI_SYM_AH_BAR9_7; + + case SYM_VARIO_UP_2A: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_VARIO_UP_1A: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_VARIO_DOWN_1A: + return DJI_SYM_ARROW_SMALL_DOWN; + + case SYM_VARIO_DOWN_2A: + return DJI_SYM_ARROW_SMALL_DOWN; + + case SYM_ALT: + return DJI_SYM_ALTITUDE; +/* + case SYM_HUD_SIGNAL_0: + return DJI_SYM_HUD_SIGNAL_0; + + case SYM_HUD_SIGNAL_1: + return DJI_SYM_HUD_SIGNAL_1; + + case SYM_HUD_SIGNAL_2: + return DJI_SYM_HUD_SIGNAL_2; + + case SYM_HUD_SIGNAL_3: + return DJI_SYM_HUD_SIGNAL_3; + + case SYM_HUD_SIGNAL_4: + return DJI_SYM_HUD_SIGNAL_4; + + case SYM_HOME_DIST: + return DJI_SYM_HOME_DIST; + + case SYM_FLIGHT_DIST_REMAINING: + return DJI_SYM_FLIGHT_DIST_REMAINING; +*/ + case SYM_HUD_ARROWS_L1: + return DJI_SYM_ARROW_SMALL_LEFT; + + case SYM_HUD_ARROWS_L2: + return DJI_SYM_ARROW_SMALL_LEFT; + + case SYM_HUD_ARROWS_L3: + return DJI_SYM_ARROW_SMALL_LEFT; + + case SYM_HUD_ARROWS_R1: + return DJI_SYM_ARROW_SMALL_RIGHT; + + case SYM_HUD_ARROWS_R2: + return DJI_SYM_ARROW_SMALL_RIGHT; + + case SYM_HUD_ARROWS_R3: + return DJI_SYM_ARROW_SMALL_RIGHT; + + case SYM_HUD_ARROWS_U1: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_HUD_ARROWS_U2: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_HUD_ARROWS_U3: + return DJI_SYM_ARROW_SMALL_UP; + + case SYM_HUD_ARROWS_D1: + return DJI_SYM_ARROW_SMALL_DOWN; + + case SYM_HUD_ARROWS_D2: + return DJI_SYM_ARROW_SMALL_DOWN; + + case SYM_HUD_ARROWS_D3: + return DJI_SYM_ARROW_SMALL_DOWN; + + default: + break; + } + + return '?'; // Missing/not mapped character +} + +#endif + +#endif diff --git a/src/main/io/displayport_msp_bf_compat.h b/src/main/io/displayport_msp_dji_compat.h similarity index 69% rename from src/main/io/displayport_msp_bf_compat.h rename to src/main/io/displayport_msp_dji_compat.h index 95dab7b518d..6380770aa00 100644 --- a/src/main/io/displayport_msp_bf_compat.h +++ b/src/main/io/displayport_msp_dji_compat.h @@ -22,15 +22,15 @@ #include "platform.h" -#if defined(USE_OSD) && defined(USE_MSP_DISPLAYPORT) && !defined(DISABLE_MSP_BF_COMPAT) +#if defined(USE_OSD) && defined(USE_MSP_DISPLAYPORT) && !defined(DISABLE_MSP_DJI_COMPAT) #include "osd.h" -uint8_t getBfCharacter(uint8_t ch, uint8_t page); -#define isBfCompatibleVideoSystem(osdConfigPtr) (osdConfigPtr->video_system == VIDEO_SYSTEM_BFCOMPAT || osdConfigPtr->video_system == VIDEO_SYSTEM_BFCOMPAT_HD) +uint8_t getDJICharacter(uint8_t ch, uint8_t page); +#define isDJICompatibleVideoSystem(osdConfigPtr) (osdConfigPtr->video_system == VIDEO_SYSTEM_DJICOMPAT || osdConfigPtr->video_system == VIDEO_SYSTEM_DJICOMPAT_HD) #else -#define getBfCharacter(x, page) (x) +#define getDJICharacter(x, page) (x) #ifdef OSD_UNIT_TEST -#define isBfCompatibleVideoSystem(osdConfigPtr) (true) +#define isDJICompatibleVideoSystem(osdConfigPtr) (true) #else -#define isBfCompatibleVideoSystem(osdConfigPtr) (false) +#define isDJICompatibleVideoSystem(osdConfigPtr) (false) #endif #endif \ No newline at end of file diff --git a/src/main/io/displayport_msp_osd.c b/src/main/io/displayport_msp_osd.c index d587104e9b9..2e425e6aecb 100644 --- a/src/main/io/displayport_msp_osd.c +++ b/src/main/io/displayport_msp_osd.c @@ -51,7 +51,7 @@ #include "msp/msp_serial.h" #include "displayport_msp_osd.h" -#include "displayport_msp_bf_compat.h" +#include "displayport_msp_dji_compat.h" #define FONT_VERSION 3 @@ -307,7 +307,7 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz uint8_t len = 4; do { bitArrayClr(dirty, pos); - subcmd[len] = isBfCompatibleVideoSystem(osdConfig()) ? getBfCharacter(screen[pos++], page): screen[pos++]; + subcmd[len] = isDJICompatibleVideoSystem(osdConfig()) ? getDJICharacter(screen[pos++], page): screen[pos++]; len++; if (bitArrayGet(dirty, pos)) { @@ -315,7 +315,7 @@ static int drawScreen(displayPort_t *displayPort) // 250Hz } } while (next == pos && next < endOfLine && getAttrPage(attrs[next]) == page && getAttrBlink(attrs[next]) == blink); - if (!isBfCompatibleVideoSystem(osdConfig())) { + if (!isDJICompatibleVideoSystem(osdConfig())) { attributes |= (page << DISPLAYPORT_MSP_ATTR_FONTPAGE); } @@ -465,7 +465,7 @@ displayPort_t* mspOsdDisplayPortInit(const videoSystem_e videoSystem) if (mspOsdSerialInit()) { switch(videoSystem) { case VIDEO_SYSTEM_AUTO: - case VIDEO_SYSTEM_BFCOMPAT: + case VIDEO_SYSTEM_DJICOMPAT: case VIDEO_SYSTEM_PAL: currentOsdMode = SD_3016; screenRows = PAL_ROWS; @@ -486,7 +486,7 @@ displayPort_t* mspOsdDisplayPortInit(const videoSystem_e videoSystem) screenRows = DJI_ROWS; screenCols = DJI_COLS; break; - case VIDEO_SYSTEM_BFCOMPAT_HD: + case VIDEO_SYSTEM_DJICOMPAT_HD: case VIDEO_SYSTEM_AVATAR: currentOsdMode = HD_5320; screenRows = AVATAR_ROWS; @@ -500,10 +500,10 @@ displayPort_t* mspOsdDisplayPortInit(const videoSystem_e videoSystem) init(); displayInit(&mspOsdDisplayPort, &mspOsdVTable); - if (osdVideoSystem == VIDEO_SYSTEM_BFCOMPAT) { - mspOsdDisplayPort.displayPortType = "MSP DisplayPort: BetaFlight Compatability mode"; - } else if (osdVideoSystem == VIDEO_SYSTEM_BFCOMPAT_HD) { - mspOsdDisplayPort.displayPortType = "MSP DisplayPort: BetaFlight Compatability mode (HD)"; + if (osdVideoSystem == VIDEO_SYSTEM_DJICOMPAT) { + mspOsdDisplayPort.displayPortType = "MSP DisplayPort: DJI Compatability mode"; + } else if (osdVideoSystem == VIDEO_SYSTEM_DJICOMPAT_HD) { + mspOsdDisplayPort.displayPortType = "MSP DisplayPort: DJI Compatability mode (HD)"; } else { mspOsdDisplayPort.displayPortType = "MSP DisplayPort"; } diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h new file mode 100644 index 00000000000..66972a810e7 --- /dev/null +++ b/src/main/io/dji_osd_symbols.h @@ -0,0 +1,164 @@ +/* @file max7456_symbols.h + * @brief max7456 symbols for the mwosd font set + * + * @author Nathan Tsoi nathan@vertile.com + * + * Copyright (C) 2016 Nathan Tsoi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +#pragma once + +//Misc +#define DJI_SYM_NONE 0x00 +#define DJI_SYM_END_OF_FONT 0xFF +#define DJI_SYM_BLANK 0x20 +#define DJI_SYM_HYPHEN 0x2D +#define DJI_SYM_BBLOG 0x10 +#define DJI_SYM_HOMEFLAG 0x11 +#define DJI_SYM_RPM 0x12 +#define DJI_SYM_ROLL 0x14 +#define DJI_SYM_PITCH 0x15 +#define DJI_SYM_TEMPERATURE 0x7A +#define DJI_SYM_MAX 0x24 + +// GPS and navigation +#define DJI_SYM_LAT 0x89 +#define DJI_SYM_LON 0x98 +#define DJI_SYM_ALTITUDE 0x7F +#define DJI_SYM_OVER_HOME 0x05 + +// RSSI +#define DJI_SYM_RSSI 0x01 + +// Throttle Position (%) +#define DJI_SYM_THR 0x04 + +// Unit Icons (Metric) +#define DJI_SYM_M 0x0C +#define DJI_SYM_C 0x0E + +// Unit Icons (Imperial) +#define DJI_SYM_F 0x0D +#define DJI_SYM_FT 0x0F + +// Heading Graphics +#define DJI_SYM_HEADING_N 0x18 +#define DJI_SYM_HEADING_S 0x19 +#define DJI_SYM_HEADING_E 0x1A +#define DJI_SYM_HEADING_W 0x1B +#define DJI_SYM_HEADING_DIVIDED_LINE 0x1C +#define DJI_SYM_HEADING_LINE 0x1D + +// AH Center screen Graphics +#define DJI_SYM_CROSSHAIR_LEFT 0x72 +#define DJI_SYM_CROSSHAIR_CENTRE 0x73 +#define DJI_SYM_CROSSHAIR_RIGHT 0x74 +#define DJI_SYM_AH_RIGHT 0x02 +#define DJI_SYM_AH_LEFT 0x03 +#define DJI_SYM_AH_DECORATION 0x13 +#define DJI_SYM_SMALL_CROSSHAIR 0x7E + +// Satellite Graphics +#define DJI_SYM_SAT_L 0x1E +#define DJI_SYM_SAT_R 0x1F + +// Direction arrows +#define DJI_SYM_ARROW_SOUTH 0x60 +#define DJI_SYM_ARROW_2 0x61 +#define DJI_SYM_ARROW_3 0x62 +#define DJI_SYM_ARROW_4 0x63 +#define DJI_SYM_ARROW_EAST 0x64 +#define DJI_SYM_ARROW_6 0x65 +#define DJI_SYM_ARROW_7 0x66 +#define DJI_SYM_ARROW_8 0x67 +#define DJI_SYM_ARROW_NORTH 0x68 +#define DJI_SYM_ARROW_10 0x69 +#define DJI_SYM_ARROW_11 0x6A +#define DJI_SYM_ARROW_12 0x6B +#define DJI_SYM_ARROW_WEST 0x6C +#define DJI_SYM_ARROW_14 0x6D +#define DJI_SYM_ARROW_15 0x6E +#define DJI_SYM_ARROW_16 0x6F + +#define DJI_SYM_ARROW_SMALL_UP 0x75 +#define DJI_SYM_ARROW_SMALL_DOWN 0x76 +#define DJI_SYM_ARROW_SMALL_RIGHT 0x77 +#define DJI_SYM_ARROW_SMALL_LEFT 0x78 + +// AH Bars +#define DJI_SYM_AH_BAR9_0 0x80 +#define DJI_SYM_AH_BAR9_1 0x81 +#define DJI_SYM_AH_BAR9_2 0x82 +#define DJI_SYM_AH_BAR9_3 0x83 +#define DJI_SYM_AH_BAR9_4 0x84 +#define DJI_SYM_AH_BAR9_5 0x85 +#define DJI_SYM_AH_BAR9_6 0x86 +#define DJI_SYM_AH_BAR9_7 0x87 +#define DJI_SYM_AH_BAR9_8 0x88 + +// Progress bar +#define DJI_SYM_PB_START 0x8A +#define DJI_SYM_PB_FULL 0x8B +#define DJI_SYM_PB_HALF 0x8C +#define DJI_SYM_PB_EMPTY 0x8D +#define DJI_SYM_PB_END 0x8E +#define DJI_SYM_PB_CLOSE 0x8F + +// Batt evolution +#define DJI_SYM_BATT_FULL 0x90 +#define DJI_SYM_BATT_5 0x91 +#define DJI_SYM_BATT_4 0x92 +#define DJI_SYM_BATT_3 0x93 +#define DJI_SYM_BATT_2 0x94 +#define DJI_SYM_BATT_1 0x95 +#define DJI_SYM_BATT_EMPTY 0x96 + +// Batt Icons +#define DJI_SYM_MAIN_BATT 0x97 + +// Voltage and amperage +#define DJI_SYM_VOLT 0x06 +#define DJI_SYM_AMP 0x9A +#define DJI_SYM_MAH 0x07 +#define DJI_SYM_WATT 0x57 // 0x57 is 'W' + +// Time +#define DJI_SYM_ON_H 0x70 +#define DJI_SYM_FLY_H 0x71 +#define DJI_SYM_ON_M 0x9B +#define DJI_SYM_FLY_M 0x9C + +// Speed +#define DJI_SYM_KPH 0x9E +#define DJI_SYM_MPH 0x9D +#define DJI_SYM_MPS 0x9F +#define DJI_SYM_FTPS 0x99 + +// Menu cursor +#define DJI_SYM_CURSOR DJI_SYM_AH_LEFT + +// Stick overlays +#define DJI_SYM_STICK_OVERLAY_SPRITE_HIGH 0x08 +#define DJI_SYM_STICK_OVERLAY_SPRITE_MID 0x09 +#define DJI_SYM_STICK_OVERLAY_SPRITE_LOW 0x0A +#define DJI_SYM_STICK_OVERLAY_CENTER 0x0B +#define DJI_SYM_STICK_OVERLAY_VERTICAL 0x16 +#define DJI_SYM_STICK_OVERLAY_HORIZONTAL 0x17 + +// GPS degree/minute/second symbols +#define DJI_SYM_GPS_DEGREE DJI_SYM_STICK_OVERLAY_SPRITE_HIGH // kind of looks like the degree symbol +#define DJI_SYM_GPS_MINUTE 0x27 // ' +#define DJI_SYM_GPS_SECOND 0x22 // " diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 56245ea04af..f3f00ae7bdb 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -70,7 +70,7 @@ #include "io/osd_common.h" #include "io/osd_hud.h" #include "io/osd_utils.h" -#include "io/displayport_msp_bf_compat.h" +#include "io/displayport_msp_dji_compat.h" #include "io/vtx.h" #include "io/vtx_string.h" @@ -253,51 +253,6 @@ bool osdIsNotMetric(void) { return !(osdConfig()->units == OSD_UNIT_METRIC || osdConfig()->units == OSD_UNIT_METRIC_MPH); } -/* - * Aligns text to the left side. Adds spaces at the end to keep string length unchanged. - */ -/* -- Currently unused -- -static void osdLeftAlignString(char *buff) -{ - uint8_t sp = 0, ch = 0; - uint8_t len = strlen(buff); - while (buff[sp] == ' ') sp++; - for (ch = 0; ch < (len - sp); ch++) buff[ch] = buff[ch + sp]; - for (sp = ch; sp < len; sp++) buff[sp] = ' '; -}*/ - -/* - * This is a simplified distance conversion code that does not use any scaling - * but is fully compatible with the DJI G2 MSP Displayport OSD implementation. - * (Based on osdSimpleAltitudeSymbol() implementation) - */ -/* void osdSimpleDistanceSymbol(char *buff, int32_t dist) { - - int32_t convertedDistance; - char suffix; - - switch ((osd_unit_e)osdConfig()->units) { - case OSD_UNIT_UK: - FALLTHROUGH; - case OSD_UNIT_GA: - FALLTHROUGH; - case OSD_UNIT_IMPERIAL: - convertedDistance = CENTIMETERS_TO_FEET(dist); - suffix = SYM_ALT_FT; - break; - case OSD_UNIT_METRIC_MPH: - FALLTHROUGH; - case OSD_UNIT_METRIC: - convertedDistance = CENTIMETERS_TO_METERS(dist); - suffix = SYM_ALT_M; // Intentionally use the altitude symbol, as the distance symbol is not defined in BFCOMPAT mode - break; - } - - tfp_sprintf(buff, "%5d", (int) convertedDistance); // 5 digits, allowing up to 99999 meters/feet, which should be plenty for 99.9% of use cases - buff[5] = suffix; - buff[6] = '\0'; -} */ - /** * Converts distance into a string based on the current unit system * prefixed by a a symbol to indicate the unit used. @@ -313,12 +268,12 @@ static void osdFormatDistanceSymbol(char *buff, int32_t dist, uint8_t decimals) uint8_t symbol_mi = SYM_DIST_MI; uint8_t symbol_nm = SYM_DIST_NM; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it and change the values - if (isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values + if (isDJICompatibleVideoSystem(osdConfig())) { // Add one digit so up no switch to scaled decimal occurs above 99 digits = 4U; sym_index = 4U; - // Use altitude symbols on purpose, as it seems distance symbols are not defined in BFCOMPAT mode + // Use altitude symbols on purpose, as it seems distance symbols are not defined in DJICOMPAT mode symbol_m = SYM_ALT_M; symbol_km = SYM_ALT_KM; symbol_ft = SYM_ALT_FT; @@ -570,8 +525,8 @@ void osdFormatAltitudeSymbol(char *buff, int32_t alt) buff[0] = ' '; } -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it and change the values - if (isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values + if (isDJICompatibleVideoSystem(osdConfig())) { totalDigits++; digits++; symbolIndex++; @@ -792,21 +747,21 @@ static void osdFormatCoordinate(char *buff, char sym, int32_t val) int32_t decimalPart = abs(val % (int)GPS_DEGREES_DIVIDER); STATIC_ASSERT(GPS_DEGREES_DIVIDER == 1e7, adjust_max_decimal_digits); int decimalDigits; - bool bfcompat = false; // Assume BFCOMPAT mode is no enabled + bool djiCompat = false; // Assume DJICOMPAT mode is no enabled -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if(isBfCompatibleVideoSystem(osdConfig())) { - bfcompat = true; +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if(isDJICompatibleVideoSystem(osdConfig())) { + djiCompat = true; } #endif - if (!bfcompat) { + if (!djiCompat) { decimalDigits = tfp_sprintf(buff + 1 + integerDigits, "%07d", (int)decimalPart); // Embbed the decimal separator buff[1 + integerDigits - 1] += SYM_ZERO_HALF_TRAILING_DOT - '0'; buff[1 + integerDigits] += SYM_ZERO_HALF_LEADING_DOT - '0'; } else { - // BFCOMPAT mode enabled + // DJICOMPAT mode enabled decimalDigits = tfp_sprintf(buff + 1 + integerDigits, ".%06d", (int)decimalPart); } // Fill up to coordinateLength with zeros @@ -1752,8 +1707,8 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_MAIN_BATT_VOLTAGE: { uint8_t base_digits = 2U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if(isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if(isDJICompatibleVideoSystem(osdConfig())) { base_digits = 3U; // Add extra digit to account for decimal point taking an extra character space } #endif @@ -1763,8 +1718,8 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_SAG_COMPENSATED_MAIN_BATT_VOLTAGE: { uint8_t base_digits = 2U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if(isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if(isDJICompatibleVideoSystem(osdConfig())) { base_digits = 3U; // Add extra digit to account for decimal point taking an extra character space } #endif @@ -1787,9 +1742,9 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_MAH_DRAWN: { uint8_t mah_digits = osdConfig()->mAh_precision; // Initialize to config value -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if (isBfCompatibleVideoSystem(osdConfig())) { - //BFcompat is unable to work with scaled values and it only has mAh symbol to work with +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if (isDJICompatibleVideoSystem(osdConfig())) { + //DJIcompat is unable to work with scaled values and it only has mAh symbol to work with tfp_sprintf(buff, "%5d", (int)getMAhDrawn()); // Use 5 digits to allow packs below 100Ah buff[5] = SYM_MAH; buff[6] = '\0'; @@ -1828,9 +1783,9 @@ static bool osdDrawSingleElement(uint8_t item) else if (currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MAH) { uint8_t mah_digits = osdConfig()->mAh_precision; // Initialize to config value -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if (isBfCompatibleVideoSystem(osdConfig())) { - //BFcompat is unable to work with scaled values and it only has mAh symbol to work with +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if (isDJICompatibleVideoSystem(osdConfig())) { + //DJIcompat is unable to work with scaled values and it only has mAh symbol to work with tfp_sprintf(buff, "%5d", (int)getBatteryRemainingCapacity()); // Use 5 digits to allow packs below 100Ah buff[5] = SYM_MAH; buff[6] = '\0'; @@ -2139,8 +2094,8 @@ static bool osdDrawSingleElement(uint8_t item) buff[1] = SYM_HDP_R; int32_t centiHDOP = 100 * gpsSol.hdop / HDOP_SCALE; uint8_t digits = 2U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it and change the values - if (isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values + if (isDJICompatibleVideoSystem(osdConfig())) { digits = 3U; } #endif @@ -2799,8 +2754,8 @@ static bool osdDrawSingleElement(uint8_t item) // time will be longer than 99 minutes. If it is, it will show 99:^^ if (glideTime > (99 * 60) + 59) { tfp_sprintf(buff + 1, "%02d:", (int)(glideTime / 60)); - buff[4] = SYM_DIRECTION; - buff[5] = SYM_DIRECTION; + buff[4] = SYM_DECORATION; + buff[5] = SYM_DECORATION; } else { tfp_sprintf(buff + 1, "%02d:%02d", (int)(glideTime / 60), (int)(glideTime % 60)); } @@ -3147,8 +3102,8 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_MAIN_BATT_CELL_VOLTAGE: { uint8_t base_digits = 3U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if(isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if(isDJICompatibleVideoSystem(osdConfig())) { base_digits = 4U; // Add extra digit to account for decimal point taking an extra character space } #endif @@ -3159,8 +3114,8 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE: { uint8_t base_digits = 3U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it - if(isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it + if(isDJICompatibleVideoSystem(osdConfig())) { base_digits = 4U; // Add extra digit to account for decimal point taking an extra character space } #endif @@ -3215,8 +3170,8 @@ static bool osdDrawSingleElement(uint8_t item) timeUs_t currentTimeUs = micros(); timeDelta_t efficiencyTimeDelta = cmpTimeUs(currentTimeUs, efficiencyUpdated); uint8_t digits = 3U; -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it and change the values - if (isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values + if (isDJICompatibleVideoSystem(osdConfig())) { // Increase number of digits so values above 99 don't get scaled by osdFormatCentiNumber digits = 4U; } @@ -3248,7 +3203,7 @@ static bool osdDrawSingleElement(uint8_t item) } if (!efficiencyValid) { buff[0] = buff[1] = buff[2] = buff[3] = '-'; - buff[digits] = SYM_MAH_MI_0; // This will overwrite the "-" at buff[3] if not in BFCOMPAT mode + buff[digits] = SYM_MAH_MI_0; // This will overwrite the "-" at buff[3] if not in DJICOMPAT mode buff[digits + 1] = SYM_MAH_MI_1; buff[digits + 2] = '\0'; } @@ -3418,7 +3373,7 @@ static bool osdDrawSingleElement(uint8_t item) horizontalWindSpeed = getEstimatedHorizontalWindSpeed(&angle); int16_t windDirection = osdGetHeadingAngle( CENTIDEGREES_TO_DEGREES((int)angle) - DECIDEGREES_TO_DEGREES(attitude.values.yaw) + 22); buff[0] = SYM_WIND_HORIZONTAL; - buff[1] = SYM_DIRECTION + (windDirection*2 / 90); + buff[1] = SYM_DECORATION + (windDirection*2 / 90); osdFormatWindSpeedStr(buff + 2, horizontalWindSpeed, valid); break; } @@ -3435,10 +3390,10 @@ static bool osdDrawSingleElement(uint8_t item) float verticalWindSpeed; verticalWindSpeed = -getEstimatedWindSpeed(Z); //from NED to NEU if (verticalWindSpeed < 0) { - buff[1] = SYM_AH_DIRECTION_DOWN; + buff[1] = SYM_AH_DECORATION_DOWN; verticalWindSpeed = -verticalWindSpeed; } else { - buff[1] = SYM_AH_DIRECTION_UP; + buff[1] = SYM_AH_DECORATION_UP; } osdFormatWindSpeedStr(buff + 2, verticalWindSpeed, valid); break; @@ -3552,7 +3507,7 @@ static bool osdDrawSingleElement(uint8_t item) } else { referenceSymbol = '-'; } - displayWriteChar(osdDisplayPort, elemPosX, elemPosY, SYM_DIRECTION); + displayWriteChar(osdDisplayPort, elemPosX, elemPosY, SYM_DECORATION); displayWriteChar(osdDisplayPort, elemPosX, elemPosY + 1, referenceSymbol); return true; } @@ -4186,8 +4141,8 @@ uint8_t drawLogos(bool singular, uint8_t row) { uint8_t logoColOffset = 0; bool usePilotLogo = (osdConfig()->use_pilot_logo && osdDisplayIsHD()); -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is in use, the pilot logo cannot be used, due to font issues. - if (isBfCompatibleVideoSystem(osdConfig())) +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is in use, the pilot logo cannot be used, due to font issues. + if (isDJICompatibleVideoSystem(osdConfig())) usePilotLogo = false; #endif @@ -4727,8 +4682,8 @@ uint8_t drawStat_AverageEfficiency(uint8_t col, uint8_t row, uint8_t statValX, b tfp_sprintf(outBuff, ": "); uint8_t digits = 3U; // Total number of digits (including decimal point) -#ifndef DISABLE_MSP_BF_COMPAT // IF BFCOMPAT is not supported, there's no need to check for it and change the values - if (isBfCompatibleVideoSystem(osdConfig())) { +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values + if (isDJICompatibleVideoSystem(osdConfig())) { // Add one digit so no switch to scaled decimal occurs above 99 digits = 4U; } diff --git a/src/main/io/osd_grid.c b/src/main/io/osd_grid.c index 5d7e8736d91..9e79194498d 100644 --- a/src/main/io/osd_grid.c +++ b/src/main/io/osd_grid.c @@ -315,16 +315,16 @@ void osdGridDrawSidebars(displayPort_t *display) // Arrows if (osdConfig()->sidebar_scroll_arrows) { displayWriteChar(display, elemPosX - hudwidth, elemPosY - hudheight - 1, - left.arrow == OSD_SIDEBAR_ARROW_UP ? SYM_AH_DIRECTION_UP : SYM_BLANK); + left.arrow == OSD_SIDEBAR_ARROW_UP ? SYM_AH_DECORATION_UP : SYM_BLANK); displayWriteChar(display, elemPosX + hudwidth, elemPosY - hudheight - 1, - right.arrow == OSD_SIDEBAR_ARROW_UP ? SYM_AH_DIRECTION_UP : SYM_BLANK); + right.arrow == OSD_SIDEBAR_ARROW_UP ? SYM_AH_DECORATION_UP : SYM_BLANK); displayWriteChar(display, elemPosX - hudwidth, elemPosY + hudheight + 1, - left.arrow == OSD_SIDEBAR_ARROW_DOWN ? SYM_AH_DIRECTION_DOWN : SYM_BLANK); + left.arrow == OSD_SIDEBAR_ARROW_DOWN ? SYM_AH_DECORATION_DOWN : SYM_BLANK); displayWriteChar(display, elemPosX + hudwidth, elemPosY + hudheight + 1, - right.arrow == OSD_SIDEBAR_ARROW_DOWN ? SYM_AH_DIRECTION_DOWN : SYM_BLANK); + right.arrow == OSD_SIDEBAR_ARROW_DOWN ? SYM_AH_DECORATION_DOWN : SYM_BLANK); } // Draw AH sides diff --git a/src/main/io/osd_hud.c b/src/main/io/osd_hud.c index 07bc181d1c1..8a6a68f467a 100644 --- a/src/main/io/osd_hud.c +++ b/src/main/io/osd_hud.c @@ -207,7 +207,7 @@ void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitu if (poiType == 1) { // POI from the ESP radar error_x = hudWrap360(poiP1 - DECIDEGREES_TO_DEGREES(osdGetHeading())); - osdHudWrite(poi_x - 1, poi_y, SYM_DIRECTION + ((error_x + 22) / 45) % 8, 1); + osdHudWrite(poi_x - 1, poi_y, SYM_DECORATION + ((error_x + 22) / 45) % 8, 1); osdHudWrite(poi_x + 1, poi_y, SYM_HUD_SIGNAL_0 + poiP2, 1); } else if (poiType == 2) { // Waypoint, @@ -248,7 +248,7 @@ void osdHudDrawPoi(uint32_t poiDistance, int16_t poiDirection, int32_t poiAltitu tfp_sprintf(buff, "%3d", altc); } - buff[0] = (poiAltitude >= 0) ? SYM_AH_DIRECTION_UP : SYM_AH_DIRECTION_DOWN; + buff[0] = (poiAltitude >= 0) ? SYM_AH_DECORATION_UP : SYM_AH_DECORATION_DOWN; } else { // Display the distance by default switch ((osd_unit_e)osdConfig()->units) { case OSD_UNIT_UK: diff --git a/src/main/io/osd_utils.c b/src/main/io/osd_utils.c index 6675be8783b..9c9fb0608a0 100644 --- a/src/main/io/osd_utils.c +++ b/src/main/io/osd_utils.c @@ -20,7 +20,7 @@ #include "common/maths.h" #include "common/typeconversion.h" #include "drivers/osd_symbols.h" -#include "io/displayport_msp_bf_compat.h" +#include "io/displayport_msp_dji_compat.h" #if defined(USE_OSD) || defined(OSD_UNIT_TEST) @@ -45,7 +45,7 @@ bool osdFormatCentiNumber(char *buff, int32_t centivalue, uint32_t scale, int ma int decimals = maxDecimals; bool negative = false; bool scaled = false; - bool explicitDecimal = isBfCompatibleVideoSystem(osdConfig()); + bool explicitDecimal = isDJICompatibleVideoSystem(osdConfig()); buff[length] = '\0'; From 10d7dd58c42bfab845172e98104c0254663d6552 Mon Sep 17 00:00:00 2001 From: Scavanger Date: Wed, 15 May 2024 22:20:16 -0300 Subject: [PATCH 055/429] snapp --- docs/Broken USB recovery.md | 118 ++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/Broken USB recovery.md diff --git a/docs/Broken USB recovery.md b/docs/Broken USB recovery.md new file mode 100644 index 00000000000..46db627c83e --- /dev/null +++ b/docs/Broken USB recovery.md @@ -0,0 +1,118 @@ +# Broken USB recovery + +It is possible to flash INAV without USB over UART 1 or 3. + +## Prerequisites: +- USB/UART adapter (FT232, CP2102, etc.) +- STM32 Cube Programmer (https://www.st.com/en/development-tools/stm32cubeprog.html) + +To gain access to the FC via Configurator, MSP must be activated on a UART as standard. Some FCs already have this enabled by default, if not a custom firmware must be created. + +The following targets have MSP activated on a UART by default: + +| Target | Standard MSP Port | +|-----------| ----------- | +| AOCODARCF4V3 | UART5 | +| ATOMRCF405NAVI_DELUXE | UART1 | +| FF_F35_LIGHTNING | UART1 | +| FLYCOLORF7V2 | UART4 | +| GEPRCF405_BT_HD | UART5* | +| GEPRCF722_BT_HD | UART4* | +| IFLIGHT_BLITZ_F7_AIO | UART1 | +| JHEMCUF405WING | UART6 | +| JHEMCUH743HD | UART4 | +| KAKUTEH7 | UART1 and UART2* | +| KAKUTEH7WING | UART6 | +| MAMBAF405_2022A | UART4 | +| MAMBAF405US | UART4 | +| MAMBAF722 | UART4 | +| MAMBAF722 APP | UART4*| +| MAMBAF722WING | UART4 | +| MAMBAF722_X8 | UART4 | +| MAMBAH743 | UART4* | +| MATEKF405SE | UART1 | +| NEUTRONRCH743BT | UART3* | +| SDMODELH7V1 | UART1 and UART2 | +| SKYSTARSH743HD | UART4 | +| SPEEDYBEEF4 | UART5* | +| SPEEDYBEEF405MINI | UART4* | +| SPEEDYBEEF405V3 | UART4* | +| SPEEDYBEEF405V4 | UART4* | +| SPEEDYBEEF405WING | UART6 | +| SPEEDYBEEF7 | UART6 | +| SPRACINGF4EVO | UART1 | +| TMOTORF7V2 | UART5 | + +(*) No Pads/Pins, Port is used interally (Bluetooth) + +## Custom firmware: + +If the FC does not have MSP activated on a UART by default or does not have a connector for it, a custom firmware must be built. +The following procedure describes the process under Windows 10/11: + +Please read [Building in Windows 2010 or 11 with Linux Subsystem](https://github.com/iNavFlight/inav/blob/master/docs/development/Building%20in%20Windows%2010%20or%2011%20with%20Linux%20Subsystem.md) +and follow the instructions up to "Building with Make". + +To activate MSP by default, go to the directory `src/main/target/[your target]`. +If no config.c exists, create a new text file with this name and the following content: + +``` +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#include "platform.h" +#include "io/serial.h" + +void targetConfiguration(void) +{ + serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].msp_baudrateIndex = BAUD_115200; +} + +``` + +If the file already exists, add the following lines in the function `void targetConfiguration(void)` (before the last `}`) + +``` +serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].functionMask = FUNCTION_MSP; +serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].msp_baudrateIndex = BAUD_115200; +``` + +Replace the X in SERIAL_PORT_USARTX (in both lines) with the number of UART/serial port on which MSP is to be activated. + +Example: +For UART 2: `SERIAL_PORT_USART2` +For UART 3: `SERIAL_PORT_USART3` +etc. + +Save the file and build the firmware as described in the document above. + +## Flashing via Uart: + +1. Disconnect ALL peripherals and the USB Cable from the FC. To power the FC use a battery or use the 5V provided from the USB/Serial Converter. +2. Connect UART 1 or 3 (other UARTS will not work) and GND to the USB/Serial converter (RX -> TX, TX -> RX) +3. Keep the boot/dfu button pressed +4. Switch on the FC / supply with power +5. Start STM32 CubeProgrammer and go to "Erasing & Programming", second option in the menu. +6. Select UART (blue dropdown field) and select the COM port of the USB/Serial adapter and press "Connect". The corresponding processor should now be displayed below. +7. Click on "Full flash erase". This is also necessary if you are flashing the same firmware version that was previously on the FC, otherwise MSP may not be activated on the UART. +8. Under "Download" load the previously created firmware (`INAV_X.X.X_[Your Target].hex`) or the standard firmware if UART is already activated there. The option "Verify programming" is optional but recommended. Make sure that "Skip flash erase while programming" is NOT activated. +9. Click "Start Programming" + +After the process is completed, switch the FC off and on again and then the Configurator can connect to the FC via USB/serial adapter and the previously configured UART. From 3d9d1f3b91aa255c80919d90d89dbfa755894a64 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 16 May 2024 07:43:56 +0100 Subject: [PATCH 056/429] Update docs --- docs/Betaflight 4.3 compatible OSD.md | 50 --------------------------- docs/DJI compatible OSD.md | 50 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 docs/Betaflight 4.3 compatible OSD.md create mode 100644 docs/DJI compatible OSD.md diff --git a/docs/Betaflight 4.3 compatible OSD.md b/docs/Betaflight 4.3 compatible OSD.md deleted file mode 100644 index 0e9644dae24..00000000000 --- a/docs/Betaflight 4.3 compatible OSD.md +++ /dev/null @@ -1,50 +0,0 @@ -# Betaflight 4.3 compatible MSP DisplayPort OSD (DJI O3 "Canvas Mode") - -INAV 6.0 includes a special mode for MSP DisplayPort that supports incomplete implementations of MSP DisplayPort that only support BetaFlight, like the DJI O3 Air Unit. INAV 6.1 expands this to include HD canvas sizes from BetaFlight 4.4. - -Different flight controllers have different OSD symbols and elements and require different fonts. BetaFlight's font is a single page and supports a maximum of 256 glyphs, INAV's font is currently 2 pages and supports up to 512 different glyphs. - -While there is some overlap between the glyphs in BetaFlight and INAV, it is not possible to perform a 1 to 1 mapping for all the them. In cases where there is no suitable glyph in the BetaFlight font, a question mark `?` will be displayed. - -This mode can be enabled by selecting BF43COMPAT or BFHDCOMPAT as video format in the OSD tab of the configurator or by typing the following command on the CLI: - -`set osd_video_system = BF43COMPAT` - -or - -`set osd_video_system = BFHDCOMPAT` - -## Limitations - -* Canvas size needs to be manually changed to HD on the Display menu in DJI's goggles (you may need a firmware update) and set as BFHDCOMPAT in the OSD tab of the configurator. -* Unsupported Glyphs show up as `?` - -## FAQ - -### I see a lot of `?` on my OSD. - -That is expected, when your INAV OSD widgets use glyphs that don't have a suitable mapping in BetaFlight's font. - -### Does it work with the G2 and Original Air Unit/Vista? - -Yes. - -### Is this a replacement for WTFOS? - -Not exactly. WTFOS is a full implementation of MSP-Displayport for rooted Air Unit/Vista/Googles V2 and actually works much better than BetaFlight compatibility mode, being able to display all INAV's glyphs. - -### Can INAV fix DJI's product? - -No. OSD renderinng happens on the googles/air unit side of things. Please ask DJI to fix their incomplete MSP DisplayPort implemenation. You can probably request it in [DJI's forum](https://forum.dji.com/forum.php?mod=forumdisplay&fid=129&filter=typeid&typeid=767). - -### BetaFlight X.Y now has more symbols, can you update INAV? - -Maybe. If a future version of BetaFlight includes more Glyphs that can be mapped into INAV it is fairly simple to add the mapping, but the problem with DJI's implemenation persists. Even if we update the mapping, if DJI does not update the fonts on their side the problem will persist. - -### Can you replace glyph `X` with text `x description`? - -While it might technically be possible to replace some glyphs with text in multiple cells, it will introduce a lot of complexity in the OSD rendering and configuration for something we hope is a temporary workaround. - -### Does DJI support Canvas Mode? - -Actually, no. What DJI calls Canvas Mode is actually MSP DisplayPort and is a character based OSD. diff --git a/docs/DJI compatible OSD.md b/docs/DJI compatible OSD.md new file mode 100644 index 00000000000..6af25670306 --- /dev/null +++ b/docs/DJI compatible OSD.md @@ -0,0 +1,50 @@ +# DJI compatible MSP DisplayPort OSD (DJI O3 "Canvas Mode") + +INAV 6.0 includes a special mode for MSP DisplayPort that supports DJI's incomplete implementations of MSP DisplayPort. This can be found on products like the DJI O3 Air Unit. INAV 6.1 expands this to include HD canvas sizes from BetaFlight 4.4. + +Different flight controller firmware have different OSD symbols and elements and require different fonts. BetaFlight's font is a single page and supports a maximum of 256 glyphs, INAV's font is currently 2 pages and supports up to 512 different glyphs. DJI's font is single page and based, but not the same as, BetaFlight's font. + +While there is some overlap between the glyphs in DJI and INAV, it is not possible to perform a 1 to 1 mapping for all the them. In cases where there is no suitable glyph in the DJI font, a question mark `?` will be displayed. + +This mode can be enabled by selecting DJI43COMPAT or DJIHDCOMPAT as video format in the OSD tab of the configurator or by typing the following command on the CLI: + +`set osd_video_system = DJI43COMPAT` + +or + +`set osd_video_system = DJIHDCOMPAT` + +## Limitations + +* Canvas size needs to be manually changed to HD on the Display menu in DJI's goggles (you may need a firmware update) and set as DJIHDCOMPAT in the OSD tab of the configurator. +* Unsupported Glyphs show up as `?` + +## FAQ + +### I see a lot of `?` on my OSD. + +That is expected. When your INAV OSD widgets use glyphs that don't have a suitable mapping in DJI's font. + +### Does it work with the G2 and Original Air Unit/Vista? + +Yes. + +### Is this a replacement for WTFOS? + +Not exactly. WTFOS is a full implementation of MSP-Displayport for rooted Air Unit/Vista/Googles V2 and actually works much better than DJI compatibility mode. It can use all of INAV's OSD elements as intended. If you have the option of WTFOS or DJI compatability mode. WTFOS is the best option. + +### Can INAV fix DJI's product? + +No. OSD renderinng happens on the googles/air unit side of things. Please ask DJI to fix their incomplete MSP DisplayPort implemenation. You can probably request it in [DJI's forum](https://forum.dji.com/forum.php?mod=forumdisplay&fid=129&filter=typeid&typeid=767). To see what you're missing out on with O3. Check out what WTFOS did with the original system. Not only could the pilots upload the fonts of their choosing (who doesn't want a cool SneakyFPV font on their OSD). But there were no problems supporting and firmware. Plus, there was even an option to save the OSD to a file and overlay that over your DVR video. If you're reading this far. Please recommend to DJI that they fix their product, to at least what was possible with WTFOS. + +### DJI's font now has more symbols, can you update INAV? + +Maybe. If a future version of DJI's font includes more Glyphs that can be mapped into INAV. It is fairly simple to add the mapping. However, the best solution would be full support of MSP DisplayPort by DJI. Then there will never be an issue with missing icons. As the latest INAV font would be able to be uploaded on to the goggles. + +### Can you replace glyph `X` with text `x description`? + +While it might technically be possible to replace some glyphs with text in multiple cells, it will introduce a lot of complexity in the OSD rendering and configuration for something we hope is a temporary workaround. + +### Does DJI support Canvas Mode? + +Actually, no. What DJI calls Canvas Mode is actually MSP DisplayPort and is a character based OSD. Currently, the only true implementaion of Canvas Mode is with FrSKY PixelOSD. This was found on some F722 flight controllers from Matek. From a818190ed12761ea7977f29f4d963c2a51310064 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 18 May 2024 13:49:04 +0200 Subject: [PATCH 057/429] Use letter `Q` for DJI LinkQuality OSD element --- src/main/io/displayport_msp_dji_compat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index de4fa8656fa..46e14c00470 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -41,10 +41,8 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_RSSI: return DJI_SYM_RSSI; -/* case SYM_LQ: - return DJI_SYM_LINK_QUALITY; -*/ + return 'Q'; case SYM_LAT: return DJI_SYM_LAT; From ec7ebd1c4b3c66155896c0615e3c0f11590b62d7 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 18 May 2024 14:15:59 +0200 Subject: [PATCH 058/429] Do not render DJI logo on OSD when using DJI Compat modes --- src/main/io/osd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index f3f00ae7bdb..62186908ff9 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -4140,10 +4140,13 @@ uint8_t drawLogos(bool singular, uint8_t row) { uint8_t logoRow = row; uint8_t logoColOffset = 0; bool usePilotLogo = (osdConfig()->use_pilot_logo && osdDisplayIsHD()); + bool useINAVLogo = (singular && !usePilotLogo) || !singular; #ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is in use, the pilot logo cannot be used, due to font issues. - if (isDJICompatibleVideoSystem(osdConfig())) + if (isDJICompatibleVideoSystem(osdConfig())) { usePilotLogo = false; + useINAVLogo = false; + } #endif uint8_t logoSpacing = osdConfig()->inav_to_pilot_logo_spacing; @@ -4160,7 +4163,7 @@ uint8_t drawLogos(bool singular, uint8_t row) { } // Draw INAV logo - if ((singular && !usePilotLogo) || !singular) { + if (useINAVLogo) { unsigned logo_c = SYM_LOGO_START; uint8_t logo_x = logoColOffset; for (uint8_t lRow = 0; lRow < SYM_LOGO_HEIGHT; lRow++) { @@ -4191,7 +4194,7 @@ uint8_t drawLogos(bool singular, uint8_t row) { } return logoRow; - } +} #ifdef USE_STATS uint8_t drawStat_Stats(uint8_t statNameX, uint8_t row, uint8_t statValueX, bool isBootStats) From 3efb86c848123475d904f97ab6ee1ecb3716a0f3 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 18 May 2024 14:16:29 +0200 Subject: [PATCH 059/429] Do not render DJI logo on OSD when using DJI compat mode --- src/main/io/osd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 62186908ff9..b2407b2325b 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -4181,9 +4181,9 @@ uint8_t drawLogos(bool singular, uint8_t row) { logoRow = row; if (singular) { logo_x = logoColOffset; - } else { - logo_x = logoColOffset + SYM_LOGO_WIDTH + logoSpacing; - } + } else { + logo_x = logoColOffset + SYM_LOGO_WIDTH + logoSpacing; + } for (uint8_t lRow = 0; lRow < SYM_LOGO_HEIGHT; lRow++) { for (uint8_t lCol = 0; lCol < SYM_LOGO_WIDTH; lCol++) { @@ -4193,6 +4193,10 @@ uint8_t drawLogos(bool singular, uint8_t row) { } } + if (!usePilotLogo && !useINAVLogo) { + logoRow += SYM_LOGO_HEIGHT; + } + return logoRow; } From 3615e6fb0981d7e03125fe454e8acaff7b1f6a34 Mon Sep 17 00:00:00 2001 From: dzaro-dev <23706061+dzaro-dev@users.noreply.github.com> Date: Sat, 18 May 2024 16:58:22 +0100 Subject: [PATCH 060/429] Adding Crosshair Styles --- src/main/io/dji_osd_symbols.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h index 66972a810e7..3ef5a6c5e9b 100644 --- a/src/main/io/dji_osd_symbols.h +++ b/src/main/io/dji_osd_symbols.h @@ -71,6 +71,26 @@ #define DJI_SYM_AH_DECORATION 0x13 #define DJI_SYM_SMALL_CROSSHAIR 0x7E +// Crosshair Styles +#define DJI_SYM_AH_CH_TYPE3 0x00 +#define DJI_SYM_AH_CH_TYPE3_1 0x7E +#define DJI_SYM_AH_CH_TYPE3_2 0x00 +#define DJI_SYM_AH_CH_TYPE4 0x2D +#define DJI_SYM_AH_CH_TYPE4_1 0x7E +#define DJI_SYM_AH_CH_TYPE4_2 0x2D +#define DJI_SYM_AH_CH_TYPE5 0x17 +#define DJI_SYM_AH_CH_TYPE5_1 0x7E +#define DJI_SYM_AH_CH_TYPE5_2 0x17 +#define DJI_SYM_AH_CH_TYPE6 0x00 +#define DJI_SYM_AH_CH_TYPE6_1 0x09 +#define DJI_SYM_AH_CH_TYPE6_2 0x00 +#define DJI_SYM_AH_CH_TYPE7 0x78 +#define DJI_SYM_AH_CH_TYPE7_1 0x7E +#define DJI_SYM_AH_CH_TYPE7_2 0x77 +#define DJI_SYM_AH_CH_TYPE8 0x02 +#define DJI_SYM_AH_CH_TYPE8_1 0x7E +#define DJI_SYM_AH_CH_TYPE8_2 0x03 + // Satellite Graphics #define DJI_SYM_SAT_L 0x1E #define DJI_SYM_SAT_R 0x1F From cc4b3db899a995eae8514c63309d985338efa2d3 Mon Sep 17 00:00:00 2001 From: dzaro-dev <23706061+dzaro-dev@users.noreply.github.com> Date: Sat, 18 May 2024 17:02:59 +0100 Subject: [PATCH 061/429] Adding Crosshair Styles --- src/main/io/displayport_msp_dji_compat.c | 49 ++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index de4fa8656fa..93ec60b9ce8 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -469,40 +469,75 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_AH_RIGHT: return DJI_SYM_AH_RIGHT; - /* case SYM_AH_DECORATION_COUNT: return DJI_SYM_AH_DECORATION_COUNT; */ case SYM_AH_CH_LEFT: + case SYM_AH_CH_AIRCRAFT1: + return DJI_SYM_CROSSHAIR_LEFT; + case SYM_AH_CH_TYPE3: + return DJI_SYM_AH_CH_TYPE3; + case SYM_AH_CH_TYPE4: + return DJI_SYM_AH_CH_TYPE4; + case SYM_AH_CH_TYPE5: + return DJI_SYM_AH_CH_TYPE5; + case SYM_AH_CH_TYPE6: + return DJI_SYM_AH_CH_TYPE6; + case SYM_AH_CH_TYPE7: + return DJI_SYM_AH_CH_TYPE7; + case SYM_AH_CH_TYPE8: - case SYM_AH_CH_AIRCRAFT1: - return DJI_SYM_CROSSHAIR_LEFT; + return DJI_SYM_AH_CH_TYPE8; case SYM_AH_CH_CENTER: + case SYM_AH_CH_AIRCRAFT2: + return DJI_SYM_CROSSHAIR_CENTRE; + case (SYM_AH_CH_TYPE3+1): + return DJI_SYM_AH_CH_TYPE3_1; + case (SYM_AH_CH_TYPE4+1): + return DJI_SYM_AH_CH_TYPE4_1; + case (SYM_AH_CH_TYPE5+1): + return DJI_SYM_AH_CH_TYPE5_1; + case (SYM_AH_CH_TYPE6+1): + return DJI_SYM_AH_CH_TYPE6_1; + case (SYM_AH_CH_TYPE7+1): + return DJI_SYM_AH_CH_TYPE7_1; + case (SYM_AH_CH_TYPE8+1): - case SYM_AH_CH_AIRCRAFT2: - return DJI_SYM_CROSSHAIR_CENTRE; + return DJI_SYM_AH_CH_TYPE8_1; case SYM_AH_CH_RIGHT: + case SYM_AH_CH_AIRCRAFT3: + return DJI_SYM_CROSSHAIR_RIGHT; + case (SYM_AH_CH_TYPE3+2): + return DJI_SYM_AH_CH_TYPE3_2; + case (SYM_AH_CH_TYPE4+2): + return DJI_SYM_AH_CH_TYPE4_2; + case (SYM_AH_CH_TYPE5+2): + return DJI_SYM_AH_CH_TYPE5_2; + case (SYM_AH_CH_TYPE6+2): + return DJI_SYM_AH_CH_TYPE6_2; + case (SYM_AH_CH_TYPE7+2): + return DJI_SYM_AH_CH_TYPE7_2; + case (SYM_AH_CH_TYPE8+2): - case SYM_AH_CH_AIRCRAFT3: - return DJI_SYM_CROSSHAIR_RIGHT; + return DJI_SYM_AH_CH_TYPE8_2; case SYM_AH_CH_AIRCRAFT0: case SYM_AH_CH_AIRCRAFT4: From 5e85fe07b1d8ca589390c060f915c9c64ecb26ba Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sat, 18 May 2024 20:31:04 +0100 Subject: [PATCH 062/429] Allow pilots the option to hide question marks from the OSD. --- docs/Settings.md | 10 ++++++ src/main/fc/settings.yaml | 41 +++--------------------- src/main/io/displayport_msp_dji_compat.c | 2 +- src/main/io/osd.c | 5 ++- src/main/io/osd.h | 5 ++- 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 30533330adf..29a745544e4 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -4412,6 +4412,16 @@ Value under which the OSD axis g force indicators will blink (g) --- +### osd_highlight_djis_missing_font_symbols + +Show question marks where there is no symbol in the DJI font to represent the INAV OSD element's symbol. When off, blank spaces will be used. Only relevent for DJICOMPAT modes. + +| Default | Min | Max | +| --- | --- | --- | +| ON | OFF | ON | + +--- + ### osd_home_position_arm_screen Should home position coordinates be displayed on the arming screen. diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index dfa7bb97d35..d276aca274d 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -3453,7 +3453,6 @@ groups: min: 8 max: 11 default_value: 9 - - name: osd_adsb_distance_warning description: "Distance in meters of ADSB aircraft that is displayed" default_value: 20000 @@ -3478,7 +3477,6 @@ groups: min: 0 max: 64000 type: uint16_t - - name: osd_estimations_wind_compensation description: "Use wind estimation for remaining flight time/distance estimation" default_value: ON @@ -3491,12 +3489,10 @@ groups: condition: USE_WIND_ESTIMATOR field: estimations_wind_mps type: bool - - name: osd_failsafe_switch_layout description: "If enabled the OSD automatically switches to the first layout during failsafe" default_value: OFF type: bool - - name: osd_plus_code_digits description: "Numer of plus code digits before shortening with `osd_plus_code_short`. Precision at the equator: 10=13.9x13.9m; 11=2.8x3.5m; 12=56x87cm; 13=11x22cm." field: plus_code_digits @@ -3508,213 +3504,186 @@ groups: field: plus_code_short default_value: "0" table: osd_plus_code_short - - name: osd_ahi_style description: "Sets OSD Artificial Horizon style \"DEFAULT\" or \"LINE\" for the FrSky Graphical OSD." field: ahi_style default_value: "DEFAULT" table: osd_ahi_style type: uint8_t - - name: osd_force_grid field: force_grid type: bool default_value: OFF description: Force OSD to work in grid mode even if the OSD device supports pixel level access (mainly used for development) - - name: osd_ahi_bordered field: ahi_bordered type: bool description: Shows a border/corners around the AHI region (pixel OSD only) default_value: OFF - - name: osd_ahi_width field: ahi_width max: 255 description: AHI width in pixels (pixel OSD only) default_value: 132 - - name: osd_ahi_height field: ahi_height max: 255 description: AHI height in pixels (pixel OSD only) default_value: 162 - - name: osd_ahi_vertical_offset field: ahi_vertical_offset min: -128 max: 127 description: AHI vertical offset from center (pixel OSD only) default_value: -18 - - name: osd_sidebar_horizontal_offset field: sidebar_horizontal_offset min: -128 max: 127 default_value: 0 description: Sidebar horizontal offset from default position. Positive values move the sidebars closer to the edges. - - name: osd_left_sidebar_scroll_step field: left_sidebar_scroll_step max: 255 default_value: 0 description: How many units each sidebar step represents. 0 means the default value for the scroll type. - - name: osd_right_sidebar_scroll_step field: right_sidebar_scroll_step max: 255 default_value: 0 description: Same as left_sidebar_scroll_step, but for the right sidebar - - name: osd_sidebar_height field: sidebar_height min: 0 max: 5 default_value: 3 description: Height of sidebars in rows. 0 leaves only the level indicator arrows (Not for pixel OSD) - - name: osd_ahi_pitch_interval field: ahi_pitch_interval min: 0 max: 30 default_value: 0 description: Draws AHI at increments of the set pitch interval over the full pitch range. AHI line is drawn with ends offset when pitch first exceeds interval with offset increasing with increasing pitch. Offset direction changes between climb and dive. Set to 0 to disable (Not for pixel OSD) - - name: osd_home_position_arm_screen type: bool default_value: ON description: Should home position coordinates be displayed on the arming screen. - - name: osd_pan_servo_index description: Index of the pan servo, used to adjust osd home heading direction based on camera pan. Note that this feature does not work with continiously rotating servos. field: pan_servo_index min: 0 max: 16 default_value: 0 - - name: osd_pan_servo_pwm2centideg description: Centidegrees of pan servo rotation us PWM signal. A servo with 180 degrees of rotation from 1000 to 2000 us PWM typically needs `18` for this setting. Change sign to inverse direction. field: pan_servo_pwm2centideg default_value: 0 min: -36 max: 36 - - name: osd_pan_servo_offcentre_warning description: Degrees either side of the pan servo centre; where it is assumed camera is wanted to be facing forwards, but isn't at 0. If in this range and not 0 for longer than 10 seconds, the pan servo offset OSD element will blink. 0 means the warning is disabled. field: pan_servo_offcentre_warning min: 0 max: 45 default_value: 10 - - name: osd_pan_servo_indicator_show_degrees description: Show the degress of offset from centre on the pan servo OSD display element. field: pan_servo_indicator_show_degrees type: bool default_value: OFF - - name: osd_esc_rpm_precision description: Number of characters used to display the RPM value. field: esc_rpm_precision min: 3 max: 6 default_value: 3 - - name: osd_mah_precision description: Number of digits used for mAh precision. Currently used by mAh Used and Battery Remaining Capacity field: mAh_precision min: 4 max: 6 default_value: 4 - - name: osd_use_pilot_logo description: Use custom pilot logo with/instead of the INAV logo. The pilot logo must be characters 473 to 511 field: use_pilot_logo type: bool default_value: OFF - - name: osd_inav_to_pilot_logo_spacing description: The space between the INAV and pilot logos, if `osd_use_pilot_logo` is `ON`. This number may be adjusted so that it fits the odd/even col width displays. For example, if using an odd column width display, such as Walksnail, and this is set to 4. 1 will be added so that the logos are equally spaced from the centre of the screen. field: inav_to_pilot_logo_spacing min: 0 max: 20 default_value: 8 - - name: osd_arm_screen_display_time description: Amount of time to display the arm screen [ms] field: arm_screen_display_time min: 1000 max: 5000 default_value: 1500 - - name: osd_switch_indicator_zero_name description: "Character to use for OSD switch incicator 0." field: osd_switch_indicator0_name type: string max: 5 default_value: "FLAP" - - name: osd_switch_indicator_one_name description: "Character to use for OSD switch incicator 1." field: osd_switch_indicator1_name type: string max: 5 default_value: "GEAR" - - name: osd_switch_indicator_two_name description: "Character to use for OSD switch incicator 2." field: osd_switch_indicator2_name type: string max: 5 default_value: "CAM" - - name: osd_switch_indicator_three_name description: "Character to use for OSD switch incicator 3." field: osd_switch_indicator3_name type: string max: 5 default_value: "LIGT" - - name: osd_switch_indicator_zero_channel description: "RC Channel to use for OSD switch indicator 0." field: osd_switch_indicator0_channel min: 5 max: MAX_SUPPORTED_RC_CHANNEL_COUNT default_value: 5 - - name: osd_switch_indicator_one_channel description: "RC Channel to use for OSD switch indicator 1." field: osd_switch_indicator1_channel min: 5 max: MAX_SUPPORTED_RC_CHANNEL_COUNT default_value: 5 - - name: osd_switch_indicator_two_channel description: "RC Channel to use for OSD switch indicator 2." field: osd_switch_indicator2_channel min: 5 max: MAX_SUPPORTED_RC_CHANNEL_COUNT default_value: 5 - - name: osd_switch_indicator_three_channel description: "RC Channel to use for OSD switch indicator 3." field: osd_switch_indicator3_channel min: 5 max: MAX_SUPPORTED_RC_CHANNEL_COUNT default_value: 5 - - name: osd_switch_indicators_align_left description: "Align text to left of switch indicators" field: osd_switch_indicators_align_left type: bool default_value: ON - - name: osd_system_msg_display_time description: System message display cycle time for multiple messages (milliseconds). field: system_msg_display_time default_value: 1000 min: 500 max: 5000 - + - name: osd_highlight_djis_missing_font_symbols + description: Show question marks where there is no symbol in the DJI font to represent the INAV OSD element's symbol. When off, blank spaces will be used. Only relevent for DJICOMPAT modes. + field: highlight_djis_fuckup + default_value: ON + type: bool - name: PG_OSD_COMMON_CONFIG type: osdCommonConfig_t headers: ["io/osd_common.h"] diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index de4fa8656fa..e6c2d0b3c03 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -705,7 +705,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) break; } - return '?'; // Missing/not mapped character + return (osdConfig()->highlight_djis_fuckup) ? '?' : SYM_BLANK; // Missing/not mapped character } #endif diff --git a/src/main/io/osd.c b/src/main/io/osd.c index f3f00ae7bdb..881a8b4e767 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -223,7 +223,7 @@ static bool osdDisplayHasCanvas; #define AH_MAX_PITCH_DEFAULT 20 // Specify default maximum AHI pitch value displayed (degrees) -PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 10); +PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 11); PG_REGISTER_WITH_RESET_FN(osdLayoutsConfig_t, osdLayoutsConfig, PG_OSD_LAYOUTS_CONFIG, 1); void osdStartedSaveProcess(void) { @@ -3874,6 +3874,9 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig, .airspeed_alarm_min = SETTING_OSD_AIRSPEED_ALARM_MIN_DEFAULT, .airspeed_alarm_max = SETTING_OSD_AIRSPEED_ALARM_MAX_DEFAULT, #endif +#ifndef DISABLE_MSP_DJI_COMPAT + .highlight_djis_fuckup = SETTING_OSD_HIGHLIGHT_DJIS_MISSING_FONT_SYMBOLS_DEFAULT, +#endif .video_system = SETTING_OSD_VIDEO_SYSTEM_DEFAULT, .row_shiftdown = SETTING_OSD_ROW_SHIFTDOWN_DEFAULT, diff --git a/src/main/io/osd.h b/src/main/io/osd.h index ca5dca66137..ed60e26e4b8 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -457,7 +457,10 @@ typedef struct osdConfig_s { bool use_pilot_logo; // If enabled, the pilot logo (last 40 characters of page 2 font) will be used with the INAV logo. uint8_t inav_to_pilot_logo_spacing; // The space between the INAV and pilot logos, if pilot logo is used. This number may be adjusted so that it fits the odd/even col width. uint16_t arm_screen_display_time; // Length of time the arm screen is displayed - #ifdef USE_ADSB +#ifndef DISABLE_MSP_DJI_COMPAT + bool highlight_djis_fuckup; // If enabled, show question marks where there is no character in DJI's font to represent an OSD element symbol +#endif +#ifdef USE_ADSB uint16_t adsb_distance_warning; // in metres uint16_t adsb_distance_alert; // in metres uint16_t adsb_ignore_plane_above_me_limit; // in metres From 135406decf4e63ef89fc4afc47885a54b7b5949d Mon Sep 17 00:00:00 2001 From: dzaro-dev <23706061+dzaro-dev@users.noreply.github.com> Date: Sun, 19 May 2024 00:44:12 +0100 Subject: [PATCH 063/429] Update dji_osd_symbols.h as per request --- src/main/io/dji_osd_symbols.h | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h index 3ef5a6c5e9b..2489bb176d9 100644 --- a/src/main/io/dji_osd_symbols.h +++ b/src/main/io/dji_osd_symbols.h @@ -71,26 +71,6 @@ #define DJI_SYM_AH_DECORATION 0x13 #define DJI_SYM_SMALL_CROSSHAIR 0x7E -// Crosshair Styles -#define DJI_SYM_AH_CH_TYPE3 0x00 -#define DJI_SYM_AH_CH_TYPE3_1 0x7E -#define DJI_SYM_AH_CH_TYPE3_2 0x00 -#define DJI_SYM_AH_CH_TYPE4 0x2D -#define DJI_SYM_AH_CH_TYPE4_1 0x7E -#define DJI_SYM_AH_CH_TYPE4_2 0x2D -#define DJI_SYM_AH_CH_TYPE5 0x17 -#define DJI_SYM_AH_CH_TYPE5_1 0x7E -#define DJI_SYM_AH_CH_TYPE5_2 0x17 -#define DJI_SYM_AH_CH_TYPE6 0x00 -#define DJI_SYM_AH_CH_TYPE6_1 0x09 -#define DJI_SYM_AH_CH_TYPE6_2 0x00 -#define DJI_SYM_AH_CH_TYPE7 0x78 -#define DJI_SYM_AH_CH_TYPE7_1 0x7E -#define DJI_SYM_AH_CH_TYPE7_2 0x77 -#define DJI_SYM_AH_CH_TYPE8 0x02 -#define DJI_SYM_AH_CH_TYPE8_1 0x7E -#define DJI_SYM_AH_CH_TYPE8_2 0x03 - // Satellite Graphics #define DJI_SYM_SAT_L 0x1E #define DJI_SYM_SAT_R 0x1F @@ -182,3 +162,23 @@ #define DJI_SYM_GPS_DEGREE DJI_SYM_STICK_OVERLAY_SPRITE_HIGH // kind of looks like the degree symbol #define DJI_SYM_GPS_MINUTE 0x27 // ' #define DJI_SYM_GPS_SECOND 0x22 // " + +// Crosshair Styles +#define DJI_SYM_AH_CH_TYPE3 DJI_SYM_NONE +#define DJI_SYM_AH_CH_TYPE3_1 DJI_SYM_SMALL_CROSSHAIR +#define DJI_SYM_AH_CH_TYPE3_2 DJI_SYM_NONE +#define DJI_SYM_AH_CH_TYPE4 DJI_SYM_HYPHEN +#define DJI_SYM_AH_CH_TYPE4_1 DJI_SYM_SMALL_CROSSHAIR +#define DJI_SYM_AH_CH_TYPE4_2 DJI_SYM_HYPHEN +#define DJI_SYM_AH_CH_TYPE5 DJI_SYM_STICK_OVERLAY_HORIZONTAL +#define DJI_SYM_AH_CH_TYPE5_1 DJI_SYM_SMALL_CROSSHAIR +#define DJI_SYM_AH_CH_TYPE5_2 DJI_SYM_STICK_OVERLAY_HORIZONTAL +#define DJI_SYM_AH_CH_TYPE6 DJI_SYM_NONE +#define DJI_SYM_AH_CH_TYPE6_1 DJI_SYM_STICK_OVERLAY_SPRITE_MID +#define DJI_SYM_AH_CH_TYPE6_2 DJI_SYM_NONE +#define DJI_SYM_AH_CH_TYPE7 DJI_SYM_ARROW_SMALL_LEFT +#define DJI_SYM_AH_CH_TYPE7_1 DJI_SYM_SMALL_CROSSHAIR +#define DJI_SYM_AH_CH_TYPE7_2 DJI_SYM_ARROW_SMALL_RIGHT +#define DJI_SYM_AH_CH_TYPE8 DJI_SYM_AH_LEFT +#define DJI_SYM_AH_CH_TYPE8_1 DJI_SYM_SMALL_CROSSHAIR +#define DJI_SYM_AH_CH_TYPE8_2 DJI_SYM_AH_RIGHT From 655b325fcef1f550046a1cb4f643f62fbe48aeb3 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 19 May 2024 08:33:14 +0100 Subject: [PATCH 064/429] Tidy up DJI crosshairs Re-ordered to keep the same crosshairs together. --- src/main/io/displayport_msp_dji_compat.c | 82 ++++++++++-------------- src/main/io/dji_osd_symbols.h | 20 ------ 2 files changed, 34 insertions(+), 68 deletions(-) diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 93ec60b9ce8..ba6f7399c66 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -476,72 +476,58 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_AH_CH_LEFT: case SYM_AH_CH_AIRCRAFT1: return DJI_SYM_CROSSHAIR_LEFT; - - case SYM_AH_CH_TYPE3: - return DJI_SYM_AH_CH_TYPE3; - - case SYM_AH_CH_TYPE4: - return DJI_SYM_AH_CH_TYPE4; - - case SYM_AH_CH_TYPE5: - return DJI_SYM_AH_CH_TYPE5; - - case SYM_AH_CH_TYPE6: - return DJI_SYM_AH_CH_TYPE6; - - case SYM_AH_CH_TYPE7: - return DJI_SYM_AH_CH_TYPE7; - - case SYM_AH_CH_TYPE8: - return DJI_SYM_AH_CH_TYPE8; - case SYM_AH_CH_CENTER: case SYM_AH_CH_AIRCRAFT2: return DJI_SYM_CROSSHAIR_CENTRE; - - case (SYM_AH_CH_TYPE3+1): - return DJI_SYM_AH_CH_TYPE3_1; - - case (SYM_AH_CH_TYPE4+1): - return DJI_SYM_AH_CH_TYPE4_1; - - case (SYM_AH_CH_TYPE5+1): - return DJI_SYM_AH_CH_TYPE5_1; - - case (SYM_AH_CH_TYPE6+1): - return DJI_SYM_AH_CH_TYPE6_1; - - case (SYM_AH_CH_TYPE7+1): - return DJI_SYM_AH_CH_TYPE7_1; - - case (SYM_AH_CH_TYPE8+1): - return DJI_SYM_AH_CH_TYPE8_1; - case SYM_AH_CH_RIGHT: case SYM_AH_CH_AIRCRAFT3: return DJI_SYM_CROSSHAIR_RIGHT; + + case SYM_AH_CH_AIRCRAFT0: + case SYM_AH_CH_AIRCRAFT4: + return DJI_SYM_BLANK; + case SYM_AH_CH_TYPE3: + return DJI_SYM_NONE; + case (SYM_AH_CH_TYPE3+1): + return DJI_SYM_SMALL_CROSSHAIR; case (SYM_AH_CH_TYPE3+2): - return DJI_SYM_AH_CH_TYPE3_2; + return DJI_SYM_NONE; + case SYM_AH_CH_TYPE4: + return DJI_SYM_HYPHEN; + case (SYM_AH_CH_TYPE4+1): + return DJI_SYM_SMALL_CROSSHAIR; case (SYM_AH_CH_TYPE4+2): - return DJI_SYM_AH_CH_TYPE4_2; + return DJI_SYM_HYPHEN; + case SYM_AH_CH_TYPE5: + return DJI_SYM_STICK_OVERLAY_HORIZONTAL; + case (SYM_AH_CH_TYPE5+1): + return DJI_SYM_SMALL_CROSSHAIR; case (SYM_AH_CH_TYPE5+2): - return DJI_SYM_AH_CH_TYPE5_2; + return DJI_SYM_STICK_OVERLAY_HORIZONTAL; + case SYM_AH_CH_TYPE6: + return DJI_SYM_NONE; + case (SYM_AH_CH_TYPE6+1): + return DJI_SYM_STICK_OVERLAY_SPRITE_MID; case (SYM_AH_CH_TYPE6+2): - return DJI_SYM_AH_CH_TYPE6_2; + return DJI_SYM_NONE; + case SYM_AH_CH_TYPE7: + return DJI_SYM_ARROW_SMALL_LEFT; + case (SYM_AH_CH_TYPE7+1): + return DJI_SYM_SMALL_CROSSHAIR; case (SYM_AH_CH_TYPE7+2): - return DJI_SYM_AH_CH_TYPE7_2; + return DJI_SYM_ARROW_SMALL_RIGHT; + case SYM_AH_CH_TYPE8: + return DJI_SYM_AH_LEFT; + case (SYM_AH_CH_TYPE8+1): + return DJI_SYM_SMALL_CROSSHAIR; case (SYM_AH_CH_TYPE8+2): - return DJI_SYM_AH_CH_TYPE8_2; - - case SYM_AH_CH_AIRCRAFT0: - case SYM_AH_CH_AIRCRAFT4: - return DJI_SYM_BLANK; + return DJI_SYM_AH_RIGHT; case SYM_ARROW_UP: return DJI_SYM_ARROW_NORTH; diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h index 2489bb176d9..66972a810e7 100644 --- a/src/main/io/dji_osd_symbols.h +++ b/src/main/io/dji_osd_symbols.h @@ -162,23 +162,3 @@ #define DJI_SYM_GPS_DEGREE DJI_SYM_STICK_OVERLAY_SPRITE_HIGH // kind of looks like the degree symbol #define DJI_SYM_GPS_MINUTE 0x27 // ' #define DJI_SYM_GPS_SECOND 0x22 // " - -// Crosshair Styles -#define DJI_SYM_AH_CH_TYPE3 DJI_SYM_NONE -#define DJI_SYM_AH_CH_TYPE3_1 DJI_SYM_SMALL_CROSSHAIR -#define DJI_SYM_AH_CH_TYPE3_2 DJI_SYM_NONE -#define DJI_SYM_AH_CH_TYPE4 DJI_SYM_HYPHEN -#define DJI_SYM_AH_CH_TYPE4_1 DJI_SYM_SMALL_CROSSHAIR -#define DJI_SYM_AH_CH_TYPE4_2 DJI_SYM_HYPHEN -#define DJI_SYM_AH_CH_TYPE5 DJI_SYM_STICK_OVERLAY_HORIZONTAL -#define DJI_SYM_AH_CH_TYPE5_1 DJI_SYM_SMALL_CROSSHAIR -#define DJI_SYM_AH_CH_TYPE5_2 DJI_SYM_STICK_OVERLAY_HORIZONTAL -#define DJI_SYM_AH_CH_TYPE6 DJI_SYM_NONE -#define DJI_SYM_AH_CH_TYPE6_1 DJI_SYM_STICK_OVERLAY_SPRITE_MID -#define DJI_SYM_AH_CH_TYPE6_2 DJI_SYM_NONE -#define DJI_SYM_AH_CH_TYPE7 DJI_SYM_ARROW_SMALL_LEFT -#define DJI_SYM_AH_CH_TYPE7_1 DJI_SYM_SMALL_CROSSHAIR -#define DJI_SYM_AH_CH_TYPE7_2 DJI_SYM_ARROW_SMALL_RIGHT -#define DJI_SYM_AH_CH_TYPE8 DJI_SYM_AH_LEFT -#define DJI_SYM_AH_CH_TYPE8_1 DJI_SYM_SMALL_CROSSHAIR -#define DJI_SYM_AH_CH_TYPE8_2 DJI_SYM_AH_RIGHT From 508b3ddc904b9c1ddf9194fd4d51e4eaf3b063e9 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 19 May 2024 09:07:16 +0100 Subject: [PATCH 065/429] Remove unused define from DJI OSD symbols I searched the code and DJI_SYM_CURSOR isn't used anywhere. The only OSD use of cursor at all is in the CMS, which just uses the '>' character. So this define can go. After that the dji_osd_symbols.h file is a pure character to variable map. --- src/main/io/dji_osd_symbols.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h index 2489bb176d9..35a034c7f54 100644 --- a/src/main/io/dji_osd_symbols.h +++ b/src/main/io/dji_osd_symbols.h @@ -147,9 +147,6 @@ #define DJI_SYM_MPS 0x9F #define DJI_SYM_FTPS 0x99 -// Menu cursor -#define DJI_SYM_CURSOR DJI_SYM_AH_LEFT - // Stick overlays #define DJI_SYM_STICK_OVERLAY_SPRITE_HIGH 0x08 #define DJI_SYM_STICK_OVERLAY_SPRITE_MID 0x09 From 536c5c3958f8623d02cf3c46ae9956b005a381b6 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 19 May 2024 20:24:18 +0200 Subject: [PATCH 066/429] Make Iterm Lock configurable --- src/main/fc/settings.yaml | 12 ++++++++++++ src/main/flight/pid.c | 9 ++++++--- src/main/flight/pid.h | 5 +++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 307f6d9cb53..3abe94e12c9 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2227,6 +2227,18 @@ groups: field: fixedWingLevelTrimGain min: 0 max: 20 + - name: fw_iterm_lock_time_max_ms + description: Defines max time in milliseconds for how long ITerm Lock will shut down Iterm after sticks are release + default_value: 500 + field: fwItermLockTimeMaxMs + min: 100 + max: 1000 + - name: fw_iterm_lock_rate_threshold + description: Defines rate percentage when full P I and D attenuation should happen. 100 disables Iterm Lock for P and D term + field: fwItermLockRateLimit + default_value: 40 + min: 10 + max: 100 - name: PG_PID_AUTOTUNE_CONFIG type: pidAutotuneConfig_t diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 479d8e8d346..711b3a0af07 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -178,7 +178,7 @@ static EXTENDED_FASTRAM bool angleHoldIsLevel = false; static EXTENDED_FASTRAM float fixedWingLevelTrim; static EXTENDED_FASTRAM pidController_t fixedWingLevelTrimController; -PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 8); +PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 9); PG_RESET_TEMPLATE(pidProfile_t, pidProfile, .bank_mc = { @@ -312,6 +312,8 @@ PG_RESET_TEMPLATE(pidProfile_t, pidProfile, .smithPredictorDelay = SETTING_SMITH_PREDICTOR_DELAY_DEFAULT, .smithPredictorFilterHz = SETTING_SMITH_PREDICTOR_LPF_HZ_DEFAULT, #endif + .fwItermLockTimeMaxMs = SETTING_FW_ITERM_LOCK_TIME_MAX_MS_DEFAULT, + .fwItermLockRateLimit = SETTING_FW_ITERM_LOCK_RATE_THRESHOLD_DEFAULT, ); bool pidInitFilters(void) @@ -748,7 +750,8 @@ static void nullRateController(pidState_t *pidState, float dT, float dT_inv) { static void fwRateAttenuation(pidState_t *pidState, const float rateTarget, const float rateError) { const float maxRate = currentControlRateProfile->stabilized.rates[pidState->axis] * 10.0f; - const float dampingFactor = attenuation(rateTarget, maxRate / 2.5f); + + const float dampingFactor = attenuation(rateTarget, maxRate * pidProfile()->fwItermLockRateLimit / 100.0f); /* * Iterm damping is applied (down to 0) when: @@ -770,7 +773,7 @@ static void fwRateAttenuation(pidState_t *pidState, const float rateTarget, cons pidState->attenuation.targetOverThresholdTimeMs = 0; } - pidState->attenuation.aI = MIN(dampingFactor, (errorThresholdReached && (millis() - pidState->attenuation.targetOverThresholdTimeMs) < 500) ? 0.0f : 1.0f); + pidState->attenuation.aI = MIN(dampingFactor, (errorThresholdReached && (millis() - pidState->attenuation.targetOverThresholdTimeMs) < pidProfile()->fwItermLockTimeMaxMs) ? 0.0f : 1.0f); //P & D damping factors are always the same and based on current damping factor pidState->attenuation.aP = dampingFactor; diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index c8df7231ed6..93e713b61a9 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -155,6 +155,11 @@ typedef struct pidProfile_s { float smithPredictorDelay; uint16_t smithPredictorFilterHz; #endif + + + uint16_t fwItermLockTimeMaxMs; + uint8_t fwItermLockRateLimit; + } pidProfile_t; typedef struct pidAutotuneConfig_s { From 2118cebf255d2cce359863636d68f19ad6538c0e Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 19 May 2024 20:24:41 +0200 Subject: [PATCH 067/429] Iterm Lock configurability --- src/main/fc/settings.yaml | 6 ++++++ src/main/flight/pid.c | 3 ++- src/main/flight/pid.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 3abe94e12c9..a2d2195bde0 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2239,6 +2239,12 @@ groups: default_value: 40 min: 10 max: 100 + - name: fw_iterm_lock_engage_threshold + description: Defines error rate (in percents of max rate) when Iterm Lock is engaged when sticks are release. Iterm Lock will stay active until error drops below this number + default_value: 10 + min: 5 + max: 25 + field: fwItermLockEngageThreshold - name: PG_PID_AUTOTUNE_CONFIG type: pidAutotuneConfig_t diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 711b3a0af07..a9d1291877f 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -314,6 +314,7 @@ PG_RESET_TEMPLATE(pidProfile_t, pidProfile, #endif .fwItermLockTimeMaxMs = SETTING_FW_ITERM_LOCK_TIME_MAX_MS_DEFAULT, .fwItermLockRateLimit = SETTING_FW_ITERM_LOCK_RATE_THRESHOLD_DEFAULT, + .fwItermLockEngageThreshold = SETTING_FW_ITERM_LOCK_ENGAGE_THRESHOLD_DEFAULT, ); bool pidInitFilters(void) @@ -761,7 +762,7 @@ static void fwRateAttenuation(pidState_t *pidState, const float rateTarget, cons */ //If error is greater than 10% or max rate - const bool errorThresholdReached = fabsf(rateError) > maxRate * 0.1f; + const bool errorThresholdReached = fabsf(rateError) > maxRate * pidProfile()->fwItermLockEngageThreshold / 100.0f; //If stick (setpoint) was moved above threshold in the last 500ms if (fabsf(rateTarget) > maxRate * 0.2f) { diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index 93e713b61a9..26aeb86990d 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -159,6 +159,7 @@ typedef struct pidProfile_s { uint16_t fwItermLockTimeMaxMs; uint8_t fwItermLockRateLimit; + uint8_t fwItermLockEngageThreshold; } pidProfile_t; From fc9457f4708b616594de728681ae072bc03bcda6 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 19 May 2024 20:25:52 +0200 Subject: [PATCH 068/429] Docs update --- docs/Settings.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/Settings.md b/docs/Settings.md index 9f3baaed662..96141fa65d2 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1302,6 +1302,36 @@ Fixed-wing rate stabilisation I-gain for YAW --- +### fw_iterm_lock_engage_threshold + +Defines error rate (in percents of max rate) when Iterm Lock is engaged when sticks are release. Iterm Lock will stay active until error drops below this number + +| Default | Min | Max | +| --- | --- | --- | +| 10 | 5 | 25 | + +--- + +### fw_iterm_lock_rate_threshold + +Defines rate percentage when full P I and D attenuation should happen. 100 disables Iterm Lock for P and D term + +| Default | Min | Max | +| --- | --- | --- | +| 40 | 10 | 100 | + +--- + +### fw_iterm_lock_time_max_ms + +Defines max time in milliseconds for how long ITerm Lock will shut down Iterm after sticks are release + +| Default | Min | Max | +| --- | --- | --- | +| 500 | 100 | 1000 | + +--- + ### fw_level_pitch_gain I-gain for the pitch trim for self-leveling flight modes. Higher values means that AUTOTRIM will be faster but might introduce oscillations From 5a2b1ee9a7a21090c2586fe9d8b8088ee98760a4 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 21 May 2024 11:39:23 +0100 Subject: [PATCH 069/429] move activewp and rxupdaterate fields --- src/main/blackbox/blackbox.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 727488cc1b1..4433e7b4aba 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -402,13 +402,15 @@ static const blackboxSimpleFieldDefinition_t blackboxGpsHFields[] = { // Rarely-updated fields static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = { + {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"flightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"stateFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"failsafePhase", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, {"rxSignalReceived", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, {"rxFlightChannelsValid", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, - + {"rxUpdateRate", -1, UNSIGNED, PREDICT(PREVIOUS), ENCODING(UNSIGNED_VB)}, + {"hwHealthStatus", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"powerSupplyImpedance", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"sagCompensatedVBat", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, @@ -436,8 +438,6 @@ static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = { {"escRPM", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"escTemperature", -1, SIGNED, PREDICT(PREVIOUS), ENCODING(SIGNED_VB)}, #endif - {"rxUpdateRate", -1, UNSIGNED, PREDICT(PREVIOUS), ENCODING(UNSIGNED_VB)}, - {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, }; typedef enum BlackboxState { @@ -1259,7 +1259,8 @@ static void writeSlowFrame(void) int32_t values[3]; blackboxWrite('S'); - + + blackboxWriteUnsignedVB(slowHistory.activeWpNumber); blackboxWriteUnsignedVB(slowHistory.flightModeFlags); blackboxWriteUnsignedVB(slowHistory.stateFlags); @@ -1268,9 +1269,11 @@ static void writeSlowFrame(void) */ values[0] = slowHistory.failsafePhase; values[1] = slowHistory.rxSignalReceived ? 1 : 0; - values[2] = slowHistory.rxFlightChannelsValid ? 1 : 0; + values[2] = slowHistory.rxFlightChannelsValid ? 1 : 0; blackboxWriteTag2_3S32(values); + blackboxWriteUnsignedVB(slowHistory.rxUpdateRate); + blackboxWriteUnsignedVB(slowHistory.hwHealthStatus); blackboxWriteUnsignedVB(slowHistory.powerSupplyImpedance); @@ -1296,8 +1299,6 @@ static void writeSlowFrame(void) blackboxWriteUnsignedVB(slowHistory.escRPM); blackboxWriteSignedVB(slowHistory.escTemperature); #endif - blackboxWriteUnsignedVB(slowHistory.rxUpdateRate); - blackboxWriteUnsignedVB(slowHistory.activeWpNumber); blackboxSlowFrameIterationTimer = 0; } @@ -1307,6 +1308,7 @@ static void writeSlowFrame(void) */ static void loadSlowState(blackboxSlowState_t *slow) { + slow->activeWpNumber = getActiveWpNumber(); memcpy(&slow->flightModeFlags, &rcModeActivationMask, sizeof(slow->flightModeFlags)); //was flightModeFlags; // Also log Nav auto enabled flight modes rather than just those selected by boxmode if (FLIGHT_MODE(ANGLE_MODE)) { @@ -1328,6 +1330,7 @@ static void loadSlowState(blackboxSlowState_t *slow) slow->failsafePhase = failsafePhase(); slow->rxSignalReceived = rxIsReceivingSignal(); slow->rxFlightChannelsValid = rxAreFlightChannelsValid(); + slow->rxUpdateRate = getRcUpdateFrequency(); slow->hwHealthStatus = (getHwGyroStatus() << 2 * 0) | // Pack hardware health status into a bit field. (getHwAccelerometerStatus() << 2 * 1) | // Use raw hardwareSensorStatus_e values and pack them using 2 bits per value (getHwCompassStatus() << 2 * 2) | // Report GYRO in 2 lowest bits, then ACC, COMPASS, BARO, GPS, RANGEFINDER and PITOT @@ -1379,9 +1382,6 @@ static void loadSlowState(blackboxSlowState_t *slow) slow->escRPM = escSensor->rpm; slow->escTemperature = escSensor->temperature; #endif - - slow->rxUpdateRate = getRcUpdateFrequency(); - slow->activeWpNumber = getActiveWpNumber(); } /** From 946241d995ca8b7c8c762330a31b9d2ed9f1d1be Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Tue, 21 May 2024 21:41:30 +0100 Subject: [PATCH 070/429] Made it more boring --- src/main/fc/settings.yaml | 2 +- src/main/io/displayport_msp_dji_compat.c | 2 +- src/main/io/osd.c | 2 +- src/main/io/osd.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d276aca274d..fa21316463e 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -3681,7 +3681,7 @@ groups: max: 5000 - name: osd_highlight_djis_missing_font_symbols description: Show question marks where there is no symbol in the DJI font to represent the INAV OSD element's symbol. When off, blank spaces will be used. Only relevent for DJICOMPAT modes. - field: highlight_djis_fuckup + field: highlight_djis_missing_characters default_value: ON type: bool - name: PG_OSD_COMMON_CONFIG diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index e6c2d0b3c03..cf57b49be67 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -705,7 +705,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) break; } - return (osdConfig()->highlight_djis_fuckup) ? '?' : SYM_BLANK; // Missing/not mapped character + return (osdConfig()->highlight_djis_missing_characters) ? '?' : SYM_BLANK; // Missing/not mapped character } #endif diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 881a8b4e767..34135ce2fd7 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -3875,7 +3875,7 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig, .airspeed_alarm_max = SETTING_OSD_AIRSPEED_ALARM_MAX_DEFAULT, #endif #ifndef DISABLE_MSP_DJI_COMPAT - .highlight_djis_fuckup = SETTING_OSD_HIGHLIGHT_DJIS_MISSING_FONT_SYMBOLS_DEFAULT, + .highlight_djis_missing_characters = SETTING_OSD_HIGHLIGHT_DJIS_MISSING_FONT_SYMBOLS_DEFAULT, #endif .video_system = SETTING_OSD_VIDEO_SYSTEM_DEFAULT, diff --git a/src/main/io/osd.h b/src/main/io/osd.h index ed60e26e4b8..7ac14054994 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -458,7 +458,7 @@ typedef struct osdConfig_s { uint8_t inav_to_pilot_logo_spacing; // The space between the INAV and pilot logos, if pilot logo is used. This number may be adjusted so that it fits the odd/even col width. uint16_t arm_screen_display_time; // Length of time the arm screen is displayed #ifndef DISABLE_MSP_DJI_COMPAT - bool highlight_djis_fuckup; // If enabled, show question marks where there is no character in DJI's font to represent an OSD element symbol + bool highlight_djis_missing_characters; // If enabled, show question marks where there is no character in DJI's font to represent an OSD element symbol #endif #ifdef USE_ADSB uint16_t adsb_distance_warning; // in metres From b4dfc9302a84b31f03e79ed179c8754aab99fb76 Mon Sep 17 00:00:00 2001 From: HishamGhosheh Date: Thu, 23 May 2024 01:57:25 +0200 Subject: [PATCH 071/429] Add JHEF405PRO (aka GHF405AIO-HD) support --- src/main/target/JHEF405PRO/CMakeLists.txt | 1 + src/main/target/JHEF405PRO/target.c | 34 +++++ src/main/target/JHEF405PRO/target.h | 154 ++++++++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 src/main/target/JHEF405PRO/CMakeLists.txt create mode 100644 src/main/target/JHEF405PRO/target.c create mode 100644 src/main/target/JHEF405PRO/target.h diff --git a/src/main/target/JHEF405PRO/CMakeLists.txt b/src/main/target/JHEF405PRO/CMakeLists.txt new file mode 100644 index 00000000000..eb7f0108832 --- /dev/null +++ b/src/main/target/JHEF405PRO/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f405xg(JHEF405PRO) diff --git a/src/main/target/JHEF405PRO/target.c b/src/main/target/JHEF405PRO/target.c new file mode 100644 index 00000000000..23c1604c0ca --- /dev/null +++ b/src/main/target/JHEF405PRO/target.c @@ -0,0 +1,34 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0), // S1 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0), // S2 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 0, 1), // S3 + DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 0, 0), // S4 + + DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM, 0, 0), // PPM + DEF_TIM(TIM1, CH2, PA9, TIM_USE_LED, 0, 1 ), //LED +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/JHEF405PRO/target.h b/src/main/target/JHEF405PRO/target.h new file mode 100644 index 00000000000..43547cd2efa --- /dev/null +++ b/src/main/target/JHEF405PRO/target.h @@ -0,0 +1,154 @@ +/* + * This is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "JHEF405PRO" +#define USBD_PRODUCT_STRING "JHEF405PRO" + +#define LED0 PC14 +#define BEEPER PC13 +#define BEEPER_INVERTED + +// *************** SPI1 Gyro & ACC ********************** +#define USE_SPI +#define USE_SPI_DEVICE_1 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW90_DEG +#define ICM42605_CS_PIN PB12 +#define ICM42605_SPI_BUS BUS_SPI1 + +#define USE_EXTI +#define GYRO_INT_EXTI PB13 +#define USE_MPU_DATA_READY_SIGNAL + +// *************** SPI3 OSD & Flash *************************** +#define USE_SPI_DEVICE_3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +// OSD +#define USE_OSD +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI3 +#define MAX7456_CS_PIN PB14 + +// Flash +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_CS_PIN PB3 +#define M25P16_SPI_BUS BUS_SPI3 + +// *************** I2C /Baro/Mag ********************* +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 +#define DEFAULT_I2C_BUS BUS_I2C1 + +// Baro +#define USE_BARO +#define BARO_I2C_BUS DEFAULT_I2C_BUS +#define USE_BARO_DPS310 + +// Mag +#define USE_MAG +#define USE_MAG_ALL +#define MAG_I2C_BUS DEFAULT_I2C_BUS + +// Temperature +#define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS + +// Range finder +#define USE_RANGEFINDER +#define USE_RANGEFINDER_HCSR04_I2C +#define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS + +// PITOT +#define PITOT_I2C_BUS DEFAULT_I2C_BUS + +// *************** UART ***************************** +#define USB_IO +#define USE_VCP +#define VBUS_SENSING_PIN PA8 // TODO validate +#define VBUS_SENSING_ENABLED + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PB6 + +#define USE_UART2 +#define UART2_RX_PIN PD6 +#define UART2_TX_PIN PD5 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +#define SERIAL_PORT_COUNT 6 + +// *************** ADC *************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_STREAM DMA2_Stream0 +#define ADC_CHANNEL_1_PIN PC3 +#define ADC_CHANNEL_2_PIN PC2 +#define ADC_CHANNEL_3_PIN PC0 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 +#define CURRENT_METER_SCALE 250 + +// *************** OTHERS ************************* +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) + +// Rx defaults +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_CRSF +#define SERIALRX_UART SERIAL_PORT_USART2 + + +// *************** LED2812 ************************ +#define USE_LED_STRIP +#define WS2811_PIN PA9 + + + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff + +//TIMER +#define MAX_PWM_OUTPUT_PORTS 4 + +#define USE_DSHOT From b7a24063af29560cc5a95cfdbbdded5ea3d638f4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 23 May 2024 09:43:41 +0200 Subject: [PATCH 072/429] Add PSA about ICM426xx changes in INAV 7.1 Some users have reported issues with INAV 7.1+ when upgrading from previews versions in aircraft that had this gyro. Recalibrating the gyro, or redoing the setup in INAV 7.1 seems to have fixed most of them. --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index a70c42d4c86..a83ba6c6cfd 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,10 @@ > INAV 7 is the last INAV official release available for F411 based flight controllers. The next milestone, INAV 8 will not be available for F411 boards. +# ICM426xx IMUs PSA + +> The filtering settings for the ICM426xx has changed to matche what is used by Ardupilot and Betaflight in INAV 7.1. When upgrading from older versions you may need to recalibrate the Accelerometer and if you are not using INAV's default tune you may also want to check if the tune is still good. + ![INAV](http://static.rcgroups.net/forums/attachments/6/1/0/3/7/6/a9088858-102-inav.png) # PosHold, Navigation and RTH without compass PSA From e37ed9f270ba1729463e4d01f29923584d70c9fd Mon Sep 17 00:00:00 2001 From: HishamGhosheh Date: Thu, 23 May 2024 10:27:55 +0200 Subject: [PATCH 073/429] Add SKIP_RELEASES to JHEF405PRO --- src/main/target/JHEF405PRO/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/JHEF405PRO/CMakeLists.txt b/src/main/target/JHEF405PRO/CMakeLists.txt index eb7f0108832..939221cf744 100644 --- a/src/main/target/JHEF405PRO/CMakeLists.txt +++ b/src/main/target/JHEF405PRO/CMakeLists.txt @@ -1 +1 @@ -target_stm32f405xg(JHEF405PRO) +target_stm32f405xg(JHEF405PRO SKIP_RELEASES) From 39bd781552867e2e22a176cac222498270bfed2d Mon Sep 17 00:00:00 2001 From: Scavanger Date: Thu, 23 May 2024 10:51:41 -0300 Subject: [PATCH 074/429] USB-Rescue --- cmake/at32.cmake | 5 ++++ cmake/sitl.cmake | 4 +++ cmake/stm32.cmake | 5 ++++ docs/Broken USB recovery.md | 51 +++++-------------------------------- src/main/fc/config.c | 8 ++++++ 5 files changed, 28 insertions(+), 45 deletions(-) diff --git a/cmake/at32.cmake b/cmake/at32.cmake index 54e178deb7b..6ac70bc528e 100644 --- a/cmake/at32.cmake +++ b/cmake/at32.cmake @@ -326,6 +326,11 @@ function(target_at32) math(EXPR hse_value "${hse_mhz} * 1000000") list(APPEND target_definitions "HSE_VALUE=${hse_value}") + + if (MSP_UART) + list(APPEND target_definitions "MSP_UART=${MSP_UART}") + endif() + if(args_COMPILE_DEFINITIONS) list(APPEND target_definitions ${args_COMPILE_DEFINITIONS}) endif() diff --git a/cmake/sitl.cmake b/cmake/sitl.cmake index ee43aa9a93a..39e6456830a 100644 --- a/cmake/sitl.cmake +++ b/cmake/sitl.cmake @@ -99,6 +99,10 @@ function (target_sitl name) math(EXPR hse_value "${hse_mhz} * 1000000") list(APPEND target_definitions "HSE_VALUE=${hse_value}") + if (MSP_UART) + list(APPEND target_definitions "MSP_UART=${MSP_UART}") + endif() + string(TOLOWER ${PROJECT_NAME} lowercase_project_name) set(binary_name ${lowercase_project_name}_${FIRMWARE_VERSION}_${name}) if(DEFINED BUILD_SUFFIX AND NOT "" STREQUAL "${BUILD_SUFFIX}") diff --git a/cmake/stm32.cmake b/cmake/stm32.cmake index f02185e9aff..c4534a30500 100644 --- a/cmake/stm32.cmake +++ b/cmake/stm32.cmake @@ -333,6 +333,11 @@ function(target_stm32) math(EXPR hse_value "${hse_mhz} * 1000000") list(APPEND target_definitions "HSE_VALUE=${hse_value}") + + if (MSP_UART) + list(APPEND target_definitions "MSP_UART=${MSP_UART}") + endif() + if(args_COMPILE_DEFINITIONS) list(APPEND target_definitions ${args_COMPILE_DEFINITIONS}) endif() diff --git a/docs/Broken USB recovery.md b/docs/Broken USB recovery.md index 46db627c83e..3406653b981 100644 --- a/docs/Broken USB recovery.md +++ b/docs/Broken USB recovery.md @@ -53,55 +53,16 @@ The following procedure describes the process under Windows 10/11: Please read [Building in Windows 2010 or 11 with Linux Subsystem](https://github.com/iNavFlight/inav/blob/master/docs/development/Building%20in%20Windows%2010%20or%2011%20with%20Linux%20Subsystem.md) and follow the instructions up to "Building with Make". -To activate MSP by default, go to the directory `src/main/target/[your target]`. -If no config.c exists, create a new text file with this name and the following content: - -``` -/* - * This file is part of INAV. - * - * INAV is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * INAV is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with INAV. If not, see . - */ - -#include - -#include "platform.h" -#include "io/serial.h" - -void targetConfiguration(void) -{ - serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].functionMask = FUNCTION_MSP; - serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].msp_baudrateIndex = BAUD_115200; -} - -``` - -If the file already exists, add the following lines in the function `void targetConfiguration(void)` (before the last `}`) - -``` -serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].functionMask = FUNCTION_MSP; -serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USARTX)].msp_baudrateIndex = BAUD_115200; -``` - -Replace the X in SERIAL_PORT_USARTX (in both lines) with the number of UART/serial port on which MSP is to be activated. +In the step 'prepare build environment' add the option `-DMSP_UART=SERIAL_PORT_USARTX` to `cmake` + +Replace the X in SERIAL_PORT_USARTX with the number of UART/serial port on which MSP is to be activated. Example: -For UART 2: `SERIAL_PORT_USART2` -For UART 3: `SERIAL_PORT_USART3` +For UART 2: `cmake -DMSP_UART=SERIAL_PORT_USART2 ..` +For UART 3: `cmake -DMSP_UART=SERIAL_PORT_USART3 ..` etc. -Save the file and build the firmware as described in the document above. +Build the firmware as described in the document above (`make [YOUR_TARGET]`). ## Flashing via Uart: diff --git a/src/main/fc/config.c b/src/main/fc/config.c index c9a50c60a25..e5f164988df 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -284,6 +284,14 @@ void createDefaultConfig(void) featureSet(FEATURE_AIRMODE); targetConfiguration(); + +#ifdef MSP_UART + int port = findSerialPortIndexByIdentifier(MSP_UART); + if (port) { + serialConfigMutable()->portConfigs[port].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[port].msp_baudrateIndex = BAUD_115200; + } +#endif } void resetConfigs(void) From a974ccc85b6f3f79a67f58149c6b960b603e15eb Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 24 May 2024 10:01:08 -0500 Subject: [PATCH 075/429] revert buggy inav_use_gps_no_baro to default off --- src/main/fc/settings.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d2d8c5c433e..de413d456af 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2288,10 +2288,10 @@ groups: field: use_gps_velned type: bool - name: inav_use_gps_no_baro - description: "Defines if INAV should use only use GPS data for altitude estimation when barometer is not available. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed." + description: "Defines if INAV should use only use GPS data for altitude estimation and not barometer. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed." field: use_gps_no_baro type: bool - default_value: ON + default_value: OFF - name: inav_allow_dead_reckoning description: "Defines if INAV will dead-reckon over short GPS outages. May also be useful for indoors OPFLOW navigation" default_value: OFF From 4e1e59eb1f16ccfea2d4d4728bdf094eabcced66 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 24 May 2024 13:07:07 -0500 Subject: [PATCH 076/429] inav_use_gps_no_baro Settings.md --- docs/Settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 9c31498ef19..9817422595e 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1844,11 +1844,11 @@ Allows to chose when the home position is reset. Can help prevent resetting home ### inav_use_gps_no_baro -Defines if INAV should use only use GPS data for altitude estimation when barometer is not available. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed. +Defines if INAV should use only use GPS data for altitude estimation and not barometer. If set to ON, INAV will allow GPS assisted modes and RTH even when there is no barometer installed. | Default | Min | Max | | --- | --- | --- | -| ON | OFF | ON | +| OFF | OFF | ON | --- From 9be624037c2c812b3e08a352e3d952febdf77dcb Mon Sep 17 00:00:00 2001 From: WizzardDr <93602460+WizzardDr@users.noreply.github.com> Date: Fri, 24 May 2024 22:13:13 +0100 Subject: [PATCH 077/429] Skip `pollVersion()` and `pollGnssCapabilities()` if `gps_auto_config = OFF` Modified gps_ublox.c to skip `pollVersion()` and `pollGnssCapabilities()` if `gps_auto_config = OFF`. This is to support an RX only UART connection of the GPS module. --- src/main/io/gps_ublox.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 8375774e044..8c071613289 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1048,25 +1048,26 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) gpsState.hwVersion = UBX_HW_VERSION_UNKNOWN; gpsState.autoConfigStep = 0; - do { - pollVersion(); - gpsState.autoConfigStep++; - ptWaitTimeout((gpsState.hwVersion != UBX_HW_VERSION_UNKNOWN), GPS_CFG_CMD_TIMEOUT_MS); - } while(gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && gpsState.hwVersion == UBX_HW_VERSION_UNKNOWN); - - gpsState.autoConfigStep = 0; - ubx_capabilities.supported = ubx_capabilities.enabledGnss = ubx_capabilities.defaultGnss = 0; - // M7 and earlier will never get pass this step, so skip it (#9440). - // UBLOX documents that this is M8N and later - if (gpsState.hwVersion > UBX_HW_VERSION_UBLOX7) { - do { - pollGnssCapabilities(); - gpsState.autoConfigStep++; - ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS); - } while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0); - } // Configure GPS module if enabled if (gpsState.gpsConfig->autoConfig) { + do { + pollVersion(); + gpsState.autoConfigStep++; + ptWaitTimeout((gpsState.hwVersion != UBX_HW_VERSION_UNKNOWN), GPS_CFG_CMD_TIMEOUT_MS); + } while(gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && gpsState.hwVersion == UBX_HW_VERSION_UNKNOWN); + + gpsState.autoConfigStep = 0; + ubx_capabilities.supported = ubx_capabilities.enabledGnss = ubx_capabilities.defaultGnss = 0; + // M7 and earlier will never get pass this step, so skip it (#9440). + // UBLOX documents that this is M8N and later + if (gpsState.hwVersion > UBX_HW_VERSION_UBLOX7) { + do { + pollGnssCapabilities(); + gpsState.autoConfigStep++; + ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS); + } while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0); + } + // Configure GPS ptSpawn(gpsConfigure); } @@ -1079,7 +1080,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) ptSemaphoreWait(semNewDataReady); gpsProcessNewSolutionData(false); - if ((gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) { + if ((gpsState.gpsConfig->autoConfig) && (gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) { if ((millis() - gpsState.lastCapaPoolMs) > GPS_CAPA_INTERVAL) { gpsState.lastCapaPoolMs = millis(); From 9081429453e7ac6bb4d3f527cb4e74cc7a958ea5 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Fri, 24 May 2024 23:20:55 +0100 Subject: [PATCH 078/429] Include trusted alt for healthy position --- src/main/navigation/navigation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index cc4e269ef4b..e3b491af6ae 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -4437,7 +4437,7 @@ uint32_t distanceToFirstWP(void) bool navigationPositionEstimateIsHealthy(void) { - return (posControl.flags.estPosStatus >= EST_USABLE) && STATE(GPS_FIX_HOME); + return posControl.flags.estPosStatus >= EST_USABLE && posControl.flags.estAltStatus >= EST_USABLE && STATE(GPS_FIX_HOME); } navArmingBlocker_e navigationIsBlockingArming(bool *usedBypass) From 943e16f81f03f12a41a4156cff885133945da9ba Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sun, 26 May 2024 14:02:35 +0100 Subject: [PATCH 079/429] Update system messages --- src/main/io/osd.c | 334 +++++++++++++++++++++++----------------------- 1 file changed, 167 insertions(+), 167 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index f3f00ae7bdb..e48a70ef001 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -525,7 +525,7 @@ void osdFormatAltitudeSymbol(char *buff, int32_t alt) buff[0] = ' '; } -#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values +#ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it and change the values if (isDJICompatibleVideoSystem(osdConfig())) { totalDigits++; digits++; @@ -620,7 +620,7 @@ static inline void osdFormatFlyTime(char *buff, textAttributes_t *attr) } /** - * Trim whitespace from string. + * Trim whitespace from string. * Used in Stats screen on lines with multiple values. */ char *osdFormatTrimWhiteSpace(char *buff) @@ -631,7 +631,7 @@ char *osdFormatTrimWhiteSpace(char *buff) while(isspace((unsigned char)*buff)) buff++; // All spaces? - if(*buff == 0) + if(*buff == 0) return buff; // Trim trailing spaces @@ -1098,7 +1098,7 @@ void osdCrosshairPosition(uint8_t *x, uint8_t *y) * Check if this OSD layout is using scaled or unscaled throttle. * If both are used, it will default to scaled. */ -bool osdUsingScaledThrottle(void) +bool osdUsingScaledThrottle(void) { bool usingScaledThrottle = OSD_VISIBLE(osdLayoutsConfig()->item_pos[currentLayout][OSD_SCALED_THROTTLE_POS]); bool usingRCThrottle = OSD_VISIBLE(osdLayoutsConfig()->item_pos[currentLayout][OSD_THROTTLE_POS]); @@ -1322,7 +1322,7 @@ static void osdDrawMap(int referenceHeading, uint16_t referenceSym, uint16_t cen } } - if (STATE(GPS_FIX) + if (STATE(GPS_FIX) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) #endif @@ -1841,7 +1841,7 @@ static bool osdDrawSingleElement(uint8_t item) if (STATE(GPS_ESTIMATED_FIX)) { strcpy(buff + 2, "ES"); TEXT_ATTRIBUTES_ADD_BLINK(elemAttr); - } else + } else #endif if (!STATE(GPS_FIX)) { hardwareSensorStatus_e sensorStatus = getHwGPSStatus(); @@ -1900,10 +1900,10 @@ static bool osdDrawSingleElement(uint8_t item) case OSD_HOME_DIR: { - if ((STATE(GPS_FIX) + if ((STATE(GPS_FIX) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) -#endif +#endif ) && STATE(GPS_FIX_HOME) && isImuHeadingValid()) { if (GPS_distanceToHome < (navConfig()->general.min_rth_distance / 100) ) { displayWriteChar(osdDisplayPort, elemPosX, elemPosY, SYM_HOME_NEAR); @@ -2540,18 +2540,18 @@ static bool osdDrawSingleElement(uint8_t item) osdCrosshairPosition(&elemPosX, &elemPosY); osdHudDrawCrosshair(osdGetDisplayPortCanvas(), elemPosX, elemPosY); - if (osdConfig()->hud_homing && (STATE(GPS_FIX) -#ifdef USE_GPS_FIX_ESTIMATION + if (osdConfig()->hud_homing && (STATE(GPS_FIX) +#ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) -#endif +#endif ) && STATE(GPS_FIX_HOME) && isImuHeadingValid()) { osdHudDrawHoming(elemPosX, elemPosY); } - if ((STATE(GPS_FIX) -#ifdef USE_GPS_FIX_ESTIMATION + if ((STATE(GPS_FIX) +#ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) -#endif +#endif ) && isImuHeadingValid()) { if (osdConfig()->hud_homepoint || osdConfig()->hud_radar_disp > 0 || osdConfig()->hud_wp_disp > 0) { @@ -3176,10 +3176,10 @@ static bool osdDrawSingleElement(uint8_t item) digits = 4U; } #endif - if ((STATE(GPS_FIX) + if ((STATE(GPS_FIX) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) -#endif +#endif ) && gpsSol.groundSpeed > 0) { if (efficiencyTimeDelta >= EFFICIENCY_UPDATE_INTERVAL) { value = pt1FilterApply4(&eFilterState, ((float)getAmperage() / gpsSol.groundSpeed) / 0.0036f, @@ -3202,7 +3202,7 @@ static bool osdDrawSingleElement(uint8_t item) tfp_sprintf(buff + strlen(buff), "%c", SYM_AH_MI); } if (!efficiencyValid) { - buff[0] = buff[1] = buff[2] = buff[3] = '-'; + buff[0] = buff[1] = buff[2] = buff[3] = '-'; buff[digits] = SYM_MAH_MI_0; // This will overwrite the "-" at buff[3] if not in DJICOMPAT mode buff[digits + 1] = SYM_MAH_MI_1; buff[digits + 2] = '\0'; @@ -3216,7 +3216,7 @@ static bool osdDrawSingleElement(uint8_t item) tfp_sprintf(buff + strlen(buff), "%c", SYM_AH_NM); } if (!efficiencyValid) { - buff[0] = buff[1] = buff[2] = buff[3] = '-'; + buff[0] = buff[1] = buff[2] = buff[3] = '-'; buff[digits] = SYM_MAH_NM_0; buff[digits + 1] = SYM_MAH_NM_1; buff[digits + 2] = '\0'; @@ -3232,7 +3232,7 @@ static bool osdDrawSingleElement(uint8_t item) tfp_sprintf(buff + strlen(buff), "%c", SYM_AH_KM); } if (!efficiencyValid) { - buff[0] = buff[1] = buff[2] = buff[3] = '-'; + buff[0] = buff[1] = buff[2] = buff[3] = '-'; buff[digits] = SYM_MAH_KM_0; buff[digits + 1] = SYM_MAH_KM_1; buff[digits + 2] = '\0'; @@ -3407,7 +3407,7 @@ static bool osdDrawSingleElement(uint8_t item) STATIC_ASSERT(GPS_DEGREES_DIVIDER == OLC_DEG_MULTIPLIER, invalid_olc_deg_multiplier); int digits = osdConfig()->plus_code_digits; int digitsRemoved = osdConfig()->plus_code_short * 2; - if ((STATE(GPS_FIX) + if ((STATE(GPS_FIX) #ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) #endif @@ -4204,7 +4204,7 @@ uint8_t drawStat_Stats(uint8_t statNameX, uint8_t row, uint8_t statValueX, bool displayWrite(osdDisplayPort, statNameX, row, "ODOMETER:"); else displayWrite(osdDisplayPort, statNameX, row, "ODOMETER"); - + switch (osdConfig()->units) { case OSD_UNIT_UK: FALLTHROUGH; @@ -4217,7 +4217,7 @@ uint8_t drawStat_Stats(uint8_t statNameX, uint8_t row, uint8_t statValueX, bool tfp_sprintf(string_buffer, ": %d", statTotalDist); buffLen = 3 + sizeof(statTotalDist); } - + string_buffer[buffLen++] = SYM_MI; break; default: @@ -4243,8 +4243,8 @@ uint8_t drawStat_Stats(uint8_t statNameX, uint8_t row, uint8_t statValueX, bool uint16_t statTotalDist = (uint16_t)(statsConfig()->stats_total_dist / METERS_PER_KILOMETER); tfp_sprintf(string_buffer, ": %d", statTotalDist); buffLen = 3 + sizeof(statTotalDist); - } - + } + string_buffer[buffLen++] = SYM_KM; break; } @@ -4255,13 +4255,13 @@ uint8_t drawStat_Stats(uint8_t statNameX, uint8_t row, uint8_t statValueX, bool displayWrite(osdDisplayPort, statNameX, ++row, "TOTAL TIME:"); else displayWrite(osdDisplayPort, statNameX, ++row, "TOTAL TIME"); - + uint32_t tot_mins = statsConfig()->stats_total_time / 60; if (isBootStats) tfp_sprintf(string_buffer, "%d:%02dH:M%c", (int)(tot_mins / 60), (int)(tot_mins % 60), '\0'); else tfp_sprintf(string_buffer, ": %d:%02d H:M%c", (int)(tot_mins / 60), (int)(tot_mins % 60), '\0'); - + displayWrite(osdDisplayPort, statValueX-(isBootStats ? 7 : 0), row, string_buffer); #ifdef USE_ADC @@ -4486,7 +4486,7 @@ static void osdUpdateStats(void) if (escTemperatureValid) { if (stats.min_esc_temp > escSensor->temperature) stats.min_esc_temp = escSensor->temperature; - + if (stats.max_esc_temp < escSensor->temperature) stats.max_esc_temp = escSensor->temperature; } @@ -4560,7 +4560,7 @@ uint8_t drawStat_MaxDistanceFromHome(uint8_t col, uint8_t row, uint8_t statValX) } else { displayWrite(osdDisplayPort, col, row, "MAX DISTANCE FROM "); valueXOffset = 18; - } + } displayWriteChar(osdDisplayPort, col + valueXOffset, row, SYM_HOME); tfp_sprintf(buff, ": "); osdFormatDistanceStr(buff + 2, stats.max_distance * 100); @@ -4576,10 +4576,10 @@ uint8_t drawStat_Speed(uint8_t col, uint8_t row, uint8_t statValX) uint8_t multiValueXOffset = 0; displayWrite(osdDisplayPort, col, row, "MAX/AVG SPEED"); - + osdFormatVelocityStr(buff2, stats.max_3D_speed, true, false); tfp_sprintf(buff, ": %s/", osdFormatTrimWhiteSpace(buff2)); - multiValueXOffset = strlen(buff); + multiValueXOffset = strlen(buff); displayWrite(osdDisplayPort, statValX, row, buff); osdGenerateAverageVelocityStr(buff2); @@ -4612,8 +4612,8 @@ uint8_t drawStat_BatteryVoltage(uint8_t col, uint8_t row, uint8_t statValX) tfp_sprintf(buff, ": "); osdFormatCentiNumber(buff + 2, stats.min_voltage, 0, osdConfig()->main_voltage_decimals, 0, osdConfig()->main_voltage_decimals + 2, false); strcat(osdFormatTrimWhiteSpace(buff), "/"); - multiValueXOffset = strlen(buff); - // AverageCell + multiValueXOffset = strlen(buff); + // AverageCell osdFormatCentiNumber(buff + multiValueXOffset, stats.min_voltage / getBatteryCellCount(), 0, 2, 0, 3, false); tfp_sprintf(buff + strlen(buff), "%c", SYM_VOLT); @@ -4645,7 +4645,7 @@ uint8_t drawStat_MaximumPowerAndCurrent(uint8_t col, uint8_t row, uint8_t statVa uint8_t drawStat_UsedEnergy(uint8_t col, uint8_t row, uint8_t statValX) { char buff[12]; - + if (osdDisplayIsHD()) displayWrite(osdDisplayPort, col, row, "USED ENERGY FLT/TOT"); else @@ -4674,7 +4674,7 @@ uint8_t drawStat_AverageEfficiency(uint8_t col, uint8_t row, uint8_t statValX, b int32_t totalDistance = getTotalTravelDistance(); bool moreThanAh = false; bool efficiencyValid = totalDistance >= 10000; - + if (osdDisplayIsHD()) displayWrite(osdDisplayPort, col, row, "AVG EFFICIENCY FLT/TOT"); else @@ -4698,18 +4698,18 @@ uint8_t drawStat_AverageEfficiency(uint8_t col, uint8_t row, uint8_t statValX, b moreThanAh = osdFormatCentiNumber(buff, (int32_t)((getMAhDrawn() - stats.flightStartMAh) * 10000.0f * METERS_PER_MILE / totalDistance), 1000, 0, 2, digits, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); if (osdDisplayIsHD()) { - if (!moreThanAh) + if (!moreThanAh) tfp_sprintf(outBuff + strlen(outBuff), "%c%c", SYM_MAH_MI_0, SYM_MAH_MI_1); - else + else tfp_sprintf(outBuff + strlen(outBuff), "%c", SYM_AH_MI); - + moreThanAh = false; } strcat(outBuff, "/"); moreThanAh = moreThanAh || osdFormatCentiNumber(buff, (int32_t)(getMAhDrawn() * 10000.0f * METERS_PER_MILE / totalDistance), 1000, 0, 2, digits, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); - + if (!moreThanAh) tfp_sprintf(outBuff + strlen(outBuff), "%c%c", SYM_MAH_MI_0, SYM_MAH_MI_1); else @@ -4736,11 +4736,11 @@ uint8_t drawStat_AverageEfficiency(uint8_t col, uint8_t row, uint8_t statValX, b moreThanAh = osdFormatCentiNumber(buff, (int32_t)((getMAhDrawn()-stats.flightStartMAh) * 10000.0f * METERS_PER_NAUTICALMILE / totalDistance), 1000, 0, 2, digits, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); if (osdDisplayIsHD()) { - if (!moreThanAh) + if (!moreThanAh) tfp_sprintf(outBuff + strlen(outBuff), "%c%c", SYM_MAH_NM_0, SYM_MAH_NM_1); - else + else tfp_sprintf(outBuff + strlen(outBuff), "%c", SYM_AH_NM); - + moreThanAh = false; } @@ -4781,11 +4781,11 @@ uint8_t drawStat_AverageEfficiency(uint8_t col, uint8_t row, uint8_t statValX, b moreThanAh = osdFormatCentiNumber(buff, (int32_t)((getMAhDrawn() - stats.flightStartMAh) * 10000000.0f / totalDistance), 1000, 0, 2, digits, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); if (osdDisplayIsHD()) { - if (!moreThanAh) + if (!moreThanAh) tfp_sprintf(outBuff + strlen(outBuff), "%c%c", SYM_MAH_KM_0, SYM_MAH_KM_1); - else + else tfp_sprintf(outBuff + strlen(outBuff), "%c", SYM_AH_KM); - + moreThanAh = false; } @@ -4838,7 +4838,7 @@ uint8_t drawStat_RXStats(uint8_t col, uint8_t row, uint8_t statValX) tfp_sprintf(buff, ": "); itoa(stats.min_rssi, buff + 2, 10); strcat(osdFormatTrimWhiteSpace(buff), "%"); - + if (rxConfig()->serialrx_provider == SERIALRX_CRSF) { strcat(osdFormatTrimWhiteSpace(buff), "/"); multiValueXOffset = strlen(buff); @@ -4881,9 +4881,9 @@ uint8_t drawStat_ESCTemperature(uint8_t col, uint8_t row, uint8_t statValX) { char buff[12]; displayWrite(osdDisplayPort, col, row, "MIN/MAX ESC TEMP"); - tfp_sprintf(buff, ": %3d/%3d%c", - ((osdConfig()->units == OSD_UNIT_IMPERIAL) ? (int16_t)(stats.min_esc_temp * 9 / 5.0f + 320) : stats.min_esc_temp), - ((osdConfig()->units == OSD_UNIT_IMPERIAL) ? (int16_t)(stats.max_esc_temp * 9 / 5.0f + 320) : stats.max_esc_temp), + tfp_sprintf(buff, ": %3d/%3d%c", + ((osdConfig()->units == OSD_UNIT_IMPERIAL) ? (int16_t)(stats.min_esc_temp * 9 / 5.0f + 320) : stats.min_esc_temp), + ((osdConfig()->units == OSD_UNIT_IMPERIAL) ? (int16_t)(stats.max_esc_temp * 9 / 5.0f + 320) : stats.max_esc_temp), ((osdConfig()->units == OSD_UNIT_IMPERIAL) ? SYM_TEMP_F : SYM_TEMP_C)); displayWrite(osdDisplayPort, statValX, row++, buff); @@ -4904,10 +4904,10 @@ uint8_t drawStat_GForce(uint8_t col, uint8_t row, uint8_t statValX) displayWrite(osdDisplayPort, col, row, "MAX G-FORCE"); else displayWrite(osdDisplayPort, col, row, "MAX/MIN Z/MAX Z G-FORCE"); - + tfp_sprintf(outBuff, ": "); osdFormatCentiNumber(buff, max_gforce * 100, 0, 2, 0, 3, false); - + if (!osdDisplayIsHD()) { strcat(outBuff, osdFormatTrimWhiteSpace(buff)); displayWrite(osdDisplayPort, statValX, row++, outBuff); @@ -4922,7 +4922,7 @@ uint8_t drawStat_GForce(uint8_t col, uint8_t row, uint8_t statValX) osdFormatCentiNumber(buff, acc_extremes_min * 100, 0, 2, 0, 4, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); strcat(outBuff, "/"); - + osdFormatCentiNumber(buff, acc_extremes_max * 100, 0, 2, 0, 3, false); strcat(outBuff, osdFormatTrimWhiteSpace(buff)); displayWrite(osdDisplayPort, statValX, row++, outBuff); @@ -4949,7 +4949,7 @@ static void osdShowStats(bool isSinglePageStatsCompatible, uint8_t page) const uint8_t statNameX = (osdDisplayPort->cols - (osdDisplayIsHD() ? 41 : 28)) / 2; const uint8_t statValuesX = osdDisplayPort->cols - statNameX - (osdDisplayIsHD() ? 15 : 11); - + if (page > 1) page = 0; @@ -5023,9 +5023,9 @@ static void osdShowStats(bool isSinglePageStatsCompatible, uint8_t page) if (feature(FEATURE_BLACKBOX)) { char buff[12]; displayWrite(osdDisplayPort, statNameX, row, "BLACKBOX FILE"); - + tfp_sprintf(buff, ": %u/%u", stats.min_sats, stats.max_sats); - + int32_t logNumber = blackboxGetLogNumber(); if (logNumber >= 0) tfp_sprintf(buff, ": %05ld ", logNumber); @@ -5043,7 +5043,7 @@ static void osdShowStats(bool isSinglePageStatsCompatible, uint8_t page) break; } } - + row = drawStat_DisarmMethod(statNameX, row, statValuesX); // The following has been commented out as it will be added in #9688 @@ -5399,27 +5399,27 @@ static void osdRefresh(timeUs_t currentTimeUs) // Manual paging stick commands are only applicable to multi-page stats. // ****************************** - // For single-page stats, this effectively disables the ability to cancel the + // For single-page stats, this effectively disables the ability to cancel the // automatic paging/updates with the stick commands. So unless stats_page_auto_swap_time - // is set to 0 or greater than 4 (saved settings display interval is 5 seconds), then - // "Saved Settings" should display if it is active within the refresh interval. + // is set to 0 or greater than 4 (saved settings display interval is 5 seconds), then + // "Saved Settings" should display if it is active within the refresh interval. // ****************************** // With multi-page stats, "Saved Settings" could also be missed if the user - // has canceled automatic paging using the stick commands, because that is only - // updated when osdShowStats() is called. So, in that case, they would only see - // the "Saved Settings" message if they happen to manually change pages using the - // stick commands within the interval the message is displayed. + // has canceled automatic paging using the stick commands, because that is only + // updated when osdShowStats() is called. So, in that case, they would only see + // the "Saved Settings" message if they happen to manually change pages using the + // stick commands within the interval the message is displayed. bool manualPageUpRequested = false; - bool manualPageDownRequested = false; + bool manualPageDownRequested = false; if (!statsSinglePageCompatible) { // These methods ensure the paging stick commands are held for a brief period - // Otherwise it can result in a race condition where the stats are - // updated too quickly and can result in partial blanks, etc. - if (osdIsPageUpStickCommandHeld()) { + // Otherwise it can result in a race condition where the stats are + // updated too quickly and can result in partial blanks, etc. + if (osdIsPageUpStickCommandHeld()) { manualPageUpRequested = true; statsAutoPagingEnabled = false; } else if (osdIsPageDownStickCommandHeld()) { - manualPageDownRequested = true; + manualPageDownRequested = true; statsAutoPagingEnabled = false; } } @@ -5462,7 +5462,7 @@ static void osdRefresh(timeUs_t currentTimeUs) displayHeartbeat(osdDisplayPort); isThrottleHigh = checkStickPosition(THR_HI); } - + return; } @@ -5631,24 +5631,19 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (buff != NULL) { const char *message = NULL; - char messageBuf[MAX(SETTING_MAX_NAME_LENGTH, OSD_MESSAGE_LENGTH+1)]; //warning: shared buffer. Make sure it is used by single message in code below! - // We might have up to 5 messages to show. - const char *messages[5]; + // Warning: messageBuf is shared. Make sure it is used by single message in code below! + char messageBuf[MAX(SETTING_MAX_NAME_LENGTH, OSD_MESSAGE_LENGTH + 1)]; + // We might have up to 6 messages to show. + const char *messages[6]; unsigned messageCount = 0; const char *failsafeInfoMessage = NULL; const char *invertedInfoMessage = NULL; if (ARMING_FLAG(ARMED)) { -#ifdef USE_FW_AUTOLAND - if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding() || FLIGHT_MODE(NAV_FW_AUTOLAND)) { - if (isWaypointMissionRTHActive() && !posControl.fwLandState.landWp) { -#else - if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { - if (isWaypointMissionRTHActive()) { -#endif - // if RTH activated whilst WP mode selected, remind pilot to cancel WP mode to exit RTH - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); - } + if (STATE(LANDING_DETECTED)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); + } else if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { + // Returns maximum of 5 messages if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); } else if (NAV_Status.state == MW_NAV_STATE_WP_ENROUTE) { @@ -5670,36 +5665,27 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = messageBuf; } - } else if (NAV_Status.state == MW_NAV_STATE_LAND_SETTLE && posControl.landingDelay > 0) { - uint16_t remainingHoldSec = MS2S(posControl.landingDelay - millis()); - tfp_sprintf(messageBuf, "LANDING DELAY: %3u SECONDS", remainingHoldSec); - - messages[messageCount++] = messageBuf; } - else { -#ifdef USE_FW_AUTOLAND - if (canFwLandingBeCancelled()) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS); - } else if (!FLIGHT_MODE(NAV_FW_AUTOLAND)) { -#endif - const char *navStateMessage = navigationStateMessage(); - if (navStateMessage) { - messages[messageCount++] = navStateMessage; - } -#ifdef USE_FW_AUTOLAND + const char *navStateMessage = navigationStateMessage(); + if (navStateMessage) { + messages[messageCount++] = navStateMessage; } -#endif } - #if defined(USE_SAFE_HOME) const char *safehomeMessage = divertingToSafehomeMessage(); if (safehomeMessage) { messages[messageCount++] = safehomeMessage; } #endif - if (FLIGHT_MODE(FAILSAFE_MODE)) { - // In FS mode while being armed too + if (FLIGHT_MODE(FAILSAFE_MODE)) { // In FS mode while armed + if (NAV_Status.state == MW_NAV_STATE_LAND_SETTLE && posControl.landingDelay > 0) { + uint16_t remainingHoldSec = MS2S(posControl.landingDelay - millis()); + tfp_sprintf(messageBuf, "LANDING DELAY: %3u SECONDS", remainingHoldSec); + + messages[messageCount++] = messageBuf; + } + const char *failsafePhaseMessage = osdFailsafePhaseMessage(); failsafeInfoMessage = osdFailsafeInfoMessage(); @@ -5709,56 +5695,52 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (failsafeInfoMessage) { messages[messageCount++] = failsafeInfoMessage; } + } else if (isWaypointMissionRTHActive()) { + // if RTH activated whilst WP mode selected, remind pilot to cancel WP mode to exit RTH + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); } } else { /* messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ - if (STATE(FIXED_WING_LEGACY) && (navGetCurrentStateFlags() & NAV_CTL_LAUNCH)) { - messages[messageCount++] = navConfig()->fw.launch_manual_throttle ? OSD_MESSAGE_STR(OSD_MSG_AUTOLAUNCH_MANUAL) : - OSD_MESSAGE_STR(OSD_MSG_AUTOLAUNCH); - const char *launchStateMessage = fixedWingLaunchStateMessage(); - if (launchStateMessage) { - messages[messageCount++] = launchStateMessage; - } - } else { - if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && !navigationRequiresAngleMode()) { - // ALTHOLD might be enabled alongside ANGLE/HORIZON/ANGLEHOLD/ACRO - // when it doesn't require ANGLE mode (required only in FW - // right now). If it requires ANGLE, its display is handled by OSD_FLYMODE. - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ALTITUDE_HOLD); - } - if (STATE(MULTIROTOR) && FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) { - if (posControl.cruise.multicopterSpeed >= 50.0f) { - char buf[6]; - osdFormatVelocityStr(buf, posControl.cruise.multicopterSpeed, false, false); - tfp_sprintf(messageBuf, "(SPD %s)", buf); - } else { - strcpy(messageBuf, "(HOLD)"); - } - messages[messageCount++] = messageBuf; - } - if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM) && !feature(FEATURE_FW_AUTOTRIM)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTRIM); - } - if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE); - if (FLIGHT_MODE(MANUAL_MODE)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE_ACRO); + if (STATE(AIRPLANE)) { // Returns maximum of 3 messages +#ifdef USE_FW_AUTOLAND + if (canFwLandingBeCancelled()) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS); + } else +#endif + if (navGetCurrentStateFlags() & NAV_CTL_LAUNCH) { + messages[messageCount++] = navConfig()->fw.launch_manual_throttle ? OSD_MESSAGE_STR(OSD_MSG_AUTOLAUNCH_MANUAL) : + OSD_MESSAGE_STR(OSD_MSG_AUTOLAUNCH); + const char *launchStateMessage = fixedWingLaunchStateMessage(); + if (launchStateMessage) { + messages[messageCount++] = launchStateMessage; } - } - if (isFixedWingLevelTrimActive()) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOLEVEL); - } - if (FLIGHT_MODE(HEADFREE_MODE)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_HEADFREE); - } - if (FLIGHT_MODE(SOARING_MODE)) { + } else if (FLIGHT_MODE(SOARING_MODE)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_NAV_SOARING); + } else { + strcpy(messageBuf, "(AUTO-"); + if (isFixedWingLevelTrimActive()) { + strcat(messageBuf, OSD_MSG_AUTOLEVEL); + } + if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM) && !feature(FEATURE_FW_AUTOTRIM)) { + if (messageBuf[6] != '\0') { + strcat(messageBuf, ":"); + } + strcat(messageBuf, OSD_MSG_AUTOTRIM); + } + if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) { + if (messageBuf[6] != '\0') { + strcat(messageBuf, ":"); + } + strcat(messageBuf, OSD_MSG_AUTOTUNE); + if (FLIGHT_MODE(MANUAL_MODE)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE_ACRO); + } + } + if (messageBuf[6] != '\0') { + strcat(messageBuf, ")"); + messages[messageCount++] = messageBuf; + } } - if (posControl.flags.wpMissionPlannerActive) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); - } - if (STATE(LANDING_DETECTED)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); - } + if (IS_RC_MODE_ACTIVE(BOXANGLEHOLD)) { int8_t navAngleHoldAxis = navCheckActiveAngleHoldAxis(); if (isAngleHoldLevel()) { @@ -5769,40 +5751,58 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ANGLEHOLD_PITCH); } } + } else if (STATE(MULTIROTOR)) { // Returns maximum of 1 messages + if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) { + if (posControl.cruise.multicopterSpeed >= 50.0f) { + char buf[6]; + osdFormatVelocityStr(buf, posControl.cruise.multicopterSpeed, false, false); + tfp_sprintf(messageBuf, "(SPD %s)", buf); + } else { + strcpy(messageBuf, "(HOLD)"); + } + messages[messageCount++] = messageBuf; + } else if (FLIGHT_MODE(HEADFREE_MODE)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_HEADFREE); + } + } + + if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && !navigationRequiresAngleMode()) { + // ALTHOLD might be enabled alongside ANGLE/HORIZON/ANGLEHOLD/ACRO + // when it doesn't require ANGLE mode (required only in FW + // right now). If it requires ANGLE, its display is handled by OSD_FLYMODE. + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ALTITUDE_HOLD); + } + + if (posControl.flags.wpMissionPlannerActive) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); } } - } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { + } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { // Returns maximum of 2 messages unsigned invalidIndex; // Check if we're unable to arm for some reason if (ARMING_FLAG(ARMING_DISABLED_INVALID_SETTING) && !settingsValidate(&invalidIndex)) { + const setting_t *setting = settingGet(invalidIndex); + settingGetName(setting, messageBuf); + for (int ii = 0; messageBuf[ii]; ii++) { + messageBuf[ii] = sl_toupper(messageBuf[ii]); + } + invertedInfoMessage = messageBuf; + messages[messageCount++] = invertedInfoMessage; - const setting_t *setting = settingGet(invalidIndex); - settingGetName(setting, messageBuf); - for (int ii = 0; messageBuf[ii]; ii++) { - messageBuf[ii] = sl_toupper(messageBuf[ii]); - } - invertedInfoMessage = messageBuf; - messages[messageCount++] = invertedInfoMessage; - - invertedInfoMessage = OSD_MESSAGE_STR(OSD_MSG_INVALID_SETTING); - messages[messageCount++] = invertedInfoMessage; - + invertedInfoMessage = OSD_MESSAGE_STR(OSD_MSG_INVALID_SETTING); + messages[messageCount++] = invertedInfoMessage; } else { - - invertedInfoMessage = OSD_MESSAGE_STR(OSD_MSG_UNABLE_ARM); - messages[messageCount++] = invertedInfoMessage; - - // Show the reason for not arming - messages[messageCount++] = osdArmingDisabledReasonMessage(); - + invertedInfoMessage = OSD_MESSAGE_STR(OSD_MSG_UNABLE_ARM); + messages[messageCount++] = invertedInfoMessage; + // Show the reason for not arming + messages[messageCount++] = osdArmingDisabledReasonMessage(); } } else if (!ARMING_FLAG(ARMED)) { if (isWaypointListValid()) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_MISSION_LOADED); } } - /* Messages that are shown regardless of Arming state */ // The following has been commented out as it will be added in #9688 @@ -5834,7 +5834,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } else if (message == invertedInfoMessage) { TEXT_ATTRIBUTES_ADD_INVERTED(elemAttr); } - // We're shoing either failsafePhaseMessage or + // We're showing either failsafePhaseMessage or // navStateMessage. Don't BLINK here since // having this text available might be crucial // during a lost aircraft recovery and blinking From 7a4f6cbfc6cd41aac32f1e1182583d121ee8d6c2 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Mon, 27 May 2024 17:20:15 +0100 Subject: [PATCH 080/429] Comments + change FW auto messages --- src/main/io/osd.c | 38 ++++++++++++++++++++++---------------- src/main/io/osd.h | 6 +++--- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index e48a70ef001..ff91d559629 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -2380,8 +2380,9 @@ static bool osdDrawSingleElement(uint8_t item) p = " WP "; else if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && navigationRequiresAngleMode()) { // If navigationRequiresAngleMode() returns false when ALTHOLD is active, - // it means it can be combined with ANGLE, HORIZON, ANGLEHOLD, ACRO, etc... + // it means it can be combined with ANGLE, HORIZON, ACRO, etc... // and its display is handled by OSD_MESSAGES rather than OSD_FLYMODE. + // (Currently only applies to multirotor). p = " AH "; } else if (FLIGHT_MODE(ANGLE_MODE)) @@ -5631,11 +5632,14 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (buff != NULL) { const char *message = NULL; - // Warning: messageBuf is shared. Make sure it is used by single message in code below! + /* Warning: messageBuf is shared, use accordingly */ char messageBuf[MAX(SETTING_MAX_NAME_LENGTH, OSD_MESSAGE_LENGTH + 1)]; - // We might have up to 6 messages to show. - const char *messages[6]; + + /* Warning, ensure number of messages returned does not exceed messages array size + * Messages array set 1 larger than maximum expected message count of 6 */ + const char *messages[7]; unsigned messageCount = 0; + const char *failsafeInfoMessage = NULL; const char *invertedInfoMessage = NULL; @@ -5643,7 +5647,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (STATE(LANDING_DETECTED)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); } else if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { - // Returns maximum of 5 messages + /* RETURNS MAXIMUM OF 5 MESSAGES */ if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); } else if (NAV_Status.state == MW_NAV_STATE_WP_ENROUTE) { @@ -5699,8 +5703,9 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter // if RTH activated whilst WP mode selected, remind pilot to cancel WP mode to exit RTH messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); } - } else { /* messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ - if (STATE(AIRPLANE)) { // Returns maximum of 3 messages + } else { /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ + /* RETURNS MAXIMUM OF 4 MESSAGES */ + if (STATE(AIRPLANE)) { /* RETURNS MAXIMUM OF 3 MESSAGES */ #ifdef USE_FW_AUTOLAND if (canFwLandingBeCancelled()) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS); @@ -5751,7 +5756,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ANGLEHOLD_PITCH); } } - } else if (STATE(MULTIROTOR)) { // Returns maximum of 1 messages + } else if (STATE(MULTIROTOR)) { /* RETURNS MAXIMUM OF 2 MESSAGES */ if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) { if (posControl.cruise.multicopterSpeed >= 50.0f) { char buf[6]; @@ -5764,20 +5769,20 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } else if (FLIGHT_MODE(HEADFREE_MODE)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_HEADFREE); } - } + if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && !navigationRequiresAngleMode()) { + /* If ALTHOLD is separately enabled for multirotor together with ANGL/HORIZON/ACRO modes + * then ANGL/HORIZON/ACRO are indicated by the OSD_FLYMODE field. + * In this case indicate ALTHOLD is active via a system message */ - if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && !navigationRequiresAngleMode()) { - // ALTHOLD might be enabled alongside ANGLE/HORIZON/ANGLEHOLD/ACRO - // when it doesn't require ANGLE mode (required only in FW - // right now). If it requires ANGLE, its display is handled by OSD_FLYMODE. - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ALTITUDE_HOLD); + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ALTITUDE_HOLD); + } } if (posControl.flags.wpMissionPlannerActive) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); } } - } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { // Returns maximum of 2 messages + } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* RETURNS MAXIMUM OF 2 MESSAGES */ unsigned invalidIndex; // Check if we're unable to arm for some reason @@ -5803,7 +5808,8 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_MISSION_LOADED); } } - /* Messages that are shown regardless of Arming state */ + + /* Messages that are shown regardless of Arming state - RETURNS MAXIMUM OF 1 MESSAGES */ // The following has been commented out as it will be added in #9688 // uint16_t rearmMs = (emergInflightRearmEnabled()) ? emergencyInFlightRearmTimeMS() : 0; diff --git a/src/main/io/osd.h b/src/main/io/osd.h index ca5dca66137..3a8f0b98403 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -109,10 +109,10 @@ #define OSD_MSG_AUTOLAUNCH "AUTOLAUNCH" #define OSD_MSG_AUTOLAUNCH_MANUAL "AUTOLAUNCH (MANUAL)" #define OSD_MSG_ALTITUDE_HOLD "(ALTITUDE HOLD)" -#define OSD_MSG_AUTOTRIM "(AUTOTRIM)" -#define OSD_MSG_AUTOTUNE "(AUTOTUNE)" +#define OSD_MSG_AUTOTRIM "TRIM" +#define OSD_MSG_AUTOTUNE "TUNE" #define OSD_MSG_AUTOTUNE_ACRO "SWITCH TO ACRO" -#define OSD_MSG_AUTOLEVEL "(AUTO LEVEL TRIM)" +#define OSD_MSG_AUTOLEVEL "LEVELTRIM" #define OSD_MSG_HEADFREE "(HEADFREE)" #define OSD_MSG_NAV_SOARING "(SOARING)" #define OSD_MSG_UNABLE_ARM "UNABLE TO ARM" From 5d7d4adbc5b6f61a47b727caf7e00cfce2e11da9 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Mon, 27 May 2024 19:49:40 +0100 Subject: [PATCH 081/429] Update osd.c --- src/main/io/osd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index ff91d559629..78c8316f369 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5647,7 +5647,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (STATE(LANDING_DETECTED)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); } else if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { - /* RETURNS MAXIMUM OF 5 MESSAGES */ + /* ADDS MAXIMUM OF 5 MESSAGES */ if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); } else if (NAV_Status.state == MW_NAV_STATE_WP_ENROUTE) { @@ -5704,8 +5704,8 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); } } else { /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ - /* RETURNS MAXIMUM OF 4 MESSAGES */ - if (STATE(AIRPLANE)) { /* RETURNS MAXIMUM OF 3 MESSAGES */ + /* ADDS MAXIMUM OF 4 MESSAGES */ + if (STATE(AIRPLANE)) { /* ADDS MAXIMUM OF 3 MESSAGES */ #ifdef USE_FW_AUTOLAND if (canFwLandingBeCancelled()) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS); @@ -5756,7 +5756,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ANGLEHOLD_PITCH); } } - } else if (STATE(MULTIROTOR)) { /* RETURNS MAXIMUM OF 2 MESSAGES */ + } else if (STATE(MULTIROTOR)) { /* ADDS MAXIMUM OF 2 MESSAGES */ if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) { if (posControl.cruise.multicopterSpeed >= 50.0f) { char buf[6]; @@ -5782,7 +5782,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); } } - } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* RETURNS MAXIMUM OF 2 MESSAGES */ + } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* ADDS MAXIMUM OF 2 MESSAGES */ unsigned invalidIndex; // Check if we're unable to arm for some reason @@ -5809,7 +5809,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } } - /* Messages that are shown regardless of Arming state - RETURNS MAXIMUM OF 1 MESSAGES */ + /* Messages that are shown regardless of Arming state - ADDS MAXIMUM OF 1 MESSAGES */ // The following has been commented out as it will be added in #9688 // uint16_t rearmMs = (emergInflightRearmEnabled()) ? emergencyInFlightRearmTimeMS() : 0; From 3051c90cbc1db49d6f448f5a82a78bc37e178a6f Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Mon, 27 May 2024 20:22:14 +0100 Subject: [PATCH 082/429] Update osd.c --- src/main/io/osd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 78c8316f369..552687a4c62 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5722,14 +5722,14 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_NAV_SOARING); } else { strcpy(messageBuf, "(AUTO-"); - if (isFixedWingLevelTrimActive()) { - strcat(messageBuf, OSD_MSG_AUTOLEVEL); - } if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM) && !feature(FEATURE_FW_AUTOTRIM)) { + strcat(messageBuf, OSD_MSG_AUTOTRIM); + } + if (isFixedWingLevelTrimActive()) { if (messageBuf[6] != '\0') { strcat(messageBuf, ":"); } - strcat(messageBuf, OSD_MSG_AUTOTRIM); + strcat(messageBuf, OSD_MSG_AUTOLEVEL); } if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) { if (messageBuf[6] != '\0') { From 3802e1df1b141d5dda9b159169bf617215677d50 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 28 May 2024 21:20:47 +0100 Subject: [PATCH 083/429] Add FW tune/trim mode priority --- src/main/fc/rc_modes.c | 16 +++++++++++- src/main/fc/rc_modes.h | 1 + src/main/flight/pid.c | 4 +-- src/main/flight/pid_autotune.c | 5 ++-- src/main/flight/servos.c | 24 ++++++++--------- src/main/io/osd.c | 47 ++++++++++++---------------------- src/main/io/osd.h | 6 ++--- 7 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/main/fc/rc_modes.c b/src/main/fc/rc_modes.c index 741308755ca..b593bddcc6a 100755 --- a/src/main/fc/rc_modes.c +++ b/src/main/fc/rc_modes.c @@ -114,7 +114,6 @@ void processAirmode(void) { } else if (STATE(MULTIROTOR)) { processAirmodeMultirotor(); } - } bool isUsingNavigationModes(void) @@ -122,6 +121,21 @@ bool isUsingNavigationModes(void) return isUsingNAVModes; } +bool isFwAutoModeActive(boxId_e mode) +{ + /* Sets activation priority of fixed wing auto tune/trim modes: Autotune -> Autotrim -> Autolevel */ + + if (mode == BOXAUTOTUNE) { + return IS_RC_MODE_ACTIVE(BOXAUTOTUNE); + } else if (mode == BOXAUTOTRIM) { + return IS_RC_MODE_ACTIVE(BOXAUTOTRIM) && !IS_RC_MODE_ACTIVE(BOXAUTOTUNE); + } else if (mode == BOXAUTOLEVEL) { + return IS_RC_MODE_ACTIVE(BOXAUTOLEVEL) && !IS_RC_MODE_ACTIVE(BOXAUTOTUNE) && !IS_RC_MODE_ACTIVE(BOXAUTOTRIM); + } + + return false; +} + bool IS_RC_MODE_ACTIVE(boxId_e boxId) { return bitArrayGet(rcModeActivationMask.bits, boxId); diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index 04aea681bc9..ad2c4422252 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -140,3 +140,4 @@ bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range); void updateActivatedModes(void); void updateUsedModeActivationConditionFlags(void); +bool isFwAutoModeActive(boxId_e mode); diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index a9d1291877f..dc15f07ad6f 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -1380,7 +1380,7 @@ pidBank_t * pidBankMutable(void) { bool isFixedWingLevelTrimActive(void) { - return IS_RC_MODE_ACTIVE(BOXAUTOLEVEL) && !areSticksDeflected() && + return isFwAutoModeActive(BOXAUTOLEVEL) && !areSticksDeflected() && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE)) && !FLIGHT_MODE(SOARING_MODE) && !FLIGHT_MODE(MANUAL_MODE) && !navigationIsControllingAltitude() && !(navCheckActiveAngleHoldAxis() == FD_PITCH && !angleHoldIsLevel); @@ -1404,7 +1404,7 @@ void updateFixedWingLevelTrim(timeUs_t currentTimeUs) previousArmingState = ARMING_FLAG(ARMED); // return if not active or disarmed - if (!IS_RC_MODE_ACTIVE(BOXAUTOLEVEL) || !ARMING_FLAG(ARMED)) { + if (!isFwAutoModeActive(BOXAUTOLEVEL) || !ARMING_FLAG(ARMED)) { return; } diff --git a/src/main/flight/pid_autotune.c b/src/main/flight/pid_autotune.c index af6896f4233..c4be8101bc4 100755 --- a/src/main/flight/pid_autotune.c +++ b/src/main/flight/pid_autotune.c @@ -40,6 +40,7 @@ #include "fc/config.h" #include "fc/controlrate_profile.h" #include "fc/rc_controls.h" +#include "fc/rc_modes.h" #include "fc/rc_adjustments.h" #include "fc/runtime_config.h" #include "fc/settings.h" @@ -130,7 +131,7 @@ void autotuneStart(void) void autotuneUpdateState(void) { - if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE) && STATE(AIRPLANE) && ARMING_FLAG(ARMED)) { + if (isFwAutoModeActive(BOXAUTOTUNE) && STATE(AIRPLANE) && ARMING_FLAG(ARMED)) { if (!FLIGHT_MODE(AUTO_TUNE)) { autotuneStart(); ENABLE_FLIGHT_MODE(AUTO_TUNE); @@ -202,7 +203,7 @@ void autotuneFixedWingUpdate(const flight_dynamics_index_t axis, float desiredRa if ((tuneCurrent[axis].updateCount & 25) == 0 && tuneCurrent[axis].updateCount >= AUTOTUNE_FIXED_WING_MIN_SAMPLES) { if (pidAutotuneConfig()->fw_rate_adjustment != FIXED && !FLIGHT_MODE(ANGLE_MODE)) { // Rate discovery is not possible in ANGLE mode - + // Target 80% control surface deflection to leave some room for P and I to work float pidSumTarget = (pidAutotuneConfig()->fw_max_rate_deflection / 100.0f) * pidSumLimit; diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index f38a4ea108c..f88f4cd2cf1 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -82,7 +82,7 @@ void Reset_servoMixers(servoMixer_t *instance) #ifdef USE_PROGRAMMING_FRAMEWORK ,.conditionId = -1 #endif - ); + ); } } @@ -96,7 +96,7 @@ void pgResetFn_servoParams(servoParam_t *instance) .max = DEFAULT_SERVO_MAX, .middle = DEFAULT_SERVO_MIDDLE, .rate = 100 - ); + ); } } @@ -194,7 +194,7 @@ void servosInit(void) } int getServoCount(void) -{ +{ if (mixerUsesServos) { return 1 + maxServoIndex - minServoIndex; } @@ -246,7 +246,7 @@ static void filterServos(void) void writeServos(void) { filterServos(); - + #if !defined(SITL_BUILD) int servoIndex = 0; bool zeroServoValue = false; @@ -449,7 +449,7 @@ void processServoAutotrimMode(void) static int32_t servoMiddleAccum[MAX_SUPPORTED_SERVOS]; static int32_t servoMiddleAccumCount[MAX_SUPPORTED_SERVOS]; - if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM)) { + if (isFwAutoModeActive(BOXAUTOTRIM)) { switch (trimState) { case AUTOTRIM_IDLE: if (ARMING_FLAG(ARMED)) { @@ -544,7 +544,7 @@ void processServoAutotrimMode(void) void processContinuousServoAutotrim(const float dT) { static timeMs_t lastUpdateTimeMs; - static servoAutotrimState_e trimState = AUTOTRIM_IDLE; + static servoAutotrimState_e trimState = AUTOTRIM_IDLE; static uint32_t servoMiddleUpdateCount; const float rotRateMagnitudeFiltered = pt1FilterApply4(&rotRateFilter, fast_fsqrtf(vectorNormSquared(&imuMeasuredRotationBF)), SERVO_AUTOTRIM_FILTER_CUTOFF, dT); @@ -556,16 +556,16 @@ void processContinuousServoAutotrim(const float dT) const bool planeIsFlyingStraight = rotRateMagnitudeFiltered <= DEGREES_TO_RADIANS(servoConfig()->servo_autotrim_rotation_limit); const bool noRotationCommanded = targetRateMagnitudeFiltered <= servoConfig()->servo_autotrim_rotation_limit; const bool sticksAreCentered = !areSticksDeflected(); - const bool planeIsFlyingLevel = ABS(attitude.values.pitch + DEGREES_TO_DECIDEGREES(getFixedWingLevelTrim())) <= SERVO_AUTOTRIM_ATTITUDE_LIMIT + const bool planeIsFlyingLevel = ABS(attitude.values.pitch + DEGREES_TO_DECIDEGREES(getFixedWingLevelTrim())) <= SERVO_AUTOTRIM_ATTITUDE_LIMIT && ABS(attitude.values.roll) <= SERVO_AUTOTRIM_ATTITUDE_LIMIT; if ( - planeIsFlyingStraight && - noRotationCommanded && + planeIsFlyingStraight && + noRotationCommanded && planeIsFlyingLevel && sticksAreCentered && - !FLIGHT_MODE(MANUAL_MODE) && + !FLIGHT_MODE(MANUAL_MODE) && isGPSHeadingValid() // TODO: proper flying detection - ) { + ) { // Plane is flying straight and level: trim servos for (int axis = FD_ROLL; axis <= FD_PITCH; axis++) { // For each stabilized axis, add 5 units of I-term to all associated servo midpoints @@ -610,7 +610,7 @@ void processContinuousServoAutotrim(const float dT) DEBUG_SET(DEBUG_AUTOTRIM, 1, servoMiddleUpdateCount); DEBUG_SET(DEBUG_AUTOTRIM, 3, MAX(RADIANS_TO_DEGREES(rotRateMagnitudeFiltered), targetRateMagnitudeFiltered)); DEBUG_SET(DEBUG_AUTOTRIM, 5, axisPID_I[FD_ROLL]); - DEBUG_SET(DEBUG_AUTOTRIM, 7, axisPID_I[FD_PITCH]); + DEBUG_SET(DEBUG_AUTOTRIM, 7, axisPID_I[FD_PITCH]); } void processServoAutotrim(const float dT) { diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 552687a4c62..207b3cb73ec 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5632,10 +5632,10 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (buff != NULL) { const char *message = NULL; - /* Warning: messageBuf is shared, use accordingly */ + /* WARNING: messageBuf is shared, use accordingly */ char messageBuf[MAX(SETTING_MAX_NAME_LENGTH, OSD_MESSAGE_LENGTH + 1)]; - /* Warning, ensure number of messages returned does not exceed messages array size + /* WARNING: ensure number of messages returned does not exceed messages array size * Messages array set 1 larger than maximum expected message count of 6 */ const char *messages[7]; unsigned messageCount = 0; @@ -5647,7 +5647,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (STATE(LANDING_DETECTED)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); } else if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { - /* ADDS MAXIMUM OF 5 MESSAGES */ + /* ADDS MAXIMUM OF 5 MESSAGES TO TOTAL */ if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); } else if (NAV_Status.state == MW_NAV_STATE_WP_ENROUTE) { @@ -5704,8 +5704,8 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); } } else { /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ - /* ADDS MAXIMUM OF 4 MESSAGES */ - if (STATE(AIRPLANE)) { /* ADDS MAXIMUM OF 3 MESSAGES */ + /* ADDS MAXIMUM OF 4 MESSAGES TO TOTAL */ + if (STATE(AIRPLANE)) { /* ADDS MAXIMUM OF 3 MESSAGES TO TOTAL */ #ifdef USE_FW_AUTOLAND if (canFwLandingBeCancelled()) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MOVE_STICKS); @@ -5720,30 +5720,15 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } } else if (FLIGHT_MODE(SOARING_MODE)) { messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_NAV_SOARING); - } else { - strcpy(messageBuf, "(AUTO-"); - if (IS_RC_MODE_ACTIVE(BOXAUTOTRIM) && !feature(FEATURE_FW_AUTOTRIM)) { - strcat(messageBuf, OSD_MSG_AUTOTRIM); - } - if (isFixedWingLevelTrimActive()) { - if (messageBuf[6] != '\0') { - strcat(messageBuf, ":"); - } - strcat(messageBuf, OSD_MSG_AUTOLEVEL); - } - if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) { - if (messageBuf[6] != '\0') { - strcat(messageBuf, ":"); - } - strcat(messageBuf, OSD_MSG_AUTOTUNE); - if (FLIGHT_MODE(MANUAL_MODE)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE_ACRO); - } - } - if (messageBuf[6] != '\0') { - strcat(messageBuf, ")"); - messages[messageCount++] = messageBuf; + } else if (isFwAutoModeActive(BOXAUTOTUNE)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE); + if (FLIGHT_MODE(MANUAL_MODE)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTUNE_ACRO); } + } else if (isFwAutoModeActive(BOXAUTOTRIM) && !feature(FEATURE_FW_AUTOTRIM)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOTRIM); + } else if (isFixedWingLevelTrimActive()) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOLEVEL); } if (IS_RC_MODE_ACTIVE(BOXANGLEHOLD)) { @@ -5756,7 +5741,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ANGLEHOLD_PITCH); } } - } else if (STATE(MULTIROTOR)) { /* ADDS MAXIMUM OF 2 MESSAGES */ + } else if (STATE(MULTIROTOR)) { /* ADDS MAXIMUM OF 2 MESSAGES TO TOTAL */ if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) { if (posControl.cruise.multicopterSpeed >= 50.0f) { char buf[6]; @@ -5782,7 +5767,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); } } - } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* ADDS MAXIMUM OF 2 MESSAGES */ + } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* ADDS MAXIMUM OF 2 MESSAGES TO TOTAL */ unsigned invalidIndex; // Check if we're unable to arm for some reason @@ -5809,7 +5794,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } } - /* Messages that are shown regardless of Arming state - ADDS MAXIMUM OF 1 MESSAGES */ + /* Messages that are shown regardless of Arming state - ADDS MAXIMUM OF 1 MESSAGES TO TOTAL */ // The following has been commented out as it will be added in #9688 // uint16_t rearmMs = (emergInflightRearmEnabled()) ? emergencyInFlightRearmTimeMS() : 0; diff --git a/src/main/io/osd.h b/src/main/io/osd.h index 3a8f0b98403..ca5dca66137 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -109,10 +109,10 @@ #define OSD_MSG_AUTOLAUNCH "AUTOLAUNCH" #define OSD_MSG_AUTOLAUNCH_MANUAL "AUTOLAUNCH (MANUAL)" #define OSD_MSG_ALTITUDE_HOLD "(ALTITUDE HOLD)" -#define OSD_MSG_AUTOTRIM "TRIM" -#define OSD_MSG_AUTOTUNE "TUNE" +#define OSD_MSG_AUTOTRIM "(AUTOTRIM)" +#define OSD_MSG_AUTOTUNE "(AUTOTUNE)" #define OSD_MSG_AUTOTUNE_ACRO "SWITCH TO ACRO" -#define OSD_MSG_AUTOLEVEL "LEVELTRIM" +#define OSD_MSG_AUTOLEVEL "(AUTO LEVEL TRIM)" #define OSD_MSG_HEADFREE "(HEADFREE)" #define OSD_MSG_NAV_SOARING "(SOARING)" #define OSD_MSG_UNABLE_ARM "UNABLE TO ARM" From 06eb0ef3c04135df62ae42ac87e9f1d9c9acd387 Mon Sep 17 00:00:00 2001 From: Fernando Schuindt Date: Wed, 29 May 2024 01:23:33 -0300 Subject: [PATCH 084/429] Fix OSD mentioned twice on README.md feature list --- readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.md b/readme.md index a70c42d4c86..b8e9f21105d 100644 --- a/readme.md +++ b/readme.md @@ -51,7 +51,6 @@ Fly safe, fly smart with INAV 7.1 and a compass by your side! * SmartAudio and IRC Tramp VTX support * Telemetry: SmartPort, FPort, MAVlink, LTM, CRSF * Multi-color RGB LED Strip support -* On Screen Display (OSD) - both character and pixel style * And many more! For a list of features, changes and some discussion please review consult the releases [page](https://github.com/iNavFlight/inav/releases) and the documentation. From 2667c03850189242486e5554ae62bea741a797a3 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Thu, 30 May 2024 13:03:25 +0100 Subject: [PATCH 085/429] update flight modes --- src/main/blackbox/blackbox.c | 57 +++++++++++++++++++----------------- src/main/fc/fc_core.c | 2 +- src/main/flight/pid.c | 4 +-- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 4433e7b4aba..419b7b4add4 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -402,15 +402,22 @@ static const blackboxSimpleFieldDefinition_t blackboxGpsHFields[] = { // Rarely-updated fields static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = { - {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, + /* "flightModeFlags" renamed internally to more correct ref of rcModeFlags, since it logs rc boxmode selections, + * but name kept for external compatibility reasons. + * "activeFlightModeFlags" logs actual active flight modes rather than rc boxmodes. + * 'active' should at least distinguish it from the existing "flightModeFlags" */ + + {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"flightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, + {"flightModeFlags2", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, + {"activeFlightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"stateFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"failsafePhase", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, {"rxSignalReceived", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, {"rxFlightChannelsValid", -1, UNSIGNED, PREDICT(0), ENCODING(TAG2_3S32)}, {"rxUpdateRate", -1, UNSIGNED, PREDICT(PREVIOUS), ENCODING(UNSIGNED_VB)}, - + {"hwHealthStatus", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"powerSupplyImpedance", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"sagCompensatedVBat", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, @@ -533,7 +540,9 @@ typedef struct blackboxGpsState_s { // This data is updated really infrequently: typedef struct blackboxSlowState_s { - uint32_t flightModeFlags; // extend this data size (from uint16_t) + uint32_t rcModeFlags; + uint32_t rcModeFlags2; + uint32_t activeFlightModeFlags; uint32_t stateFlags; uint8_t failsafePhase; bool rxSignalReceived; @@ -566,7 +575,7 @@ extern boxBitmask_t rcModeActivationMask; static BlackboxState blackboxState = BLACKBOX_STATE_DISABLED; static uint32_t blackboxLastArmingBeep = 0; -static uint32_t blackboxLastFlightModeFlags = 0; +static uint32_t blackboxLastRcModeFlags = 0; static struct { uint32_t headerIndex; @@ -1259,9 +1268,11 @@ static void writeSlowFrame(void) int32_t values[3]; blackboxWrite('S'); - + blackboxWriteUnsignedVB(slowHistory.activeWpNumber); - blackboxWriteUnsignedVB(slowHistory.flightModeFlags); + blackboxWriteUnsignedVB(slowHistory.rcModeFlags); + blackboxWriteUnsignedVB(slowHistory.rcModeFlags2); + blackboxWriteUnsignedVB(slowHistory.activeFlightModeFlags); blackboxWriteUnsignedVB(slowHistory.stateFlags); /* @@ -1269,10 +1280,10 @@ static void writeSlowFrame(void) */ values[0] = slowHistory.failsafePhase; values[1] = slowHistory.rxSignalReceived ? 1 : 0; - values[2] = slowHistory.rxFlightChannelsValid ? 1 : 0; + values[2] = slowHistory.rxFlightChannelsValid ? 1 : 0; blackboxWriteTag2_3S32(values); - blackboxWriteUnsignedVB(slowHistory.rxUpdateRate); + blackboxWriteUnsignedVB(slowHistory.rxUpdateRate); blackboxWriteUnsignedVB(slowHistory.hwHealthStatus); @@ -1309,28 +1320,20 @@ static void writeSlowFrame(void) static void loadSlowState(blackboxSlowState_t *slow) { slow->activeWpNumber = getActiveWpNumber(); - memcpy(&slow->flightModeFlags, &rcModeActivationMask, sizeof(slow->flightModeFlags)); //was flightModeFlags; + + slow->rcModeFlags = rcModeActivationMask.bits[0]; // first 32 bits of boxId_e + slow->rcModeFlags2 = rcModeActivationMask.bits[1]; // remaining bits of boxId_e + // Also log Nav auto enabled flight modes rather than just those selected by boxmode - if (FLIGHT_MODE(ANGLE_MODE)) { - slow->flightModeFlags |= (1 << BOXANGLE); - } - if (FLIGHT_MODE(NAV_ALTHOLD_MODE)) { - slow->flightModeFlags |= (1 << BOXNAVALTHOLD); - } - if (FLIGHT_MODE(NAV_RTH_MODE)) { - slow->flightModeFlags |= (1 << BOXNAVRTH); - } if (navigationGetHeadingControlState() == NAV_HEADING_CONTROL_AUTO) { - slow->flightModeFlags |= (1 << BOXHEADINGHOLD); - } - if (navigationRequiresTurnAssistance()) { - slow->flightModeFlags |= (1 << BOXTURNASSIST); + slow->rcModeFlags |= (1 << BOXHEADINGHOLD); } + slow->activeFlightModeFlags = flightModeFlags; slow->stateFlags = stateFlags; slow->failsafePhase = failsafePhase(); slow->rxSignalReceived = rxIsReceivingSignal(); slow->rxFlightChannelsValid = rxAreFlightChannelsValid(); - slow->rxUpdateRate = getRcUpdateFrequency(); + slow->rxUpdateRate = getRcUpdateFrequency(); slow->hwHealthStatus = (getHwGyroStatus() << 2 * 0) | // Pack hardware health status into a bit field. (getHwAccelerometerStatus() << 2 * 1) | // Use raw hardwareSensorStatus_e values and pack them using 2 bits per value (getHwCompassStatus() << 2 * 2) | // Report GYRO in 2 lowest bits, then ACC, COMPASS, BARO, GPS, RANGEFINDER and PITOT @@ -1498,7 +1501,7 @@ void blackboxStart(void) * it finally plays the beep for this arming event. */ blackboxLastArmingBeep = getArmingBeepTimeMicros(); - memcpy(&blackboxLastFlightModeFlags, &rcModeActivationMask, sizeof(blackboxLastFlightModeFlags)); // record startup status + memcpy(&blackboxLastRcModeFlags, &rcModeActivationMask, sizeof(blackboxLastRcModeFlags)); // record startup status blackboxSetState(BLACKBOX_STATE_PREPARE_LOG_FILE); } @@ -2023,10 +2026,10 @@ static void blackboxCheckAndLogArmingBeep(void) static void blackboxCheckAndLogFlightMode(void) { // Use != so that we can still detect a change if the counter wraps - if (memcmp(&rcModeActivationMask, &blackboxLastFlightModeFlags, sizeof(blackboxLastFlightModeFlags))) { + if (memcmp(&rcModeActivationMask, &blackboxLastRcModeFlags, sizeof(blackboxLastRcModeFlags))) { flightLogEvent_flightMode_t eventData; // Add new data for current flight mode flags - eventData.lastFlags = blackboxLastFlightModeFlags; - memcpy(&blackboxLastFlightModeFlags, &rcModeActivationMask, sizeof(blackboxLastFlightModeFlags)); + eventData.lastFlags = blackboxLastRcModeFlags; + memcpy(&blackboxLastRcModeFlags, &rcModeActivationMask, sizeof(blackboxLastRcModeFlags)); memcpy(&eventData.flags, &rcModeActivationMask, sizeof(eventData.flags)); blackboxLogEvent(FLIGHT_LOG_EVENT_FLIGHTMODE, (flightLogEventData_t *)&eventData); } diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 4b231548b99..d96c198f83d 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -704,7 +704,7 @@ void processRx(timeUs_t currentTimeUs) } /* Turn assistant mode */ - if (IS_RC_MODE_ACTIVE(BOXTURNASSIST)) { + if (IS_RC_MODE_ACTIVE(BOXTURNASSIST) || navigationRequiresTurnAssistance()) { ENABLE_FLIGHT_MODE(TURN_ASSISTANT); } else { DISABLE_FLIGHT_MODE(TURN_ASSISTANT); diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index a9d1291877f..cb6502b0107 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -1099,7 +1099,7 @@ void checkItermFreezingActive(pidState_t *pidState, flight_dynamics_index_t axis if (usedPidControllerType == PID_TYPE_PIFF && pidProfile()->fixedWingYawItermBankFreeze != 0 && axis == FD_YAW) { // Do not allow yaw I-term to grow when bank angle is too large float bankAngle = DECIDEGREES_TO_DEGREES(attitude.values.roll); - if (fabsf(bankAngle) > pidProfile()->fixedWingYawItermBankFreeze && !(FLIGHT_MODE(AUTO_TUNE) || FLIGHT_MODE(TURN_ASSISTANT) || navigationRequiresTurnAssistance())){ + if (fabsf(bankAngle) > pidProfile()->fixedWingYawItermBankFreeze && !(FLIGHT_MODE(AUTO_TUNE) || FLIGHT_MODE(TURN_ASSISTANT))) { pidState->itermFreezeActive = true; } else { @@ -1242,7 +1242,7 @@ void FAST_CODE pidController(float dT) } // Apply Turn Assistance - if ((FLIGHT_MODE(TURN_ASSISTANT) || navigationRequiresTurnAssistance()) && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE))) { + if (FLIGHT_MODE(TURN_ASSISTANT) && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE))) { float bankAngleTarget = DECIDEGREES_TO_RADIANS(pidRcCommandToAngle(rcCommand[FD_ROLL], pidProfile()->max_angle_inclination[FD_ROLL])); float pitchAngleTarget = DECIDEGREES_TO_RADIANS(pidRcCommandToAngle(rcCommand[FD_PITCH], pidProfile()->max_angle_inclination[FD_PITCH])); pidTurnAssistant(pidState, bankAngleTarget, pitchAngleTarget); From 5191ec369485f4d4941cf96ac8143595863d8dbf Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 09:56:39 +0200 Subject: [PATCH 086/429] Update readme.md Fix small typo that sneaked in. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c18b029563c..fac247ef9ab 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ # ICM426xx IMUs PSA -> The filtering settings for the ICM426xx has changed to matche what is used by Ardupilot and Betaflight in INAV 7.1. When upgrading from older versions you may need to recalibrate the Accelerometer and if you are not using INAV's default tune you may also want to check if the tune is still good. +> The filtering settings for the ICM426xx has changed to match what is used by Ardupilot and Betaflight in INAV 7.1. When upgrading from older versions you may need to recalibrate the Accelerometer and if you are not using INAV's default tune you may also want to check if the tune is still good. ![INAV](http://static.rcgroups.net/forums/attachments/6/1/0/3/7/6/a9088858-102-inav.png) From 5a3e21dfbed2d91cf0f09fcd6ebf6b64b5443715 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 16:41:39 +0200 Subject: [PATCH 087/429] Add extra infor about special labels --- src/main/drivers/pwm_mapping.h | 5 +++++ src/main/fc/fc_msp.c | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index e9b3a0f9573..cfb96afadbf 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -53,6 +53,11 @@ typedef enum { SERVO_TYPE_SBUS_PWM } servoProtocolType_e; +typedef enum { + PIN_LABEL_NONE = 0, + PIN_LABEL_LED +} pinLabel_e; + typedef enum { PWM_INIT_ERROR_NONE = 0, PWM_INIT_ERROR_TOO_MANY_MOTORS, diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 75e18ef3681..2398b0d4157 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1589,15 +1589,22 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF } break; case MSP2_INAV_OUTPUT_MAPPING_EXT2: - for (uint8_t i = 0; i < timerHardwareCount; ++i) - if (!(timerHardware[i].usageFlags & (TIM_USE_PPM | TIM_USE_PWM))) { - #if defined(SITL_BUILD) - sbufWriteU8(dst, i); - #else - sbufWriteU8(dst, timer2id(timerHardware[i].tim)); - #endif - sbufWriteU32(dst, timerHardware[i].usageFlags); + { + ioTag_t led_tag = IO_TAG(WS2811_PIN); + for (uint8_t i = 0; i < timerHardwareCount; ++i) + + if (!(timerHardware[i].usageFlags & (TIM_USE_PPM | TIM_USE_PWM))) { + #if defined(SITL_BUILD) + sbufWriteU8(dst, i); + #else + sbufWriteU8(dst, timer2id(timerHardware[i].tim)); + #endif + sbufWriteU32(dst, timerHardware[i].usageFlags); + // Extra label to help identify repurposed PINs. + // Eventually, we can try to add more labels for PPM pins, etc. + sbufWriteU8(dst, timerHardware[i].tag == led_tag ? PIN_LABEL_LED : PIN_LABEL_NONE); } + } break; From 0b50f5519efe77a0aa51ca6bad35aba20330e80a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 17:33:37 +0200 Subject: [PATCH 088/429] Fix sitl build --- src/main/fc/fc_msp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 2398b0d4157..44fefaa378a 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1600,9 +1600,13 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU8(dst, timer2id(timerHardware[i].tim)); #endif sbufWriteU32(dst, timerHardware[i].usageFlags); + #if defined(SITIL_BUILD) + sbufWriteU8(dst, 0); + #else // Extra label to help identify repurposed PINs. // Eventually, we can try to add more labels for PPM pins, etc. sbufWriteU8(dst, timerHardware[i].tag == led_tag ? PIN_LABEL_LED : PIN_LABEL_NONE); + #endif } } break; From d78aa93c234183d34e908b3f1aafc2478b5951c4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 17:37:25 +0200 Subject: [PATCH 089/429] sitl can be a pain. One more fix :) --- src/main/fc/fc_msp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 44fefaa378a..5deb8efafb2 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1590,7 +1590,9 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP2_INAV_OUTPUT_MAPPING_EXT2: { + #if defined(SITIL_BUILD) ioTag_t led_tag = IO_TAG(WS2811_PIN); + #endif for (uint8_t i = 0; i < timerHardwareCount; ++i) if (!(timerHardware[i].usageFlags & (TIM_USE_PPM | TIM_USE_PWM))) { From ad151352bd5c908029030237c6c51aa7ad0c900e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 17:41:41 +0200 Subject: [PATCH 090/429] s/defined/!defined/g --- src/main/fc/fc_msp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 5deb8efafb2..17b51f037a3 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1590,7 +1590,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP2_INAV_OUTPUT_MAPPING_EXT2: { - #if defined(SITIL_BUILD) + #if !defined(SITIL_BUILD) ioTag_t led_tag = IO_TAG(WS2811_PIN); #endif for (uint8_t i = 0; i < timerHardwareCount; ++i) From d33488d91a343411220242ca74280c5101a5494b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 17:45:26 +0200 Subject: [PATCH 091/429] Now, tripple checked. ;) --- src/main/fc/fc_msp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 17b51f037a3..f70c00f221b 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1590,7 +1590,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP2_INAV_OUTPUT_MAPPING_EXT2: { - #if !defined(SITIL_BUILD) + #if !defined(SITL_BUILD) ioTag_t led_tag = IO_TAG(WS2811_PIN); #endif for (uint8_t i = 0; i < timerHardwareCount; ++i) @@ -1602,7 +1602,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU8(dst, timer2id(timerHardware[i].tim)); #endif sbufWriteU32(dst, timerHardware[i].usageFlags); - #if defined(SITIL_BUILD) + #if defined(SITL_BUILD) sbufWriteU8(dst, 0); #else // Extra label to help identify repurposed PINs. From e88b85f4ea4e4eaf4e56d119de3d73ba66d45544 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 18:12:42 +0200 Subject: [PATCH 092/429] Make sure LED is at the end of the PWM list --- src/main/target/AIRBOTF7/target.c | 6 +++--- src/main/target/ANYFCM7/target.c | 15 ++++++++------- src/main/target/BLUEJAYF4/target.c | 4 ++-- src/main/target/F4BY/target.c | 18 ++++++++++-------- src/main/target/FOXEERF745AIO/target.c | 4 ++-- src/main/target/FRSKYPILOT/target.c | 4 ---- src/main/target/IFLIGHT_BLITZ_ATF435/target.c | 2 +- src/main/target/MATEKF405/target.c | 2 +- src/main/target/NEUTRONRCF435MINI/target.c | 6 +++--- src/main/target/NEUTRONRCF435WING/target.c | 3 +-- src/main/target/OMNIBUSF4/CMakeLists.txt | 1 - src/main/target/OMNIBUSF4/target.c | 7 ++----- src/main/target/SAGEATF4/target.c | 12 ++++++------ .../target/SPEEDYBEEF405MINI/CMakeLists.txt | 1 - src/main/target/SPEEDYBEEF405MINI/target.c | 11 +++-------- src/main/target/SPRACINGF7DUAL/target.c | 4 +++- src/main/target/TAKERF722SE/target.c | 2 +- src/main/target/TMOTORF7V2/target.c | 2 +- src/main/target/TMOTORVELOXF7V2/target.c | 2 +- 19 files changed, 48 insertions(+), 58 deletions(-) diff --git a/src/main/target/AIRBOTF7/target.c b/src/main/target/AIRBOTF7/target.c index 22d2564821a..6cad05c41fd 100644 --- a/src/main/target/AIRBOTF7/target.c +++ b/src/main/target/AIRBOTF7/target.c @@ -42,13 +42,13 @@ BUSDEV_REGISTER_SPI_TAG(busdev_imu1_mpu6500, DEVHW_MPU6500, GYRO_1_SPI_BUS, #endif timerHardware_t timerHardware[] = { - DEF_TIM(TIM2, CH1, PA15, TIM_USE_LED, 0, 0), // LED - DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // Cam control, SS, UNUSED - DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), //S1 DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), //S2 DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), //S3 DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), //S4 + // + DEF_TIM(TIM2, CH1, PA15, TIM_USE_LED, 0, 0), // LED + DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // Cam control, SS, UNUSED }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/ANYFCM7/target.c b/src/main/target/ANYFCM7/target.c index 7dd30d2250b..aae6922a374 100644 --- a/src/main/target/ANYFCM7/target.c +++ b/src/main/target/ANYFCM7/target.c @@ -26,12 +26,6 @@ #define TIM_EN_N TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_N_CHANNEL timerHardware_t timerHardware[] = { - // DEF_TIM(TIM12, CH1, PB14, TIM_USE_PWM | TIM_USE_PPM, 0, 0 ), // S1_IN - // DEF_TIM(TIM12, CH2, PB15, TIM_USE_PWM, 0, 0 ), // S2_IN - // DEF_TIM(TIM8, CH1, PC6, TIM_USE_PWM, 0, 0 ), // S3_IN DMA2_ST2 DMA2_ST2 - // DEF_TIM(TIM8, CH2, PC7, TIM_USE_PWM, 0, 0 ), // S4_IN DMA2_ST3 DMA2_ST2 - // DEF_TIM(TIM8, CH3, PC8, TIM_USE_PWM, 0, 0 ), // S5_IN DMA2_ST4 DMA2_ST2 - // DEF_TIM(TIM8, CH4, PC9, TIM_USE_PWM, 0, 0 ), // S6_IN DMA2_ST7 DEF_TIM(TIM4, CH3, PB8, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S10_OUT 1 DMA1_ST7 DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S6_OUT 2 DMA1_ST1 @@ -39,10 +33,17 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 1 ), // S1_OUT 4 DMA1_ST7 DMA1_ST6 DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S2_OUT DMA1_ST4 DEF_TIM(TIM1, CH2N, PB0, TIM_USE_OUTPUT_AUTO, 0, 1 ), // S3_OUT DMA2_ST6 DMA2_ST2 - DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO | TIM_USE_LED, 0, 0 ), // S4_OUT DMA1_ST5 + DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S4_OUT DMA1_ST5 -- Used to have TIM_USE_LED DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S7_OUT DMA1_ST2 DEF_TIM(TIM1, CH3N, PB1, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S8_OUT DMA2_ST6 DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S9_OUT DMA1_ST4 + + // DEF_TIM(TIM12, CH1, PB14, TIM_USE_PWM | TIM_USE_PPM, 0, 0 ), // S1_IN + // DEF_TIM(TIM12, CH2, PB15, TIM_USE_PWM, 0, 0 ), // S2_IN + // DEF_TIM(TIM8, CH1, PC6, TIM_USE_PWM, 0, 0 ), // S3_IN DMA2_ST2 DMA2_ST2 + // DEF_TIM(TIM8, CH2, PC7, TIM_USE_PWM, 0, 0 ), // S4_IN DMA2_ST3 DMA2_ST2 + // DEF_TIM(TIM8, CH3, PC8, TIM_USE_PWM, 0, 0 ), // S5_IN DMA2_ST4 DMA2_ST2 + // DEF_TIM(TIM8, CH4, PC9, TIM_USE_PWM, 0, 0 ), // S6_IN DMA2_ST7 }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/BLUEJAYF4/target.c b/src/main/target/BLUEJAYF4/target.c index ba48551f76c..37afb69b1ce 100644 --- a/src/main/target/BLUEJAYF4/target.c +++ b/src/main/target/BLUEJAYF4/target.c @@ -29,8 +29,8 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S2_OUT - DMA1_ST4 DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S3_OUT - DMA1_ST1 DEF_TIM(TIM9, CH2, PA3, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S4_OUT - no DMA - //DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 1 ), // S4_OUT - DMA1_ST3 (Could be DMA1_ST1 with dmaopt=0) - DEF_TIM(TIM3, CH4, PB0, TIM_USE_OUTPUT_AUTO | TIM_USE_LED, 0, 0 ), // S5_OUT - DMA1_ST2 + //DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 1 ), // S4_OUT - DMA1_ST3 (Could be DMA1_ST1 with dmaopt=0) + DEF_TIM(TIM3, CH4, PB0, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S5_OUT - DMA1_ST2 -- used to be TIM_USE_LED DEF_TIM(TIM3, CH3, PB1, TIM_USE_OUTPUT_AUTO, 0, 0 ), // S6_OUT - DMA1_ST7 }; diff --git a/src/main/target/F4BY/target.c b/src/main/target/F4BY/target.c index 8d1b4622f69..b1654e27ec0 100644 --- a/src/main/target/F4BY/target.c +++ b/src/main/target/F4BY/target.c @@ -6,14 +6,6 @@ #include "drivers/timer.h" timerHardware_t timerHardware[] = { - // DEF_TIM(TIM3, CH4, PC9, TIM_USE_PPM | TIM_USE_PWM, 0, 0), // S1_IN - // DEF_TIM(TIM3, CH3, PC8, TIM_USE_PWM, 0, 0), // S2_IN - // DEF_TIM(TIM3, CH1, PC6, TIM_USE_PWM, 0, 0), // S3_IN - // DEF_TIM(TIM3, CH2, PC7, TIM_USE_PWM, 0, 0), // S4_IN - // DEF_TIM(TIM4, CH4, PD15, TIM_USE_PWM, 0, 0), // S5_IN - // DEF_TIM(TIM4, CH3, PD14, TIM_USE_PWM, 0, 0), // S6_IN - // DEF_TIM(TIM4, CH2, PD13, TIM_USE_PWM, 0, 0), // S7_IN - // DEF_TIM(TIM4, CH1, PD12, TIM_USE_PWM, 0, 0), // S8_IN DEF_TIM(TIM2, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1_OUT DEF_TIM(TIM2, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT @@ -25,6 +17,16 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM1, CH4, PE14, TIM_USE_OUTPUT_AUTO, 0, 0), // S8_OUT DEF_TIM(TIM9, CH2, PE6, TIM_USE_ANY, 0, 0), // sonar echo if needed + + + // DEF_TIM(TIM3, CH4, PC9, TIM_USE_PPM | TIM_USE_PWM, 0, 0), // S1_IN + // DEF_TIM(TIM3, CH3, PC8, TIM_USE_PWM, 0, 0), // S2_IN + // DEF_TIM(TIM3, CH1, PC6, TIM_USE_PWM, 0, 0), // S3_IN + // DEF_TIM(TIM3, CH2, PC7, TIM_USE_PWM, 0, 0), // S4_IN + // DEF_TIM(TIM4, CH4, PD15, TIM_USE_PWM, 0, 0), // S5_IN + // DEF_TIM(TIM4, CH3, PD14, TIM_USE_PWM, 0, 0), // S6_IN + // DEF_TIM(TIM4, CH2, PD13, TIM_USE_PWM, 0, 0), // S7_IN + // DEF_TIM(TIM4, CH1, PD12, TIM_USE_PWM, 0, 0), // S8_IN }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/FOXEERF745AIO/target.c b/src/main/target/FOXEERF745AIO/target.c index f724f65913c..382306a8d50 100644 --- a/src/main/target/FOXEERF745AIO/target.c +++ b/src/main/target/FOXEERF745AIO/target.c @@ -25,12 +25,12 @@ timerHardware_t timerHardware[] = { - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED STRIP - D(2, 6, 0) - DEF_TIM(TIM3, CH1, PB4, TIM_USE_MOTOR, 0, 0), // M1 - D(1, 4, 5) DEF_TIM(TIM3, CH2, PB5, TIM_USE_MOTOR, 0, 0), // M2 - D(1, 5, 5) DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0), // M3 - D(1, 2, 5) DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0), // M4 - D(1, 7, 5) + // + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED STRIP - D(2, 6, 0) }; diff --git a/src/main/target/FRSKYPILOT/target.c b/src/main/target/FRSKYPILOT/target.c index 50b82d7687e..95989f5f42a 100644 --- a/src/main/target/FRSKYPILOT/target.c +++ b/src/main/target/FRSKYPILOT/target.c @@ -39,13 +39,9 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 DEF_TIM(TIM4, CH3, PB8, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 DEF_TIM(TIM4, CH4, PB9, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 -#ifdef FRSKYPILOT_LED - DEF_TIM(TIM2, CH2, PA1, TIM_USE_LED | TIM_USE_LED, 0, 0), // S10 now LED, S11 & S12 UART 3 only -#else DEF_TIM(TIM2, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DEF_TIM(TIM2, CH3, PB10, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 DEF_TIM(TIM2, CH4, PB11, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 -#endif DEF_TIM(TIM5, CH1, PA0, TIM_USE_BEEPER, 0, 0), // beeper }; diff --git a/src/main/target/IFLIGHT_BLITZ_ATF435/target.c b/src/main/target/IFLIGHT_BLITZ_ATF435/target.c index 2de0fd50578..947d19c0d20 100644 --- a/src/main/target/IFLIGHT_BLITZ_ATF435/target.c +++ b/src/main/target/IFLIGHT_BLITZ_ATF435/target.c @@ -41,7 +41,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TMR4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0,11), // S5 DEF_TIM(TMR4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0,10), // S6 DEF_TIM(TMR2, CH3, PB10, TIM_USE_OUTPUT_AUTO, 0,5), //S7 - DEF_TIM(TMR2, CH4, PB11, TIM_USE_OUTPUT_AUTO, 0,6), //S8 + DEF_TIM(TMR2, CH4, PB11, TIM_USE_OUTPUT_AUTO, 0,6), //S8 DEF_TIM(TMR1, CH1, PA8, TIM_USE_LED, 0, 0), // LED STRIP }; diff --git a/src/main/target/MATEKF405/target.c b/src/main/target/MATEKF405/target.c index 1706954b7f9..5b6f0ce559d 100644 --- a/src/main/target/MATEKF405/target.c +++ b/src/main/target/MATEKF405/target.c @@ -29,7 +29,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 1), // S3 UP(2,1) DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 UP(2,1) - DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO | TIM_USE_LED , 0, 0), // S5 UP(1,7) + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 UP(1,7) -- LED DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 UP(2,5) DEF_TIM(TIM4, CH3, PB8, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 D(1,7)!S5 UP(2,6) diff --git a/src/main/target/NEUTRONRCF435MINI/target.c b/src/main/target/NEUTRONRCF435MINI/target.c index 9400ae4be1b..0933322bb14 100644 --- a/src/main/target/NEUTRONRCF435MINI/target.c +++ b/src/main/target/NEUTRONRCF435MINI/target.c @@ -26,13 +26,13 @@ timerHardware_t timerHardware[] = { - DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY |TIM_USE_LED, 0,6), // PWM1 - LED MCO1 DMA1 CH2 - DEF_TIM(TMR4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0,0), // motor1 DMA2 CH7 DEF_TIM(TMR4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0,2), // motor2 DMA2 CH6 DEF_TIM(TMR2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0,1), // motor3 DMA2 CH5 DEF_TIM(TMR3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0,3), // motor4 DMA2 CH4 - + // + DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY |TIM_USE_LED, 0,6), // PWM1 - LED MCO1 DMA1 CH2 + // }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/NEUTRONRCF435WING/target.c b/src/main/target/NEUTRONRCF435WING/target.c index b1cd9031cc3..428654ebed3 100644 --- a/src/main/target/NEUTRONRCF435WING/target.c +++ b/src/main/target/NEUTRONRCF435WING/target.c @@ -26,8 +26,6 @@ timerHardware_t timerHardware[] = { - DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY |TIM_USE_LED, 0,7), // PWM1 - LED MCO1 DMA1 CH2 - DEF_TIM(TMR4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0,0), // motor1 DMA2 CH7 DEF_TIM(TMR1, CH3, PA10, TIM_USE_OUTPUT_AUTO, 0,2), // motor2 DMA2 CH6 DEF_TIM(TMR2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0,1), // motor3 DMA2 CH5 @@ -38,6 +36,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TMR3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0,8), // PWM3 - OUT7 DMA2 CH3 DEF_TIM(TMR2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0,11), // PWM4 - OUT8 DMA1 CH7 + DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY |TIM_USE_LED, 0,7), // PWM1 - LED MCO1 DMA1 CH2 }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/OMNIBUSF4/CMakeLists.txt b/src/main/target/OMNIBUSF4/CMakeLists.txt index 72f3bbeca87..a6ccb483bf5 100644 --- a/src/main/target/OMNIBUSF4/CMakeLists.txt +++ b/src/main/target/OMNIBUSF4/CMakeLists.txt @@ -3,7 +3,6 @@ target_stm32f405xg(DYSF4PROV2) target_stm32f405xg(OMNIBUSF4) # the OMNIBUSF4SD has an SDCARD instead of flash, a BMP280 baro and therefore a slightly different ppm/pwm and SPI mapping target_stm32f405xg(OMNIBUSF4PRO) -target_stm32f405xg(OMNIBUSF4PRO_LEDSTRIPM5) target_stm32f405xg(OMNIBUSF4V3_S5_S6_2SS) target_stm32f405xg(OMNIBUSF4V3_S5S6_SS) target_stm32f405xg(OMNIBUSF4V3_S6_SS) diff --git a/src/main/target/OMNIBUSF4/target.c b/src/main/target/OMNIBUSF4/target.c index 86485aa49fc..be85e9fbce3 100644 --- a/src/main/target/OMNIBUSF4/target.c +++ b/src/main/target/OMNIBUSF4/target.c @@ -41,15 +41,12 @@ timerHardware_t timerHardware[] = { #elif defined(OMNIBUSF4V3_S6_SS) DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // S6_OUT SOFTSERIAL -#elif defined(OMNIBUSF4PRO_LEDSTRIPM5) - DEF_TIM(TIM5, CH2, PA1, TIM_USE_LED, 0, 0), // S5_OUT LED strip - DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT #else - DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO | TIM_USE_LED, 0, 0), // S5_OUT MOTOR, SERVO or LED + DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT MOTOR, SERVO or LED DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT #endif -#if (defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)) && !defined(OMNIBUSF4PRO_LEDSTRIPM5) +#if (defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)) DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), // LED strip for F4 V2 / F4-Pro-0X and later (RCD_CS for F4) #endif diff --git a/src/main/target/SAGEATF4/target.c b/src/main/target/SAGEATF4/target.c index 2d951598ae0..06f571c949b 100644 --- a/src/main/target/SAGEATF4/target.c +++ b/src/main/target/SAGEATF4/target.c @@ -26,19 +26,19 @@ timerHardware_t timerHardware[] = { - // DEF_TIM(TMR5, CH4, PA3, TIM_USE_PPM, 0, 4), // PPM UART2_RX_PIN DMA1 CH5 + // DEF_TIM(TMR5, CH4, PA3, TIM_USE_PPM, 0, 4), // PPM UART2_RX_PIN DMA1 CH5 - DEF_TIM(TMR4, CH1, PB6, TIM_USE_MOTOR, 0,0), // motor1 DMA1 CH1 - DEF_TIM(TMR4, CH2, PB7, TIM_USE_MOTOR, 0,1), // motor2 DMA1 CH2 - DEF_TIM(TMR4, CH3, PB8, TIM_USE_MOTOR, 0,2), // motor3 DMA1 CH3 - DEF_TIM(TMR4, CH4, PB9, TIM_USE_MOTOR, 0,3), // motor4 DMA1 CH4 + DEF_TIM(TMR4, CH1, PB6, TIM_USE_MOTOR, 0,0), // motor1 DMA1 CH1 + DEF_TIM(TMR4, CH2, PB7, TIM_USE_MOTOR, 0,1), // motor2 DMA1 CH2 + DEF_TIM(TMR4, CH3, PB8, TIM_USE_MOTOR, 0,2), // motor3 DMA1 CH3 + DEF_TIM(TMR4, CH4, PB9, TIM_USE_MOTOR, 0,3), // motor4 DMA1 CH4 DEF_TIM(TMR3, CH1, PC6, TIM_USE_OUTPUT_AUTO, 0,8), // PWM1 - OUT5 DMA2 CH2 DMA2_CHANNEL1->ADC DEF_TIM(TMR3, CH2, PC7, TIM_USE_OUTPUT_AUTO, 0,9), // PWM2 - OUT6 DMA2 CH3 DEF_TIM(TMR3, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0,10), // PWM3 - OUT7 DMA2 CH4 DEF_TIM(TMR3, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0,11), // PWM4 - OUT8 DMA2 CH5 - DEF_TIM(TMR2, CH3, PB10, TIM_USE_ANY | TIM_USE_LED, 0,5), // PWM1 - LED MCO1 DMA1 CH6 + DEF_TIM(TMR2, CH3, PB10, TIM_USE_ANY | TIM_USE_LED, 0,5), // PWM1 - LED MCO1 DMA1 CH6 DEF_TIM(TMR5, CH4, PB11, TIM_USE_ANY | TIM_USE_BEEPER, 0,6), // PWM2 - BB DMA1 CH7 }; diff --git a/src/main/target/SPEEDYBEEF405MINI/CMakeLists.txt b/src/main/target/SPEEDYBEEF405MINI/CMakeLists.txt index e18c0cd5ada..c4105609952 100644 --- a/src/main/target/SPEEDYBEEF405MINI/CMakeLists.txt +++ b/src/main/target/SPEEDYBEEF405MINI/CMakeLists.txt @@ -1,2 +1 @@ target_stm32f405xg(SPEEDYBEEF405MINI) -target_stm32f405xg(SPEEDYBEEF405MINI_6OUTPUTS) diff --git a/src/main/target/SPEEDYBEEF405MINI/target.c b/src/main/target/SPEEDYBEEF405MINI/target.c index 3cc7fbbebba..b1e6e10f6f4 100644 --- a/src/main/target/SPEEDYBEEF405MINI/target.c +++ b/src/main/target/SPEEDYBEEF405MINI/target.c @@ -32,15 +32,10 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 1, 0), // S3 DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 1, 0), // S4 -#ifdef SPEEDYBEEF405MINI_6OUTPUTS - DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 1, 0), // CAM_CTRL - DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // LED -#else - DEF_TIM(TIM12, CH1, PB14, TIM_USE_ANY, 1, 0), // CAM_CTRL - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED -#endif + DEF_TIM(TIM12, CH1, PB14, TIM_USE_ANY, 1, 0), // CAM_CTRL + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED - DEF_TIM(TIM5, CH3, PA2, TIM_USE_ANY, 0, 0), //TX2 softserial1_Tx + DEF_TIM(TIM5, CH3, PA2, TIM_USE_ANY, 0, 0), //TX2 softserial1_Tx }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/SPRACINGF7DUAL/target.c b/src/main/target/SPRACINGF7DUAL/target.c index e94835b93c2..ead356956a4 100644 --- a/src/main/target/SPRACINGF7DUAL/target.c +++ b/src/main/target/SPRACINGF7DUAL/target.c @@ -56,7 +56,6 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0), // ESC 7 DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0), // ESC 8 - DEF_TIM(TIM2, CH2, PA1, TIM_USE_LED, 0, 0), // LED Strip // Additional 2 PWM channels available on UART3 RX/TX pins // However, when using led strip the timer cannot be used, but no code appears to prevent that right now DEF_TIM(TIM2, CH3, PB10, TIM_USE_MOTOR, 0, 0), // Shared with UART3 TX PIN and SPI3 TX (OSD) @@ -67,6 +66,9 @@ timerHardware_t timerHardware[] = { // However, when using transponder the timer cannot be used, but no code appears to prevent that right now DEF_TIM(TIM1, CH2, PA9, TIM_USE_SERVO | TIM_USE_PWM, 0, 1), // PWM 3 DEF_TIM(TIM1, CH3, PA10, TIM_USE_SERVO | TIM_USE_PWM, 0, 1), // PWM 4 + + + DEF_TIM(TIM2, CH2, PA1, TIM_USE_LED, 0, 0), // LED Strip }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/TAKERF722SE/target.c b/src/main/target/TAKERF722SE/target.c index d67062a9fbc..c49e383a72f 100644 --- a/src/main/target/TAKERF722SE/target.c +++ b/src/main/target/TAKERF722SE/target.c @@ -40,7 +40,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/TMOTORF7V2/target.c b/src/main/target/TMOTORF7V2/target.c index c21b0f0229a..df6004b7a2f 100644 --- a/src/main/target/TMOTORF7V2/target.c +++ b/src/main/target/TMOTORF7V2/target.c @@ -35,8 +35,8 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED DEF_TIM(TIM2, CH2, PB3, TIM_USE_PWM | TIM_USE_SERVO, 0, 0), // "C.C" + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/TMOTORVELOXF7V2/target.c b/src/main/target/TMOTORVELOXF7V2/target.c index 7d9ae0d3292..b5f56ea6b79 100644 --- a/src/main/target/TMOTORVELOXF7V2/target.c +++ b/src/main/target/TMOTORVELOXF7V2/target.c @@ -37,7 +37,7 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 UP1-6 D(1, 0, 2) // used to be fw motor DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 UP1-6 D(1, 3, 2) // used to be fw motor - DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 1), // LED + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 1), // LED }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); From 243c6775999d15105fa0bb7e57ef00f92b2fc74a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 18:24:39 +0200 Subject: [PATCH 093/429] Some targets don't have led pin defined --- src/main/fc/fc_msp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index f70c00f221b..4ae42184816 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1590,7 +1590,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF break; case MSP2_INAV_OUTPUT_MAPPING_EXT2: { - #if !defined(SITL_BUILD) + #if !defined(SITL_BUILD) && defined(WS2811_PIN) ioTag_t led_tag = IO_TAG(WS2811_PIN); #endif for (uint8_t i = 0; i < timerHardwareCount; ++i) @@ -1602,7 +1602,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU8(dst, timer2id(timerHardware[i].tim)); #endif sbufWriteU32(dst, timerHardware[i].usageFlags); - #if defined(SITL_BUILD) + #if defined(SITL_BUILD) || !defined(WS2811_PIN) sbufWriteU8(dst, 0); #else // Extra label to help identify repurposed PINs. From 22697304b2173bd1305293b2bef4317c769033d3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 31 May 2024 21:40:01 +0200 Subject: [PATCH 094/429] Update gps_ublox.c Fix formatting. --- src/main/io/gps_ublox.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 8c071613289..958de158d3e 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1061,11 +1061,11 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) // M7 and earlier will never get pass this step, so skip it (#9440). // UBLOX documents that this is M8N and later if (gpsState.hwVersion > UBX_HW_VERSION_UBLOX7) { - do { - pollGnssCapabilities(); - gpsState.autoConfigStep++; - ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS); - } while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0); + do { + pollGnssCapabilities(); + gpsState.autoConfigStep++; + ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS); + } while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0); } // Configure GPS From 0e9ca2a58d8944f805d1089e20b23f8386206fcb Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 31 May 2024 21:49:43 -0500 Subject: [PATCH 095/429] update CMakeLists.txt to version 7.1.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f74527e5f1b..3a2bd54e6e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ else() endif() endif() -project(INAV VERSION 7.1.1) +project(INAV VERSION 7.1.2) enable_language(ASM) From eb676ece935821beac71e16d4aaf551b52d52fa9 Mon Sep 17 00:00:00 2001 From: flywoo Date: Sat, 1 Jun 2024 11:39:48 +0800 Subject: [PATCH 096/429] Added new targets FLYWOOF722PRO, F405HD, updated F745, F405PRO config --- src/main/target/FLYWOOF405PRO/CMakeLists.txt | 1 + src/main/target/FLYWOOF405PRO/config.c | 34 ++++ src/main/target/FLYWOOF405PRO/target.c | 3 - src/main/target/FLYWOOF405PRO/target.h | 19 ++- src/main/target/FLYWOOF722PRO/CMakeLists.txt | 1 + src/main/target/FLYWOOF722PRO/config.c | 30 ++++ src/main/target/FLYWOOF722PRO/target.c | 48 ++++++ src/main/target/FLYWOOF722PRO/target.h | 158 +++++++++++++++++++ src/main/target/FLYWOOF745/target.c | 9 -- src/main/target/FLYWOOF745/target.h | 10 ++ 10 files changed, 296 insertions(+), 17 deletions(-) create mode 100644 src/main/target/FLYWOOF405PRO/config.c create mode 100644 src/main/target/FLYWOOF722PRO/CMakeLists.txt create mode 100644 src/main/target/FLYWOOF722PRO/config.c create mode 100644 src/main/target/FLYWOOF722PRO/target.c create mode 100644 src/main/target/FLYWOOF722PRO/target.h diff --git a/src/main/target/FLYWOOF405PRO/CMakeLists.txt b/src/main/target/FLYWOOF405PRO/CMakeLists.txt index 8447a117c00..2c5382d82ef 100644 --- a/src/main/target/FLYWOOF405PRO/CMakeLists.txt +++ b/src/main/target/FLYWOOF405PRO/CMakeLists.txt @@ -1 +1,2 @@ target_stm32f405xg(FLYWOOF405PRO) +target_stm32f405xg(FLYWOOF405HD) \ No newline at end of file diff --git a/src/main/target/FLYWOOF405PRO/config.c b/src/main/target/FLYWOOF405PRO/config.c new file mode 100644 index 00000000000..dfe6c0ce100 --- /dev/null +++ b/src/main/target/FLYWOOF405PRO/config.c @@ -0,0 +1,34 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include "platform.h" + +#include "fc/fc_msp_box.h" + +#include "io/piniobox.h" + +#include "drivers/pwm_output.h" +#include "drivers/pwm_mapping.h" + +void targetConfiguration(void) +{ + // Make sure S1-S4 default to Motors + + timerOverridesMutable(timer2id(TIM3))->outputMode = OUTPUT_MODE_MOTORS; + timerOverridesMutable(timer2id(TIM2))->outputMode = OUTPUT_MODE_MOTORS; +} diff --git a/src/main/target/FLYWOOF405PRO/target.c b/src/main/target/FLYWOOF405PRO/target.c index c0f1c4eec2d..d4dd134dddc 100644 --- a/src/main/target/FLYWOOF405PRO/target.c +++ b/src/main/target/FLYWOOF405PRO/target.c @@ -24,15 +24,12 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 D(1,3,2) DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 D(1,0,2) - DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 1), // S3 D(1,7,5) DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 D(1,2,5) DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 D(2,4,7) DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 - - DEF_TIM(TIM1, CH2, PA9, TIM_USE_LED, 0, 0), //2812LED D(1,5,3) // DEF_TIM(TIM10, CH1, PB8, TIM_USE_PPM, 0, 0), // PPM }; diff --git a/src/main/target/FLYWOOF405PRO/target.h b/src/main/target/FLYWOOF405PRO/target.h index 14b5e9e03cb..a5a02c5fe84 100644 --- a/src/main/target/FLYWOOF405PRO/target.h +++ b/src/main/target/FLYWOOF405PRO/target.h @@ -17,9 +17,13 @@ #pragma once +#ifdef FLYWOOF405PRO #define TARGET_BOARD_IDENTIFIER "F4PR" #define USBD_PRODUCT_STRING "FLYWOOF405PRO" - +#else +#define TARGET_BOARD_IDENTIFIER "F4HD" +#define USBD_PRODUCT_STRING "FLYWOOF405HD" +#endif #define LED0 PC14 //Green #define BEEPER PC13 @@ -84,11 +88,12 @@ #define SPI3_MISO_PIN PC11 #define SPI3_MOSI_PIN PC12 +#ifdef FLYWOOF405PRO #define USE_OSD #define USE_MAX7456 #define MAX7456_SPI_BUS BUS_SPI3 -#define MAX7456_CS_PIN PB14// - +#define MAX7456_CS_PIN PB14 +#endif // *************** Onboard flash ******************** #define USE_FLASHFS @@ -109,6 +114,10 @@ #define UART1_TX_PIN PB6 #define UART1_RX_PIN PA10 +#define USE_UART2 +#define UART2_TX_PIN PD5 +#define UART2_RX_PIN PD6 + #define USE_UART3 #define UART3_TX_PIN PB10 #define UART3_RX_PIN PB11 @@ -125,7 +134,7 @@ #define UART6_TX_PIN PC6 #define UART6_RX_PIN PC7 -#define SERIAL_PORT_COUNT 6 +#define SERIAL_PORT_COUNT 7 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL #define SERIALRX_PROVIDER SERIALRX_SBUS @@ -159,6 +168,6 @@ #define TARGET_IO_PORTA 0xffff #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC 0xffff -#define TARGET_IO_PORTD (BIT(2)) +#define TARGET_IO_PORTD 0xffff #define MAX_PWM_OUTPUT_PORTS 8 diff --git a/src/main/target/FLYWOOF722PRO/CMakeLists.txt b/src/main/target/FLYWOOF722PRO/CMakeLists.txt new file mode 100644 index 00000000000..1906be3d599 --- /dev/null +++ b/src/main/target/FLYWOOF722PRO/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f722xe(FLYWOOF722PRO) diff --git a/src/main/target/FLYWOOF722PRO/config.c b/src/main/target/FLYWOOF722PRO/config.c new file mode 100644 index 00000000000..ae386d4bc0a --- /dev/null +++ b/src/main/target/FLYWOOF722PRO/config.c @@ -0,0 +1,30 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include +#include "platform.h" +#include "drivers/pwm_mapping.h" +#include "fc/fc_msp_box.h" +#include "io/piniobox.h" + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + + timerOverridesMutable(timer2id(TIM3))->outputMode = OUTPUT_MODE_MOTORS; + timerOverridesMutable(timer2id(TIM2))->outputMode = OUTPUT_MODE_MOTORS; +} diff --git a/src/main/target/FLYWOOF722PRO/target.c b/src/main/target/FLYWOOF722PRO/target.c new file mode 100644 index 00000000000..e8b78979f95 --- /dev/null +++ b/src/main/target/FLYWOOF722PRO/target.c @@ -0,0 +1,48 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + + +BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000, DEVHW_MPU6000, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_MPU6000_ALIGN); +BUSDEV_REGISTER_SPI_TAG(busdev_ICM42605, DEVHW_ICM42605, ICM42605_SPI_BUS, ICM42605_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42605_ALIGN); +BUSDEV_REGISTER_SPI_TAG(busdev_BMI270, DEVHW_BMI270, BMI270_SPI_BUS, BMI270_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_BMI270_ALIGN); + +timerHardware_t timerHardware[] = { + //DEF_TIM(TIM8, CH1, PC6, TIM_USE_PPM,0, 0), // PPM&SBUS + + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 - D(1,2) + DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 - D(1,4) + DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 - D(1,6) + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 - D(1,5) + DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 - D(2,4) + DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 - D(2,1) + DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 - D(1,0) + DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 - D(1,3) + + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED STRIP(1,5) +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/FLYWOOF722PRO/target.h b/src/main/target/FLYWOOF722PRO/target.h new file mode 100644 index 00000000000..34d6de266c4 --- /dev/null +++ b/src/main/target/FLYWOOF722PRO/target.h @@ -0,0 +1,158 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#define TARGET_BOARD_IDENTIFIER "FWF7" +#define USBD_PRODUCT_STRING "FLYWOOF722PRO" + +/*** Indicators ***/ +#define LED0 PC15 +#define USE_BEEPER +#define BEEPER PC14 +#define BEEPER_INVERTED + +/*** SPI/I2C bus ***/ +#define USE_SPI +#define USE_SPI_DEVICE_1 // Gyro 1/2 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS + +#define USE_IMU_MPU6000 +#define IMU_MPU6000_ALIGN CW0_DEG +#define MPU6000_SPI_BUS BUS_SPI1 +#define MPU6000_CS_PIN PA4 + +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 + +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW180_DEG +#define BMI270_SPI_BUS BUS_SPI1 +#define BMI270_CS_PIN PA4 + + +#define USE_SPI_DEVICE_2 // MAX7456 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define USE_SPI_DEVICE_3 // FLASH +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PB5 + +#define USE_I2C +#define USE_I2C_DEVICE_1 // I2C pads +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 + +/*** Onboard flash ***/ +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_CS_PIN PC13 +#define M25P16_SPI_BUS BUS_SPI3 + +/*** OSD ***/ +#define USE_OSD +#define USE_MAX7456 +#define MAX7456_CS_PIN PB12 +#define MAX7456_SPI_BUS BUS_SPI2 + +/*** Serial ports ***/ +#define USB_IO +#define USE_VCP + +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 + +#define USE_UART2 +#define UART2_TX_PIN PA2 +#define UART2_RX_PIN PA3 + +#define USE_UART3 +#define UART3_TX_PIN PB10 +#define UART3_RX_PIN PB11 + +#define USE_UART4 +#define UART4_TX_PIN PA0 +#define UART4_RX_PIN PA1 + +#define USE_UART5 +#define UART5_TX_PIN PC12 +#define UART5_RX_PIN PD2 + +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 + +#define SERIAL_PORT_COUNT 7 + +/*** BARO & MAG ***/ +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C1 +#define USE_BARO_BMP280 +#define USE_BARO_MS5611 +#define USE_BARO_DPS310 +#define USE_BARO_SPL06 + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +/*** ADC ***/ +#define USE_ADC +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define ADC_CHANNEL_3_PIN PC2 + +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_1 +#define VBAT_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 + + +/*** PINIO ***/ +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PB0 + +/*** LED STRIP ***/ +#define USE_LED_STRIP +#define WS2811_PIN PA8 + +/*** Default settings ***/ +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT +#define CURRENT_METER_SCALE_DEFAULT 170 +#define SERIALRX_UART SERIAL_PORT_USART1 +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS + +/*** Timer/PWM output ***/ +#define USE_SERIAL_4WAY_BLHELI_INTERFACE +#define MAX_PWM_OUTPUT_PORTS 6 +#define USE_DSHOT +#define USE_ESC_SENSOR + +/*** Used pins ***/ +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) diff --git a/src/main/target/FLYWOOF745/target.c b/src/main/target/FLYWOOF745/target.c index 04c083ac94f..a68d3d3199f 100644 --- a/src/main/target/FLYWOOF745/target.c +++ b/src/main/target/FLYWOOF745/target.c @@ -32,20 +32,11 @@ timerHardware_t timerHardware[] = { // DEF_TIM(TIM1, CH3, PE13, TIM_USE_PPM, 0, 1), // PPM, // DMA2_ST6 - -#ifdef FLYWOOF745 - DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // M1 , DMA1_ST2 - DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // M2 , DMA2_ST7 - DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // M3 , DMA1_ST7 - DEF_TIM(TIM1, CH2, PE11, TIM_USE_OUTPUT_AUTO, 0, 1), // M4 , DMA2_ST4 - DEF_TIM(TIM1, CH1, PE9, TIM_USE_OUTPUT_AUTO, 0, 2), // M5 , DMA2_ST2 -#else /* FLYWOOF745NANO */ DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // M1 , DMA1_ST7 DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // M2 , DMA1_ST2 DEF_TIM(TIM1, CH1, PE9, TIM_USE_OUTPUT_AUTO, 0, 2), // M3 , DMA2_ST2 DEF_TIM(TIM1, CH2, PE11, TIM_USE_OUTPUT_AUTO, 0, 1), // M4 , DMA2_ST4 DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // M5 , DMA2_ST7 -#endif DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 0), // M6 , DMA1_ST1 DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // M7 , DMA1_ST4 DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0), // M8 , DMA1_ST5 diff --git a/src/main/target/FLYWOOF745/target.h b/src/main/target/FLYWOOF745/target.h index c2b1937c611..d00c2455945 100644 --- a/src/main/target/FLYWOOF745/target.h +++ b/src/main/target/FLYWOOF745/target.h @@ -41,6 +41,16 @@ #define MPU6000_CS_PIN SPI4_NSS_PIN #define MPU6000_SPI_BUS BUS_SPI4 +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW270_DEG +#define BMI270_CS_PIN SPI4_NSS_PIN +#define BMI270_SPI_BUS BUS_SPI4 + +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_CS_PIN SPI4_NSS_PIN +#define ICM42605_SPI_BUS BUS_SPI4 + #define USB_IO #define USE_VCP #define VBUS_SENSING_ENABLED From b976458ec1e21adff510ac43183945aa8c669012 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sun, 2 Jun 2024 12:59:29 +0100 Subject: [PATCH 097/429] inverted crash detection --- docs/Settings.md | 10 ++++++++ src/main/fc/settings.yaml | 6 +++++ src/main/navigation/navigation.c | 11 +++++---- src/main/navigation/navigation.h | 1 + src/main/navigation/navigation_multicopter.c | 26 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index a1c339c1d8c..a6cd597ef17 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3582,6 +3582,16 @@ Multicopter hover throttle hint for altitude controller. Should be set to approx --- +### nav_mc_inverted_crash_detection + +Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 3s. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | 0 | 15 | + +--- + ### nav_mc_manual_climb_rate Maximum climb/descent rate firmware is allowed when processing pilot input for ALTHOLD control mode [cm/s] diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d9aa83c93cf..2dbda7569bb 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2415,6 +2415,12 @@ groups: default_value: OFF field: general.flags.landing_bump_detection type: bool + - name: nav_mc_inverted_crash_detection + description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 3s." + default_value: 0 + field: mc.inverted_crash_detection + min: 0 + max: 15 - name: nav_mc_althold_throttle description: "If set to STICK the FC remembers the throttle stick position when enabling ALTHOLD and treats it as the neutral midpoint for holding altitude. If set to MID_STICK or HOVER the neutral midpoint is set to the mid stick position or the hover throttle position respectively." default_value: "STICK" diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index cc4e269ef4b..a4a31370c63 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -175,7 +175,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig, .land_detect_sensitivity = SETTING_NAV_LAND_DETECT_SENSITIVITY_DEFAULT, // Changes sensitivity of landing detection .auto_disarm_delay = SETTING_NAV_AUTO_DISARM_DELAY_DEFAULT, // 2000 ms - time delay to disarm when auto disarm after landing enabled .rth_linear_descent_start_distance = SETTING_NAV_RTH_LINEAR_DESCENT_START_DISTANCE_DEFAULT, - .cruise_yaw_rate = SETTING_NAV_CRUISE_YAW_RATE_DEFAULT, // 20dps + .cruise_yaw_rate = SETTING_NAV_CRUISE_YAW_RATE_DEFAULT, // 20dps .rth_fs_landing_delay = SETTING_NAV_RTH_FS_LANDING_DELAY_DEFAULT, // Delay before landing in FS. 0 = immedate landing }, @@ -193,13 +193,14 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig, .braking_boost_timeout = SETTING_NAV_MC_BRAKING_BOOST_TIMEOUT_DEFAULT, // Timout boost after 750ms .braking_boost_speed_threshold = SETTING_NAV_MC_BRAKING_BOOST_SPEED_THRESHOLD_DEFAULT, // Boost can happen only above 1.5m/s .braking_boost_disengage_speed = SETTING_NAV_MC_BRAKING_BOOST_DISENGAGE_SPEED_DEFAULT, // Disable boost at 1m/s - .braking_bank_angle = SETTING_NAV_MC_BRAKING_BANK_ANGLE_DEFAULT, // Max braking angle + .braking_bank_angle = SETTING_NAV_MC_BRAKING_BANK_ANGLE_DEFAULT, // Max braking angle #endif - .posDecelerationTime = SETTING_NAV_MC_POS_DECELERATION_TIME_DEFAULT, // posDecelerationTime * 100 - .posResponseExpo = SETTING_NAV_MC_POS_EXPO_DEFAULT, // posResponseExpo * 100 + .posDecelerationTime = SETTING_NAV_MC_POS_DECELERATION_TIME_DEFAULT, // posDecelerationTime * 100 + .posResponseExpo = SETTING_NAV_MC_POS_EXPO_DEFAULT, // posResponseExpo * 100 .slowDownForTurning = SETTING_NAV_MC_WP_SLOWDOWN_DEFAULT, - .althold_throttle_type = SETTING_NAV_MC_ALTHOLD_THROTTLE_DEFAULT, // STICK + .althold_throttle_type = SETTING_NAV_MC_ALTHOLD_THROTTLE_DEFAULT, // STICK + .inverted_crash_detection = SETTING_NAV_MC_INVERTED_CRASH_DETECTION_DEFAULT, // 0 - disarm time delay for inverted crash detection }, // Fixed wing diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 276fb61cc1e..1a19de7b34d 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -344,6 +344,7 @@ typedef struct navConfig_s { uint8_t posResponseExpo; // Position controller expo (taret vel expo for MC) bool slowDownForTurning; // Slow down during WP missions when changing heading on next waypoint uint8_t althold_throttle_type; // throttle zero datum type for alt hold + uint8_t inverted_crash_detection; // Enables inverted crash detection, setting defines disarm time delay (0 = disabled) } mc; struct { diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index b108ef6aa31..96d44252715 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -36,6 +36,7 @@ #include "sensors/boardalignment.h" #include "sensors/gyro.h" +#include "fc/fc_core.h" #include "fc/config.h" #include "fc/rc_controls.h" #include "fc/rc_curves.h" @@ -794,11 +795,36 @@ static bool isLandingGbumpDetected(timeMs_t currentTimeMs) return false; } #endif +bool isMulticopterCrashedInverted(void) +{ + static timeMs_t startTime = 0; + + if ((ABS(attitude.values.roll) > 1000 || ABS(attitude.values.pitch) > 700) && fabsf(navGetCurrentActualPositionAndVelocity()->vel.z) < MC_LAND_CHECK_VEL_Z_MOVING) { + if (startTime == 0) { + startTime = millis(); + } else { + /* minimum 2s disarm delay + extra user set delay time. Min time of 3s given min user setting is 1s if enabled */ + uint16_t disarmTimeDelay = 2000 + S2MS(navConfig()->mc.inverted_crash_detection); + + return millis() - startTime > disarmTimeDelay; + } + } else { + startTime = 0; + } + + return false; +} + bool isMulticopterLandingDetected(void) { DEBUG_SET(DEBUG_LANDING, 4, 0); DEBUG_SET(DEBUG_LANDING, 3, averageAbsGyroRates() * 100); + if (navConfig()->mc.inverted_crash_detection && isMulticopterCrashedInverted()) { + ENABLE_ARMING_FLAG(ARMING_DISABLED_LANDING_DETECTED); + disarm(DISARM_LANDING); + } + const timeMs_t currentTimeMs = millis(); #if defined(USE_BARO) From 985fa2b440403674ae7c9abf9388abec810a70aa Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 2 Jun 2024 16:01:52 +0100 Subject: [PATCH 098/429] Add battery profile to programming framework --- src/main/programming/logic_condition.c | 4 ++++ src/main/programming/logic_condition.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/main/programming/logic_condition.c b/src/main/programming/logic_condition.c index 343db2989f5..f927ac18d1b 100644 --- a/src/main/programming/logic_condition.c +++ b/src/main/programming/logic_condition.c @@ -815,6 +815,10 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_ACTIVE_PROFILE: // int return getConfigProfile() + 1; break; + + case LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE: //int + return getConfigBatteryProfile() + 1; + break; case LOGIC_CONDITION_OPERAND_FLIGHT_ACTIVE_MIXER_PROFILE: // int return currentMixerProfileIndex + 1; diff --git a/src/main/programming/logic_condition.h b/src/main/programming/logic_condition.h index 3a0c0a87b1b..5defafaee67 100644 --- a/src/main/programming/logic_condition.h +++ b/src/main/programming/logic_condition.h @@ -142,6 +142,7 @@ typedef enum { LOGIC_CONDITION_OPERAND_FLIGHT_MIXER_TRANSITION_ACTIVE, //0,1 // 39 LOGIC_CONDITION_OPERAND_FLIGHT_ATTITUDE_YAW, // deg // 40 LOGIC_CONDITION_OPERAND_FLIGHT_FW_LAND_STATE, // 41 + LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE, // int // 42 } logicFlightOperands_e; typedef enum { From b9fd9e3f56d67a2ae4c265df4477d78554a218fa Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 2 Jun 2024 19:02:38 +0100 Subject: [PATCH 099/429] Consolidate the old `PIDProfile` and `Profile` in to `Control Profile` - Consolidate the old `PIDProfile` and `Profile` in to `Control Profile` - Improve consistency of the order `Control Profile`, `Mixer Profile`, and `Battery Profile` - Added `mixer_profile` to the `diff`/`dump` commands - Rename and update the profile documentation - Update the programming framework documentaion --- docs/{Profiles.md => Control Profiles.md} | 49 ++--- docs/Programming Framework.md | 232 +++++++++++----------- src/main/fc/cli.c | 70 ++++--- 3 files changed, 177 insertions(+), 174 deletions(-) rename docs/{Profiles.md => Control Profiles.md} (64%) diff --git a/docs/Profiles.md b/docs/Control Profiles.md similarity index 64% rename from docs/Profiles.md rename to docs/Control Profiles.md index 925de755f85..af41fed53b9 100644 --- a/docs/Profiles.md +++ b/docs/Control Profiles.md @@ -1,56 +1,59 @@ -# Profiles +# Control Profiles A profile is a set of configuration settings. -Currently three profiles are supported. The default profile is profile `1`. +Currently, INAV gives you three control profiles. The default control profile is `1`. -## Changing profiles +## Changing contorl profiles ### Stick Commands -Profiles can be selected using a GUI or the following stick combinations: +Control profiles can be selected using a GUI or the following stick combinations: -| Profile | Throttle | Yaw | Pitch | Roll | -| ------- | -------- | ----- | ------ | ------ | -| 1 | Down | Left | Middle | Left | -| 2 | Down | Left | Up | Middle | -| 3 | Down | Left | Middle | Right | +| Profile # | Throttle | Yaw | Pitch | Roll | +| -------- | -------- | ----- | ------ | ------ | +| 1 | Down | Left | Middle | Left | +| 2 | Down | Left | Up | Middle | +| 3 | Down | Left | Middle | Right | ### CLI -The CLI `profile` command can also be used to change profiles: +The CLI `control_profile` command can also be used to change control profiles: ``` -profile +control_profile ``` ### Programming (4.0.0 onwards) -You can change profiles using the programming frame work. This allows a lot of flexability in how you change profiles. +You can change control profiles using the programming frame work. This allows a lot of flexability in how you change profiles. For example, using a simple switch on channel 15. [![For example, using a simple switch](https://i.imgur.com/SS9CaaOl.png)](https://i.imgur.com/SS9CaaO.png) -Or using the speed to change profiles. In this example: -- when lower than 25 cm/s (basically not flying), profiles are not effected. -- Below 2682 cm/s (60 mph | 97 Km/h) use Profile 1 -- Above 5364 cm/s (120 mph | 193 Km/h) use Profile 3 -- Between 2683 and 5364 cm/s, use Profile 2 +Or using the speed to change control profiles. In this example: +- when lower than 25 cm/s (basically not flying), control profiles are not effected. +- Below 2682 cm/s (60 mph | 97 Km/h) use control profile 1 +- Above 5364 cm/s (120 mph | 193 Km/h) use control profile 3 +- Between 2683 and 5364 cm/s, use control profile 2 [![Using speed to change profiles](https://i.imgur.com/WjkuhhWl.png)](https://i.imgur.com/WjkuhhW.png) -#### Configurator use with profile changing logic. +> [!NOTE] +> From INAV 8.0, the programming framework operator is **Set Control Profile** and the **Flight** Operand is **Active Control Profile**. Pre-INAV 8.0, they were **Set Profile** and **Active Profile** respectively. -If you have logic conditions that change the profiles. You may find that if you manually change the profile using the drop down boxes in the top right of Configurator; that they switch back to a different profile. This is because the logic conditions are still running in the background. If this is the case, the simplest solutuion is to temporarily disable the switches that trigger the `set profile` operations. Remember to re-enable these switches after you have made your changes. +#### Configurator use with control profile changing logic. + +If you have logic conditions that change the profiles. You may find that if you manually change the control profile; using the drop down boxes in the top right of Configurator. That they switch back to a different control profile. This is because the logic conditions are still running in the background. If this is the case, the simplest solutuion is to temporarily disable the switches that trigger the `Set Control Profile` operations. Remember to re-enable these switches after you have made your changes. [![Disabled SET PROFILE switches](https://i.imgur.com/AeH9ll7l.png)](https://i.imgur.com/AeH9ll7.png) ## Profile Contents -The values contained within a profile can be seen by using the CLI `dump profile` command. +The values contained within a control profile can be seen by using the CLI `dump control_profile` command. e.g ``` -# dump profile +# dump control_profile -# profile -profile 1 +# control_profile +control_profile 1 set mc_p_pitch = 40 set mc_i_pitch = 30 diff --git a/docs/Programming Framework.md b/docs/Programming Framework.md index 9f95fdb25d5..e0199cfd714 100644 --- a/docs/Programming Framework.md +++ b/docs/Programming Framework.md @@ -44,13 +44,13 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | Operation ID | Name | Notes | |---------------|-------------------------------|-------| -| 0 | TRUE | Always evaluates as true | -| 1 | EQUAL | Evaluates `false` if `false` or `0` | -| 2 | GREATER_THAN | `true` if `Operand A` is a higher value than `Operand B` | -| 3 | LOWER_THAN | `true` if `Operand A` is a lower value than `Operand B` | -| 4 | LOW | `true` if `<1333` | -| 5 | MID | `true` if `>=1333 and <=1666` | -| 6 | HIGH | `true` if `>1666` | +| 0 | True | Always evaluates as true | +| 1 | Equal (A=B) | Evaluates `false` if `false` or `0` | +| 2 | Greater Than (A>B) | `true` if `Operand A` is a higher value than `Operand B` | +| 3 | Lower Than (A=1333 and <=1666` | +| 6 | High | `true` if `>1666` | | 7 | AND | `true` if `Operand A` and `Operand B` are the same value or both `true` | | 8 | OR | `true` if `Operand A` and/or `OperandB` is `true` | | 9 | XOR | `true` if `Operand A` or `Operand B` is `true`, but not both | @@ -58,105 +58,109 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | 11 | NOR | `true` if `Operand A` and `Operand B` are both `false` | | 12 | NOT | The boolean opposite to `Operand A` | | 13 | Sticky | `Operand A` is the activation operator, `Operand B` is the deactivation operator. After the activation is `true`, the operator will return `true` until Operand B is evaluated as `true`| -| 14 | Basic: Add | Add `Operand A` to `Operand B` and returns the result | -| 15 | Basic: Subtract | Substract `Operand B` from `Operand A` and returns the result | -| 16 | Basic: Multiply | Multiply `Operand A` by `Operand B` and returns the result | -| 17 | Basic: Divide | Divide `Operand A` by `Operand B` and returns the result | +| 14 | Basic: Add | Add `Operand A` to `Operand B` and returns the result | +| 15 | Basic: Subtract | Substract `Operand B` from `Operand A` and returns the result | +| 16 | Basic: Multiply | Multiply `Operand A` by `Operand B` and returns the result | +| 17 | Basic: Divide | Divide `Operand A` by `Operand B` and returns the result | | 18 | Set GVAR | Store value from `Operand B` into the Global Variable addressed by `Operand A`. Bear in mind, that operand `Global Variable` means: Value stored in Global Variable of an index! To store in GVAR 1 use `Value 1` not `Global Variable 1` | -| 19 | Increase GVAR | Increase the GVAR indexed by `Operand A` (use `Value 1` for Global Variable 1) with value from `Operand B` | -| 20 | Decrease GVAR | Decrease the GVAR indexed by `Operand A` (use `Value 1` for Global Variable 1) with value from `Operand B` | +| 19 | Increase GVAR | Increase the GVAR indexed by `Operand A` (use `Value 1` for Global Variable 1) with value from `Operand B` | +| 20 | Decrease GVAR | Decrease the GVAR indexed by `Operand A` (use `Value 1` for Global Variable 1) with value from `Operand B` | | 21 | Set IO Port | Set I2C IO Expander pin `Operand A` to value of `Operand B`. `Operand A` accepts values `0-7` and `Operand B` accepts `0` and `1` | -| 22 | OVERRIDE_ARMING_SAFETY | Allows the craft to arm on any angle even without GPS fix. WARNING: This bypasses all safety checks, even that the throttle is low, so use with caution. If you only want to check for certain conditions, such as arm without GPS fix. You will need to add logic conditions to check the throttle is low. | -| 23 | OVERRIDE_THROTTLE_SCALE | Override throttle scale to the value defined by operand. Operand type `0` and value `50` means throttle will be scaled by 50%. | -| 24 | SWAP_ROLL_YAW | basically, when activated, yaw stick will control roll and roll stick will control yaw. Required for tail-sitters VTOL during vertical-horizonral transition when body frame changes | -| 25 | SET_VTX_POWER_LEVEL | Sets VTX power level. Accepted values are `0-3` for SmartAudio and `0-4` for Tramp protocol | -| 26 | INVERT_ROLL | Inverts ROLL axis input for PID/PIFF controller | -| 27 | INVERT_PITCH | Inverts PITCH axis input for PID/PIFF controller | -| 28 | INVERT_YAW | Inverts YAW axis input for PID/PIFF controller | -| 29 | OVERRIDE_THROTTLE | Override throttle value that is fed to the motors by mixer. Operand is scaled in us. `1000` means throttle cut, `1500` means half throttle | -| 30 | SET_VTX_BAND | Sets VTX band. Accepted values are `1-5` | -| 31 | SET_VTX_CHANNEL | Sets VTX channel. Accepted values are `1-8` | -| 32 | SET_OSD_LAYOUT | Sets OSD layout. Accepted values are `0-3` | -| 33 | Trigonometry: Sine | Computes SIN of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | -| 34 | Trigonometry: Cosine | Computes COS of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | -| 35 | Trigonometry: Tangent | Computes TAN of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | -| 36 | MAP_INPUT | Scales `Operand A` from [`0` : `Operand B`] to [`0` : `1000`]. Note: input will be constrained and then scaled | -| 37 | MAP_OUTPUT | Scales `Operand A` from [`0` : `1000`] to [`0` : `Operand B`]. Note: input will be constrained and then scaled | -| 38 | RC_CHANNEL_OVERRIDE | Overrides channel set by `Operand A` to value of `Operand B`. Note operand A should normally be set as a "Value", NOT as "Get RC Channel"| -| 39 | SET_HEADING_TARGET | Sets heading-hold target to `Operand A`, in degrees. Value wraps-around. | -| 40 | Modulo | Modulo. Divide `Operand A` by `Operand B` and returns the remainder | -| 41 | LOITER_RADIUS_OVERRIDE | Sets the loiter radius to `Operand A` [`0` : `100000`] in cm. If the value is lower than the loiter radius set in the **Advanced Tuning**, that will be used. | -| 42 | SET_PROFILE | Sets the active config profile (PIDFF/Rates/Filters/etc) to `Operand A`. `Operand A` must be a valid profile number, currently from 1 to 3. If not, the profile will not change | -| 43 | Use Lowest Value | Finds the lowest value of `Operand A` and `Operand B` | -| 44 | Use Highest Value | Finds the highest value of `Operand A` and `Operand B` | -| 45 | FLIGHT_AXIS_ANGLE_OVERRIDE | Sets the target attitude angle for axis. In other words, when active, it enforces Angle mode (Heading Hold for Yaw) on this axis (Angle mode does not have to be active). `Operand A` defines the axis: `0` - Roll, `1` - Pitch, `2` - Yaw. `Operand B` defines the angle in degrees | -| 46 | FLIGHT_AXIS_RATE_OVERRIDE | Sets the target rate (rotation speed) for axis. `Operand A` defines the axis: `0` - Roll, `1` - Pitch, `2` - Yaw. `Operand B` defines the rate in degrees per second | -| 47 | EDGE | Momentarily true when triggered by `Operand A`. `Operand A` is the activation operator [`boolean`], `Operand B` _(Optional)_ is the time for the edge to stay active [ms]. After activation, operator will return `true` until the time in Operand B is reached. If a pure momentary edge is wanted. Just leave `Operand B` as the default `Value: 0` setting. | -| 48 | DELAY | Delays activation after being triggered. This will return `true` when `Operand A` _is_ true, and the delay time in `Operand B` [ms] has been exceeded. | -| 49 | TIMER | A simple on - off timer. `true` for the duration of `Operand A` [ms]. Then `false` for the duration of `Operand B` [ms]. | -| 50 | DELTA | This returns `true` when the value of `Operand A` has changed by the value of `Operand B` or greater within 100ms. | -| 51 | APPROX_EQUAL | `true` if `Operand B` is within 1% of `Operand A`. | -| 52 | LED_PIN_PWM | Value `Operand A` from [`0` : `100`] starts PWM generation on LED Pin. See [LED pin PWM](LED%20pin%20PWM.md). Any other value stops PWM generation (stop to allow ws2812 LEDs updates in shared modes)| +| 22 | Override Arming Safety | Allows the craft to arm on any angle even without GPS fix. WARNING: This bypasses all safety checks, even that the throttle is low, so use with caution. If you only want to check for certain conditions, such as arm without GPS fix. You will need to add logic conditions to check the throttle is low. | +| 23 | Override Throttle Scale | Override throttle scale to the value defined by operand. Operand type `0` and value `50` means throttle will be scaled by 50%. | +| 24 | Swap Roll & Yaw | basically, when activated, yaw stick will control roll and roll stick will control yaw. Required for tail-sitters VTOL during vertical-horizonral transition when body frame changes | +| 25 | Set VTx Power Level | Sets VTX power level. Accepted values are `0-3` for SmartAudio and `0-4` for Tramp protocol | +| 26 | Invert Roll | Inverts ROLL axis input for PID/PIFF controller | +| 27 | Invert Pitch | Inverts PITCH axis input for PID/PIFF controller | +| 28 | Invert Yaw | Inverts YAW axis input for PID/PIFF controller | +| 29 | Override Throttlw | Override throttle value that is fed to the motors by mixer. Operand is scaled in us. `1000` means throttle cut, `1500` means half throttle | +| 30 | Set VTx Band | Sets VTX band. Accepted values are `1-5` | +| 31 | Set VTx Channel | Sets VTX channel. Accepted values are `1-8` | +| 32 | Set OSD Layout | Sets OSD layout. Accepted values are `0-3` | +| 33 | Trigonometry: Sine | Computes SIN of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | +| 34 | Trigonometry: Cosine | Computes COS of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | +| 35 | Trigonometry: Tangent | Computes TAN of `Operand A` value in degrees. Output is multiplied by `Operand B` value. If `Operand B` is `0`, result is multiplied by `500` | +| 36 | Map Input | Scales `Operand A` from [`0` : `Operand B`] to [`0` : `1000`]. Note: input will be constrained and then scaled | +| 37 | Map Output | Scales `Operand A` from [`0` : `1000`] to [`0` : `Operand B`]. Note: input will be constrained and then scaled | +| 38 | Override RC Channel | Overrides channel set by `Operand A` to value of `Operand B`. Note operand A should normally be set as a "Value", NOT as "Get RC Channel"| +| 39 | Set Heading Target | Sets heading-hold target to `Operand A`, in centidegrees. Value wraps-around. | +| 40 | Modulo | Modulo. Divide `Operand A` by `Operand B` and returns the remainder | +| 41 | Override Loiter Radius | Sets the loiter radius to `Operand A` [`0` : `100000`] in cm. If the value is lower than the loiter radius set in the **Advanced Tuning**, that will be used. | +| 42 | Set Control Profile | Sets the active config profile (PIDFF/Rates/Filters/etc) to `Operand A`. `Operand A` must be a valid profile number, currently from 1 to 3. If not, the profile will not change | +| 43 | Use Lowest Value | Finds the lowest value of `Operand A` and `Operand B` | +| 44 | Use Highest Value | Finds the highest value of `Operand A` and `Operand B` | +| 45 | Flight Axis Angle Override | Sets the target attitude angle for axis. In other words, when active, it enforces Angle mode (Heading Hold for Yaw) on this axis (Angle mode does not have to be active). `Operand A` defines the axis: `0` - Roll, `1` - Pitch, `2` - Yaw. `Operand B` defines the angle in degrees | +| 46 | Flight Axis Rate Override | Sets the target rate (rotation speed) for axis. `Operand A` defines the axis: `0` - Roll, `1` - Pitch, `2` - Yaw. `Operand B` defines the rate in degrees per second | +| 47 | Edge | Momentarily true when triggered by `Operand A`. `Operand A` is the activation operator [`boolean`], `Operand B` _(Optional)_ is the time for the edge to stay active [ms]. After activation, operator will return `true` until the time in Operand B is reached. If a pure momentary edge is wanted. Just leave `Operand B` as the default `Value: 0` setting. | +| 48 | Delay | Delays activation after being triggered. This will return `true` when `Operand A` _is_ true, and the delay time in `Operand B` [ms] has been exceeded. | +| 49 | Timer | A simple on - off timer. `true` for the duration of `Operand A` [ms]. Then `false` for the duration of `Operand B` [ms]. | +| 50 | Delta (|A| >= B) | This returns `true` when the value of `Operand A` has changed by the value of `Operand B` or greater within 100ms. | +| 51 | Approx Equals (A ~ B) | `true` if `Operand B` is within 1% of `Operand A`. | +| 52 | LED Pin PWM | Value `Operand A` from [`0` : `100`] starts PWM generation on LED Pin. See [LED pin PWM](LED%20pin%20PWM.md). Any other value stops PWM generation (stop to allow ws2812 LEDs updates in shared modes). | +| 53 | Disable GPS Sensor Fix | Disables the GNSS sensor fix. For testing GNSS failure. | +| 54 | Mag calibration | Trigger a magnetometer calibration. | ### Operands | Operand Type | Name | Notes | |---------------|-----------------------|-------| -| 0 | VALUE | Value derived from `value` field | -| 1 | GET_RC_CHANNEL | `value` points to RC channel number, indexed from 1 | -| 2 | FLIGHT | `value` points to flight parameter table | -| 3 | FLIGHT_MODE | `value` points to flight modes table | -| 4 | LC | `value` points to other logic condition ID | -| 5 | GVAR | Value stored in Global Variable indexed by `value`. `GVAR 1` means: value in GVAR 1 | -| 5 | PID | Output of a Programming PID indexed by `value`. `PID 1` means: value in PID 1 | - -#### FLIGHT - -| Operand Value | Name | Notes | -|---------------|-------------------------------|-------| -| 0 | ARM_TIMER | in `seconds` | -| 1 | HOME_DISTANCE | in `meters` | -| 2 | TRIP_DISTANCE | in `meters` | -| 3 | RSSI | | -| 4 | VBAT | in `Volts * 100`, eg. `12.1V` is `1210` | -| 5 | CELL_VOLTAGE | in `Volts * 100`, eg. `12.1V` is `1210` | -| 6 | CURRENT | in `Amps * 100`, eg. `9A` is `900` | -| 7 | MAH_DRAWN | in `mAh` | -| 8 | GPS_SATS | | -| 9 | GROUD_SPEED | in `cm/s` | -| 10 | 3D_SPEED | in `cm/s` | -| 11 | AIR_SPEED | in `cm/s` | -| 12 | ALTITUDE | in `cm` | -| 13 | VERTICAL_SPEED | in `cm/s` | -| 14 | TROTTLE_POS | in `%` | -| 15 | ATTITUDE_ROLL | in `degrees` | -| 16 | ATTITUDE_PITCH | in `degrees` | -| 17 | IS_ARMED | boolean `0`/`1` | -| 18 | IS_AUTOLAUNCH | boolean `0`/`1` | -| 19 | IS_ALTITUDE_CONTROL | boolean `0`/`1` | -| 20 | IS_POSITION_CONTROL | boolean `0`/`1` | -| 21 | IS_EMERGENCY_LANDING | boolean `0`/`1` | -| 22 | IS_RTH | boolean `0`/`1` | -| 23 | IS_LANDING | boolean `0`/`1` | -| 24 | IS_FAILSAFE | boolean `0`/`1` | -| 25 | STABILIZED_ROLL | Roll PID controller output `[-500:500]` | -| 26 | STABILIZED_PITCH | Pitch PID controller output `[-500:500]` | -| 27 | STABILIZED_YAW | Yaw PID controller output `[-500:500]` | -| 28 | 3D HOME_DISTANCE | in `meters`, calculated from HOME_DISTANCE and ALTITUDE using Pythagorean theorem | -| 29 | CROSSFIRE LQ | Crossfire Link quality as returned by the CRSF protocol | -| 30 | CROSSFIRE SNR | Crossfire SNR as returned by the CRSF protocol | -| 31 | GPS_VALID | boolean `0`/`1`. True when the GPS has a valid 3D Fix | -| 32 | LOITER_RADIUS | The current loiter radius in cm. | -| 33 | ACTIVE_PROFILE | integer for the active config profile `[1..MAX_PROFILE_COUNT]` | -| 34 | BATT_CELLS | Number of battery cells detected | -| 35 | AGL_STATUS | boolean `1` when AGL can be trusted, `0` when AGL estimate can not be trusted | -| 36 | AGL | integer Above The Groud Altitude in `cm` | -| 37 | RANGEFINDER_RAW | integer raw distance provided by the rangefinder in `cm` | -| 38 | ACTIVE_MIXER_PROFILE | Which mixers are currently active (for vtol etc) | -| 39 | MIXER_TRANSITION_ACTIVE | Currently switching between mixers (quad to plane etc) | -| 40 | ATTITUDE_YAW | current heading (yaw) in `degrees` | -| 41 | FW Land Sate | integer `1` - `5`, indicates the status of the FW landing, 0 Idle, 1 Downwind, 2 Base Leg, 3 Final Approach, 4 Glide, 5 Flare | +| 0 | Value | Value derived from `value` field | +| 1 | Get RC Channel | `value` points to RC channel number, indexed from 1 | +| 2 | Flight | `value` points to **Flight** Parameters table | +| 3 | Flight Mode | `value` points to **Flight_Mode** table | +| 4 | Logic Condition | `value` points to other logic condition ID | +| 5 | Get Global Variable | Value stored in Global Variable indexed by `value`. `GVAR 1` means: value in GVAR 1 | +| 5 | Programming PID | Output of a Programming PID indexed by `value`. `PID 1` means: value in PID 1 | +| 6 | Waypoints | `value` points to the **Waypoint** parameter table | + +#### Flight Parameters + +| Operand Value | Name | Notes | +|---------------|---------------------------------------|-------| +| 0 | ARM Timer [s] | Time since armed in `seconds` | +| 1 | Home Distance [m] | distance from home in `meters` | +| 2 | Trip distance [m] | Trip distance in `meters` | +| 3 | RSSI | | +| 4 | Vbat [centi-Volt] [1V = 100] | VBAT Voltage in `Volts * 100`, eg. `12.1V` is `1210` | +| 5 | Cell voltage [centi-Volt] [1V = 100] | Average cell voltage in `Volts * 100`, eg. `12.1V` is `1210` | +| 6 | Current [centi-Amp] [1A = 100] | Current in `Amps * 100`, eg. `9A` is `900` | +| 7 | Current drawn [mAh] | Total used current in `mAh` | +| 8 | GPS Sats | | +| 9 | Ground speed [cm/s] | Ground speed in `cm/s` | +| 10 | 3D speed [cm/s] | 3D speed in `cm/s` | +| 11 | Air speed [cm/s] | Air speed in `cm/s` | +| 12 | Altitude [cm] | Altitude in `cm` | +| 13 | Vertical speed [cm/s] | Vertical speed in `cm/s` | +| 14 | Throttle position [%] | Throttle position in `%` | +| 15 | Roll [deg] | Roll attitude in `degrees` | +| 16 | Pitch [deg] | Pitch attitude in `degrees` | +| 17 | Is Armed | Is the system armed? boolean `0`/`1` | +| 18 | Is Autolaunch | Is auto launch active? boolean `0`/`1` | +| 19 | Is Controlling Altitude | Is altitude being controlled? boolean `0`/`1` | +| 20 | Is Controlling Position | Is the position being controlled? boolean `0`/`1` | +| 21 | Is Emergency Landing | Is the aircraft emergency landing? boolean `0`/`1` | +| 22 | Is RTH | Is RTH active? boolean `0`/`1` | +| 23 | Is Landing | Is the aircaft automatically landing? boolean `0`/`1` | +| 24 | Is Failsafe | Is the flight controller in a failsafe? boolean `0`/`1` | +| 25 | Stabilized Roll | Roll PID controller output `[-500:500]` | +| 26 | Stabilized Pitch | Pitch PID controller output `[-500:500]` | +| 27 | Stabilized Yaw | Yaw PID controller output `[-500:500]` | +| 28 | 3D home distance [m] | 3D distance to home in `meters`. Calculated from Home distance and Altitude using Pythagorean theorem | +| 29 | CRSF LQ | Link quality as returned by the CRSF protocol | +| 30 | CRSF SNR | SNR as returned by the CRSF protocol | +| 31 | GPS Valid Fix | Boolean `0`/`1`. True when the GPS has a valid 3D Fix | +| 32 | Loiter Radius [cm] | The current loiter radius in cm. | +| 33 | Active Control Profile | Integer for the active config profile `[1..MAX_PROFILE_COUNT]` | +| 34 | Battery cells | Number of battery cells detected | +| 35 | AGL status [0/1] | Boolean `1` when AGL can be trusted, `0` when AGL estimate can not be trusted | +| 36 | AGL [cm] | Integer altitude above The Groud Altitude in `cm` | +| 37 | Rangefinder [cm] | Integer raw distance provided by the rangefinder in `cm` | +| 38 | Active Mixer Profile | Which mixer is currently active (for vtol etc) | +| 39 | Mixer Transition Active | Boolean `0`/`1`. Are we currently switching between mixers (quad to plane etc) | +| 40 | Yaw [deg] | Current heading (yaw) in `degrees` | +| 41 | FW Land Sate | Integer `1` - `5`, indicates the status of the FW landing, 0 Idle, 1 Downwind, 2 Base Leg, 3 Final Approach, 4 Glide, 5 Flare | +| 42 | Current battery profile | The active battery profile. Integer `[1..MAX_PROFILE_COUNT]` | #### FLIGHT_MODE @@ -164,22 +168,22 @@ The flight mode operands return `true` when the mode is active. These are modes | Operand Value | Name | Notes | |---------------|-------------------|-------| -| 0 | FAILSAFE | `true` when a **Failsafe** state has been triggered. | -| 1 | MANUAL | `true` when you are in the **Manual** flight mode. | +| 0 | Failsafe | `true` when a **Failsafe** state has been triggered. | +| 1 | Manual | `true` when you are in the **Manual** flight mode. | | 2 | RTH | `true` when you are in the **Return to Home** flight mode. | -| 3 | POSHOLD | `true` when you are in the **Position Hold** or **Loiter** flight modes. | -| 4 | CRUISE | `true` when you are in the **Cruise** flight mode. | -| 5 | ALTHOLD | `true` when you the **Altitude Hold** flight mode modifier is active. | -| 6 | ANGLE | `true` when you are in the **Angle** flight mode. | -| 7 | HORIZON | `true` when you are in the **Horizon** flight mode. | -| 8 | AIR | `true` when you the **Airmode** flight mode modifier is active. | -| 9 | USER1 | `true` when the **USER 1** mode is active. | -| 10 | USER2 | `true` when the **USER 2** mode is active. | -| 11 | COURSE_HOLD | `true` when you are in the **Course Hold** flight mode. | -| 12 | USER3 | `true` when the **USER 3** mode is active. | -| 13 | USER4 | `true` when the **USER 4** mode is active. | -| 14 | ACRO | `true` when you are in the **Acro** flight mode. | -| 15 | WAYPOINT_MISSION | `true` when you are in the **WP Mission** flight mode. | +| 3 | Position Hold | `true` when you are in the **Position Hold** or **Loiter** flight modes. | +| 4 | Cruise | `true` when you are in the **Cruise** flight mode. | +| 5 | Altitude Hold | `true` when you the **Altitude Hold** flight mode modifier is active. | +| 6 | Angle | `true` when you are in the **Angle** flight mode. | +| 7 | Horizon | `true` when you are in the **Horizon** flight mode. | +| 8 | Air | `true` when you the **Airmode** flight mode modifier is active. | +| 9 | USER 1 | `true` when the **USER 1** mode is active. | +| 10 | USER 2 | `true` when the **USER 2** mode is active. | +| 11 | Course Hold | `true` when you are in the **Course Hold** flight mode. | +| 12 | USER 3 | `true` when the **USER 3** mode is active. | +| 13 | USER 4 | `true` when the **USER 4** mode is active. | +| 14 | Acro | `true` when you are in the **Acro** flight mode. | +| 15 | Waypoint Mission | `true` when you are in the **WP Mission** flight mode. | #### WAYPOINTS @@ -335,5 +339,3 @@ choose *value* and enter the channel number. Choosing "get RC value" is a common which does something other than what you probably want. ![screenshot of override an RC channel with a value](./assets/images/ipf_set_get_rc_channel.png) - - diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 3bedf7d324d..aba1f58b905 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -293,7 +293,7 @@ static void cliPutp(void *p, char ch) typedef enum { DUMP_MASTER = (1 << 0), - DUMP_PROFILE = (1 << 1), + DUMP_CONTROL_PROFILE = (1 << 1), DUMP_BATTERY_PROFILE = (1 << 2), DUMP_MIXER_PROFILE = (1 << 3), DUMP_ALL = (1 << 4), @@ -3336,30 +3336,30 @@ static void cliPlaySound(char *cmdline) beeper(beeperModeForTableIndex(i)); } -static void cliProfile(char *cmdline) +static void cliControlProfile(char *cmdline) { // CLI profile index is 1-based if (isEmpty(cmdline)) { - cliPrintLinef("profile %d", getConfigProfile() + 1); + cliPrintLinef("control_profile %d", getConfigProfile() + 1); return; } else { const int i = fastA2I(cmdline) - 1; if (i >= 0 && i < MAX_PROFILE_COUNT) { setConfigProfileAndWriteEEPROM(i); - cliProfile(""); + cliControlProfile(""); } } } -static void cliDumpProfile(uint8_t profileIndex, uint8_t dumpMask) +static void cliDumpControlProfile(uint8_t profileIndex, uint8_t dumpMask) { if (profileIndex >= MAX_PROFILE_COUNT) { // Faulty values return; } setConfigProfile(profileIndex); - cliPrintHashLine("profile"); - cliPrintLinef("profile %d\r\n", getConfigProfile() + 1); + cliPrintHashLine("control_profile"); + cliPrintLinef("control_profile %d\r\n", getConfigProfile() + 1); dumpAllValues(PROFILE_VALUE, dumpMask); dumpAllValues(CONTROL_RATE_VALUE, dumpMask); dumpAllValues(EZ_TUNE_VALUE, dumpMask); @@ -3981,12 +3981,12 @@ static void printConfig(const char *cmdline, bool doDiff) const char *options; if ((options = checkCommand(cmdline, "master"))) { dumpMask = DUMP_MASTER; // only - } else if ((options = checkCommand(cmdline, "profile"))) { - dumpMask = DUMP_PROFILE; // only - } else if ((options = checkCommand(cmdline, "battery_profile"))) { - dumpMask = DUMP_BATTERY_PROFILE; // only + } else if ((options = checkCommand(cmdline, "control_profile"))) { + dumpMask = DUMP_CONTROL_PROFILE; // only } else if ((options = checkCommand(cmdline, "mixer_profile"))) { dumpMask = DUMP_MIXER_PROFILE; // only + } else if ((options = checkCommand(cmdline, "battery_profile"))) { + dumpMask = DUMP_BATTERY_PROFILE; // only } else if ((options = checkCommand(cmdline, "all"))) { dumpMask = DUMP_ALL; // all profiles and rates } else { @@ -3997,16 +3997,16 @@ static void printConfig(const char *cmdline, bool doDiff) dumpMask = dumpMask | DO_DIFF; } - const int currentProfileIndexSave = getConfigProfile(); - const int currentBatteryProfileIndexSave = getConfigBatteryProfile(); + const int currentControlProfileIndexSave = getConfigProfile(); const int currentMixerProfileIndexSave = getConfigMixerProfile(); + const int currentBatteryProfileIndexSave = getConfigBatteryProfile(); backupConfigs(); // reset all configs to defaults to do differencing resetConfigs(); // restore the profile indices, since they should not be reset for proper comparison - setConfigProfile(currentProfileIndexSave); - setConfigBatteryProfile(currentBatteryProfileIndexSave); + setConfigProfile(currentControlProfileIndexSave); setConfigMixerProfile(currentMixerProfileIndexSave); + setConfigBatteryProfile(currentBatteryProfileIndexSave); if (checkCommand(options, "showdefaults")) { dumpMask = dumpMask | SHOW_DEFAULTS; // add default values as comments for changed values @@ -4128,25 +4128,25 @@ static void printConfig(const char *cmdline, bool doDiff) if (dumpMask & DUMP_ALL) { // dump all profiles - const int currentProfileIndexSave = getConfigProfile(); - const int currentBatteryProfileIndexSave = getConfigBatteryProfile(); + const int currentControlProfileIndexSave = getConfigProfile(); const int currentMixerProfileIndexSave = getConfigMixerProfile(); + const int currentBatteryProfileIndexSave = getConfigBatteryProfile(); + for (int ii = 0; ii < MAX_PROFILE_COUNT; ++ii) { + cliDumpControlProfile(ii, dumpMask); + } for (int ii = 0; ii < MAX_MIXER_PROFILE_COUNT; ++ii) { cliDumpMixerProfile(ii, dumpMask); } - for (int ii = 0; ii < MAX_PROFILE_COUNT; ++ii) { - cliDumpProfile(ii, dumpMask); - } for (int ii = 0; ii < MAX_BATTERY_PROFILE_COUNT; ++ii) { cliDumpBatteryProfile(ii, dumpMask); } - setConfigProfile(currentProfileIndexSave); - setConfigBatteryProfile(currentBatteryProfileIndexSave); + setConfigProfile(currentControlProfileIndexSave); setConfigMixerProfile(currentMixerProfileIndexSave); + setConfigBatteryProfile(currentBatteryProfileIndexSave); cliPrintHashLine("restore original profile selection"); + cliPrintLinef("profile %d", currentControlProfileIndexSave + 1); cliPrintLinef("mixer_profile %d", currentMixerProfileIndexSave + 1); - cliPrintLinef("profile %d", currentProfileIndexSave + 1); cliPrintLinef("battery_profile %d", currentBatteryProfileIndexSave + 1); #ifdef USE_CLI_BATCH @@ -4154,18 +4154,19 @@ static void printConfig(const char *cmdline, bool doDiff) #endif } else { // dump just the current profiles + cliDumpControlProfile(getConfigProfile(), dumpMask); cliDumpMixerProfile(getConfigMixerProfile(), dumpMask); - cliDumpProfile(getConfigProfile(), dumpMask); cliDumpBatteryProfile(getConfigBatteryProfile(), dumpMask); } } + + if (dumpMask & DUMP_CONTROL_PROFILE) { + cliDumpControlProfile(getConfigProfile(), dumpMask); + } + if (dumpMask & DUMP_MIXER_PROFILE) { cliDumpMixerProfile(getConfigMixerProfile(), dumpMask); } - - if (dumpMask & DUMP_PROFILE) { - cliDumpProfile(getConfigProfile(), dumpMask); - } if (dumpMask & DUMP_BATTERY_PROFILE) { cliDumpBatteryProfile(getConfigBatteryProfile(), dumpMask); @@ -4279,9 +4280,9 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("defaults", "reset to defaults and reboot", NULL, cliDefaults), CLI_COMMAND_DEF("dfu", "DFU mode on reboot", NULL, cliDfu), CLI_COMMAND_DEF("diff", "list configuration changes from default", - "[master|battery_profile|profile|rates|all] {showdefaults}", cliDiff), + "[master|battery_profile|control_profile|mixer_profile|rates|all] {showdefaults}", cliDiff), CLI_COMMAND_DEF("dump", "dump configuration", - "[master|battery_profile|profile|rates|all] {showdefaults}", cliDump), + "[master|battery_profile|control_profile|mixer_profile|rates|all] {showdefaults}", cliDump), #ifdef USE_RX_ELERES CLI_COMMAND_DEF("eleres_bind", NULL, NULL, cliEleresBind), #endif // USE_RX_ELERES @@ -4322,12 +4323,9 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("msc", "switch into msc mode", NULL, cliMsc), #endif CLI_COMMAND_DEF("play_sound", NULL, "[]\r\n", cliPlaySound), - CLI_COMMAND_DEF("profile", "change profile", - "[]", cliProfile), - CLI_COMMAND_DEF("battery_profile", "change battery profile", - "[]", cliBatteryProfile), - CLI_COMMAND_DEF("mixer_profile", "change mixer profile", - "[]", cliMixerProfile), + CLI_COMMAND_DEF("control_profile", "change control profile", "[]", cliControlProfile), + CLI_COMMAND_DEF("mixer_profile", "change mixer profile", "[]", cliMixerProfile), + CLI_COMMAND_DEF("battery_profile", "change battery profile", "[]", cliBatteryProfile), CLI_COMMAND_DEF("resource", "view currently used resources", NULL, cliResource), CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange), #if defined(USE_SAFE_HOME) From c012de6ca6295d16ac5dc8074f9476e9e77037a9 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 2 Jun 2024 19:59:24 +0100 Subject: [PATCH 100/429] Make `battery_capacity_unit` a global setting Remove `battery_capacity_unit` from battery profiles. --- docs/Battery.md | 3 --- src/main/fc/fc_msp.c | 16 ++++++++-------- src/main/fc/settings.yaml | 12 ++++++------ src/main/flight/rth_estimator.c | 2 +- src/main/io/osd.c | 6 +++--- src/main/sensors/battery.c | 9 +++++---- src/main/sensors/battery_config_structs.h | 21 +++++++++++---------- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/docs/Battery.md b/docs/Battery.md index f6bdbd50391..e519c325410 100644 --- a/docs/Battery.md +++ b/docs/Battery.md @@ -201,7 +201,6 @@ Up to 3 battery profiles are supported. You can select the battery profile from - `vbat_max_cell_voltage` - `vbat_warning_cell_voltage` - `vbat_min_cell_voltage` -- `battery_capacity_unit` - `battery_capacity` - `battery_capacity_warning` - `battery_capacity_critical` @@ -253,7 +252,6 @@ feature BAT_PROF_AUTOSWITCH battery_profile 1 set bat_cells = 3 -set battery_capacity_unit = MAH set battery_capacity = 2200 set battery_capacity_warning = 440 set battery_capacity_critical = 220 @@ -262,7 +260,6 @@ set battery_capacity_critical = 220 battery_profile 2 set bat_cells = 4 -set battery_capacity_unit = MAH set battery_capacity = 1500 set battery_capacity_warning = 300 set battery_capacity_critical = 150 diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 4ae42184816..2109d3e08a9 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -856,7 +856,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU32(dst, currentBatteryProfile->capacity.value); sbufWriteU32(dst, currentBatteryProfile->capacity.warning); sbufWriteU32(dst, currentBatteryProfile->capacity.critical); - sbufWriteU8(dst, currentBatteryProfile->capacity.unit); + sbufWriteU8(dst, batteryMetersConfig()->capacity_unit); break; case MSP2_INAV_MISC2: @@ -895,7 +895,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF sbufWriteU32(dst, currentBatteryProfile->capacity.value); sbufWriteU32(dst, currentBatteryProfile->capacity.warning); sbufWriteU32(dst, currentBatteryProfile->capacity.critical); - sbufWriteU8(dst, currentBatteryProfile->capacity.unit); + sbufWriteU8(dst, batteryMetersConfig()->capacity_unit); break; #ifdef USE_GPS @@ -2081,13 +2081,13 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) currentBatteryProfileMutable->capacity.value = sbufReadU32(src); currentBatteryProfileMutable->capacity.warning = sbufReadU32(src); currentBatteryProfileMutable->capacity.critical = sbufReadU32(src); - currentBatteryProfileMutable->capacity.unit = sbufReadU8(src); + batteryMetersConfigMutable()->capacity_unit = sbufReadU8(src); if ((batteryMetersConfig()->voltageSource != BAT_VOLTAGE_RAW) && (batteryMetersConfig()->voltageSource != BAT_VOLTAGE_SAG_COMP)) { batteryMetersConfigMutable()->voltageSource = BAT_VOLTAGE_RAW; return MSP_RESULT_ERROR; } - if ((currentBatteryProfile->capacity.unit != BAT_CAPACITY_UNIT_MAH) && (currentBatteryProfile->capacity.unit != BAT_CAPACITY_UNIT_MWH)) { - currentBatteryProfileMutable->capacity.unit = BAT_CAPACITY_UNIT_MAH; + if ((batteryMetersConfig()->capacity_unit != BAT_CAPACITY_UNIT_MAH) && (batteryMetersConfig()->capacity_unit != BAT_CAPACITY_UNIT_MWH)) { + batteryMetersConfigMutable()->capacity_unit = BAT_CAPACITY_UNIT_MAH; return MSP_RESULT_ERROR; } } else @@ -2120,13 +2120,13 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) currentBatteryProfileMutable->capacity.value = sbufReadU32(src); currentBatteryProfileMutable->capacity.warning = sbufReadU32(src); currentBatteryProfileMutable->capacity.critical = sbufReadU32(src); - currentBatteryProfileMutable->capacity.unit = sbufReadU8(src); + batteryMetersConfigMutable()->capacity_unit = sbufReadU8(src); if ((batteryMetersConfig()->voltageSource != BAT_VOLTAGE_RAW) && (batteryMetersConfig()->voltageSource != BAT_VOLTAGE_SAG_COMP)) { batteryMetersConfigMutable()->voltageSource = BAT_VOLTAGE_RAW; return MSP_RESULT_ERROR; } - if ((currentBatteryProfile->capacity.unit != BAT_CAPACITY_UNIT_MAH) && (currentBatteryProfile->capacity.unit != BAT_CAPACITY_UNIT_MWH)) { - currentBatteryProfileMutable->capacity.unit = BAT_CAPACITY_UNIT_MAH; + if ((batteryMetersConfig()->capacity_unit != BAT_CAPACITY_UNIT_MAH) && (batteryMetersConfig()->capacity_unit != BAT_CAPACITY_UNIT_MWH)) { + batteryMetersConfigMutable()->capacity_unit = BAT_CAPACITY_UNIT_MAH; return MSP_RESULT_ERROR; } } else diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d9aa83c93cf..3c192495751 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -890,6 +890,12 @@ groups: condition: USE_ADC min: 0 max: 65535 + - name: battery_capacity_unit + description: "Unit used for `battery_capacity`, `battery_capacity_warning` and `battery_capacity_critical` [MAH/MWH] (milliAmpere hour / milliWatt hour)." + default_value: "MAH" + field: capacity_unit + table: bat_capacity_unit + type: uint8_t - name: current_meter_scale description: "This sets the output voltage to current scaling for the current sensor in 0.1 mV/A steps. 400 is 40mV/A such as the ACS756 sensor outputs. 183 is the setting for the uberdistro with a 0.25mOhm shunt." default_value: :target @@ -996,12 +1002,6 @@ groups: field: capacity.critical min: 0 max: 4294967295 - - name: battery_capacity_unit - description: "Unit used for `battery_capacity`, `battery_capacity_warning` and `battery_capacity_critical` [MAH/MWH] (milliAmpere hour / milliWatt hour)." - default_value: "MAH" - field: capacity.unit - table: bat_capacity_unit - type: uint8_t - name: controlrate_profile description: "Control rate profile to switch to when the battery profile is selected, 0 to disable and keep the currently selected control rate profile" default_value: 0 diff --git a/src/main/flight/rth_estimator.c b/src/main/flight/rth_estimator.c index 708c71bd1cf..e0ca0fba20d 100644 --- a/src/main/flight/rth_estimator.c +++ b/src/main/flight/rth_estimator.c @@ -222,7 +222,7 @@ float calculateRemainingDistanceBeforeRTH(bool takeWindIntoAccount) { // check requirements const bool areBatterySettingsOK = feature(FEATURE_VBAT) && feature(FEATURE_CURRENT_METER) && batteryWasFullWhenPluggedIn(); - const bool areRTHEstimatorSettingsOK = batteryMetersConfig()->cruise_power > 0 && currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MWH &¤tBatteryProfile->capacity.value > 0 && navConfig()->fw.cruise_speed > 0; + const bool areRTHEstimatorSettingsOK = batteryMetersConfig()->cruise_power > 0 && batteryMetersConfig()->capacity_unit == BAT_CAPACITY_UNIT_MWH && currentBatteryProfile->capacity.value > 0 && navConfig()->fw.cruise_speed > 0; const bool isNavigationOK = navigationPositionEstimateIsHealthy() && isImuHeadingValid(); if (!(areBatterySettingsOK && areRTHEstimatorSettingsOK && isNavigationOK)) { diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 34135ce2fd7..a3a298962a3 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -1780,7 +1780,7 @@ static bool osdDrawSingleElement(uint8_t item) tfp_sprintf(buff, " NA"); else if (!batteryWasFullWhenPluggedIn()) tfp_sprintf(buff, " NF"); - else if (currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MAH) { + else if (batteryMetersConfig()->capacity_unit == BAT_CAPACITY_UNIT_MAH) { uint8_t mah_digits = osdConfig()->mAh_precision; // Initialize to config value #ifndef DISABLE_MSP_DJI_COMPAT // IF DJICOMPAT is not supported, there's no need to check for it @@ -1803,11 +1803,11 @@ static bool osdDrawSingleElement(uint8_t item) buff[mah_digits + 1] = '\0'; unitsDrawn = true; } - } else // currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MWH + } else // batteryMetersConfig()->capacityUnit == BAT_CAPACITY_UNIT_MWH osdFormatCentiNumber(buff + 1, getBatteryRemainingCapacity() / 10, 0, 2, 0, 3, false); if (!unitsDrawn) { - buff[4] = currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MAH ? SYM_MAH : SYM_WH; + buff[4] = batteryMetersConfig()->capacity_unit == BAT_CAPACITY_UNIT_MAH ? SYM_MAH : SYM_WH; buff[5] = '\0'; } diff --git a/src/main/sensors/battery.c b/src/main/sensors/battery.c index 2ca7024694e..a29fa2e07cf 100644 --- a/src/main/sensors/battery.c +++ b/src/main/sensors/battery.c @@ -97,7 +97,7 @@ static int32_t mWhDrawn = 0; // energy (milliWatt hours) draw batteryState_e batteryState; const batteryProfile_t *currentBatteryProfile; -PG_REGISTER_ARRAY_WITH_RESET_FN(batteryProfile_t, MAX_BATTERY_PROFILE_COUNT, batteryProfiles, PG_BATTERY_PROFILES, 2); +PG_REGISTER_ARRAY_WITH_RESET_FN(batteryProfile_t, MAX_BATTERY_PROFILE_COUNT, batteryProfiles, PG_BATTERY_PROFILES, 3); void pgResetFn_batteryProfiles(batteryProfile_t *instance) { @@ -118,7 +118,6 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance) .value = SETTING_BATTERY_CAPACITY_DEFAULT, .warning = SETTING_BATTERY_CAPACITY_WARNING_DEFAULT, .critical = SETTING_BATTERY_CAPACITY_CRITICAL_DEFAULT, - .unit = SETTING_BATTERY_CAPACITY_UNIT_DEFAULT, }, .controlRateProfile = 0, @@ -167,7 +166,7 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance) } } -PG_REGISTER_WITH_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig, PG_BATTERY_METERS_CONFIG, 1); +PG_REGISTER_WITH_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig, PG_BATTERY_METERS_CONFIG, 2); PG_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig, @@ -186,6 +185,8 @@ PG_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig, .voltageSource = SETTING_BAT_VOLTAGE_SRC_DEFAULT, + .capacity_unit = SETTING_BATTERY_CAPACITY_UNIT_DEFAULT, + .cruise_power = SETTING_CRUISE_POWER_DEFAULT, .idle_power = SETTING_IDLE_POWER_DEFAULT, .rth_energy_margin = SETTING_RTH_ENERGY_MARGIN_DEFAULT, @@ -405,7 +406,7 @@ void batteryUpdate(timeUs_t timeDelta) if ((currentBatteryProfile->capacity.value > 0) && batteryFullWhenPluggedIn) { uint32_t capacityDiffBetweenFullAndEmpty = currentBatteryProfile->capacity.value - currentBatteryProfile->capacity.critical; - int32_t drawn = (currentBatteryProfile->capacity.unit == BAT_CAPACITY_UNIT_MWH ? mWhDrawn : mAhDrawn); + int32_t drawn = (batteryMetersConfig()->capacity_unit == BAT_CAPACITY_UNIT_MWH ? mWhDrawn : mAhDrawn); batteryRemainingCapacity = (drawn > (int32_t)capacityDiffBetweenFullAndEmpty ? 0 : capacityDiffBetweenFullAndEmpty - drawn); } diff --git a/src/main/sensors/battery_config_structs.h b/src/main/sensors/battery_config_structs.h index 81eafef44ad..829ac8d8794 100644 --- a/src/main/sensors/battery_config_structs.h +++ b/src/main/sensors/battery_config_structs.h @@ -61,16 +61,18 @@ typedef struct batteryMetersConfig_s { #endif struct { - int16_t scale; // scale the current sensor output voltage to milliamps. Value in 1/10th mV/A - int16_t offset; // offset of the current sensor in millivolt steps - currentSensor_e type; // type of current meter used, either ADC or virtual + int16_t scale; // scale the current sensor output voltage to milliamps. Value in 1/10th mV/A + int16_t offset; // offset of the current sensor in millivolt steps + currentSensor_e type; // type of current meter used, either ADC or virtual } current; batVoltageSource_e voltageSource; - uint32_t cruise_power; // power drawn by the motor(s) at cruise throttle/speed (cW) - uint16_t idle_power; // power drawn by the system when the motor(s) are stopped (cW) - uint8_t rth_energy_margin; // Energy that should be left after RTH (%), used for remaining time/distance before RTH + batCapacityUnit_e capacity_unit; // Describes unit of capacity.value, capacity.warning and capacity.critical + + uint32_t cruise_power; // power drawn by the motor(s) at cruise throttle/speed (cW) + uint16_t idle_power; // power drawn by the system when the motor(s) are stopped (cW) + uint8_t rth_energy_margin; // Energy that should be left after RTH (%), used for remaining time/distance before RTH float throttle_compensation_weight; @@ -90,10 +92,9 @@ typedef struct batteryProfile_s { #endif struct { - uint32_t value; // mAh or mWh (see capacity.unit) - uint32_t warning; // mAh or mWh (see capacity.unit) - uint32_t critical; // mAh or mWh (see capacity.unit) - batCapacityUnit_e unit; // Describes unit of capacity.value, capacity.warning and capacity.critical + uint32_t value; // mAh or mWh (see batteryMetersConfig()->capacity_unit) + uint32_t warning; // mAh or mWh (see batteryMetersConfig()->capacity_unit) + uint32_t critical; // mAh or mWh (see batteryMetersConfig()->capacity_unit) } capacity; uint8_t controlRateProfile; From 18c7ec44a51aedd3fcb3baae4bee381a5619772b Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 2 Jun 2024 20:02:12 +0100 Subject: [PATCH 101/429] Fix missed CLI command in the diff --- src/main/fc/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index aba1f58b905..18243fdefce 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -4145,7 +4145,7 @@ static void printConfig(const char *cmdline, bool doDiff) setConfigBatteryProfile(currentBatteryProfileIndexSave); cliPrintHashLine("restore original profile selection"); - cliPrintLinef("profile %d", currentControlProfileIndexSave + 1); + cliPrintLinef("control_profile %d", currentControlProfileIndexSave + 1); cliPrintLinef("mixer_profile %d", currentMixerProfileIndexSave + 1); cliPrintLinef("battery_profile %d", currentBatteryProfileIndexSave + 1); From 48d05dcb50de2a1228b1fe9b299c9f5529db8d08 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 2 Jun 2024 21:19:34 +0200 Subject: [PATCH 102/429] Initial draft for gimbal support. Needs plumbing so we have a gimbal task running to send gumbal updates --- docs/Settings.md | 40 ++++++++++ src/main/CMakeLists.txt | 4 + src/main/config/parameter_group_ids.h | 3 +- src/main/drivers/gimbal_common.c | 23 ++++++ src/main/drivers/gimbal_common.h | 37 ++++++++++ src/main/fc/fc_msp_box.c | 10 +++ src/main/fc/rc_modes.h | 8 +- src/main/fc/settings.yaml | 28 +++++++ src/main/io/gimbal_htk.c | 101 ++++++++++++++++++++++++++ src/main/io/gimbal_htk.h | 42 +++++++++++ src/main/io/serial.h | 1 + 11 files changed, 294 insertions(+), 3 deletions(-) create mode 100644 src/main/drivers/gimbal_common.c create mode 100644 src/main/drivers/gimbal_common.h create mode 100644 src/main/io/gimbal_htk.c create mode 100644 src/main/io/gimbal_htk.h diff --git a/docs/Settings.md b/docs/Settings.md index a1c339c1d8c..5af90a7e15f 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1462,6 +1462,46 @@ Yaw Iterm is frozen when bank angle is above this threshold [degrees]. This solv --- +### gimabl_pitch_channel + +Gimbal pitch rc channel index. 0 is no channel. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | 0 | 32 | + +--- + +### gimabl_roll_channel + +Gimbal roll rc channel index. 0 is no channel. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | 0 | 32 | + +--- + +### gimabl_sensitivity + +Gimbal sensitivity is similar to gain and will affect how quickly the gimbal will react. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | -16 | 15 | + +--- + +### gimabl_yaw_channel + +Gimbal yaw rc channel index. 0 is no channel. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | 0 | 32 | + +--- + ### gps_auto_baud Automatic configuration of GPS baudrate(The specified baudrate in configured in ports will be used) when used with UBLOX GPS diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c87abc1782d..31d09c716cf 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -177,6 +177,8 @@ main_sources(COMMON_SRC drivers/flash_m25p16.h drivers/flash_w25n01g.c drivers/flash_w25n01g.h + drivers/gimbal_common.h + drivers/gimbal_common.c drivers/io.c drivers/io.h drivers/io_pcf8574.c @@ -354,6 +356,8 @@ main_sources(COMMON_SRC io/servo_sbus.h io/frsky_osd.c io/frsky_osd.h + io/gimbal_htk.c + io/gimbal_htk.h io/osd_dji_hd.c io/osd_dji_hd.h io/lights.c diff --git a/src/main/config/parameter_group_ids.h b/src/main/config/parameter_group_ids.h index 822e85f137a..90085fae638 100644 --- a/src/main/config/parameter_group_ids.h +++ b/src/main/config/parameter_group_ids.h @@ -126,7 +126,8 @@ #define PG_FW_AUTOLAND_CONFIG 1036 #define PG_FW_AUTOLAND_APPROACH_CONFIG 1037 #define PG_OSD_CUSTOM_ELEMENTS_CONFIG 1038 -#define PG_INAV_END PG_OSD_CUSTOM_ELEMENTS_CONFIG +#define PG_GIMBAL_CONFIG 1039 +#define PG_INAV_END PG_GIMBAL_CONFIG // OSD configuration (subject to change) //#define PG_OSD_FONT_CONFIG 2047 diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c new file mode 100644 index 00000000000..a5fbf38be76 --- /dev/null +++ b/src/main/drivers/gimbal_common.c @@ -0,0 +1,23 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include +#include + +#include "drivers/gimbal_common.h" + +PG_REGISTER(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0); \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h new file mode 100644 index 00000000000..9ac2ad3d9bc --- /dev/null +++ b/src/main/drivers/gimbal_common.h @@ -0,0 +1,37 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#pragma once + +#include + +#include "config/feature.h" + +typedef struct gimbalConfig_s { + uint8_t yawChannel; + uint8_t pitchChannel; + uint8_t rollChannel; + uint8_t sensitivity; +} gimbalConfig_t; + +PG_DECLARE(gimbalConfig_t, gimbalConfig); + +typedef enum { + GIMBAL_MODE_PITCH_ROLL_LOCK = 0, + GIMBAL_MODE_PITCH_LOCK = 1, + GIMBAL_MODE_FOLLOW = 2 +} gimbal_htk_mode_e; \ No newline at end of file diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 7ffbbefd95e..77aacd2f41b 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -102,6 +102,10 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXMIXERPROFILE, .boxName = "MIXER PROFILE 2", .permanentId = 62 }, { .boxId = BOXMIXERTRANSITION, .boxName = "MIXER TRANSITION", .permanentId = 63 }, { .boxId = BOXANGLEHOLD, .boxName = "ANGLE HOLD", .permanentId = 64 }, + { .boxId = BOXGIMBALLOCK, .boxName = "GIMBAL LOCK", .permanentId = 65 }, + { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LOCK P", .permanentId = 66 }, + { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LOCK P+R", .permanentId = 66 }, + { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } }; @@ -431,6 +435,12 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXMIXERTRANSITION)), BOXMIXERTRANSITION); #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); + + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALLOCK)), BOXGIMBALLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPLOCK)), BOXGIMBALPLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPRLOCK)), BOXGIMBALPRLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); + memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); for (uint32_t i = 0; i < activeBoxIdCount; i++) { if (activeBoxes[activeBoxIds[i]]) { diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index 04aea681bc9..cac8528b6ad 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -78,9 +78,13 @@ typedef enum { BOXCHANGEMISSION = 50, BOXBEEPERMUTE = 51, BOXMULTIFUNCTION = 52, - BOXMIXERPROFILE = 53, - BOXMIXERTRANSITION = 54, + BOXMIXERPROFILE = 53, + BOXMIXERTRANSITION = 54, BOXANGLEHOLD = 55, + BOXGIMBALLOCK = 56, + BOXGIMBALPLOCK = 57, + BOXGIMBALPRLOCK = 58, + BOXGIMBALCENTER = 59, CHECKBOX_ITEM_COUNT } boxId_e; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d9aa83c93cf..a8fdbbd408c 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4146,3 +4146,31 @@ groups: field: maxTailwind min: 0 max: 3000 + - name: PG_GIMBAL_CONFIG + type: gimbalConfig_t + headers: ["drivers/gimbal_common.h"] + members: + - name: gimabl_yaw_channel + description: "Gimbal yaw rc channel index. 0 is no channel." + default_value: 0 + field: yawChannel + min: 0 + max: 32 + - name: gimabl_roll_channel + description: "Gimbal roll rc channel index. 0 is no channel." + default_value: 0 + field: yawChannel + min: 0 + max: 32 + - name: gimabl_pitch_channel + description: "Gimbal pitch rc channel index. 0 is no channel." + default_value: 0 + field: yawChannel + min: 0 + max: 32 + - name: gimabl_sensitivity + description: "Gimbal sensitivity is similar to gain and will affect how quickly the gimbal will react." + default_value: 0 + field: sensitivity + min: -16 + max: 15 \ No newline at end of file diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_htk.c new file mode 100644 index 00000000000..0633423aec0 --- /dev/null +++ b/src/main/io/gimbal_htk.c @@ -0,0 +1,101 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#include +#include + +#include + + +void gimbal_htk_update(void) +{ + const gimbalConfig_t *cfg = gimbalConfig(); + + GimbalHtkAttitudePkt_t attittude = { + .sync = {HTKATTITUDE_SYNC0, HTKATTITUDE_SYNC1}, + .mode = GIMBAL_MODE_FOLLOW, + }; + + int yaw = 1500; + int pitch = 1500; + int roll = 1500; + + if (rxAreFlightChannelsValid()) { + if (cfg->yawChannel > 0) { + yaw = rxGetChannelValue(cfg->yawChannel - 1); + // const rxChannelRangeConfig_t *channelRanges = + // rxChannelRangeConfigs(cfg->pitchChannel - 1); + if (yaw < 1000) { + yaw = 1000; + } else if (yaw > 2000) { + yaw = 2000; + } + } + + if (cfg->pitchChannel > 0) { + pitch = rxGetChannelValue(cfg->pitchChannel - 1); + // const rxChannelRangeConfig_t *channelRanges = + // rxChannelRangeConfigs(cfg->pitchChannel - 1); + if (pitch < 1000) { + pitch = 1000; + } else if (pitch > 2000) { + pitch = 2000; + } + } + + if (cfg->rollChannel > 0) { + roll = rxGetChannelValue(cfg->rollChannel - 1); + // const rxChannelRangeConfig_t *channelRanges = + // rxChannelRangeConfigs(cfg->pitchChannel - 1); + if (roll < 1000) { + roll = 1000; + } else if (roll > 2000) { + roll = 2000; + } + } + } + + attittude.sensibility = gimbal_scale8(-16, 15, 0, 31, cfg->sensitivity); + + attittude.yaw = gimbal_scale16(1000, 2000, 0, 4095, yaw); + attittude.pitch = gimbal_scale16(1000, 2000, 0, 4095, pitch); + attittude.roll = gimbal_scale16(1000, 2000, 0, 4095, roll); + + uint16_t crc16 = 0; + uint8_t *b = (uint8_t *)&attittude; + for (uint8_t i = 0; i < sizeof(GimbalHtkAttitudePkt_t) - 2; i++) { + crc16 = crc16_ccitt(crc16, *(b + i)); + } + attittude.crch = (crc16 >> 8) & 0xFF; + attittude.crcl = crc16 & 0xFF; + + // Send new data +} + +uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value) +{ + float m = (1.0f * outputMax - outputMin) / (inputMax - inputMin); + return (uint8_t)((outputMin + (m * (value - inputMin))) + 0.5f); +} + +uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value) +{ + float m = (1.0f * outputMax - outputMin) / (inputMax - inputMin); + return (uint16_t)((outputMin + (m * (value - inputMin))) + 0.5f); +} \ No newline at end of file diff --git a/src/main/io/gimbal_htk.h b/src/main/io/gimbal_htk.h new file mode 100644 index 00000000000..1802ae33768 --- /dev/null +++ b/src/main/io/gimbal_htk.h @@ -0,0 +1,42 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#pragma once + +#include + +#define GIMBAL_HTK_MODE_DEFAULT GIMBAL_HTK_MODE_FOLLOW + +#define HTKATTITUDE_SYNC0 0xA5 +#define HTKATTITUDE_SYNC1 0x5A +typedef struct +{ + uint8_t sync[2]; //data synchronization 0xA5, 0x5A + uint64_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] + int64_t sensibility:5; //Cloud sensibility [-16~15] + uint64_t reserved:4; //hold on to one's reserve + int64_t roll:12; //Roll angle [-2048~2047] => [-180~180] + int64_t pitch:12; //Pich angle [-2048~2047] => [-180~180] + int64_t yaw:12; //Yaw angle [-2048~2047] => [-180~180] + uint64_t crch:8; //Data validation H + uint64_t crcl:8; //Data validation L +} __attribute__((packed)) GimbalHtkAttitudePkt_t; + +uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); +uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); + +void gimbal_htk_update(void); \ No newline at end of file diff --git a/src/main/io/serial.h b/src/main/io/serial.h index 7766679106b..dad56a9f4bc 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -57,6 +57,7 @@ typedef enum { FUNCTION_TELEMETRY_SMARTPORT_MASTER = (1 << 23), // 8388608 FUNCTION_UNUSED_2 = (1 << 24), // 16777216 FUNCTION_MSP_OSD = (1 << 25), // 33554432 + FUNCTION_HTK_GIMBAL = (1 << 26), // 67108864 } serialPortFunction_e; #define FUNCTION_VTX_MSP FUNCTION_MSP_OSD From 1834a67749117e9b7b6fbef4f55cc856eaea858f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:35:34 +0200 Subject: [PATCH 103/429] Make it optional Keep it out of F722 for testing builds, for now. --- src/main/drivers/gimbal_common.c | 8 ++++- src/main/drivers/gimbal_common.h | 10 +++++- src/main/fc/fc_msp_box.c | 6 ++-- src/main/fc/rc_modes.h | 7 ++-- src/main/fc/settings.yaml | 1 + src/main/io/gimbal_htk.c | 61 +++++++++++++++++++++++++++++--- src/main/io/gimbal_htk.h | 12 +++++-- src/main/target/common.h | 1 + 8 files changed, 88 insertions(+), 18 deletions(-) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index a5fbf38be76..ac883fd2e97 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -15,9 +15,15 @@ * along with INAV. If not, see . */ +#include "platform.h" + +#ifdef USE_SERIAL_GIMBAL + #include #include #include "drivers/gimbal_common.h" -PG_REGISTER(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0); \ No newline at end of file +PG_REGISTER(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0); + +#endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 9ac2ad3d9bc..8b0d7f6a86f 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -17,6 +17,10 @@ #pragma once +#include "platform.h" + +#ifdef USE_SERIAL_GIMBAL + #include #include "config/feature.h" @@ -34,4 +38,8 @@ typedef enum { GIMBAL_MODE_PITCH_ROLL_LOCK = 0, GIMBAL_MODE_PITCH_LOCK = 1, GIMBAL_MODE_FOLLOW = 2 -} gimbal_htk_mode_e; \ No newline at end of file +} gimbal_htk_mode_e; + +#define GIMBAL_MODE_DEFAULT = GIMBAL_MODE_FOLLOW; + +#endif \ No newline at end of file diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 77aacd2f41b..ca384084866 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -102,9 +102,8 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXMIXERPROFILE, .boxName = "MIXER PROFILE 2", .permanentId = 62 }, { .boxId = BOXMIXERTRANSITION, .boxName = "MIXER TRANSITION", .permanentId = 63 }, { .boxId = BOXANGLEHOLD, .boxName = "ANGLE HOLD", .permanentId = 64 }, - { .boxId = BOXGIMBALLOCK, .boxName = "GIMBAL LOCK", .permanentId = 65 }, - { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LOCK P", .permanentId = 66 }, - { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LOCK P+R", .permanentId = 66 }, + { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL P", .permanentId = 66 }, + { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LEVEL P+R", .permanentId = 66 }, { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } }; @@ -436,7 +435,6 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALLOCK)), BOXGIMBALLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPLOCK)), BOXGIMBALPLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPRLOCK)), BOXGIMBALPRLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index cac8528b6ad..fb517efa009 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -81,10 +81,9 @@ typedef enum { BOXMIXERPROFILE = 53, BOXMIXERTRANSITION = 54, BOXANGLEHOLD = 55, - BOXGIMBALLOCK = 56, - BOXGIMBALPLOCK = 57, - BOXGIMBALPRLOCK = 58, - BOXGIMBALCENTER = 59, + BOXGIMBALPLOCK = 56, + BOXGIMBALPRLOCK = 57, + BOXGIMBALCENTER = 58, CHECKBOX_ITEM_COUNT } boxId_e; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index a8fdbbd408c..cc18a663626 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4149,6 +4149,7 @@ groups: - name: PG_GIMBAL_CONFIG type: gimbalConfig_t headers: ["drivers/gimbal_common.h"] + condition: USE_SERIAL_GIMBAL members: - name: gimabl_yaw_channel description: "Gimbal yaw rc channel index. 0 is no channel." diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_htk.c index 0633423aec0..727559de7c4 100644 --- a/src/main/io/gimbal_htk.c +++ b/src/main/io/gimbal_htk.c @@ -15,28 +15,74 @@ * along with INAV. If not, see . */ +#include "platform.h" + +#ifdef USE_SERIAL_GIMBAL + #include #include +#include + #include +#include #include +#include + + +#define HTK_TX_BUFFER_SIZE 512 +static volatile uint8_t txBuffer[HTK_TX_BUFFER_SIZE]; + +static serialPort_t *htkPort = NULL; + +bool gimbal_htk_detect(void) +{ + serialPortConfig_t *portConfig = findNextSerialPortConfig(FUNCTION_HTK_GIMBAL); + + if (portConfig) { + htkPort = openSerialPort(portConfig->identifier, FUNCTION_HTK_GIMBAL, NULL, NULL, + 115200, MODE_RXTX, SERIAL_NOT_INVERTED); + + if (htkPort) { + htkPort->txBuffer = txBuffer; + htkPort->txBufferSize = HTK_TX_BUFFER_SIZE; + htkPort->txBufferTail = 0; + htkPort->txBufferHead = 0; + + return true; + } + } + return false; +} void gimbal_htk_update(void) { - const gimbalConfig_t *cfg = gimbalConfig(); + if (!htkPort) { + return; + } - GimbalHtkAttitudePkt_t attittude = { + gimbalHtkAttitudePkt_t attittude = { .sync = {HTKATTITUDE_SYNC0, HTKATTITUDE_SYNC1}, .mode = GIMBAL_MODE_FOLLOW, }; + const gimbalConfig_t *cfg = gimbalConfig(); + int yaw = 1500; int pitch = 1500; int roll = 1500; - if (rxAreFlightChannelsValid()) { + if (IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { + attittude.mode = GIMBAL_MODE_FOLLOW; + } else if (IS_RC_MODE_ACTIVE(BOXGIMBALPLOCK)) { + attittude.mode = GIMBAL_MODE_PITCH_LOCK; + } else if (IS_RC_MODE_ACTIVE(BOXGIMBALPRLOCK)) { + attittude.mode = GIMBAL_MODE_PITCH_ROLL_LOCK; + } + + if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->yawChannel > 0) { yaw = rxGetChannelValue(cfg->yawChannel - 1); // const rxChannelRangeConfig_t *channelRanges = @@ -79,12 +125,15 @@ void gimbal_htk_update(void) uint16_t crc16 = 0; uint8_t *b = (uint8_t *)&attittude; - for (uint8_t i = 0; i < sizeof(GimbalHtkAttitudePkt_t) - 2; i++) { + for (uint8_t i = 0; i < sizeof(gimbalHtkAttitudePkt_t) - 2; i++) { crc16 = crc16_ccitt(crc16, *(b + i)); } attittude.crch = (crc16 >> 8) & 0xFF; attittude.crcl = crc16 & 0xFF; + serialBeginWrite(htkPort); + //serialWriteBuf(htkPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); + serialEndWrite(htkPort); // Send new data } @@ -98,4 +147,6 @@ uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, i { float m = (1.0f * outputMax - outputMin) / (inputMax - inputMin); return (uint16_t)((outputMin + (m * (value - inputMin))) + 0.5f); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/src/main/io/gimbal_htk.h b/src/main/io/gimbal_htk.h index 1802ae33768..b45b8f02651 100644 --- a/src/main/io/gimbal_htk.h +++ b/src/main/io/gimbal_htk.h @@ -17,13 +17,17 @@ #pragma once +#include "platform.h" + +#ifdef USE_SERIAL_GIMBAL + #include #define GIMBAL_HTK_MODE_DEFAULT GIMBAL_HTK_MODE_FOLLOW #define HTKATTITUDE_SYNC0 0xA5 #define HTKATTITUDE_SYNC1 0x5A -typedef struct +typedef struct gimbalHtkAttitudePkt_s { uint8_t sync[2]; //data synchronization 0xA5, 0x5A uint64_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] @@ -34,9 +38,11 @@ typedef struct int64_t yaw:12; //Yaw angle [-2048~2047] => [-180~180] uint64_t crch:8; //Data validation H uint64_t crcl:8; //Data validation L -} __attribute__((packed)) GimbalHtkAttitudePkt_t; +} __attribute__((packed)) gimbalHtkAttitudePkt_t; uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); -void gimbal_htk_update(void); \ No newline at end of file +void gimbal_htk_update(void); + +#endif \ No newline at end of file diff --git a/src/main/target/common.h b/src/main/target/common.h index 0b878067c45..676b1760409 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -193,6 +193,7 @@ //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) +#define USE_SERIAL_GIMBAL #define USE_VTX_FFPV #define USE_SERIALRX_SUMD #define USE_TELEMETRY_HOTT From 4faed24fd752e68dd9daa7994377940f70d8cbe5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 2 Jun 2024 23:51:02 +0200 Subject: [PATCH 104/429] Business logic ok, still needs plumbing --- src/main/io/gimbal_htk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_htk.c index 727559de7c4..c2356910833 100644 --- a/src/main/io/gimbal_htk.c +++ b/src/main/io/gimbal_htk.c @@ -20,6 +20,7 @@ #ifdef USE_SERIAL_GIMBAL #include +#include #include #include @@ -31,6 +32,8 @@ #include +STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); + #define HTK_TX_BUFFER_SIZE 512 static volatile uint8_t txBuffer[HTK_TX_BUFFER_SIZE]; @@ -68,6 +71,7 @@ void gimbal_htk_update(void) .mode = GIMBAL_MODE_FOLLOW, }; + const gimbalConfig_t *cfg = gimbalConfig(); int yaw = 1500; @@ -132,7 +136,7 @@ void gimbal_htk_update(void) attittude.crcl = crc16 & 0xFF; serialBeginWrite(htkPort); - //serialWriteBuf(htkPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); + serialWriteBuf(htkPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); serialEndWrite(htkPort); // Send new data } From 0e8486e45dab64fb030f0bc252d6f4e26e8c18f0 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 3 Jun 2024 22:58:42 +0200 Subject: [PATCH 105/429] rename some fields, add some plumbing for gimbal_common --- docs/Settings.md | 8 +++--- src/main/drivers/gimbal_common.c | 45 ++++++++++++++++++++++++++++++++ src/main/drivers/gimbal_common.h | 38 +++++++++++++++++++++++++-- src/main/fc/settings.yaml | 14 +++++----- src/main/io/gimbal_htk.c | 8 +++--- 5 files changed, 96 insertions(+), 17 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 5af90a7e15f..fb93cfb69ce 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1462,9 +1462,9 @@ Yaw Iterm is frozen when bank angle is above this threshold [degrees]. This solv --- -### gimabl_pitch_channel +### gimabl_pan_channel -Gimbal pitch rc channel index. 0 is no channel. +Gimbal pan rc channel index. 0 is no channel. | Default | Min | Max | | --- | --- | --- | @@ -1492,9 +1492,9 @@ Gimbal sensitivity is similar to gain and will affect how quickly the gimbal wil --- -### gimabl_yaw_channel +### gimabl_tilt_channel -Gimbal yaw rc channel index. 0 is no channel. +Gimbal tilt rc channel index. 0 is no channel. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index ac883fd2e97..a7a2e275b07 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -20,10 +20,55 @@ #ifdef USE_SERIAL_GIMBAL #include +#include #include +#include "common/time.h" + #include "drivers/gimbal_common.h" + PG_REGISTER(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0); + +static gimbalDevice_t *commonGimbalDevice = NULL; + +void gimbalCommonInit(void) +{ +} + +void gimbalCommonSetDevice(gimbalDevice_t *gimbalDevice) +{ + commonGimbalDevice = gimbalDevice; +} + +gimbalDevice_t *gimbalCommonDevice(void) +{ + return commonGimbalDevice; +} + +void gimbalCommonProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs) +{ + if (gimbalDevice && gimbalDevice->vTable->process) { + gimbalDevice->vTable->process(gimbalDevice, currentTimeUs); + } +} + +gimbalDevType_e gimbalCommonGetDeviceType(gimbalDevice_t *gimbalDevice) +{ + if (!gimbalDevice || !gimbalDevice->vTable->getDeviceType) { + return GIMBAL_DEV_UNKNOWN; + } + + return gimbalDevice->vTable->getDeviceType(gimbalDevice); +} + +bool gimbalCommonDeviceIsReady(gimbalDevice_t *gimbalDevice) +{ + if (gimbalDevice && gimbalDevice->vTable->isReady) { + return gimbalDevice->vTable->isReady(gimbalDevice); + } + return false; +} + #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 8b0d7f6a86f..a2441184ed7 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -24,10 +24,35 @@ #include #include "config/feature.h" +#include "common/time.h" + + +typedef enum { + GIMBAL_DEV_UNSUPPORTED = 0, + GIMBAL_DEV_SERIAL, + GIMBAL_DEV_UNKNOWN=0xFF +} gimbalDevType_e; + +struct gimbalVTable_s; + +typedef struct gimbalDevice_s { + const struct gimbalVTable_s *vTable; +} gimbalDevice_t; + +// {set,get}BandAndChannel: band and channel are 1 origin +// {set,get}PowerByIndex: 0 = Power OFF, 1 = device dependent +// {set,get}PitMode: 0 = OFF, 1 = ON + +typedef struct gimbalVTable_s { + void (*process)(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); + gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimablDevice); + bool (*isReady)(const gimbalDevice_t *gimbalDevice); +} gimbalVTable_t; + typedef struct gimbalConfig_s { - uint8_t yawChannel; - uint8_t pitchChannel; + uint8_t panChannel; + uint8_t tiltChannel; uint8_t rollChannel; uint8_t sensitivity; } gimbalConfig_t; @@ -42,4 +67,13 @@ typedef enum { #define GIMBAL_MODE_DEFAULT = GIMBAL_MODE_FOLLOW; +void gimbalCommonInit(void); +void gimbalCommonSetDevice(gimbalDevice_t *gimbalDevice); +gimbalDevice_t *gimbalCommonDevice(void); + +// VTable functions +void gimbalCommonProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); +gimbalDevType_e gimbalCommonGetDeviceType(gimbalDevice_t *gimbalDevice); +bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice); + #endif \ No newline at end of file diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index cc18a663626..2127c3505ae 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4151,22 +4151,22 @@ groups: headers: ["drivers/gimbal_common.h"] condition: USE_SERIAL_GIMBAL members: - - name: gimabl_yaw_channel - description: "Gimbal yaw rc channel index. 0 is no channel." + - name: gimabl_pan_channel + description: "Gimbal pan rc channel index. 0 is no channel." default_value: 0 - field: yawChannel + field: panChannel min: 0 max: 32 - name: gimabl_roll_channel description: "Gimbal roll rc channel index. 0 is no channel." default_value: 0 - field: yawChannel + field: rollChannel min: 0 max: 32 - - name: gimabl_pitch_channel - description: "Gimbal pitch rc channel index. 0 is no channel." + - name: gimabl_tilt_channel + description: "Gimbal tilt rc channel index. 0 is no channel." default_value: 0 - field: yawChannel + field: tiltChannel min: 0 max: 32 - name: gimabl_sensitivity diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_htk.c index c2356910833..e3c97c8a425 100644 --- a/src/main/io/gimbal_htk.c +++ b/src/main/io/gimbal_htk.c @@ -87,8 +87,8 @@ void gimbal_htk_update(void) } if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { - if (cfg->yawChannel > 0) { - yaw = rxGetChannelValue(cfg->yawChannel - 1); + if (cfg->panChannel > 0) { + yaw = rxGetChannelValue(cfg->panChannel - 1); // const rxChannelRangeConfig_t *channelRanges = // rxChannelRangeConfigs(cfg->pitchChannel - 1); if (yaw < 1000) { @@ -98,8 +98,8 @@ void gimbal_htk_update(void) } } - if (cfg->pitchChannel > 0) { - pitch = rxGetChannelValue(cfg->pitchChannel - 1); + if (cfg->tiltChannel > 0) { + pitch = rxGetChannelValue(cfg->tiltChannel - 1); // const rxChannelRangeConfig_t *channelRanges = // rxChannelRangeConfigs(cfg->pitchChannel - 1); if (pitch < 1000) { From 307e35ad870b6bde9f4e2c4343884c7cd30b7fdb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 4 Jun 2024 01:08:19 +0200 Subject: [PATCH 106/429] Current status. Start plumbing task. Still need initialization --- src/main/drivers/gimbal_common.c | 17 +++++++++++++++++ src/main/drivers/gimbal_common.h | 3 +++ src/main/fc/fc_init.c | 6 ++++++ src/main/fc/fc_tasks.c | 9 +++++++++ src/main/scheduler/scheduler.h | 3 +++ 5 files changed, 38 insertions(+) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index a7a2e275b07..2a2ba396333 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -25,6 +25,8 @@ #include "common/time.h" +#include "fc/cli.h" + #include "drivers/gimbal_common.h" @@ -71,4 +73,19 @@ bool gimbalCommonDeviceIsReady(gimbalDevice_t *gimbalDevice) return false; } +void taskUpdateGimbal(timeUs_t currentTimeUs) +{ + if (cliMode) { + return; + } + + gimbalDevice_t *gimbalDevice = gimbalCommonDevice(); + + if(gimbalDevice) { + gimbalCommonProcess(gimbalDevice, currentTimeUs); + } +} + + + #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index a2441184ed7..15d4099dc4a 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -76,4 +76,7 @@ void gimbalCommonProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); gimbalDevType_e gimbalCommonGetDeviceType(gimbalDevice_t *gimbalDevice); bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice); + +void taskUpdateGimbal(timeUs_t currentTimeUs); + #endif \ No newline at end of file diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index f2b368b8fcb..5feb7c739a4 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -53,6 +53,7 @@ #include "drivers/exti.h" #include "drivers/io.h" #include "drivers/flash.h" +#include "drivers/gimbal_common.h" #include "drivers/light_led.h" #include "drivers/nvic.h" #include "drivers/osd.h" @@ -107,6 +108,7 @@ #include "io/displayport_msp_osd.h" #include "io/displayport_srxl.h" #include "io/flashfs.h" +#include "io/gimbal_htk.h" #include "io/gps.h" #include "io/ledstrip.h" #include "io/osd.h" @@ -685,6 +687,10 @@ void init(void) #ifdef USE_DSHOT initDShotCommands(); +#endif + +#ifdef USE_SERIAL_GIMBAL + #endif // Latch active features AGAIN since some may be modified by init(). diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 406622af38f..355d8824487 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -34,6 +34,7 @@ #include "drivers/serial.h" #include "drivers/stack_check.h" #include "drivers/pwm_mapping.h" +#include "drivers/gimbal_common.h" #include "fc/cli.h" #include "fc/config.h" @@ -680,4 +681,12 @@ cfTask_t cfTasks[TASK_COUNT] = { .desiredPeriod = TASK_PERIOD_HZ(TASK_AUX_RATE_HZ), // 100Hz @10ms .staticPriority = TASK_PRIORITY_HIGH, }, +#ifdef USE_SERIAL_GIMBAL + [TASK_GIMBAL] = { + .taskName = "GIMBAL", + .taskFunc = taskUpdateGimbal, + .desiredPeriod = TASK_PERIOD_HZ(50), + .staticPriority = TASK_PRIORITY_LOW, + } +#endif }; diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index 0d91876cb72..88b1ccf0384 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -121,6 +121,9 @@ typedef enum { #endif #ifdef USE_IRLOCK TASK_IRLOCK, +#endif +#ifdef USE_SERIAL_GIMBAL + TASK_GIMBAL, #endif /* Count of real tasks */ TASK_COUNT, From b8707b76cb0abed7372b5564a3b070e966cf6758 Mon Sep 17 00:00:00 2001 From: flywoo Date: Tue, 4 Jun 2024 11:09:23 +0800 Subject: [PATCH 107/429] Update F722PRO default features --- src/main/target/FLYWOOF722PRO/target.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/target/FLYWOOF722PRO/target.h b/src/main/target/FLYWOOF722PRO/target.h index 34d6de266c4..ae12a324701 100644 --- a/src/main/target/FLYWOOF722PRO/target.h +++ b/src/main/target/FLYWOOF722PRO/target.h @@ -140,6 +140,7 @@ /*** Default settings ***/ #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) #define CURRENT_METER_SCALE_DEFAULT 170 #define SERIALRX_UART SERIAL_PORT_USART1 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL From b68619c6c8b3b096cfafbcaac53a80332b172cef Mon Sep 17 00:00:00 2001 From: flywoo Date: Tue, 4 Jun 2024 14:49:28 +0800 Subject: [PATCH 108/429] Update F722PRO target.h --- src/main/target/FLYWOOF722PRO/config.c | 1 - src/main/target/FLYWOOF722PRO/target.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/target/FLYWOOF722PRO/config.c b/src/main/target/FLYWOOF722PRO/config.c index ae386d4bc0a..57ecfa64ff6 100644 --- a/src/main/target/FLYWOOF722PRO/config.c +++ b/src/main/target/FLYWOOF722PRO/config.c @@ -24,7 +24,6 @@ void targetConfiguration(void) { pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; - timerOverridesMutable(timer2id(TIM3))->outputMode = OUTPUT_MODE_MOTORS; timerOverridesMutable(timer2id(TIM2))->outputMode = OUTPUT_MODE_MOTORS; } diff --git a/src/main/target/FLYWOOF722PRO/target.h b/src/main/target/FLYWOOF722PRO/target.h index ae12a324701..3f11b44e317 100644 --- a/src/main/target/FLYWOOF722PRO/target.h +++ b/src/main/target/FLYWOOF722PRO/target.h @@ -148,7 +148,7 @@ /*** Timer/PWM output ***/ #define USE_SERIAL_4WAY_BLHELI_INTERFACE -#define MAX_PWM_OUTPUT_PORTS 6 +#define MAX_PWM_OUTPUT_PORTS 8 #define USE_DSHOT #define USE_ESC_SENSOR From 42a94cb7acb9e306f89992956e45fa80fab83346 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:40:37 +0200 Subject: [PATCH 109/429] Few extra changes to cut down noise --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ab82cc0fcd4..39ef205b954 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ *.o .DS_Store *~ +*.swp *.uvopt *.dep *.bak *.uvgui.* +*.ubx .project .settings .cproject @@ -16,6 +18,7 @@ startup_stm32f10x_md_gcc.s cov-int* /build/ /build_SITL/ +/sitl/ /obj/ /patches/ /tools/ From 4da66220a043fcbf2cd1db8ff101fd0db1d7506e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:31:31 +0200 Subject: [PATCH 110/429] Plumbing in place Time to wire things up and test. --- src/main/build/debug.h | 8 ++++++++ src/main/drivers/gimbal_common.c | 7 +++---- src/main/drivers/gimbal_common.h | 3 ++- src/main/fc/fc_init.c | 5 ++++- src/main/fc/fc_tasks.c | 6 +++++- src/main/scheduler/scheduler.h | 4 ++-- src/main/target/SITL/target.h | 1 + 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 3a09da50daf..8b739cf67c2 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -21,6 +21,8 @@ #include #include +#include "platform.h" + #define DEBUG32_VALUE_COUNT 8 extern int32_t debug[DEBUG32_VALUE_COUNT]; extern uint8_t debugMode; @@ -74,3 +76,9 @@ typedef enum { DEBUG_POS_EST, DEBUG_COUNT } debugType_e; + +#ifdef SITL_BUILD +#define SD(X) (X) +#else +#define SD(X) +#endif diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index 2a2ba396333..340db5fbdce 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -19,6 +19,7 @@ #ifdef USE_SERIAL_GIMBAL +#include #include #include #include @@ -51,7 +52,7 @@ gimbalDevice_t *gimbalCommonDevice(void) void gimbalCommonProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs) { - if (gimbalDevice && gimbalDevice->vTable->process) { + if (gimbalDevice && gimbalDevice->vTable->process && gimbalCommonIsReady(gimbalDevice)) { gimbalDevice->vTable->process(gimbalDevice, currentTimeUs); } } @@ -65,7 +66,7 @@ gimbalDevType_e gimbalCommonGetDeviceType(gimbalDevice_t *gimbalDevice) return gimbalDevice->vTable->getDeviceType(gimbalDevice); } -bool gimbalCommonDeviceIsReady(gimbalDevice_t *gimbalDevice) +bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice) { if (gimbalDevice && gimbalDevice->vTable->isReady) { return gimbalDevice->vTable->isReady(gimbalDevice); @@ -86,6 +87,4 @@ void taskUpdateGimbal(timeUs_t currentTimeUs) } } - - #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 15d4099dc4a..8814e1010dd 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -33,6 +33,7 @@ typedef enum { GIMBAL_DEV_UNKNOWN=0xFF } gimbalDevType_e; + struct gimbalVTable_s; typedef struct gimbalDevice_s { @@ -65,7 +66,7 @@ typedef enum { GIMBAL_MODE_FOLLOW = 2 } gimbal_htk_mode_e; -#define GIMBAL_MODE_DEFAULT = GIMBAL_MODE_FOLLOW; +#define GIMBAL_MODE_DEFAULT GIMBAL_MODE_FOLLOW void gimbalCommonInit(void); void gimbalCommonSetDevice(gimbalDevice_t *gimbalDevice); diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index 5feb7c739a4..124fe1dc67c 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -689,8 +689,11 @@ void init(void) initDShotCommands(); #endif + fprintf(stderr, "HERE\n"); #ifdef USE_SERIAL_GIMBAL - + fprintf(stderr, "HERE2\n"); + gimbalCommonInit(); + gimbalSerialInit(); #endif // Latch active features AGAIN since some may be modified by init(). diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 355d8824487..fb672a50766 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -427,6 +427,10 @@ void fcTasksInit(void) setTaskEnabled(TASK_SMARTPORT_MASTER, true); #endif +#ifdef USE_SERIAL_GIMBAL + setTaskEnabled(TASK_GIMBAL, true); +#endif + #if defined(SITL_BUILD) serialProxyStart(); #endif @@ -686,7 +690,7 @@ cfTask_t cfTasks[TASK_COUNT] = { .taskName = "GIMBAL", .taskFunc = taskUpdateGimbal, .desiredPeriod = TASK_PERIOD_HZ(50), - .staticPriority = TASK_PRIORITY_LOW, + .staticPriority = TASK_PRIORITY_MEDIUM, } #endif }; diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index 88b1ccf0384..36fa524141f 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -122,9 +122,9 @@ typedef enum { #ifdef USE_IRLOCK TASK_IRLOCK, #endif -#ifdef USE_SERIAL_GIMBAL +//#ifdef USE_SERIAL_GIMBAL TASK_GIMBAL, -#endif +//#endif /* Count of real tasks */ TASK_COUNT, diff --git a/src/main/target/SITL/target.h b/src/main/target/SITL/target.h index 3fbe45a5cab..05405a51ede 100644 --- a/src/main/target/SITL/target.h +++ b/src/main/target/SITL/target.h @@ -74,6 +74,7 @@ #define USE_MSP_OSD #define USE_OSD +#define USE_SERIAL_GIMBAL #undef USE_DASHBOARD From ae07fd72165f62b089f71ba858dc1d6bc161fc4d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:36:42 +0200 Subject: [PATCH 111/429] Some files that were missed --- src/main/io/gimbal_htk.c | 62 ++++++++++++++++++++++++++++++---- src/main/io/gimbal_htk.h | 7 ++-- src/main/scheduler/scheduler.h | 4 +-- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_htk.c index e3c97c8a425..2c80113365e 100644 --- a/src/main/io/gimbal_htk.c +++ b/src/main/io/gimbal_htk.c @@ -15,12 +15,17 @@ * along with INAV. If not, see . */ +#include +#include +#include + #include "platform.h" #ifdef USE_SERIAL_GIMBAL #include #include +#include #include #include @@ -31,7 +36,6 @@ #include #include - STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); #define HTK_TX_BUFFER_SIZE 512 @@ -39,15 +43,56 @@ static volatile uint8_t txBuffer[HTK_TX_BUFFER_SIZE]; static serialPort_t *htkPort = NULL; -bool gimbal_htk_detect(void) +gimbalVTable_t gimbalSerialVTable = { + //void (*process)(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); + .process = gimbalSerialProcess, + + //gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimablDevice); + .getDeviceType = gimbalSerialGetDeviceType, + //bool (*isReady)(const gimbalDevice_t *gimbalDevice); + .isReady = gimbalSerialIsReady + +}; + +gimbalDevice_t serialGimbalDevice = { + .vTable = &gimbalSerialVTable + +}; + +gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) +{ + UNUSED(gimbalDevice); + return GIMBAL_DEV_SERIAL; +} + +bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice) +{ + return htkPort != NULL && gimbalDevice->vTable != NULL; +} + +bool gimbalSerialInit(void) { - serialPortConfig_t *portConfig = findNextSerialPortConfig(FUNCTION_HTK_GIMBAL); + if(gimbalSerialDetect()) { + gimbalCommonSetDevice(&serialGimbalDevice); + return true; + } + + return false; +} + +bool gimbalSerialDetect(void) +{ + + SD(fprintf(stderr, "[GIMBAL]: serial Detect...\n")); + serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_HTK_GIMBAL); if (portConfig) { + SD(fprintf(stderr, "[GIMBAL]: found port...\n")); htkPort = openSerialPort(portConfig->identifier, FUNCTION_HTK_GIMBAL, NULL, NULL, 115200, MODE_RXTX, SERIAL_NOT_INVERTED); if (htkPort) { + SD(fprintf(stderr, "[GIMBAL]: port open!\n")); htkPort->txBuffer = txBuffer; htkPort->txBufferSize = HTK_TX_BUFFER_SIZE; htkPort->txBufferTail = 0; @@ -57,21 +102,24 @@ bool gimbal_htk_detect(void) } } + SD(fprintf(stderr, "[GIMBAL]: port not found :(...\n")); return false; } -void gimbal_htk_update(void) +void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) { - if (!htkPort) { + UNUSED(currentTime); + + if (!gimbalSerialIsReady(gimablDevice)) { + SD(fprintf(stderr, "[GIMBAL] gimabl not ready...\n")); return; } gimbalHtkAttitudePkt_t attittude = { .sync = {HTKATTITUDE_SYNC0, HTKATTITUDE_SYNC1}, - .mode = GIMBAL_MODE_FOLLOW, + .mode = GIMBAL_MODE_DEFAULT }; - const gimbalConfig_t *cfg = gimbalConfig(); int yaw = 1500; diff --git a/src/main/io/gimbal_htk.h b/src/main/io/gimbal_htk.h index b45b8f02651..bebcb794009 100644 --- a/src/main/io/gimbal_htk.h +++ b/src/main/io/gimbal_htk.h @@ -23,7 +23,6 @@ #include -#define GIMBAL_HTK_MODE_DEFAULT GIMBAL_HTK_MODE_FOLLOW #define HTKATTITUDE_SYNC0 0xA5 #define HTKATTITUDE_SYNC1 0x5A @@ -43,6 +42,10 @@ typedef struct gimbalHtkAttitudePkt_s uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); -void gimbal_htk_update(void); +bool gimbalSerialInit(void); +bool gimbalSerialDetect(void); +void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime); +bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice); +gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); #endif \ No newline at end of file diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index 36fa524141f..88b1ccf0384 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -122,9 +122,9 @@ typedef enum { #ifdef USE_IRLOCK TASK_IRLOCK, #endif -//#ifdef USE_SERIAL_GIMBAL +#ifdef USE_SERIAL_GIMBAL TASK_GIMBAL, -//#endif +#endif /* Count of real tasks */ TASK_COUNT, From 5037401b32a951ea7ba9a4080cbee855cf12d6ec Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:45:23 +0200 Subject: [PATCH 112/429] Fix typo in settings and update docs --- docs/Settings.md | 8 ++++---- src/main/fc/settings.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index fb93cfb69ce..ab5faf3ba1f 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1462,7 +1462,7 @@ Yaw Iterm is frozen when bank angle is above this threshold [degrees]. This solv --- -### gimabl_pan_channel +### gimbal_pan_channel Gimbal pan rc channel index. 0 is no channel. @@ -1472,7 +1472,7 @@ Gimbal pan rc channel index. 0 is no channel. --- -### gimabl_roll_channel +### gimbal_roll_channel Gimbal roll rc channel index. 0 is no channel. @@ -1482,7 +1482,7 @@ Gimbal roll rc channel index. 0 is no channel. --- -### gimabl_sensitivity +### gimbal_sensitivity Gimbal sensitivity is similar to gain and will affect how quickly the gimbal will react. @@ -1492,7 +1492,7 @@ Gimbal sensitivity is similar to gain and will affect how quickly the gimbal wil --- -### gimabl_tilt_channel +### gimbal_tilt_channel Gimbal tilt rc channel index. 0 is no channel. diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 2127c3505ae..8f50b3218ba 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4151,25 +4151,25 @@ groups: headers: ["drivers/gimbal_common.h"] condition: USE_SERIAL_GIMBAL members: - - name: gimabl_pan_channel + - name: gimbal_pan_channel description: "Gimbal pan rc channel index. 0 is no channel." default_value: 0 field: panChannel min: 0 max: 32 - - name: gimabl_roll_channel + - name: gimbal_roll_channel description: "Gimbal roll rc channel index. 0 is no channel." default_value: 0 field: rollChannel min: 0 max: 32 - - name: gimabl_tilt_channel + - name: gimbal_tilt_channel description: "Gimbal tilt rc channel index. 0 is no channel." default_value: 0 field: tiltChannel min: 0 max: 32 - - name: gimabl_sensitivity + - name: gimbal_sensitivity description: "Gimbal sensitivity is similar to gain and will affect how quickly the gimbal will react." default_value: 0 field: sensitivity From 033869b9da0c65828c518dba24be5ae468169e1f Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 6 Jun 2024 12:04:29 +0100 Subject: [PATCH 113/429] Update settings.yaml --- src/main/fc/settings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 3c192495751..4a22ecb8711 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2866,7 +2866,7 @@ groups: description: "Forward acceleration threshold for bungee launch or throw launch [cm/s/s], 1G = 981 cm/s/s" default_value: 1863 field: fw.launch_accel_thresh - min: 1500 + min: 1350 max: 20000 - name: nav_fw_launch_max_angle description: "Max tilt angle (pitch/roll combined) to consider launch successful. Set to 180 to disable completely [deg]" From 4fb7204d378c86f7cfe164097ddfe104b73f0ef8 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 6 Jun 2024 12:06:26 +0100 Subject: [PATCH 114/429] Update Settings.md --- docs/Settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Settings.md b/docs/Settings.md index a1c339c1d8c..3d0758ab2a2 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -2958,7 +2958,7 @@ Forward acceleration threshold for bungee launch or throw launch [cm/s/s], 1G = | Default | Min | Max | | --- | --- | --- | -| 1863 | 1500 | 20000 | +| 1863 | 1350 | 20000 | --- From 93d19f786bd647dafdb26013f10bfdc02abf94d3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:35:53 +0200 Subject: [PATCH 115/429] Let f722 have some fun --- src/main/target/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/common.h b/src/main/target/common.h index 676b1760409..cf23a7a4b9b 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -190,10 +190,10 @@ #define ADSB_LIMIT_CM 6400000 #endif +#define USE_SERIAL_GIMBAL //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) -#define USE_SERIAL_GIMBAL #define USE_VTX_FFPV #define USE_SERIALRX_SUMD #define USE_TELEMETRY_HOTT From 1f9c2857cbf80101f236c2ceb8ab4c75eb9f4e96 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:44:31 +0200 Subject: [PATCH 116/429] More .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 39ef205b954..65804b74b0a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ startup_stm32f10x_md_gcc.s cov-int* /build/ /build_SITL/ -/sitl/ +/[hs]itl/ /obj/ /patches/ /tools/ From c6da0b7540796cedb1602cdc2577040f117f521a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:12:05 +0200 Subject: [PATCH 117/429] Add unit tests --- src/main/CMakeLists.txt | 4 +- src/main/drivers/gimbal_common.c | 6 +++ src/main/drivers/gimbal_common.h | 7 +++ src/main/fc/fc_init.c | 2 +- src/main/io/{gimbal_htk.c => gimbal_serial.c} | 33 ++++++++---- src/main/io/{gimbal_htk.h => gimbal_serial.h} | 14 +++++- src/main/io/serial.h | 2 +- src/test/unit/CMakeLists.txt | 3 ++ src/test/unit/gimbal_serial_unittest.cc | 50 +++++++++++++++++++ src/test/unit/maths_unittest.cc | 8 +-- 10 files changed, 109 insertions(+), 20 deletions(-) rename src/main/io/{gimbal_htk.c => gimbal_serial.c} (88%) rename src/main/io/{gimbal_htk.h => gimbal_serial.h} (93%) create mode 100644 src/test/unit/gimbal_serial_unittest.cc diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 31d09c716cf..6fb191c161e 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -356,8 +356,8 @@ main_sources(COMMON_SRC io/servo_sbus.h io/frsky_osd.c io/frsky_osd.h - io/gimbal_htk.c - io/gimbal_htk.h + io/gimbal_serial.c + io/gimbal_serial.h io/osd_dji_hd.c io/osd_dji_hd.h io/lights.c diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index 340db5fbdce..ba09b8597c8 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -74,6 +74,11 @@ bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice) return false; } +#ifdef GIMBAL_UNIT_TEST +void taskUpdateGimbal(timeUs_t currentTimeUs) +{ +} +#else void taskUpdateGimbal(timeUs_t currentTimeUs) { if (cliMode) { @@ -86,5 +91,6 @@ void taskUpdateGimbal(timeUs_t currentTimeUs) gimbalCommonProcess(gimbalDevice, currentTimeUs); } } +#endif #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 8814e1010dd..0a7113688ee 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -26,6 +26,9 @@ #include "config/feature.h" #include "common/time.h" +#ifdef __cplusplus +extern "C" { +#endif typedef enum { GIMBAL_DEV_UNSUPPORTED = 0, @@ -80,4 +83,8 @@ bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice); void taskUpdateGimbal(timeUs_t currentTimeUs); +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index 124fe1dc67c..76aa9d79511 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -108,7 +108,7 @@ #include "io/displayport_msp_osd.h" #include "io/displayport_srxl.h" #include "io/flashfs.h" -#include "io/gimbal_htk.h" +#include "io/gimbal_serial.h" #include "io/gps.h" #include "io/ledstrip.h" #include "io/osd.h" diff --git a/src/main/io/gimbal_htk.c b/src/main/io/gimbal_serial.c similarity index 88% rename from src/main/io/gimbal_htk.c rename to src/main/io/gimbal_serial.c index 2c80113365e..8bc0c328a51 100644 --- a/src/main/io/gimbal_htk.c +++ b/src/main/io/gimbal_serial.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -38,8 +38,8 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); -#define HTK_TX_BUFFER_SIZE 512 -static volatile uint8_t txBuffer[HTK_TX_BUFFER_SIZE]; +#define GIMBAL_SERIAL_BUFFER_SIZE 512 +static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; static serialPort_t *htkPort = NULL; @@ -80,21 +80,27 @@ bool gimbalSerialInit(void) return false; } +#ifdef GIMBAL_UNIT_TEST +bool gimbalSerialDetect(void) +{ + return false; +} +#else bool gimbalSerialDetect(void) { SD(fprintf(stderr, "[GIMBAL]: serial Detect...\n")); - serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_HTK_GIMBAL); + serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_GIMBAL); if (portConfig) { SD(fprintf(stderr, "[GIMBAL]: found port...\n")); - htkPort = openSerialPort(portConfig->identifier, FUNCTION_HTK_GIMBAL, NULL, NULL, - 115200, MODE_RXTX, SERIAL_NOT_INVERTED); + htkPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, NULL, NULL, + baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); if (htkPort) { SD(fprintf(stderr, "[GIMBAL]: port open!\n")); htkPort->txBuffer = txBuffer; - htkPort->txBufferSize = HTK_TX_BUFFER_SIZE; + htkPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; htkPort->txBufferTail = 0; htkPort->txBufferHead = 0; @@ -105,7 +111,13 @@ bool gimbalSerialDetect(void) SD(fprintf(stderr, "[GIMBAL]: port not found :(...\n")); return false; } +#endif +#ifdef GIMBAL_UNIT_TEST +void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) +{ +} +#else void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) { UNUSED(currentTime); @@ -171,9 +183,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) attittude.sensibility = gimbal_scale8(-16, 15, 0, 31, cfg->sensitivity); - attittude.yaw = gimbal_scale16(1000, 2000, 0, 4095, yaw); - attittude.pitch = gimbal_scale16(1000, 2000, 0, 4095, pitch); - attittude.roll = gimbal_scale16(1000, 2000, 0, 4095, roll); + attittude.yaw = 3000;//gimbal_scale16(1000, 2000, 0, 4095, yaw); + attittude.pitch = 3000; //gimbal_scale16(1000, 2000, 0, 4095, pitch); + attittude.roll = 3000; // gimbal_scale16(1000, 2000, 0, 4095, roll); uint16_t crc16 = 0; uint8_t *b = (uint8_t *)&attittude; @@ -188,6 +200,7 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) serialEndWrite(htkPort); // Send new data } +#endif uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value) { diff --git a/src/main/io/gimbal_htk.h b/src/main/io/gimbal_serial.h similarity index 93% rename from src/main/io/gimbal_htk.h rename to src/main/io/gimbal_serial.h index bebcb794009..67b34a7458e 100644 --- a/src/main/io/gimbal_htk.h +++ b/src/main/io/gimbal_serial.h @@ -17,12 +17,18 @@ #pragma once +#include + #include "platform.h" -#ifdef USE_SERIAL_GIMBAL +#include "common/time.h" +#include "drivers/gimbal_common.h" -#include +#ifdef __cplusplus +extern "C" { +#endif +#ifdef USE_SERIAL_GIMBAL #define HTKATTITUDE_SYNC0 0xA5 #define HTKATTITUDE_SYNC1 0x5A @@ -48,4 +54,8 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime); bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice); gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); +#endif + +#ifdef __cplusplus +} #endif \ No newline at end of file diff --git a/src/main/io/serial.h b/src/main/io/serial.h index dad56a9f4bc..c2429d9887a 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -57,7 +57,7 @@ typedef enum { FUNCTION_TELEMETRY_SMARTPORT_MASTER = (1 << 23), // 8388608 FUNCTION_UNUSED_2 = (1 << 24), // 16777216 FUNCTION_MSP_OSD = (1 << 25), // 33554432 - FUNCTION_HTK_GIMBAL = (1 << 26), // 67108864 + FUNCTION_GIMBAL = (1 << 26), // 67108864 } serialPortFunction_e; #define FUNCTION_VTX_MSP FUNCTION_MSP_OSD diff --git a/src/test/unit/CMakeLists.txt b/src/test/unit/CMakeLists.txt index ebfd3b78d4f..8f165c0fe9e 100644 --- a/src/test/unit/CMakeLists.txt +++ b/src/test/unit/CMakeLists.txt @@ -40,6 +40,9 @@ set_property(SOURCE osd_unittest.cc PROPERTY definitions OSD_UNIT_TEST USE_MSP_D set_property(SOURCE gps_ublox_unittest.cc PROPERTY depends "io/gps_ublox_utils.c") set_property(SOURCE gps_ublox_unittest.cc PROPERTY definitions GPS_UBLOX_UNIT_TEST) +set_property(SOURCE gimbal_serial_unittest.cc PROPERTY depends "io/gimbal_serial.c" "drivers/gimbal_common.c") +set_property(SOURCE gimbal_serial_unittest.cc PROPERTY definitions USE_SERIAL_GIMBAL GIMBAL_UNIT_TEST) + function(unit_test src) get_filename_component(basename ${src} NAME) string(REPLACE ".cc" "" name ${basename} ) diff --git a/src/test/unit/gimbal_serial_unittest.cc b/src/test/unit/gimbal_serial_unittest.cc new file mode 100644 index 00000000000..0cafc2081bf --- /dev/null +++ b/src/test/unit/gimbal_serial_unittest.cc @@ -0,0 +1,50 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "unittest_macros.h" + +#include "io/gimbal_serial.h" + +void dumpMemory(uint8_t *mem, int size) +{ + for(int i =0; i < size; ++i) { + printf("%02x ", mem[i]); + } + printf("\n"); +} + +TEST(GimbalSerialTest, TestGimbalSerialScale) +{ +//uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); + uint8_t res8 = gimbal_scale8(-16, 15, 0, 32, 0); + printf("res8: %i\n", res8); + EXPECT_TRUE(res8 == 15); +//uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); + uint16_t res16 = gimbal_scale16(1000, 2000, -2048, 2047, 0); + printf("res16: %i\n", res16); + EXPECT_TRUE(res16 == 1499); + //EXPECT_TRUE(valuesAdded == 12); + //EXPECT_TRUE(1 == valuesAdded); + //EXPECT_FALSE(memcmp((void *)expected, (void *)&cfg, 17)); + //EXPECT_FALSE(strcmp(buf, " 123.45")); +} \ No newline at end of file diff --git a/src/test/unit/maths_unittest.cc b/src/test/unit/maths_unittest.cc index 538f28086af..77779d366e2 100644 --- a/src/test/unit/maths_unittest.cc +++ b/src/test/unit/maths_unittest.cc @@ -128,28 +128,28 @@ void expectVectorsAreEqual(fpVector3_t *a, fpVector3_t *b) TEST(MathsUnittest, TestRotateVectorWithNoAngle) { - fpVector3_t vector = { 1.0f, 0.0f, 0.0f}; + fpVector3_t vector = { .x = 1.0f, .y = 0.0f, .z = 0.0f}; fp_angles_t euler_angles = {.raw={0.0f, 0.0f, 0.0f}}; fpMat3_t rmat; rotationMatrixFromAngles(&rmat, &euler_angles); rotationMatrixRotateVector(&vector, &vector, &rmat); - fpVector3_t expected_result = { 1.0f, 0.0f, 0.0f}; + fpVector3_t expected_result = { .x = 1.0f, .y = 0.0f, .z = 0.0f}; expectVectorsAreEqual(&vector, &expected_result); } TEST(MathsUnittest, TestRotateVectorAroundAxis) { // Rotate a vector <1, 0, 0> around an each axis x y and z. - fpVector3_t vector = { 1.0f, 0.0f, 0.0f}; + fpVector3_t vector = { .x = 1.0f, .y = 0.0f, .z = 0.0f}; fp_angles_t euler_angles = {.raw={90.0f, 0.0f, 0.0f}}; fpMat3_t rmat; rotationMatrixFromAngles(&rmat, &euler_angles); rotationMatrixRotateVector(&vector, &vector, &rmat); - fpVector3_t expected_result = { 1.0f, 0.0f, 0.0f}; + fpVector3_t expected_result = { .x = 1.0f, .y = 0.0f, .z = 0.0f}; expectVectorsAreEqual(&vector, &expected_result); } From 719a96e9c8527001915c6295867ba70ca6de1198 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:28:19 +0200 Subject: [PATCH 118/429] Tested working. May need to clamp inputs to 1000-2000 range --- src/main/io/gimbal_serial.c | 49 ++++++++++++++++++++----- src/main/io/gimbal_serial.h | 3 +- src/test/unit/CMakeLists.txt | 2 +- src/test/unit/gimbal_serial_unittest.cc | 21 +++++------ 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 8bc0c328a51..67c6f5263cb 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -181,11 +182,11 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) } } - attittude.sensibility = gimbal_scale8(-16, 15, 0, 31, cfg->sensitivity); + attittude.sensibility = cfg->sensitivity; //gimbal_scale5(-16, 15, -16, 15, cfg->sensitivity); - attittude.yaw = 3000;//gimbal_scale16(1000, 2000, 0, 4095, yaw); - attittude.pitch = 3000; //gimbal_scale16(1000, 2000, 0, 4095, pitch); - attittude.roll = 3000; // gimbal_scale16(1000, 2000, 0, 4095, roll); + attittude.yaw = gimbal_scale12(1000, 2000, yaw); + attittude.pitch = gimbal_scale12(1000, 2000, pitch); + attittude.roll = gimbal_scale12(1000, 2000, roll); uint16_t crc16 = 0; uint8_t *b = (uint8_t *)&attittude; @@ -202,16 +203,44 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) } #endif -uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value) +int8_t gimbal_scale5(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value) { - float m = (1.0f * outputMax - outputMin) / (inputMax - inputMin); - return (uint8_t)((outputMin + (m * (value - inputMin))) + 0.5f); + int8_t ret = 0; + //uint8_t *rp = (uint8_t *)&ret; + ret = scaleRange(value, inputMin, inputMax, outputMin, outputMax); + return ret; + // bit magic for ensuring signed representation + //if(ret < 0) { + // *rp = *rp >> 3; + // *rp |= (1 << 5); + //} + //return *rp & 0b11111; + //return *rp; } -uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value) +int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) { - float m = (1.0f * outputMax - outputMin) / (inputMax - inputMin); - return (uint16_t)((outputMin + (m * (value - inputMin))) + 0.5f); + int16_t ret = 0; + //uint16_t *rp = (uint16_t *)&ret; + ret = scaleRange(value, inputMin, inputMax, -2048, 2047); + return ret; + // bit magic for signed representation + //if(ret < 0) { + // *rp = *rp >> 4; + // *rp |= (1 << 12); + //} + //return *rp & 0b111111111111; + //printf("bogus scale: %i(", ret); + //for (int i = 0; i < sizeof(ret) * 8; ++i) { + // if (ret & (1 << ((sizeof(ret) * 8)- i))) { + // printf("1"); + // } else { + // printf("0"); + // } + //} + //printf(")\n"); + + //return *rp; } #endif \ No newline at end of file diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 67b34a7458e..f74f11bfe30 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -45,8 +45,7 @@ typedef struct gimbalHtkAttitudePkt_s uint64_t crcl:8; //Data validation L } __attribute__((packed)) gimbalHtkAttitudePkt_t; -uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); -uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); +int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value); bool gimbalSerialInit(void); bool gimbalSerialDetect(void); diff --git a/src/test/unit/CMakeLists.txt b/src/test/unit/CMakeLists.txt index 8f165c0fe9e..300721b8f53 100644 --- a/src/test/unit/CMakeLists.txt +++ b/src/test/unit/CMakeLists.txt @@ -40,7 +40,7 @@ set_property(SOURCE osd_unittest.cc PROPERTY definitions OSD_UNIT_TEST USE_MSP_D set_property(SOURCE gps_ublox_unittest.cc PROPERTY depends "io/gps_ublox_utils.c") set_property(SOURCE gps_ublox_unittest.cc PROPERTY definitions GPS_UBLOX_UNIT_TEST) -set_property(SOURCE gimbal_serial_unittest.cc PROPERTY depends "io/gimbal_serial.c" "drivers/gimbal_common.c") +set_property(SOURCE gimbal_serial_unittest.cc PROPERTY depends "io/gimbal_serial.c" "drivers/gimbal_common.c" "common/maths.c") set_property(SOURCE gimbal_serial_unittest.cc PROPERTY definitions USE_SERIAL_GIMBAL GIMBAL_UNIT_TEST) function(unit_test src) diff --git a/src/test/unit/gimbal_serial_unittest.cc b/src/test/unit/gimbal_serial_unittest.cc index 0cafc2081bf..77ae4c93df8 100644 --- a/src/test/unit/gimbal_serial_unittest.cc +++ b/src/test/unit/gimbal_serial_unittest.cc @@ -35,16 +35,15 @@ void dumpMemory(uint8_t *mem, int size) TEST(GimbalSerialTest, TestGimbalSerialScale) { -//uint8_t gimbal_scale8(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value); - uint8_t res8 = gimbal_scale8(-16, 15, 0, 32, 0); - printf("res8: %i\n", res8); - EXPECT_TRUE(res8 == 15); -//uint16_t gimbal_scale16(int16_t inputMin, int16_t inputMax, int16_t outputMin, int16_t outputMax, int16_t value); - uint16_t res16 = gimbal_scale16(1000, 2000, -2048, 2047, 0); + int16_t res16 = gimbal_scale12(1000, 2000, 2000); + EXPECT_TRUE(res16 == 2047); + res16 = gimbal_scale12(1000, 2000, 1000); printf("res16: %i\n", res16); - EXPECT_TRUE(res16 == 1499); - //EXPECT_TRUE(valuesAdded == 12); - //EXPECT_TRUE(1 == valuesAdded); - //EXPECT_FALSE(memcmp((void *)expected, (void *)&cfg, 17)); - //EXPECT_FALSE(strcmp(buf, " 123.45")); + EXPECT_TRUE(res16 == -2048); + res16 = gimbal_scale12(1000, 2000, 1500); + printf("res16: %i\n", res16); + EXPECT_TRUE(res16 == -1); + res16 = gimbal_scale12(1000, 2000, 1501); + printf("res16: %i\n", res16); + EXPECT_TRUE(res16 == 3); } \ No newline at end of file From 4ba9a1b085b6dfd01ccee7abfa09b24569fe4e7b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:44:02 +0200 Subject: [PATCH 119/429] Clean up --- src/main/io/gimbal_serial.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 67c6f5263cb..223d9c7a408 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -199,48 +199,14 @@ void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) serialBeginWrite(htkPort); serialWriteBuf(htkPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); serialEndWrite(htkPort); - // Send new data } #endif -int8_t gimbal_scale5(int8_t inputMin, int8_t inputMax, int8_t outputMin, int8_t outputMax, int8_t value) -{ - int8_t ret = 0; - //uint8_t *rp = (uint8_t *)&ret; - ret = scaleRange(value, inputMin, inputMax, outputMin, outputMax); - return ret; - // bit magic for ensuring signed representation - //if(ret < 0) { - // *rp = *rp >> 3; - // *rp |= (1 << 5); - //} - //return *rp & 0b11111; - //return *rp; -} - int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) { int16_t ret = 0; - //uint16_t *rp = (uint16_t *)&ret; ret = scaleRange(value, inputMin, inputMax, -2048, 2047); return ret; - // bit magic for signed representation - //if(ret < 0) { - // *rp = *rp >> 4; - // *rp |= (1 << 12); - //} - //return *rp & 0b111111111111; - //printf("bogus scale: %i(", ret); - //for (int i = 0; i < sizeof(ret) * 8; ++i) { - // if (ret & (1 << ((sizeof(ret) * 8)- i))) { - // printf("1"); - // } else { - // printf("0"); - // } - //} - //printf(")\n"); - - //return *rp; } #endif \ No newline at end of file From 50754d09c9fea2ef115038f15b6740b4505aa900 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:44:48 +0200 Subject: [PATCH 120/429] ninja folder for tests --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 65804b74b0a..fd9c771bea2 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ cov-int* /build/ /build_SITL/ /[hs]itl/ +/ninja/ /obj/ /patches/ /tools/ From db0856b7cb7ef598ee2d0fab1829fdf48ba41aad Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:48:26 +0200 Subject: [PATCH 121/429] Fix typos --- src/main/drivers/gimbal_common.h | 2 +- src/main/io/gimbal_serial.c | 12 ++++-------- src/main/io/gimbal_serial.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 0a7113688ee..7ffbb9376aa 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -49,7 +49,7 @@ typedef struct gimbalDevice_s { typedef struct gimbalVTable_s { void (*process)(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); - gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimablDevice); + gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimbalDevice); bool (*isReady)(const gimbalDevice_t *gimbalDevice); } gimbalVTable_t; diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 223d9c7a408..a499dffaaca 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -45,12 +45,8 @@ static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; static serialPort_t *htkPort = NULL; gimbalVTable_t gimbalSerialVTable = { - //void (*process)(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); .process = gimbalSerialProcess, - - //gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimablDevice); .getDeviceType = gimbalSerialGetDeviceType, - //bool (*isReady)(const gimbalDevice_t *gimbalDevice); .isReady = gimbalSerialIsReady }; @@ -115,16 +111,16 @@ bool gimbalSerialDetect(void) #endif #ifdef GIMBAL_UNIT_TEST -void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) +void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) { } #else -void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime) +void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) { UNUSED(currentTime); - if (!gimbalSerialIsReady(gimablDevice)) { - SD(fprintf(stderr, "[GIMBAL] gimabl not ready...\n")); + if (!gimbalSerialIsReady(gimbalDevice)) { + SD(fprintf(stderr, "[GIMBAL] gimbal not ready...\n")); return; } diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index f74f11bfe30..3d0188b6b1c 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -49,7 +49,7 @@ int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value); bool gimbalSerialInit(void); bool gimbalSerialDetect(void); -void gimbalSerialProcess(gimbalDevice_t *gimablDevice, timeUs_t currentTime); +void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime); bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice); gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); From eabca5e0a5dfc5cb5e072c458fb39a4f980cb29b Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 7 Jun 2024 12:38:18 +0200 Subject: [PATCH 122/429] Disable adaptive filter for SITL --- src/main/target/SITL/target.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/target/SITL/target.h b/src/main/target/SITL/target.h index 3fbe45a5cab..048626ad8dd 100644 --- a/src/main/target/SITL/target.h +++ b/src/main/target/SITL/target.h @@ -97,6 +97,7 @@ #undef USE_BRUSHED_ESC_AUTODETECT #undef USE_SERIAL_4WAY_BLHELI_BOOTLOADER #undef USE_SERIAL_4WAY_SK_BOOTLOADER +#undef USE_ADAPTIVE_FILTER #undef USE_I2C #undef USE_SPI From f8e72b8afd20f7b914069012665169da7160cad2 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 7 Jun 2024 12:57:42 +0200 Subject: [PATCH 123/429] Enable task only when adaptive filter is enabled --- src/main/fc/fc_tasks.c | 2 +- src/main/sensors/gyro.c | 2 +- src/main/sensors/gyro.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 8da10280a9d..0fd239127c2 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -428,7 +428,7 @@ void fcTasksInit(void) #endif #ifdef USE_ADAPTIVE_FILTER - setTaskEnabled(TASK_ADAPTIVE_FILTER, true); + setTaskEnabled(TASK_ADAPTIVE_FILTER, (gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE)); #endif #if defined(SITL_BUILD) diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 7f7d1d171d9..2b0b7d8c9bd 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -130,8 +130,8 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .adaptiveFilterHpfHz = SETTING_GYRO_ADAPTIVE_FILTER_HPF_HZ_DEFAULT, .adaptiveFilterIntegratorThresholdHigh = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_HIGH_DEFAULT, .adaptiveFilterIntegratorThresholdLow = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW_DEFAULT, - .gyroFilterMode = SETTING_GYRO_FILTER_MODE_DEFAULT, #endif + .gyroFilterMode = SETTING_GYRO_FILTER_MODE_DEFAULT, ); STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHardware) diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 7f767e370d1..910dac2ea00 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -100,8 +100,8 @@ typedef struct gyroConfig_s { float adaptiveFilterHpfHz; float adaptiveFilterIntegratorThresholdHigh; float adaptiveFilterIntegratorThresholdLow; - uint8_t gyroFilterMode; #endif + uint8_t gyroFilterMode; } gyroConfig_t; PG_DECLARE(gyroConfig_t, gyroConfig); From 08d46dd4712a9f38eab43e256172a2dbf9a9f23c Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 7 Jun 2024 13:39:37 +0200 Subject: [PATCH 124/429] Fix compilation error in config.c --- src/main/fc/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index ac98eca02cb..dc249df059b 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -191,6 +191,7 @@ uint32_t getGyroLooptime(void) void validateAndFixConfig(void) { +#ifdef USE_ADAPTIVE_FILTER // gyroConfig()->adaptiveFilterMinHz has to be at least 5 units lower than gyroConfig()->gyro_main_lpf_hz if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; @@ -199,6 +200,7 @@ void validateAndFixConfig(void) if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; } +#endif if (accelerometerConfig()->acc_notch_cutoff >= accelerometerConfig()->acc_notch_hz) { accelerometerConfigMutable()->acc_notch_hz = 0; From a136afe0ff67d0c7570b9eb87efe49f64fc94936 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 12:40:49 +0200 Subject: [PATCH 125/429] Add modes to active modes. --- src/main/drivers/gimbal_common.c | 6 ++++++ src/main/drivers/gimbal_common.h | 2 ++ src/main/fc/fc_msp_box.c | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index ba09b8597c8..3c93b44d793 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -93,4 +93,10 @@ void taskUpdateGimbal(timeUs_t currentTimeUs) } #endif +// TODO: check if any gimbal types are enabled +bool gimbalCommonIsEnabled(void) +{ + return true; +} + #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 7ffbb9376aa..93501e1dc9c 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -83,6 +83,8 @@ bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice); void taskUpdateGimbal(timeUs_t currentTimeUs); +bool gimbalCommonIsEnabled(void); + #ifdef __cplusplus } #endif diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index ca384084866..600fd06a7fc 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -43,6 +43,8 @@ #include "telemetry/telemetry.h" +#include "drivers/gimbal_common.h" + #define BOX_SUFFIX ';' #define BOX_SUFFIX_LEN 1 @@ -361,6 +363,14 @@ void initActiveBoxIds(void) ADD_ACTIVE_BOX(BOXMIXERPROFILE); ADD_ACTIVE_BOX(BOXMIXERTRANSITION); #endif + +#ifdef USE_SERIAL_GIMBAL + if(gimbalCommonIsEnabled()) { + ADD_ACTIVE_BOX(BOXGIMBALPLOCK); + ADD_ACTIVE_BOX(BOXGIMBALPRLOCK); + ADD_ACTIVE_BOX(BOXGIMBALCENTER); + } +#endif } #define IS_ENABLED(mask) ((mask) == 0 ? 0 : 1) From 1474e029ac985eb3be8b74690d4706a817af4664 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:03:39 +0200 Subject: [PATCH 126/429] Add active modes --- src/main/fc/fc_msp_box.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 600fd06a7fc..fec9cde9550 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -104,8 +104,8 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXMIXERPROFILE, .boxName = "MIXER PROFILE 2", .permanentId = 62 }, { .boxId = BOXMIXERTRANSITION, .boxName = "MIXER TRANSITION", .permanentId = 63 }, { .boxId = BOXANGLEHOLD, .boxName = "ANGLE HOLD", .permanentId = 64 }, - { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL P", .permanentId = 66 }, - { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LEVEL P+R", .permanentId = 66 }, + { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL PITCH", .permanentId = 66 }, + { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LEVEL PITCH ROLL", .permanentId = 66 }, { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } }; From bcc9fd27ff8ab7150913c9e3083d6c384367d1db Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:12:24 +0200 Subject: [PATCH 127/429] fix permanentBoxId --- src/main/fc/fc_msp_box.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index fec9cde9550..2915c0c50cb 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -104,7 +104,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXMIXERPROFILE, .boxName = "MIXER PROFILE 2", .permanentId = 62 }, { .boxId = BOXMIXERTRANSITION, .boxName = "MIXER TRANSITION", .permanentId = 63 }, { .boxId = BOXANGLEHOLD, .boxName = "ANGLE HOLD", .permanentId = 64 }, - { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL PITCH", .permanentId = 66 }, + { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL PITCH", .permanentId = 65 }, { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LEVEL PITCH ROLL", .permanentId = 66 }, { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } From bf530ecd6fcedeebb8f178d24588df3f59d0dd1d Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 8 Jun 2024 13:55:07 +0200 Subject: [PATCH 128/429] Lower new rates slightly --- docs/Settings.md | 8 ++++---- src/main/fc/settings.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 40490808c83..265500e6720 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -2758,7 +2758,7 @@ Speed in fully autonomous modes (RTH, WP) [cm/s]. Used for WP mode when no speci | Default | Min | Max | | --- | --- | --- | -| 600 | 10 | 2000 | +| 500 | 10 | 2000 | --- @@ -3418,7 +3418,7 @@ Maximum speed allowed when processing pilot input for POSHOLD/CRUISE control mod | Default | Min | Max | | --- | --- | --- | -| 1000 | 10 | 2000 | +| 750 | 10 | 2000 | --- @@ -3438,7 +3438,7 @@ Maximum speed allowed in fully autonomous modes (RTH, WP) [cm/s] [Multirotor onl | Default | Min | Max | | --- | --- | --- | -| 1200 | 10 | 2000 | +| 1000 | 10 | 2000 | --- @@ -3478,7 +3478,7 @@ Maximum banking angle (deg) that multicopter navigation is allowed to set. Machi | Default | Min | Max | | --- | --- | --- | -| 40 | 15 | 45 | +| 35 | 15 | 45 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 71964891ce9..f5b52be72a8 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2510,7 +2510,7 @@ groups: table: nav_fw_wp_turn_smoothing - name: nav_auto_speed description: "Speed in fully autonomous modes (RTH, WP) [cm/s]. Used for WP mode when no specific WP speed set. [Multirotor only]" - default_value: 600 + default_value: 500 field: general.auto_speed min: 10 max: 2000 @@ -2522,13 +2522,13 @@ groups: max: 50 - name: nav_max_auto_speed description: "Maximum speed allowed in fully autonomous modes (RTH, WP) [cm/s] [Multirotor only]" - default_value: 1200 + default_value: 1000 field: general.max_auto_speed min: 10 max: 2000 - name: nav_manual_speed description: "Maximum speed allowed when processing pilot input for POSHOLD/CRUISE control mode [cm/s] [Multirotor only]" - default_value: 1000 + default_value: 750 field: general.max_manual_speed min: 10 max: 2000 @@ -2704,7 +2704,7 @@ groups: max: 120 - name: nav_mc_bank_angle description: "Maximum banking angle (deg) that multicopter navigation is allowed to set. Machine must be able to satisfy this angle without loosing altitude" - default_value: 40 + default_value: 35 field: mc.max_bank_angle min: 15 max: 45 From bf651acaf91d06bac78ccf8c0dbc352714fdafeb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 17:26:06 +0200 Subject: [PATCH 129/429] Update flight modes --- src/main/drivers/gimbal_common.h | 11 +++++++---- src/main/fc/fc_msp_box.c | 12 ++++++------ src/main/fc/rc_modes.h | 4 ++-- src/main/io/gimbal_serial.c | 21 +++++++++++++-------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 93501e1dc9c..0181c2cb2c0 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -64,12 +64,15 @@ typedef struct gimbalConfig_s { PG_DECLARE(gimbalConfig_t, gimbalConfig); typedef enum { - GIMBAL_MODE_PITCH_ROLL_LOCK = 0, - GIMBAL_MODE_PITCH_LOCK = 1, - GIMBAL_MODE_FOLLOW = 2 + GIMBAL_MODE_FOLLOW = 0, + GIMBAL_MODE_TILT_LOCK = (1<<0), + GIMBAL_MODE_ROLL_LOCK = (1<<1), + GIMBAL_MODE_PAN_LOCK = (1<<2), } gimbal_htk_mode_e; -#define GIMBAL_MODE_DEFAULT GIMBAL_MODE_FOLLOW +#define GIMBAL_MODE_DEFAULT GIMBAL_MODE_FOLLOW +#define GIMBAL_MODE_TILT_ROLL_LOCK (GIMBAL_MODE_TILT_LOCK | GIMBAL_MODE_ROLL_LOCK) +#define GIMBAL_MODE_PAN_TILT_ROLL_LOCK (GIMBAL_MODE_TILT_LOCK | GIMBAL_MODE_ROLL_LOCK | GIMBAL_MODE_PAN_LOCK) void gimbalCommonInit(void); void gimbalCommonSetDevice(gimbalDevice_t *gimbalDevice); diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 2915c0c50cb..15c0d7136ef 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -104,8 +104,8 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXMIXERPROFILE, .boxName = "MIXER PROFILE 2", .permanentId = 62 }, { .boxId = BOXMIXERTRANSITION, .boxName = "MIXER TRANSITION", .permanentId = 63 }, { .boxId = BOXANGLEHOLD, .boxName = "ANGLE HOLD", .permanentId = 64 }, - { .boxId = BOXGIMBALPLOCK, .boxName = "GIMBAL LEVEL PITCH", .permanentId = 65 }, - { .boxId = BOXGIMBALPRLOCK, .boxName = "GIMBAL LEVEL PITCH ROLL", .permanentId = 66 }, + { .boxId = BOXGIMBALTLOCK, .boxName = "GIMBAL LEVEL TILT", .permanentId = 65 }, + { .boxId = BOXGIMBALRLOCK, .boxName = "GIMBAL LEVEL ROLL", .permanentId = 66 }, { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } }; @@ -366,8 +366,8 @@ void initActiveBoxIds(void) #ifdef USE_SERIAL_GIMBAL if(gimbalCommonIsEnabled()) { - ADD_ACTIVE_BOX(BOXGIMBALPLOCK); - ADD_ACTIVE_BOX(BOXGIMBALPRLOCK); + ADD_ACTIVE_BOX(BOXGIMBALTLOCK); + ADD_ACTIVE_BOX(BOXGIMBALRLOCK); ADD_ACTIVE_BOX(BOXGIMBALCENTER); } #endif @@ -445,8 +445,8 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPLOCK)), BOXGIMBALPLOCK); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALPRLOCK)), BOXGIMBALPRLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)), BOXGIMBALTLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK)), BOXGIMBALRLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index fb517efa009..69ef0374cb0 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -81,8 +81,8 @@ typedef enum { BOXMIXERPROFILE = 53, BOXMIXERTRANSITION = 54, BOXANGLEHOLD = 55, - BOXGIMBALPLOCK = 56, - BOXGIMBALPRLOCK = 57, + BOXGIMBALTLOCK = 56, + BOXGIMBALRLOCK = 57, BOXGIMBALCENTER = 58, CHECKBOX_ITEM_COUNT } boxId_e; diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index a499dffaaca..184a34385cd 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -135,12 +135,17 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) int pitch = 1500; int roll = 1500; + if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { + attittude.mode |= GIMBAL_MODE_TILT_LOCK; + } + + if (IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK)) { + attittude.mode |= GIMBAL_MODE_ROLL_LOCK; + } + + // Follow center overrides all if (IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { attittude.mode = GIMBAL_MODE_FOLLOW; - } else if (IS_RC_MODE_ACTIVE(BOXGIMBALPLOCK)) { - attittude.mode = GIMBAL_MODE_PITCH_LOCK; - } else if (IS_RC_MODE_ACTIVE(BOXGIMBALPRLOCK)) { - attittude.mode = GIMBAL_MODE_PITCH_ROLL_LOCK; } if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { @@ -148,10 +153,10 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) yaw = rxGetChannelValue(cfg->panChannel - 1); // const rxChannelRangeConfig_t *channelRanges = // rxChannelRangeConfigs(cfg->pitchChannel - 1); - if (yaw < 1000) { - yaw = 1000; - } else if (yaw > 2000) { - yaw = 2000; + if (yaw < 1050) { + yaw = 1050; + } else if (yaw > 1950) { + yaw = 1950; } } From 0253e86133d351d1fa3d63ef25a9d30612cb997f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 17:33:30 +0200 Subject: [PATCH 130/429] Only activate TILT lock and ROLL lock if CENTER is not active --- src/main/fc/fc_msp_box.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 15c0d7136ef..f118b2a4daa 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -445,8 +445,8 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)), BOXGIMBALTLOCK); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK)), BOXGIMBALRLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALTLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); From ca494d1d72f74d3e0589ee4ebdd0a3968ff8e303 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:20:23 +0200 Subject: [PATCH 131/429] Cleanup --- src/main/io/gimbal_serial.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 184a34385cd..d14fffce1c4 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -151,8 +151,6 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { yaw = rxGetChannelValue(cfg->panChannel - 1); - // const rxChannelRangeConfig_t *channelRanges = - // rxChannelRangeConfigs(cfg->pitchChannel - 1); if (yaw < 1050) { yaw = 1050; } else if (yaw > 1950) { @@ -162,23 +160,19 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (cfg->tiltChannel > 0) { pitch = rxGetChannelValue(cfg->tiltChannel - 1); - // const rxChannelRangeConfig_t *channelRanges = - // rxChannelRangeConfigs(cfg->pitchChannel - 1); - if (pitch < 1000) { - pitch = 1000; - } else if (pitch > 2000) { - pitch = 2000; + if (pitch < 1050) { + pitch = 1050; + } else if (pitch > 1950) { + pitch = 1950; } } if (cfg->rollChannel > 0) { roll = rxGetChannelValue(cfg->rollChannel - 1); - // const rxChannelRangeConfig_t *channelRanges = - // rxChannelRangeConfigs(cfg->pitchChannel - 1); - if (roll < 1000) { - roll = 1000; - } else if (roll > 2000) { - roll = 2000; + if (roll < 1050) { + roll = 1050; + } else if (roll > 1950) { + roll = 1950; } } } From 0f2eedaf7d30ea3fd8a3c18f0f02d06471cd3ac2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:06:33 +0200 Subject: [PATCH 132/429] Use constrain instead of duplicating this code --- src/main/io/gimbal_serial.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index d14fffce1c4..364ed922fd6 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -151,29 +151,17 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { yaw = rxGetChannelValue(cfg->panChannel - 1); - if (yaw < 1050) { - yaw = 1050; - } else if (yaw > 1950) { - yaw = 1950; - } + yaw = constrain(yaw, 1000, 2000); } if (cfg->tiltChannel > 0) { pitch = rxGetChannelValue(cfg->tiltChannel - 1); - if (pitch < 1050) { - pitch = 1050; - } else if (pitch > 1950) { - pitch = 1950; - } + pitch = constrain(pitch, 1000, 2000); } if (cfg->rollChannel > 0) { roll = rxGetChannelValue(cfg->rollChannel - 1); - if (roll < 1050) { - roll = 1050; - } else if (roll > 1950) { - roll = 1950; - } + roll = constrain(roll, 1000, 2000); } } From 504dd5b3c65cd46642898ad5bc593a8deedf1a64 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 22:34:13 +0200 Subject: [PATCH 133/429] First steps to allow reading headtracker info from a side channel --- src/main/drivers/gimbal_common.c | 11 ++++++ src/main/drivers/gimbal_common.h | 2 ++ src/main/fc/fc_msp_box.c | 18 +++++++--- src/main/fc/rc_modes.h | 3 +- src/main/io/gimbal_serial.c | 58 +++++++++++++++++++++++--------- src/main/io/gimbal_serial.h | 1 + src/main/io/serial.h | 1 + 7 files changed, 73 insertions(+), 21 deletions(-) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index 3c93b44d793..9fcfcc2b9bc 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -99,4 +99,15 @@ bool gimbalCommonIsEnabled(void) return true; } + +bool gimbalCommonHtrkIsEnabled(void) +{ + const gimbalDevice_t *dev = gimbalCommonDevice(); + if(dev && dev->vTable->hasHeadTracker) { + return dev->vTable->hasHeadTracker(dev); + } + + return false; +} + #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 0181c2cb2c0..2d914bbf77a 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -51,6 +51,7 @@ typedef struct gimbalVTable_s { void (*process)(gimbalDevice_t *gimbalDevice, timeUs_t currentTimeUs); gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimbalDevice); bool (*isReady)(const gimbalDevice_t *gimbalDevice); + bool (*hasHeadTracker)(const gimbalDevice_t *gimbalDevice); } gimbalVTable_t; @@ -87,6 +88,7 @@ bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice); void taskUpdateGimbal(timeUs_t currentTimeUs); bool gimbalCommonIsEnabled(void); +bool gimbalCommonHtrkIsEnabled(void); #ifdef __cplusplus } diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index f118b2a4daa..d295bb90e25 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -107,6 +107,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = { { .boxId = BOXGIMBALTLOCK, .boxName = "GIMBAL LEVEL TILT", .permanentId = 65 }, { .boxId = BOXGIMBALRLOCK, .boxName = "GIMBAL LEVEL ROLL", .permanentId = 66 }, { .boxId = BOXGIMBALCENTER, .boxName = "GIMBAL CENTER", .permanentId = 67 }, + { .boxId = BOXGIMBALHTRK, .boxName = "GIMBAL HEADTRACKER", .permanentId = 68 }, { .boxId = CHECKBOX_ITEM_COUNT, .boxName = NULL, .permanentId = 0xFF } }; @@ -365,10 +366,13 @@ void initActiveBoxIds(void) #endif #ifdef USE_SERIAL_GIMBAL - if(gimbalCommonIsEnabled()) { + if (gimbalCommonIsEnabled()) { ADD_ACTIVE_BOX(BOXGIMBALTLOCK); ADD_ACTIVE_BOX(BOXGIMBALRLOCK); ADD_ACTIVE_BOX(BOXGIMBALCENTER); + if (gimbalCommonHtrkIsEnabled()) { + ADD_ACTIVE_BOX(BOXGIMBALHTRK); + } } #endif } @@ -445,9 +449,15 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALTLOCK); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); - CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); + if(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); + } else if (IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)), BOXGIMBALHTRK); + } else { + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALTLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); + CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); + } memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); for (uint32_t i = 0; i < activeBoxIdCount; i++) { diff --git a/src/main/fc/rc_modes.h b/src/main/fc/rc_modes.h index 69ef0374cb0..c4b21a9005b 100644 --- a/src/main/fc/rc_modes.h +++ b/src/main/fc/rc_modes.h @@ -82,8 +82,9 @@ typedef enum { BOXMIXERTRANSITION = 54, BOXANGLEHOLD = 55, BOXGIMBALTLOCK = 56, - BOXGIMBALRLOCK = 57, + BOXGIMBALRLOCK = 57, BOXGIMBALCENTER = 58, + BOXGIMBALHTRK = 59, CHECKBOX_ITEM_COUNT } boxId_e; diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 364ed922fd6..a77bf2b54a3 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -42,12 +42,14 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_ #define GIMBAL_SERIAL_BUFFER_SIZE 512 static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; -static serialPort_t *htkPort = NULL; +static serialPort_t *headTrackerPort = NULL; +static serialPort_t *gimbalPort = NULL; gimbalVTable_t gimbalSerialVTable = { .process = gimbalSerialProcess, .getDeviceType = gimbalSerialGetDeviceType, - .isReady = gimbalSerialIsReady + .isReady = gimbalSerialIsReady, + .hasHeadTracker = gimbalSerialHasHeadTracker, }; @@ -64,7 +66,12 @@ gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice) { - return htkPort != NULL && gimbalDevice->vTable != NULL; + return gimbalPort != NULL && gimbalDevice->vTable != NULL; +} + +bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice) +{ + return headTrackerPort; } bool gimbalSerialInit(void) @@ -85,28 +92,47 @@ bool gimbalSerialDetect(void) #else bool gimbalSerialDetect(void) { - SD(fprintf(stderr, "[GIMBAL]: serial Detect...\n")); serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_GIMBAL); if (portConfig) { SD(fprintf(stderr, "[GIMBAL]: found port...\n")); - htkPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, NULL, NULL, + gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, NULL, NULL, baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); - if (htkPort) { + if (gimbalPort) { SD(fprintf(stderr, "[GIMBAL]: port open!\n")); - htkPort->txBuffer = txBuffer; - htkPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; - htkPort->txBufferTail = 0; - htkPort->txBufferHead = 0; + gimbalPort->txBuffer = txBuffer; + gimbalPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; + gimbalPort->txBufferTail = 0; + gimbalPort->txBufferHead = 0; + } else { + SD(fprintf(stderr, "[GIMBAL]: port NOT open!\n")); + return false; + } + } - return true; + SD(fprintf(stderr, "[GIMBAL_HTRK]: headtracker Detect...\n")); + portConfig = findSerialPortConfig(FUNCTION_GIMBAL_HEADTRACKER); + + if (portConfig) { + SD(fprintf(stderr, "[GIMBAL_HTRK]: found port...\n")); + headTrackerPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL_HEADTRACKER, NULL, NULL, + baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); + + if (headTrackerPort) { + SD(fprintf(stderr, "[GIMBAL_HTRK]: port open!\n")); + headTrackerPort->txBuffer = txBuffer; + headTrackerPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; + headTrackerPort->txBufferTail = 0; + headTrackerPort->txBufferHead = 0; + } else { + SD(fprintf(stderr, "[GIMBAL_HTRK]: port NOT open!\n")); + return false; } } - SD(fprintf(stderr, "[GIMBAL]: port not found :(...\n")); - return false; + return gimbalPort || headTrackerPort; } #endif @@ -179,9 +205,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attittude.crch = (crc16 >> 8) & 0xFF; attittude.crcl = crc16 & 0xFF; - serialBeginWrite(htkPort); - serialWriteBuf(htkPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); - serialEndWrite(htkPort); + serialBeginWrite(gimbalPort); + serialWriteBuf(gimbalPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); + serialEndWrite(gimbalPort); } #endif diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 3d0188b6b1c..5173531a6fc 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -52,6 +52,7 @@ bool gimbalSerialDetect(void); void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime); bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice); gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); +bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice); #endif diff --git a/src/main/io/serial.h b/src/main/io/serial.h index c2429d9887a..aa9d709472e 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -58,6 +58,7 @@ typedef enum { FUNCTION_UNUSED_2 = (1 << 24), // 16777216 FUNCTION_MSP_OSD = (1 << 25), // 33554432 FUNCTION_GIMBAL = (1 << 26), // 67108864 + FUNCTION_GIMBAL_HEADTRACKER = (1 << 27), // 134217728 } serialPortFunction_e; #define FUNCTION_VTX_MSP FUNCTION_MSP_OSD From 1be5b7457b9862085110c598ba6d1fca0a678c01 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 22:37:55 +0200 Subject: [PATCH 134/429] Fix warning about unused variable --- src/main/io/gimbal_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index a77bf2b54a3..dd9166d07c7 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -71,6 +71,7 @@ bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice) bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice) { + UNUSED(gimbalDevice); return headTrackerPort; } From 9ad3f2408aebf8bc6c84a0027ea7a29006b7c3ff Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 8 Jun 2024 23:47:46 +0200 Subject: [PATCH 135/429] Parse incomming headtracking info from sidechannel --- src/main/io/gimbal_serial.c | 95 ++++++++++++++++++++++++++++++++----- src/main/io/gimbal_serial.h | 42 ++++++++++++---- 2 files changed, 117 insertions(+), 20 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index dd9166d07c7..4cbde173c36 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -53,9 +54,15 @@ gimbalVTable_t gimbalSerialVTable = { }; -gimbalDevice_t serialGimbalDevice = { - .vTable = &gimbalSerialVTable +static gimbalSerialHtrkState_t headTrackerState = { + .lastUpdate = 0, + .payloadSize = 0, + .state = WAITING_HDR1, +}; + +static gimbalDevice_t serialGimbalDevice = { + .vTable = &gimbalSerialVTable }; gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) @@ -118,7 +125,7 @@ bool gimbalSerialDetect(void) if (portConfig) { SD(fprintf(stderr, "[GIMBAL_HTRK]: found port...\n")); - headTrackerPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL_HEADTRACKER, NULL, NULL, + headTrackerPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL_HEADTRACKER, gimbalSerialHeadTrackerReceive, &headTrackerState, baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); if (headTrackerPort) { @@ -158,8 +165,8 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) const gimbalConfig_t *cfg = gimbalConfig(); - int yaw = 1500; - int pitch = 1500; + int pan = 1500; + int tilt = 1500; int roll = 1500; if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { @@ -177,13 +184,13 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { - yaw = rxGetChannelValue(cfg->panChannel - 1); - yaw = constrain(yaw, 1000, 2000); + pan = rxGetChannelValue(cfg->panChannel - 1); + pan = constrain(pan, 1000, 2000); } if (cfg->tiltChannel > 0) { - pitch = rxGetChannelValue(cfg->tiltChannel - 1); - pitch = constrain(pitch, 1000, 2000); + tilt = rxGetChannelValue(cfg->tiltChannel - 1); + tilt = constrain(tilt, 1000, 2000); } if (cfg->rollChannel > 0) { @@ -194,8 +201,10 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attittude.sensibility = cfg->sensitivity; //gimbal_scale5(-16, 15, -16, 15, cfg->sensitivity); - attittude.yaw = gimbal_scale12(1000, 2000, yaw); - attittude.pitch = gimbal_scale12(1000, 2000, pitch); + // Radio endpoints may need to be adjusted, as it seems ot go a bit bananas + // at the extremes + attittude.pan = gimbal_scale12(1000, 2000, pan); + attittude.tilt = gimbal_scale12(1000, 2000, tilt); attittude.roll = gimbal_scale12(1000, 2000, roll); uint16_t crc16 = 0; @@ -219,4 +228,68 @@ int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) return ret; } +static void resetState(gimbalSerialHtrkState_t *state) +{ + state->state = WAITING_HDR1; + state->payloadSize = 0; +} + +static bool checkCrc(gimbalHtkAttitudePkt_t *attitude) +{ + uint8_t *attitudePkt = (uint8_t *)attitude; + uint16_t crc = 0; + + for(uint8_t i = 0; i < sizeof(gimbalHtkAttitudePkt_t) - 2; ++i) { + crc = crc16_ccitt(crc, attitudePkt[i]); + } + + return (attitude->crch == ((crc >> 8) & 0xFF)) && + (attitude->crcl == (crc & 0xFF)); +} + + +void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) +{ + gimbalSerialHtrkState_t *state = (gimbalSerialHtrkState_t *)data; + uint8_t *payload = (uint8_t *)&(state->attittude); + payload += 2; + + switch(state->state) { + case WAITING_HDR1: + if(c == HTKATTITUDE_SYNC0) { + state->attittude.sync[0] = c; + state->state = WAITING_HDR2; + } + break; + case WAITING_HDR2: + if(c == HTKATTITUDE_SYNC1) { + state->attittude.sync[1] = c; + state->state = WAITING_PAYLOAD; + } else { + resetState(state); + } + break; + case WAITING_PAYLOAD: + payload[state->payloadSize++] = c; + if(state->payloadSize == HEADTRACKER_PAYLOAD_SIZE) + { + state->state = WAITING_CRCH; + } + break; + case WAITING_CRCH: + state->attittude.crch = c; + break; + case WAITING_CRCL: + state->attittude.crcl = c; + if(checkCrc(&(state->attittude))) { + state->lastUpdate = micros(); + state->pan = state->attittude.pan; + state->tilt = state->attittude.tilt; + state->roll = state->attittude.roll; + } + resetState(state); + break; + } +} + #endif \ No newline at end of file diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 5173531a6fc..3677551e88e 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -34,17 +34,40 @@ extern "C" { #define HTKATTITUDE_SYNC1 0x5A typedef struct gimbalHtkAttitudePkt_s { - uint8_t sync[2]; //data synchronization 0xA5, 0x5A - uint64_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] - int64_t sensibility:5; //Cloud sensibility [-16~15] - uint64_t reserved:4; //hold on to one's reserve - int64_t roll:12; //Roll angle [-2048~2047] => [-180~180] - int64_t pitch:12; //Pich angle [-2048~2047] => [-180~180] - int64_t yaw:12; //Yaw angle [-2048~2047] => [-180~180] - uint64_t crch:8; //Data validation H - uint64_t crcl:8; //Data validation L + uint8_t sync[2]; //data synchronization 0xA5, 0x5A + uint64_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] + int64_t sensibility:5; // Stabilization sensibility [-16~15] + uint64_t reserved:4; //hold on to one's reserve + int64_t roll:12; //Roll angle [-2048~2047] => [-180~180] + int64_t tilt:12; //Pich angle [-2048~2047] => [-180~180] + int64_t pan:12; //Yaw angle [-2048~2047] => [-180~180] + uint8_t crch; //Data validation H + uint8_t crcl; //Data validation L } __attribute__((packed)) gimbalHtkAttitudePkt_t; + +#define HEADTRACKER_PAYLOAD_SIZE (sizeof(gimbalHtkAttitudePkt_t) - 4) + +typedef enum { + WAITING_HDR1, + WAITING_HDR2, + WAITING_PAYLOAD, + WAITING_CRCH, + WAITING_CRCL, +} gimbalHeadtrackerState_e; + +typedef struct gimbalSerialHtrkState_s { + timeUs_t lastUpdate; + uint8_t payloadSize; + int16_t roll; //Roll angle [-2048~2047] => [-180~180] + int16_t tilt; //Pich angle [-2048~2047] => [-180~180] + int16_t pan; //Yaw angle [-2048~2047] => [-180~180] + gimbalHeadtrackerState_e state; + gimbalHtkAttitudePkt_t attittude; +} gimbalSerialHtrkState_t; + + + int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value); bool gimbalSerialInit(void); @@ -53,6 +76,7 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime); bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice); gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice); +void gimbalSerialHeadTrackerReceive(uint16_t c, void *data); #endif From 03f1a8b700704330980d62e1b0a88716fd31eb0f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 00:07:09 +0200 Subject: [PATCH 136/429] Plumbing for head tracking in place. 1 UART will control gimbal 1 UART will read headtracking info from external device INAV will control gimbal and will either forward headtracking attitude info or control gimbal directly. Sensitivity from headtracker unit is currently ignored. --- src/main/io/gimbal_serial.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 4cbde173c36..6e22cf710e6 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -178,10 +178,10 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) } // Follow center overrides all - if (IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { + if (IS_RC_MODE_ACTIVE(BOXGIMBALCENTER) || IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { attittude.mode = GIMBAL_MODE_FOLLOW; } - + if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { pan = rxGetChannelValue(cfg->panChannel - 1); @@ -199,6 +199,18 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) } } + if(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { + if (gimbalCommonHtrkIsEnabled() && (micros() - headTrackerState.lastUpdate) < MAX_INVALID_RX_PULSE_TIME) { + tilt = headTrackerState.tilt; + pan = headTrackerState.pan; + roll = headTrackerState.roll; + } else { + tilt = 0; + pan = 0; + roll = 0; + } + } + attittude.sensibility = cfg->sensitivity; //gimbal_scale5(-16, 15, -16, 15, cfg->sensitivity); // Radio endpoints may need to be adjusted, as it seems ot go a bit bananas From 99a351847ebb22abf45ddaa20abb6ed7bf8cfb88 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 00:40:22 +0200 Subject: [PATCH 137/429] Fix unit test build --- src/main/io/gimbal_serial.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 6e22cf710e6..9bdee4e8705 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -41,8 +41,17 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); #define GIMBAL_SERIAL_BUFFER_SIZE 512 + +#ifndef GIMBAL_UNIT_TEST static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; +static gimbalSerialHtrkState_t headTrackerState = { + .lastUpdate = 0, + .payloadSize = 0, + .state = WAITING_HDR1, +}; +#endif + static serialPort_t *headTrackerPort = NULL; static serialPort_t *gimbalPort = NULL; @@ -54,13 +63,6 @@ gimbalVTable_t gimbalSerialVTable = { }; -static gimbalSerialHtrkState_t headTrackerState = { - .lastUpdate = 0, - .payloadSize = 0, - .state = WAITING_HDR1, -}; - - static gimbalDevice_t serialGimbalDevice = { .vTable = &gimbalSerialVTable }; @@ -147,6 +149,8 @@ bool gimbalSerialDetect(void) #ifdef GIMBAL_UNIT_TEST void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) { + UNUSED(gimbalDevice); + UNUSED(currentTime); } #else void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) @@ -240,6 +244,7 @@ int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) return ret; } +#ifndef GIMBAL_UNIT_TEST static void resetState(gimbalSerialHtrkState_t *state) { state->state = WAITING_HDR1; @@ -303,5 +308,6 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) break; } } +#endif #endif \ No newline at end of file From e30ab94c8503acc1d560581c30f5aae7c2a66e0e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:23:21 +0200 Subject: [PATCH 138/429] Add uart sharing. FC rx goes to headtracking source. FC tx goes to gymbal. --- docs/Settings.md | 10 ++++++++++ src/main/config/parameter_group_ids.h | 3 ++- src/main/fc/settings.yaml | 11 ++++++++++- src/main/io/gimbal_serial.c | 9 +++++++-- src/main/io/gimbal_serial.h | 5 +++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index e328ba120cd..81e83a2ae04 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1492,6 +1492,16 @@ Gimbal sensitivity is similar to gain and will affect how quickly the gimbal wil --- +### gimbal_serial_single_uart + +Gimbal serial and headtracker device share same UART. FC RX goes to headtracker device, FC TX goes to gimbal. + +| Default | Min | Max | +| --- | --- | --- | +| OFF | OFF | ON | + +--- + ### gimbal_tilt_channel Gimbal tilt rc channel index. 0 is no channel. diff --git a/src/main/config/parameter_group_ids.h b/src/main/config/parameter_group_ids.h index 90085fae638..067d97bf0a1 100644 --- a/src/main/config/parameter_group_ids.h +++ b/src/main/config/parameter_group_ids.h @@ -127,7 +127,8 @@ #define PG_FW_AUTOLAND_APPROACH_CONFIG 1037 #define PG_OSD_CUSTOM_ELEMENTS_CONFIG 1038 #define PG_GIMBAL_CONFIG 1039 -#define PG_INAV_END PG_GIMBAL_CONFIG +#define PG_GIMBAL_SERIAL_CONFIG 1040 +#define PG_INAV_END PG_GIMBAL_SERIAL_CONFIG // OSD configuration (subject to change) //#define PG_OSD_FONT_CONFIG 2047 diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index c9525703e88..5b6a9bb34f4 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4226,4 +4226,13 @@ groups: default_value: 0 field: sensitivity min: -16 - max: 15 \ No newline at end of file + max: 15 + - name: PG_GIMBAL_SERIAL_CONFIG + type: gimbalSerialConfig_t + headers: ["io/gimbal_serial.h"] + condition: USE_SERIAL_GIMBAL + members: + - name: gimbal_serial_single_uart + description: "Gimbal serial and headtracker device share same UART. FC RX goes to headtracker device, FC TX goes to gimbal." + default_value: false + field: singleUart \ No newline at end of file diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 9bdee4e8705..49a1f69f543 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -38,6 +38,10 @@ #include #include +#include + +PG_REGISTER(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); + STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); #define GIMBAL_SERIAL_BUFFER_SIZE 512 @@ -104,10 +108,11 @@ bool gimbalSerialDetect(void) { SD(fprintf(stderr, "[GIMBAL]: serial Detect...\n")); serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_GIMBAL); + bool singleUart = gimbalSerialConfig()->singleUart; if (portConfig) { SD(fprintf(stderr, "[GIMBAL]: found port...\n")); - gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, NULL, NULL, + gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, singleUart ? gimbalSerialHeadTrackerReceive : NULL, singleUart ? &headTrackerState : NULL, baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); if (gimbalPort) { @@ -123,7 +128,7 @@ bool gimbalSerialDetect(void) } SD(fprintf(stderr, "[GIMBAL_HTRK]: headtracker Detect...\n")); - portConfig = findSerialPortConfig(FUNCTION_GIMBAL_HEADTRACKER); + portConfig = singleUart ? NULL : findSerialPortConfig(FUNCTION_GIMBAL_HEADTRACKER); if (portConfig) { SD(fprintf(stderr, "[GIMBAL_HTRK]: found port...\n")); diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 3677551e88e..a7136b0e24c 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -66,6 +66,11 @@ typedef struct gimbalSerialHtrkState_s { gimbalHtkAttitudePkt_t attittude; } gimbalSerialHtrkState_t; +typedef struct gimbalSerialConfig_s { + bool singleUart; +} gimbalSerialConfig_t; + +PG_DECLARE(gimbalSerialConfig_t, gimbalSerialConfig); int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value); From 327d173c46f51cd3ed387b38b214de98bdaec88b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 17:14:24 +0200 Subject: [PATCH 139/429] fix headtracker center position --- src/main/fc/fc_msp_box.c | 4 +-- src/main/io/gimbal_serial.c | 68 ++++++++++++++++++------------------- src/main/io/gimbal_serial.h | 4 +-- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index d295bb90e25..44a3ada88e3 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -370,9 +370,7 @@ void initActiveBoxIds(void) ADD_ACTIVE_BOX(BOXGIMBALTLOCK); ADD_ACTIVE_BOX(BOXGIMBALRLOCK); ADD_ACTIVE_BOX(BOXGIMBALCENTER); - if (gimbalCommonHtrkIsEnabled()) { - ADD_ACTIVE_BOX(BOXGIMBALHTRK); - } + ADD_ACTIVE_BOX(BOXGIMBALHTRK); } #endif } diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 49a1f69f543..09c6c857a96 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -50,7 +50,7 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_ static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; static gimbalSerialHtrkState_t headTrackerState = { - .lastUpdate = 0, + .expires = 0, .payloadSize = 0, .state = WAITING_HDR1, }; @@ -85,7 +85,7 @@ bool gimbalSerialIsReady(const gimbalDevice_t *gimbalDevice) bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice) { UNUSED(gimbalDevice); - return headTrackerPort; + return headTrackerPort || (gimbalSerialConfig()->singleUart && gimbalPort); } bool gimbalSerialInit(void) @@ -167,7 +167,7 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) return; } - gimbalHtkAttitudePkt_t attittude = { + gimbalHtkAttitudePkt_t attitude = { .sync = {HTKATTITUDE_SYNC0, HTKATTITUDE_SYNC1}, .mode = GIMBAL_MODE_DEFAULT }; @@ -179,16 +179,16 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) int roll = 1500; if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { - attittude.mode |= GIMBAL_MODE_TILT_LOCK; + attitude.mode |= GIMBAL_MODE_TILT_LOCK; } if (IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK)) { - attittude.mode |= GIMBAL_MODE_ROLL_LOCK; + attitude.mode |= GIMBAL_MODE_ROLL_LOCK; } // Follow center overrides all if (IS_RC_MODE_ACTIVE(BOXGIMBALCENTER) || IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { - attittude.mode = GIMBAL_MODE_FOLLOW; + attitude.mode = GIMBAL_MODE_FOLLOW; } if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { @@ -209,35 +209,35 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) } if(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { - if (gimbalCommonHtrkIsEnabled() && (micros() - headTrackerState.lastUpdate) < MAX_INVALID_RX_PULSE_TIME) { - tilt = headTrackerState.tilt; - pan = headTrackerState.pan; - roll = headTrackerState.roll; + if (gimbalCommonHtrkIsEnabled() && (micros() < headTrackerState.expires)) { + attitude.tilt = headTrackerState.tilt; + attitude.pan = headTrackerState.pan; + attitude.roll = headTrackerState.roll; } else { - tilt = 0; - pan = 0; - roll = 0; + attitude.tilt = 0; + attitude.pan = 0; + attitude.roll = 0; } + } else { + // Radio endpoints may need to be adjusted, as it seems ot go a bit + // bananas at the extremes + attitude.pan = gimbal_scale12(1000, 2000, pan); + attitude.tilt = gimbal_scale12(1000, 2000, tilt); + attitude.roll = gimbal_scale12(1000, 2000, roll); } - attittude.sensibility = cfg->sensitivity; //gimbal_scale5(-16, 15, -16, 15, cfg->sensitivity); - - // Radio endpoints may need to be adjusted, as it seems ot go a bit bananas - // at the extremes - attittude.pan = gimbal_scale12(1000, 2000, pan); - attittude.tilt = gimbal_scale12(1000, 2000, tilt); - attittude.roll = gimbal_scale12(1000, 2000, roll); + attitude.sensibility = cfg->sensitivity; uint16_t crc16 = 0; - uint8_t *b = (uint8_t *)&attittude; + uint8_t *b = (uint8_t *)&attitude; for (uint8_t i = 0; i < sizeof(gimbalHtkAttitudePkt_t) - 2; i++) { crc16 = crc16_ccitt(crc16, *(b + i)); } - attittude.crch = (crc16 >> 8) & 0xFF; - attittude.crcl = crc16 & 0xFF; + attitude.crch = (crc16 >> 8) & 0xFF; + attitude.crcl = crc16 & 0xFF; serialBeginWrite(gimbalPort); - serialWriteBuf(gimbalPort, (uint8_t *)&attittude, sizeof(gimbalHtkAttitudePkt_t)); + serialWriteBuf(gimbalPort, (uint8_t *)&attitude, sizeof(gimbalHtkAttitudePkt_t)); serialEndWrite(gimbalPort); } #endif @@ -273,19 +273,19 @@ static bool checkCrc(gimbalHtkAttitudePkt_t *attitude) void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) { gimbalSerialHtrkState_t *state = (gimbalSerialHtrkState_t *)data; - uint8_t *payload = (uint8_t *)&(state->attittude); + uint8_t *payload = (uint8_t *)&(state->attitude); payload += 2; switch(state->state) { case WAITING_HDR1: if(c == HTKATTITUDE_SYNC0) { - state->attittude.sync[0] = c; + state->attitude.sync[0] = c; state->state = WAITING_HDR2; } break; case WAITING_HDR2: if(c == HTKATTITUDE_SYNC1) { - state->attittude.sync[1] = c; + state->attitude.sync[1] = c; state->state = WAITING_PAYLOAD; } else { resetState(state); @@ -299,15 +299,15 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) } break; case WAITING_CRCH: - state->attittude.crch = c; + state->attitude.crch = c; break; case WAITING_CRCL: - state->attittude.crcl = c; - if(checkCrc(&(state->attittude))) { - state->lastUpdate = micros(); - state->pan = state->attittude.pan; - state->tilt = state->attittude.tilt; - state->roll = state->attittude.roll; + state->attitude.crcl = c; + if(checkCrc(&(state->attitude))) { + state->expires = micros() + MAX_INVALID_RX_PULSE_TIME; + state->pan = state->attitude.pan; + state->tilt = state->attitude.tilt; + state->roll = state->attitude.roll; } resetState(state); break; diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index a7136b0e24c..2cae71f9dd6 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -57,13 +57,13 @@ typedef enum { } gimbalHeadtrackerState_e; typedef struct gimbalSerialHtrkState_s { - timeUs_t lastUpdate; + timeUs_t expires; uint8_t payloadSize; int16_t roll; //Roll angle [-2048~2047] => [-180~180] int16_t tilt; //Pich angle [-2048~2047] => [-180~180] int16_t pan; //Yaw angle [-2048~2047] => [-180~180] gimbalHeadtrackerState_e state; - gimbalHtkAttitudePkt_t attittude; + gimbalHtkAttitudePkt_t attitude; } gimbalSerialHtrkState_t; typedef struct gimbalSerialConfig_s { From 21ccfa5233e96b28a09836b8409a78b05de51fed Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 18:36:25 +0200 Subject: [PATCH 140/429] Switch based changing from head tracker to center and sliders verified working --- src/main/build/debug.h | 1 + src/main/drivers/gimbal_common.c | 3 +++ src/main/fc/settings.yaml | 2 +- src/main/io/gimbal_serial.c | 19 ++++++++++++++++++- src/main/io/gimbal_serial.h | 2 ++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 904e036c7f1..fea424b9005 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -75,6 +75,7 @@ typedef enum { DEBUG_LANDING, DEBUG_POS_EST, DEBUG_ADAPTIVE_FILTER, + DEBUG_HEADTRACKING, DEBUG_COUNT } debugType_e; diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index 9fcfcc2b9bc..bd066250ce5 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -102,12 +102,15 @@ bool gimbalCommonIsEnabled(void) bool gimbalCommonHtrkIsEnabled(void) { + return true; + /* const gimbalDevice_t *dev = gimbalCommonDevice(); if(dev && dev->vTable->hasHeadTracker) { return dev->vTable->hasHeadTracker(dev); } return false; + */ } #endif \ No newline at end of file diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 5b6a9bb34f4..ab3b1de545d 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -83,7 +83,7 @@ tables: values: ["NONE", "AGL", "FLOW_RAW", "FLOW", "ALWAYS", "SAG_COMP_VOLTAGE", "VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC", "NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE", - "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER"] + "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER", "HEADTRACKER" ] - name: aux_operator values: ["OR", "AND"] enum: modeActivationOperator_e diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 09c6c857a96..4ade9fdbdc8 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -213,12 +213,15 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attitude.tilt = headTrackerState.tilt; attitude.pan = headTrackerState.pan; attitude.roll = headTrackerState.roll; + DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { attitude.tilt = 0; attitude.pan = 0; attitude.roll = 0; + DEBUG_SET(DEBUG_HEADTRACKING, 4, -1); } } else { + DEBUG_SET(DEBUG_HEADTRACKING, 4, 0); // Radio endpoints may need to be adjusted, as it seems ot go a bit // bananas at the extremes attitude.pan = gimbal_scale12(1000, 2000, pan); @@ -226,6 +229,10 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attitude.roll = gimbal_scale12(1000, 2000, roll); } + DEBUG_SET(DEBUG_HEADTRACKING, 5, attitude.pan); + DEBUG_SET(DEBUG_HEADTRACKING, 6, attitude.tilt); + DEBUG_SET(DEBUG_HEADTRACKING, 7, attitude.roll); + attitude.sensibility = cfg->sensitivity; uint16_t crc16 = 0; @@ -272,10 +279,16 @@ static bool checkCrc(gimbalHtkAttitudePkt_t *attitude) void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) { + static int charCount = 0; + static int pktCount = 0; + static int errorCount = 0; gimbalSerialHtrkState_t *state = (gimbalSerialHtrkState_t *)data; uint8_t *payload = (uint8_t *)&(state->attitude); payload += 2; + DEBUG_SET(DEBUG_HEADTRACKING, 0, charCount++); + DEBUG_SET(DEBUG_HEADTRACKING, 1, state->state); + switch(state->state) { case WAITING_HDR1: if(c == HTKATTITUDE_SYNC0) { @@ -300,14 +313,18 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) break; case WAITING_CRCH: state->attitude.crch = c; + state->state = WAITING_CRCL; break; case WAITING_CRCL: state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { - state->expires = micros() + MAX_INVALID_RX_PULSE_TIME; + state->expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; state->pan = state->attitude.pan; state->tilt = state->attitude.tilt; state->roll = state->attitude.roll; + DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); + } else { + DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); } resetState(state); break; diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 2cae71f9dd6..8ee8c28b58c 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -30,6 +30,8 @@ extern "C" { #ifdef USE_SERIAL_GIMBAL +#define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) + #define HTKATTITUDE_SYNC0 0xA5 #define HTKATTITUDE_SYNC1 0x5A typedef struct gimbalHtkAttitudePkt_s From 5afef318eeeda8347bed0a7dc93abce179e6044f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:49:07 +0200 Subject: [PATCH 141/429] Small fixes Some debugging info and fixes single uart setting --- src/main/drivers/gimbal_common.c | 9 +++++---- src/main/fc/fc_msp_box.c | 2 +- src/main/fc/settings.yaml | 3 ++- src/main/io/gimbal_serial.c | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index bd066250ce5..bf2db50a261 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -22,6 +22,8 @@ #include #include #include + +#include #include #include "common/time.h" @@ -42,6 +44,7 @@ void gimbalCommonInit(void) void gimbalCommonSetDevice(gimbalDevice_t *gimbalDevice) { + SD(fprintf(stderr, "[GIMBAL]: device added %p\n", gimbalDevice)); commonGimbalDevice = gimbalDevice; } @@ -102,15 +105,13 @@ bool gimbalCommonIsEnabled(void) bool gimbalCommonHtrkIsEnabled(void) { - return true; - /* const gimbalDevice_t *dev = gimbalCommonDevice(); if(dev && dev->vTable->hasHeadTracker) { - return dev->vTable->hasHeadTracker(dev); + bool ret = dev->vTable->hasHeadTracker(dev); + return ret; } return false; - */ } #endif \ No newline at end of file diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 44a3ada88e3..92776a107f9 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -449,7 +449,7 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) if(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); - } else if (IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { + } else if (gimbalCommonHtrkIsEnabled() && IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)), BOXGIMBALHTRK); } else { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALTLOCK); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index ab3b1de545d..b6bf0cbf11e 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4234,5 +4234,6 @@ groups: members: - name: gimbal_serial_single_uart description: "Gimbal serial and headtracker device share same UART. FC RX goes to headtracker device, FC TX goes to gimbal." - default_value: false + type: bool + default_value: OFF field: singleUart \ No newline at end of file diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 4ade9fdbdc8..4382904fa23 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -91,6 +91,7 @@ bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice) bool gimbalSerialInit(void) { if(gimbalSerialDetect()) { + SD(fprintf(stderr, "Setting gimbal device\n")); gimbalCommonSetDevice(&serialGimbalDevice); return true; } @@ -147,6 +148,7 @@ bool gimbalSerialDetect(void) } } + SD(fprintf(stderr, "[GIMBAL]: gimbalPort: %p headTrackerPort: %p\n", gimbalPort, headTrackerPort)); return gimbalPort || headTrackerPort; } #endif From 3b42180117dd166019bb8f6e2f78024026c0f90e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:10:04 +0200 Subject: [PATCH 142/429] Placeholders for head tracker as servo input --- src/main/flight/servos.c | 6 ++++++ src/main/flight/servos.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index f38a4ea108c..f8e51c008a2 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -347,6 +347,12 @@ void servoMixer(float dT) input[INPUT_RC_CH16] = GET_RX_CHANNEL_INPUT(AUX12); #undef GET_RX_CHANNEL_INPUT +#ifdef USE_SERIAL_GIMBAL + input[INPUT_HEADTRACKER_PAN] = 0; + input[INPUT_HEADTRACKER_TILT] = 0; + input[INPUT_HEADTRACKER_ROLL] = 0; +#endif + #ifdef USE_SIMULATOR simulatorData.input[INPUT_STABILIZED_ROLL] = input[INPUT_STABILIZED_ROLL]; simulatorData.input[INPUT_STABILIZED_PITCH] = input[INPUT_STABILIZED_PITCH]; diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 1dd65912218..d271142ece0 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -63,6 +63,9 @@ typedef enum { INPUT_GVAR_6 = 36, INPUT_GVAR_7 = 37, INPUT_MIXER_TRANSITION = 38, + INPUT_HEADTRACKER_PAN = 39, + INPUT_HEADTRACKER_TILT = 40, + INPUT_HEADTRACKER_ROLL = 41, INPUT_SOURCE_COUNT } inputSource_e; From 498ad3b578aa811584b6776874a748219f0a968b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:29:52 +0200 Subject: [PATCH 143/429] Basic plumbing on servos. Need to separate head tracker in headtracker common and headtracker serial. Potentially add headtracker msp --- src/main/flight/servos.c | 13 ++++++++++--- src/main/io/gimbal_serial.c | 18 +++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index f8e51c008a2..a214765bb25 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -38,6 +38,7 @@ #include "drivers/pwm_output.h" #include "drivers/pwm_mapping.h" #include "drivers/time.h" +#include "drivers/gimbal_common.h" #include "fc/config.h" #include "fc/fc_core.h" @@ -348,9 +349,15 @@ void servoMixer(float dT) #undef GET_RX_CHANNEL_INPUT #ifdef USE_SERIAL_GIMBAL - input[INPUT_HEADTRACKER_PAN] = 0; - input[INPUT_HEADTRACKER_TILT] = 0; - input[INPUT_HEADTRACKER_ROLL] = 0; + if(gimbalCommonHtrkIsEnabled() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { + input[INPUT_HEADTRACKER_PAN] = 0; + input[INPUT_HEADTRACKER_TILT] = 0; + input[INPUT_HEADTRACKER_ROLL] = 0; + } else { + input[INPUT_HEADTRACKER_PAN] = 0; + input[INPUT_HEADTRACKER_TILT] = 0; + input[INPUT_HEADTRACKER_ROLL] = 0; + } #endif #ifdef USE_SIMULATOR diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 4382904fa23..d6135c1b0fe 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -176,9 +176,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) const gimbalConfig_t *cfg = gimbalConfig(); - int pan = 1500; - int tilt = 1500; - int roll = 1500; + int pan = PWM_RANGE_MIDDLE; + int tilt = PWM_RANGE_MIDDLE; + int roll = PWM_RANGE_MIDDLE; if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { attitude.mode |= GIMBAL_MODE_TILT_LOCK; @@ -196,17 +196,17 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { pan = rxGetChannelValue(cfg->panChannel - 1); - pan = constrain(pan, 1000, 2000); + pan = constrain(pan, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->tiltChannel > 0) { tilt = rxGetChannelValue(cfg->tiltChannel - 1); - tilt = constrain(tilt, 1000, 2000); + tilt = constrain(tilt, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->rollChannel > 0) { roll = rxGetChannelValue(cfg->rollChannel - 1); - roll = constrain(roll, 1000, 2000); + roll = constrain(roll, PWM_RANGE_MIN, PWM_RANGE_MAX); } } @@ -226,9 +226,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) DEBUG_SET(DEBUG_HEADTRACKING, 4, 0); // Radio endpoints may need to be adjusted, as it seems ot go a bit // bananas at the extremes - attitude.pan = gimbal_scale12(1000, 2000, pan); - attitude.tilt = gimbal_scale12(1000, 2000, tilt); - attitude.roll = gimbal_scale12(1000, 2000, roll); + attitude.pan = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, pan); + attitude.tilt = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, tilt); + attitude.roll = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, roll); } DEBUG_SET(DEBUG_HEADTRACKING, 5, attitude.pan); From 8f3f1469819239fb9f9cbb364988e5c4e329e6fc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:37:15 +0200 Subject: [PATCH 144/429] Make serial headtracker input available on the mixer tab --- docs/Settings.md | 10 +++ src/main/CMakeLists.txt | 2 + src/main/config/parameter_group_ids.h | 3 +- src/main/fc/fc_init.c | 12 +++- src/main/fc/fc_tasks.c | 14 +++++ src/main/fc/settings.yaml | 24 ++++++-- src/main/flight/servos.c | 10 +-- src/main/io/gimbal_serial.c | 89 +++++++++++++++++++++++++++ src/main/io/gimbal_serial.h | 13 ++++ src/main/scheduler/scheduler.h | 4 ++ src/main/target/common.h | 1 + 11 files changed, 170 insertions(+), 12 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 81e83a2ae04..1328128fc32 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1822,6 +1822,16 @@ This setting limits yaw rotation rate that HEADING_HOLD controller can request f --- +### headtracker_type + +Type of headtrackr dervice + +| Default | Min | Max | +| --- | --- | --- | +| SERIAL | | | + +--- + ### hott_alarm_sound_interval Battery alarm delay in seconds for Hott telemetry diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 91aa45d42e3..7162bc4faa4 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -179,6 +179,8 @@ main_sources(COMMON_SRC drivers/flash_w25n01g.h drivers/gimbal_common.h drivers/gimbal_common.c + drivers/headtracker_common.h + drivers/headtracker_common.c drivers/io.c drivers/io.h drivers/io_pcf8574.c diff --git a/src/main/config/parameter_group_ids.h b/src/main/config/parameter_group_ids.h index 067d97bf0a1..b4062201c72 100644 --- a/src/main/config/parameter_group_ids.h +++ b/src/main/config/parameter_group_ids.h @@ -128,7 +128,8 @@ #define PG_OSD_CUSTOM_ELEMENTS_CONFIG 1038 #define PG_GIMBAL_CONFIG 1039 #define PG_GIMBAL_SERIAL_CONFIG 1040 -#define PG_INAV_END PG_GIMBAL_SERIAL_CONFIG +#define PG_HEADTRACKER_CONFIG 1041 +#define PG_INAV_END PG_HEADTRACKER_CONFIG // OSD configuration (subject to change) //#define PG_OSD_FONT_CONFIG 2047 diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index 76aa9d79511..b57a60a9f69 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -54,6 +54,7 @@ #include "drivers/io.h" #include "drivers/flash.h" #include "drivers/gimbal_common.h" +#include "drivers/headtracker_common.h" #include "drivers/light_led.h" #include "drivers/nvic.h" #include "drivers/osd.h" @@ -689,13 +690,20 @@ void init(void) initDShotCommands(); #endif - fprintf(stderr, "HERE\n"); #ifdef USE_SERIAL_GIMBAL - fprintf(stderr, "HERE2\n"); gimbalCommonInit(); + // Needs to be called before gimbalSerialHeadTrackerInit gimbalSerialInit(); #endif +#ifdef USE_HEADTRACKER + headTrackerCommonInit(); +#ifdef USE_SERIAL_GIMBAL + // Needs to be called after gimbalSerialInit + gimbalSerialHeadTrackerInit(); +#endif +#endif + // Latch active features AGAIN since some may be modified by init(). latchActiveFeatures(); motorControlEnable = true; diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 9dff7c70e6f..3dc126cf0c8 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -432,6 +432,10 @@ void fcTasksInit(void) setTaskEnabled(TASK_GIMBAL, true); #endif +#ifdef USE_HEADTRACKER + setTaskEnabled(TASK_HEADTRACKER, true); +#endif + #ifdef USE_ADAPTIVE_FILTER setTaskEnabled(TASK_ADAPTIVE_FILTER, (gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE)); #endif @@ -707,4 +711,14 @@ cfTask_t cfTasks[TASK_COUNT] = { .staticPriority = TASK_PRIORITY_MEDIUM, }, #endif + +#ifdef USE_SERIAL_GIMBAL + [TASK_HEADTRACKER] = { + .taskName = "HEADTRACKER", + .taskFunc = taskUpdateGimbal, + .desiredPeriod = TASK_PERIOD_HZ(50), + .staticPriority = TASK_PRIORITY_MEDIUM, + }, +#endif + }; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index b6bf0cbf11e..ee1ba4140f0 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -194,6 +194,9 @@ tables: - name: gyro_filter_mode values: ["STATIC", "DYNAMIC", "ADAPTIVE"] enum: gyroFilterType_e + - name: headtracker_dev_type + values: ["NONE", "SERIAL", "MSP"] + enum: headTrackerDevType_e constants: RPYL_PID_MIN: 0 @@ -4232,8 +4235,19 @@ groups: headers: ["io/gimbal_serial.h"] condition: USE_SERIAL_GIMBAL members: - - name: gimbal_serial_single_uart - description: "Gimbal serial and headtracker device share same UART. FC RX goes to headtracker device, FC TX goes to gimbal." - type: bool - default_value: OFF - field: singleUart \ No newline at end of file + - name: gimbal_serial_single_uart + description: "Gimbal serial and headtracker device share same UART. FC RX goes to headtracker device, FC TX goes to gimbal." + type: bool + default_value: OFF + field: singleUart + - name: PG_HEADTRACKER_CONFIG + type: headTrackerConfig_t + headers: ["drivers/headtracker_common.h"] + condition: USE_HEADTRACKER + members: + - name: headtracker_type + description: "Type of headtrackr dervice" + default_value: "SERIAL" + field: devType + type: uint8_t + table: headtracker_dev_type diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index a214765bb25..3e93b5f082b 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -39,6 +39,7 @@ #include "drivers/pwm_mapping.h" #include "drivers/time.h" #include "drivers/gimbal_common.h" +#include "drivers/headtracker_common.h" #include "fc/config.h" #include "fc/fc_core.h" @@ -349,10 +350,11 @@ void servoMixer(float dT) #undef GET_RX_CHANNEL_INPUT #ifdef USE_SERIAL_GIMBAL - if(gimbalCommonHtrkIsEnabled() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { - input[INPUT_HEADTRACKER_PAN] = 0; - input[INPUT_HEADTRACKER_TILT] = 0; - input[INPUT_HEADTRACKER_ROLL] = 0; + headTrackerDevice_t *dev = headTrackerCommonDevice(); + if(dev && headTrackerCommonIsValid(dev) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { + input[INPUT_HEADTRACKER_PAN] = headTrackerCommonGetPanPWM(dev) - PWM_RANGE_MIDDLE; + input[INPUT_HEADTRACKER_TILT] = headTrackerCommonGetTiltPWM(dev) - PWM_RANGE_MIDDLE; + input[INPUT_HEADTRACKER_ROLL] = headTrackerCommonGetRollPWM(dev) - PWM_RANGE_MIDDLE; } else { input[INPUT_HEADTRACKER_PAN] = 0; input[INPUT_HEADTRACKER_TILT] = 0; diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index d6135c1b0fe..0dd28b9dd3e 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -332,6 +333,94 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) break; } } + +#ifdef USE_HEADTRACKER + +static headtrackerVTable_t headTrackerVTable = { + .process = headtrackerSerialProcess, + .getDeviceType = headtrackerSerialGetDeviceType, + .isReady = headTrackerSerialIsReady, + .isValid = headTrackerSerialIsValid, + .getPanPWM = headTrackerSerialGetPanPWM, + .getTiltPWM = headTrackerSerialGetTiltPWM, + .getRollPWM = headTrackerSerialGetRollPWM, +}; + +headTrackerDevice_t headTrackerDevice = { + .vTable = &headTrackerVTable, +}; + +bool gimbalSerialHeadTrackerInit(void) +{ + if(headTrackerConfig()->devType == HEADTRACKER_SERIAL) { + headTrackerCommonSetDevice(&headTrackerDevice); + } + + return false; +} + +void headtrackerSerialProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs) +{ + UNUSED(currentTimeUs); + headTrackerDevice->expires = headTrackerState.expires; + return; +} + +headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + return HEADTRACKER_SERIAL; +} + +bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + + if(headTrackerPort || (gimbalSerialConfig()->singleUart && gimbalPort)) { + return headTrackerSerialIsValid(headTrackerDevice); + } + + return false; +} + +bool headTrackerSerialIsValid(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + return micros() < headTrackerState.expires; +} + +int headTrackerSerialGetPanPWM(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + if(micros() < headTrackerState.expires) { + return scaleRange(headTrackerState.pan, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + } + + return PWM_RANGE_MIDDLE; +} + +int headTrackerSerialGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + if(micros() < headTrackerState.expires) { + return scaleRange(headTrackerState.tilt, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + } + + return PWM_RANGE_MIDDLE; +} + +int headTrackerSerialGetRollPWM(const headTrackerDevice_t *headTrackerDevice) +{ + UNUSED(headTrackerDevice); + if(micros() < headTrackerState.expires) { + return scaleRange(headTrackerState.roll, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + } + + return PWM_RANGE_MIDDLE; +} + +#endif + #endif #endif \ No newline at end of file diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 8ee8c28b58c..c2f01aa1b90 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -23,6 +23,7 @@ #include "common/time.h" #include "drivers/gimbal_common.h" +#include "drivers/headtracker_common.h" #ifdef __cplusplus extern "C" { @@ -85,6 +86,18 @@ gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice); bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice); void gimbalSerialHeadTrackerReceive(uint16_t c, void *data); + +#ifdef USE_HEADTRACKER +bool gimbalSerialHeadTrackerInit(void); +void headtrackerSerialProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); +headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *headTrackerDevice); +bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice); +bool headTrackerSerialIsValid(const headTrackerDevice_t *headTrackerDevice); +int headTrackerSerialGetPanPWM(const headTrackerDevice_t *headTrackerDevice); +int headTrackerSerialGetTiltPWM(const headTrackerDevice_t *headTrackerDevice); +int headTrackerSerialGetRollPWM(const headTrackerDevice_t *headTrackerDevice); +#endif + #endif #ifdef __cplusplus diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index d8a6a34c8ef..a43206840fe 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -129,6 +129,10 @@ typedef enum { TASK_GIMBAL, #endif +#ifdef USE_HEADTRACKER + TASK_HEADTRACKER, +#endif + /* Count of real tasks */ TASK_COUNT, diff --git a/src/main/target/common.h b/src/main/target/common.h index 84dc7bf5a72..7f2a8b221f1 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -191,6 +191,7 @@ #endif #define USE_SERIAL_GIMBAL +#define USE_HEADTRACKER //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) From 5865ab990dfe056a58b3cfa4ec80c4efda8d08af Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:04:58 +0200 Subject: [PATCH 145/429] Build fixed for no gimbal or no headtracker --- src/main/fc/fc_msp_box.c | 11 ++++++- src/main/fc/fc_tasks.c | 5 +-- src/main/flight/servos.c | 6 +++- src/main/io/gimbal_serial.c | 66 ++++++++++++++++++++++++------------- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/src/main/fc/fc_msp_box.c b/src/main/fc/fc_msp_box.c index 92776a107f9..a20a23e0b24 100644 --- a/src/main/fc/fc_msp_box.c +++ b/src/main/fc/fc_msp_box.c @@ -44,6 +44,7 @@ #include "telemetry/telemetry.h" #include "drivers/gimbal_common.h" +#include "drivers/headtracker_common.h" #define BOX_SUFFIX ';' #define BOX_SUFFIX_LEN 1 @@ -370,6 +371,10 @@ void initActiveBoxIds(void) ADD_ACTIVE_BOX(BOXGIMBALTLOCK); ADD_ACTIVE_BOX(BOXGIMBALRLOCK); ADD_ACTIVE_BOX(BOXGIMBALCENTER); + } +#endif +#ifdef USE_HEADTRACKER + if(headTrackerConfig()->devType != HEADTRACKER_NONE) { ADD_ACTIVE_BOX(BOXGIMBALHTRK); } #endif @@ -447,15 +452,19 @@ void packBoxModeFlags(boxBitmask_t * mspBoxModeFlags) #endif CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXANGLEHOLD)), BOXANGLEHOLD); +#ifdef USE_SERIAL_GIMBAL if(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALCENTER); - } else if (gimbalCommonHtrkIsEnabled() && IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { +#ifdef USE_HEADTRACKER + } else if (headTrackerCommonIsReady(headTrackerCommonDevice()) && IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)), BOXGIMBALHTRK); +#endif } else { CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALTLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALRLOCK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); CHECK_ACTIVE_BOX(IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)), BOXGIMBALRLOCK); } +#endif memset(mspBoxModeFlags, 0, sizeof(boxBitmask_t)); for (uint32_t i = 0; i < activeBoxIdCount; i++) { diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 3dc126cf0c8..1179f057fa5 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -35,6 +35,7 @@ #include "drivers/stack_check.h" #include "drivers/pwm_mapping.h" #include "drivers/gimbal_common.h" +#include "drivers/headtracker_common.h" #include "fc/cli.h" #include "fc/config.h" @@ -712,10 +713,10 @@ cfTask_t cfTasks[TASK_COUNT] = { }, #endif -#ifdef USE_SERIAL_GIMBAL +#ifdef USE_HEADTRACKER [TASK_HEADTRACKER] = { .taskName = "HEADTRACKER", - .taskFunc = taskUpdateGimbal, + .taskFunc = taskUpdateHeadTracker, .desiredPeriod = TASK_PERIOD_HZ(50), .staticPriority = TASK_PRIORITY_MEDIUM, }, diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index 3e93b5f082b..3830660660a 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -349,7 +349,7 @@ void servoMixer(float dT) input[INPUT_RC_CH16] = GET_RX_CHANNEL_INPUT(AUX12); #undef GET_RX_CHANNEL_INPUT -#ifdef USE_SERIAL_GIMBAL +#ifdef USE_HEADTRACKER headTrackerDevice_t *dev = headTrackerCommonDevice(); if(dev && headTrackerCommonIsValid(dev) && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { input[INPUT_HEADTRACKER_PAN] = headTrackerCommonGetPanPWM(dev) - PWM_RANGE_MIDDLE; @@ -360,6 +360,10 @@ void servoMixer(float dT) input[INPUT_HEADTRACKER_TILT] = 0; input[INPUT_HEADTRACKER_ROLL] = 0; } +#else + input[INPUT_HEADTRACKER_PAN] = 0; + input[INPUT_HEADTRACKER_TILT] = 0; + input[INPUT_HEADTRACKER_ROLL] = 0; #endif #ifdef USE_SIMULATOR diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 0dd28b9dd3e..b4b1ef3b1ca 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -112,10 +112,17 @@ bool gimbalSerialDetect(void) serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_GIMBAL); bool singleUart = gimbalSerialConfig()->singleUart; + if (portConfig) { SD(fprintf(stderr, "[GIMBAL]: found port...\n")); +#ifdef USE_HEADTRACKER gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, singleUart ? gimbalSerialHeadTrackerReceive : NULL, singleUart ? &headTrackerState : NULL, baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); +#else + UNUSED(singleUart); + gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, NULL, NULL, + baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); +#endif if (gimbalPort) { SD(fprintf(stderr, "[GIMBAL]: port open!\n")); @@ -129,28 +136,8 @@ bool gimbalSerialDetect(void) } } - SD(fprintf(stderr, "[GIMBAL_HTRK]: headtracker Detect...\n")); - portConfig = singleUart ? NULL : findSerialPortConfig(FUNCTION_GIMBAL_HEADTRACKER); - - if (portConfig) { - SD(fprintf(stderr, "[GIMBAL_HTRK]: found port...\n")); - headTrackerPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL_HEADTRACKER, gimbalSerialHeadTrackerReceive, &headTrackerState, - baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); - - if (headTrackerPort) { - SD(fprintf(stderr, "[GIMBAL_HTRK]: port open!\n")); - headTrackerPort->txBuffer = txBuffer; - headTrackerPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; - headTrackerPort->txBufferTail = 0; - headTrackerPort->txBufferHead = 0; - } else { - SD(fprintf(stderr, "[GIMBAL_HTRK]: port NOT open!\n")); - return false; - } - } - - SD(fprintf(stderr, "[GIMBAL]: gimbalPort: %p headTrackerPort: %p\n", gimbalPort, headTrackerPort)); - return gimbalPort || headTrackerPort; + SD(fprintf(stderr, "[GIMBAL]: gimbalPort\n", gimbalPort)); + return gimbalPort; } #endif @@ -350,8 +337,43 @@ headTrackerDevice_t headTrackerDevice = { .vTable = &headTrackerVTable, }; +bool gimbalSerialHeadTrackerDetect(void) +{ + bool singleUart = gimbalSerialConfig()->singleUart; + + SD(fprintf(stderr, "[GIMBAL_HTRK]: headtracker Detect...\n")); + serialPortConfig_t *portConfig = singleUart ? NULL : findSerialPortConfig(FUNCTION_GIMBAL_HEADTRACKER); + + if (portConfig) { + SD(fprintf(stderr, "[GIMBAL_HTRK]: found port...\n")); + headTrackerPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL_HEADTRACKER, gimbalSerialHeadTrackerReceive, &headTrackerState, + baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); + + if (headTrackerPort) { + SD(fprintf(stderr, "[GIMBAL_HTRK]: port open!\n")); + headTrackerPort->txBuffer = txBuffer; + headTrackerPort->txBufferSize = GIMBAL_SERIAL_BUFFER_SIZE; + headTrackerPort->txBufferTail = 0; + headTrackerPort->txBufferHead = 0; + } else { + SD(fprintf(stderr, "[GIMBAL_HTRK]: port NOT open!\n")); + return false; + } + } + + SD(fprintf(stderr, "[GIMBAL]: gimbalPort: %p headTrackerPort: %p\n", gimbalPort, headTrackerPort)); + return (singleUart && gimbalPort) || headTrackerPort; +} + bool gimbalSerialHeadTrackerInit(void) { + if(gimbalSerialHeadTrackerDetect()) { + SD(fprintf(stderr, "Setting gimbal device\n")); + gimbalCommonSetDevice(&serialGimbalDevice); + return true; + } + + if(headTrackerConfig()->devType == HEADTRACKER_SERIAL) { headTrackerCommonSetDevice(&headTrackerDevice); } From 5efba06ad5425de43fdbe5590a3d5c93edd81ed2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:10:34 +0200 Subject: [PATCH 146/429] Missing file --- src/main/io/gimbal_serial.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index c2f01aa1b90..7e342994a38 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -89,6 +89,7 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data); #ifdef USE_HEADTRACKER bool gimbalSerialHeadTrackerInit(void); +bool gimbalSerialHeadTrackerDetect(void); void headtrackerSerialProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *headTrackerDevice); bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice); From 03698d688d0025585ea556e6ec26559809c76471 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:11:10 +0200 Subject: [PATCH 147/429] New files --- src/main/drivers/headtracker_common.c | 152 ++++++++++++++++++++++++++ src/main/drivers/headtracker_common.h | 95 ++++++++++++++++ 2 files changed, 247 insertions(+) create mode 100644 src/main/drivers/headtracker_common.c create mode 100644 src/main/drivers/headtracker_common.h diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c new file mode 100644 index 00000000000..6f10eb1a5a9 --- /dev/null +++ b/src/main/drivers/headtracker_common.c @@ -0,0 +1,152 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include "platform.h" + +#ifdef USE_HEADTRACKER + +#include +#include +#include + +#include +#include + +#include "common/time.h" +#include "common/maths.h" + +#include "fc/cli.h" + +#include "rx/rx.h" + +#include "drivers/headtracker_common.h" +#include "drivers/time.h" + + +PG_REGISTER(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); + + +static headTrackerDevice_t *commonHeadTrackerDevice = NULL; + +void headTrackerCommonInit(void) +{ +} + +void headTrackerCommonSetDevice(headTrackerDevice_t *headTrackerDevice) +{ + SD(fprintf(stderr, "[headTracker]: device added %p\n", headTrackerDevice)); + commonHeadTrackerDevice = headTrackerDevice; +} + +headTrackerDevice_t *headTrackerCommonDevice(void) +{ + return commonHeadTrackerDevice; +} + +void headTrackerCommonProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs) +{ + if (headTrackerDevice && headTrackerDevice->vTable->process && headTrackerCommonIsReady(headTrackerDevice)) { + headTrackerDevice->vTable->process(headTrackerDevice, currentTimeUs); + } +} + +headTrackerDevType_e headTrackerCommonGetDeviceType(headTrackerDevice_t *headTrackerDevice) +{ + if (!headTrackerDevice || !headTrackerDevice->vTable->getDeviceType) { + return HEADTRACKER_UNKNOWN; + } + + return headTrackerDevice->vTable->getDeviceType(headTrackerDevice); +} + +bool headTrackerCommonIsReady(headTrackerDevice_t *headTrackerDevice) +{ + if (headTrackerDevice && headTrackerDevice->vTable->isReady) { + return headTrackerDevice->vTable->isReady(headTrackerDevice); + } + return false; +} + +int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { + return headTrackerDevice->vTable->getPanPWM(headTrackerDevice); + } + + return constrain(headTrackerDevice->pan, PWM_RANGE_MIN, PWM_RANGE_MAX); +} + +int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { + return headTrackerDevice->vTable->getTiltPWM(headTrackerDevice); + } + + return constrain(headTrackerDevice->tilt, PWM_RANGE_MIN, PWM_RANGE_MAX); +} + +int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { + return headTrackerDevice->vTable->getTiltPWM(headTrackerDevice); + } + + return constrain(headTrackerDevice->roll, PWM_RANGE_MIN, PWM_RANGE_MAX); +} + + +#ifdef headTracker_UNIT_TEST +void taskUpdateHeadTracker(timeUs_t currentTimeUs) +{ +} +#else +void taskUpdateHeadTracker(timeUs_t currentTimeUs) +{ + if (cliMode) { + return; + } + + headTrackerDevice_t *headTrackerDevice = headTrackerCommonDevice(); + + if(headTrackerDevice) { + headTrackerCommonProcess(headTrackerDevice, currentTimeUs); + } +} + +// TODO: check if any headTracker types are enabled +bool headTrackerCommonIsEnabled(void) +{ + if (commonHeadTrackerDevice && headTrackerCommonIsReady(commonHeadTrackerDevice)) { + return true; + } + + return false; +} + +bool headTrackerCommonIsValid(headTrackerDevice_t *dev) { + if(dev && dev->vTable && dev->vTable->isValid) { + return dev->vTable->isValid(dev); + } + + return micros() < dev->expires; +} + + +#endif + + +#endif \ No newline at end of file diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h new file mode 100644 index 00000000000..27b62e0e568 --- /dev/null +++ b/src/main/drivers/headtracker_common.h @@ -0,0 +1,95 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#pragma once + +#include "platform.h" + +#ifdef USE_HEADTRACKER + +#include + +#include "config/feature.h" +#include "common/time.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + HEADTRACKER_NONE = 0, + HEADTRACKER_SERIAL = 1, + HEADTRACKER_MSP = 2, + HEADTRACKER_UNKNOWN = 0xFF +} headTrackerDevType_e; + + +struct headTrackerVTable_s; + +typedef struct headTrackerDevice_s { + const struct headTrackerVTable_s *vTable; + int pan; + int tilt; + int roll; + timeUs_t expires; +} headTrackerDevice_t; + +// {set,get}BandAndChannel: band and channel are 1 origin +// {set,get}PowerByIndex: 0 = Power OFF, 1 = device dependent +// {set,get}PitMode: 0 = OFF, 1 = ON + +typedef struct headTrackerVTable_s { + void (*process)(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); + headTrackerDevType_e (*getDeviceType)(const headTrackerDevice_t *headTrackerDevice); + bool (*isReady)(const headTrackerDevice_t *headTrackerDevice); + bool (*isValid)(const headTrackerDevice_t *headTrackerDevice); + int (*getPanPWM)(const headTrackerDevice_t *headTrackerDevice); + int (*getTiltPWM)(const headTrackerDevice_t *headTrackerDevice); + int (*getRollPWM)(const headTrackerDevice_t *headTrackerDevice); +} headtrackerVTable_t; + + +typedef struct headTrackerConfig_s { + headTrackerDevType_e devType; +} headTrackerConfig_t; + +PG_DECLARE(headTrackerConfig_t, headTrackerConfig); + +void headTrackerCommonInit(void); +void headTrackerCommonSetDevice(headTrackerDevice_t *headTrackerDevice); +headTrackerDevice_t *headTrackerCommonDevice(void); + +// VTable functions +void headTrackerCommonProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); +headTrackerDevType_e headTrackerCommonGetDeviceType(headTrackerDevice_t *headTrackerDevice); +bool headTrackerCommonIsReady(headTrackerDevice_t *headtrackerDevice); +bool headTrackerCommonIsValid(headTrackerDevice_t *headtrackerDevice); +int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice); +int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice); +int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice); + + +void taskUpdateHeadTracker(timeUs_t currentTimeUs); + +bool headtrackerCommonIsEnabled(void); + + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file From f09eef140175b092ba8e44171a5b9b513afd8acd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:54:36 +0200 Subject: [PATCH 148/429] sitl fix --- src/main/io/gimbal_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index b4b1ef3b1ca..71719810895 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -136,7 +136,7 @@ bool gimbalSerialDetect(void) } } - SD(fprintf(stderr, "[GIMBAL]: gimbalPort\n", gimbalPort)); + SD(fprintf(stderr, "[GIMBAL]: gimbalPort: %p\n", gimbalPort)); return gimbalPort; } #endif From 03829b730b85ae3ecc34a945f298cd55fcc09074 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:08:28 +0200 Subject: [PATCH 149/429] fix detection --- src/main/io/gimbal_serial.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 71719810895..b49ec75ccf2 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -367,15 +367,13 @@ bool gimbalSerialHeadTrackerDetect(void) bool gimbalSerialHeadTrackerInit(void) { - if(gimbalSerialHeadTrackerDetect()) { - SD(fprintf(stderr, "Setting gimbal device\n")); - gimbalCommonSetDevice(&serialGimbalDevice); - return true; - } - - if(headTrackerConfig()->devType == HEADTRACKER_SERIAL) { - headTrackerCommonSetDevice(&headTrackerDevice); + if (gimbalSerialHeadTrackerDetect()) { + SD(fprintf(stderr, "Setting gimbal device\n")); + headTrackerCommonSetDevice(&headTrackerDevice); + + return true; + } } return false; From f2f872c64ef1e54053c0f8461b41bcbd4bf6e8d4 Mon Sep 17 00:00:00 2001 From: jamming Date: Tue, 11 Jun 2024 13:40:18 +0800 Subject: [PATCH 150/429] Add a new target KakuteF4wing --- src/main/target/KAKUTEF4WING/CMakeLists.txt | 1 + src/main/target/KAKUTEF4WING/config.c | 42 ++++ src/main/target/KAKUTEF4WING/hardware_setup.c | 42 ++++ src/main/target/KAKUTEF4WING/target.c | 42 ++++ src/main/target/KAKUTEF4WING/target.h | 184 ++++++++++++++++++ 5 files changed, 311 insertions(+) create mode 100644 src/main/target/KAKUTEF4WING/CMakeLists.txt create mode 100755 src/main/target/KAKUTEF4WING/config.c create mode 100644 src/main/target/KAKUTEF4WING/hardware_setup.c create mode 100755 src/main/target/KAKUTEF4WING/target.c create mode 100644 src/main/target/KAKUTEF4WING/target.h diff --git a/src/main/target/KAKUTEF4WING/CMakeLists.txt b/src/main/target/KAKUTEF4WING/CMakeLists.txt new file mode 100644 index 00000000000..bf96ecb5d3b --- /dev/null +++ b/src/main/target/KAKUTEF4WING/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f405xg(KAKUTEF4WING) diff --git a/src/main/target/KAKUTEF4WING/config.c b/src/main/target/KAKUTEF4WING/config.c new file mode 100755 index 00000000000..206221e9930 --- /dev/null +++ b/src/main/target/KAKUTEF4WING/config.c @@ -0,0 +1,42 @@ +/* + * This file is part of INAV. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public License Version 3, as described below: + * + * This file is free software: you may copy, redistribute and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +#include + +#include "platform.h" + +#include "fc/fc_msp_box.h" +#include "fc/config.h" + +#include "rx/rx.h" + +#include "io/piniobox.h" +#include "drivers/serial.h" +#include "io/serial.h" + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2; +} + diff --git a/src/main/target/KAKUTEF4WING/hardware_setup.c b/src/main/target/KAKUTEF4WING/hardware_setup.c new file mode 100644 index 00000000000..f78fd65cd4c --- /dev/null +++ b/src/main/target/KAKUTEF4WING/hardware_setup.c @@ -0,0 +1,42 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include +#include + +#include "platform.h" + +#include "build/build_config.h" + +#include "drivers/time.h" +#include "drivers/bus_spi.h" +#include "drivers/io.h" +#include "drivers/io_impl.h" + +void initialisePreBootHardware(void) +{ + // User1 + IOInit(DEFIO_IO(PB7), OWNER_SYSTEM, RESOURCE_OUTPUT, 0); + IOConfigGPIO(DEFIO_IO(PB7), IOCFG_OUT_PP); + IOLo(DEFIO_IO(PB7)); + + // User2 + IOInit(DEFIO_IO(PB15), OWNER_SYSTEM, RESOURCE_OUTPUT, 0); + IOConfigGPIO(DEFIO_IO(PB15), IOCFG_OUT_PP); + IOLo(DEFIO_IO(PB15)); +} diff --git a/src/main/target/KAKUTEF4WING/target.c b/src/main/target/KAKUTEF4WING/target.c new file mode 100755 index 00000000000..8f717ed5fd2 --- /dev/null +++ b/src/main/target/KAKUTEF4WING/target.c @@ -0,0 +1,42 @@ +/* + * This file is part of INAV. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public License Version 3, as described below: + * + * This file is free software: you may copy, redistribute and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#include + +#include +#include "drivers/io.h" +#include "drivers/timer.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S1_OUT - DMA1_ST5 + DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT - DMA1_ST0 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3_OUT - DMA1_ST7 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4_OUT - DMA1_ST2 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT - DMA2_ST2 + DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT - DMA2_ST7 + + DEF_TIM(TIM5, CH2, PA1, TIM_USE_LED, 0, 0), // LED_STRIP - DMA1_ST4 +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/KAKUTEF4WING/target.h b/src/main/target/KAKUTEF4WING/target.h new file mode 100644 index 00000000000..27e600e5d45 --- /dev/null +++ b/src/main/target/KAKUTEF4WING/target.h @@ -0,0 +1,184 @@ +/* + * This file is part of INAV. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Alternatively, the contents of this file may be used under the terms + * of the GNU General Public License Version 3, as described below: + * + * This file is free software: you may copy, redistribute and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "F4WI" +#define USBD_PRODUCT_STRING "KakuteF4Wing" + +#define USE_TARGET_CONFIG + +// ******* Status LED***************** +#define LED0 PC5 + +// ******* Internal IMU ICM42688****** +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 +#define ICM42605_EXTI_PIN PB12 + +// *************** I2C **************** +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 +#define USE_I2C_DEVICE_2 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +// ********** External MAG On I2C1****** +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +// ********** External Devices On I2C1****** +#define TEMPERATURE_I2C_BUS BUS_I2C1 +#define PITOT_I2C_BUS BUS_I2C1 +#define USE_RANGEFINDER +#define RANGEFINDER_I2C_BUS BUS_I2C1 + +// ********** Internal BARO On I2C2********* +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C2 +#define USE_BARO_BMP280 +#define USE_BARO_DPS310 +#define USE_BARO_SPL06 + +// *************** AT7456 OSD *************** +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN PC15 + +// *************** SPI FLASH BLACKBOX********* +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define M25P16_CS_PIN PC14 +#define M25P16_SPI_BUS BUS_SPI3 +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT + +// *************** USB VCP ******************** +#define USB_IO +#define USE_VCP +#define VBUS_SENSING_PIN PA8 +#define VBUS_SENSING_ENABLED + +// *************** UART ******************** +#define USE_UART_INVERTER +//UART1 +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +//UART2 +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 + +//The 5V pads close to UART3 a are powered by both BEC and USB +//We config UART3 to serialRX, So Receiver is powered when USB Plug-IN. +//UART3: SerialRX by Default +#define USE_UART3 +#define UART3_RX_PIN PC11 +#define UART3_TX_PIN PC10 +#define INVERTER_PIN_UART3_RX PC13 + +//UART5 +#define USE_UART5 +#define UART5_RX_PIN PD2 +#define UART5_TX_PIN PC12 + +//UART6 +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +// # define USE_SOFTSERIAL1 +# define SERIAL_PORT_COUNT 6 + +// *************** SPI ******************** +#define USE_SPI +// SPI1: Connected to ICM gyro +#define USE_SPI_DEVICE_1 +#define SPI1_NSS_PIN PA4 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +// SPI2: Connected to OSD +#define USE_SPI_DEVICE_2 +#define SPI2_NSS_PIN PC15 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PC2 +#define SPI2_MOSI_PIN PC3 + +// SPI3: Connected to flash memory +#define USE_SPI_DEVICE_3 +#define SPI3_NSS_PIN PC14 +#define SPI3_SCK_PIN PB3 +#define SPI3_MISO_PIN PB4 +#define SPI3_MOSI_PIN PB5 + +// *************** Battery Voltage Sense*********** +#define USE_ADC +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define CURRENT_METER_SCALE 250 // Current_Meter 1V=40A +#define VBAT_SCALE_DEFAULT 1100 // VBAT_ADC 1V=11V + +// *************** LED_STRIP ********************** +#define USE_LED_STRIP +#define WS2811_PIN PA1 +#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST4_HANDLER +#define WS2811_DMA_STREAM DMA1_Stream4 +#define WS2811_DMA_CHANNEL DMA_Channel_6 + +// *************** PINIO *************************** +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PB7 // USER1 +#define PINIO2_PIN PB15 // USER2 + +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_GPS) + +// ***********Set rx type and procotol*************** +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART3 + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) + +#define USE_DSHOT +#define USE_ESC_SENSOR + +#define MAX_PWM_OUTPUT_PORTS 6 + + From 155732d814a2833dc28331b3b0e00241ed5874da Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:06:16 +0100 Subject: [PATCH 151/429] Change to using vertical position sanity check --- src/main/navigation/navigation_multicopter.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 96d44252715..169876d240a 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -799,19 +799,23 @@ bool isMulticopterCrashedInverted(void) { static timeMs_t startTime = 0; - if ((ABS(attitude.values.roll) > 1000 || ABS(attitude.values.pitch) > 700) && fabsf(navGetCurrentActualPositionAndVelocity()->vel.z) < MC_LAND_CHECK_VEL_Z_MOVING) { + if (ABS(attitude.values.roll) > 1000 || ABS(attitude.values.pitch) > 700) { + static uint32_t initialAltitude; + if (startTime == 0) { startTime = millis(); - } else { - /* minimum 2s disarm delay + extra user set delay time. Min time of 3s given min user setting is 1s if enabled */ - uint16_t disarmTimeDelay = 2000 + S2MS(navConfig()->mc.inverted_crash_detection); + initialAltitude = navGetCurrentActualPositionAndVelocity()->pos.z; + return false; + } else if (ABS(initialAltitude - navGetCurrentActualPositionAndVelocity()->pos.z) < 200) { + /* Check altitude change < 2m during disarm timeout period indicating MR not in flight. + * Minimum 3s disarm delay + extra user set delay time = Min time of 5s given min user setting is 1s if enabled */ + uint16_t disarmTimeDelay = 3000 + S2MS(navConfig()->mc.inverted_crash_detection); return millis() - startTime > disarmTimeDelay; } - } else { - startTime = 0; } + startTime = 0; return false; } From 4257ff3177a5f3e9f57a1b1451edecd78bd4fcc5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:56:55 +0200 Subject: [PATCH 152/429] Add MSP headtracker --- src/main/CMakeLists.txt | 2 + src/main/drivers/headtracker_common.c | 9 +-- src/main/drivers/headtracker_common.h | 15 +++-- src/main/fc/fc_msp.c | 10 +++- src/main/io/gimbal_serial.c | 2 +- src/main/io/headtracker_msp.c | 84 +++++++++++++++++++++++++++ src/main/io/headtracker_msp.h | 38 ++++++++++++ src/main/msp/msp_protocol_v2_sensor.h | 3 +- src/main/target/common.h | 2 + 9 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 src/main/io/headtracker_msp.c create mode 100644 src/main/io/headtracker_msp.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 7162bc4faa4..2e2b6cb2b20 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -362,6 +362,8 @@ main_sources(COMMON_SRC io/frsky_osd.h io/gimbal_serial.c io/gimbal_serial.h + io/headtracker_msp.c + io/headtracker_msp.h io/osd_dji_hd.c io/osd_dji_hd.h io/lights.c diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index 6f10eb1a5a9..ed895e0bc47 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -29,12 +29,13 @@ #include "common/time.h" #include "common/maths.h" +#include "drivers/time.h" + #include "fc/cli.h" #include "rx/rx.h" #include "drivers/headtracker_common.h" -#include "drivers/time.h" PG_REGISTER(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); @@ -64,7 +65,7 @@ void headTrackerCommonProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t c } } -headTrackerDevType_e headTrackerCommonGetDeviceType(headTrackerDevice_t *headTrackerDevice) +headTrackerDevType_e headTrackerCommonGetDeviceType(const headTrackerDevice_t *headTrackerDevice) { if (!headTrackerDevice || !headTrackerDevice->vTable->getDeviceType) { return HEADTRACKER_UNKNOWN; @@ -73,7 +74,7 @@ headTrackerDevType_e headTrackerCommonGetDeviceType(headTrackerDevice_t *headTra return headTrackerDevice->vTable->getDeviceType(headTrackerDevice); } -bool headTrackerCommonIsReady(headTrackerDevice_t *headTrackerDevice) +bool headTrackerCommonIsReady(const headTrackerDevice_t *headTrackerDevice) { if (headTrackerDevice && headTrackerDevice->vTable->isReady) { return headTrackerDevice->vTable->isReady(headTrackerDevice); @@ -137,7 +138,7 @@ bool headTrackerCommonIsEnabled(void) return false; } -bool headTrackerCommonIsValid(headTrackerDevice_t *dev) { +bool headTrackerCommonIsValid(const headTrackerDevice_t *dev) { if(dev && dev->vTable && dev->vTable->isValid) { return dev->vTable->isValid(dev); } diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index 27b62e0e568..092a00ab0a4 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -23,9 +23,14 @@ #include -#include "config/feature.h" #include "common/time.h" +#include "drivers/time.h" + +#include "config/feature.h" + +#define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) + #ifdef __cplusplus extern "C" { #endif @@ -60,7 +65,7 @@ typedef struct headTrackerVTable_s { int (*getPanPWM)(const headTrackerDevice_t *headTrackerDevice); int (*getTiltPWM)(const headTrackerDevice_t *headTrackerDevice); int (*getRollPWM)(const headTrackerDevice_t *headTrackerDevice); -} headtrackerVTable_t; +} headTrackerVTable_t; typedef struct headTrackerConfig_s { @@ -75,9 +80,9 @@ headTrackerDevice_t *headTrackerCommonDevice(void); // VTable functions void headTrackerCommonProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); -headTrackerDevType_e headTrackerCommonGetDeviceType(headTrackerDevice_t *headTrackerDevice); -bool headTrackerCommonIsReady(headTrackerDevice_t *headtrackerDevice); -bool headTrackerCommonIsValid(headTrackerDevice_t *headtrackerDevice); +headTrackerDevType_e headTrackerCommonGetDeviceType(const headTrackerDevice_t *headTrackerDevice); +bool headTrackerCommonIsReady(const headTrackerDevice_t *headtrackerDevice); +bool headTrackerCommonIsValid(const headTrackerDevice_t *headtrackerDevice); int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice); diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 2109d3e08a9..6362901e45b 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -96,6 +96,7 @@ #include "io/vtx.h" #include "io/vtx_string.h" #include "io/gps_private.h" //for MSP_SIMULATOR +#include "io/headtracker_msp.h" #include "io/osd/custom_elements.h" @@ -4048,7 +4049,8 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu static mspResult_e mspProcessSensorCommand(uint16_t cmdMSP, sbuf_t *src) { - UNUSED(src); + int dataSize = sbufBytesRemaining(src); + UNUSED(dataSize); switch (cmdMSP) { #if defined(USE_RANGEFINDER_MSP) @@ -4086,6 +4088,12 @@ static mspResult_e mspProcessSensorCommand(uint16_t cmdMSP, sbuf_t *src) mspPitotmeterReceiveNewData(sbufPtr(src)); break; #endif + +#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_MSP)) + case MSP2_SENSOR_HEADTRACKER: + mspHeadTrackerReceiverNewData(sbufPtr(src), dataSize); + break; +#endif } return MSP_RESULT_NO_REPLY; diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index b49ec75ccf2..77f992b2b8a 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -323,7 +323,7 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) #ifdef USE_HEADTRACKER -static headtrackerVTable_t headTrackerVTable = { +static headTrackerVTable_t headTrackerVTable = { .process = headtrackerSerialProcess, .getDeviceType = headtrackerSerialGetDeviceType, .isReady = headTrackerSerialIsReady, diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c new file mode 100644 index 00000000000..35757665d5e --- /dev/null +++ b/src/main/io/headtracker_msp.c @@ -0,0 +1,84 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#if (defined(USE_HEADTRACKER_MSP) && defined(USE_HEADTRACKER)) + +#include "build/debug.h" + +#include "common/utils.h" +#include "common/time.h" + +#include "drivers/headtracker_common.h" + +#include "io/headtracker_msp.h" + +/* +typedef struct headTrackerVTable_s { + void (*process)(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); + headTrackerDevType_e (*getDeviceType)(const headTrackerDevice_t *headTrackerDevice); + bool (*isReady)(const headTrackerDevice_t *headTrackerDevice); + bool (*isValid)(const headTrackerDevice_t *headTrackerDevice); + int (*getPanPWM)(const headTrackerDevice_t *headTrackerDevice); + int (*getTiltPWM)(const headTrackerDevice_t *headTrackerDevice); + int (*getRollPWM)(const headTrackerDevice_t *headTrackerDevice); +} headtrackerVTable_t; +*/ + +static headTrackerVTable_t headTrackerMspVTable = { + .process = NULL, + .getDeviceType = NULL, + .isReady = NULL, + .isValid = headTrackerCommonIsValid, + .getPanPWM = headTrackerCommonGetPanPWM, + .getTiltPWM = headTrackerCommonGetTiltPWM, + .getRollPWM = headTrackerCommonGetRollPWM, +}; + +static headTrackerDevice_t headTrackerMspDevice = { + .vTable = &headTrackerMspVTable, + .pan = 0, + .tilt = 0, + .roll = 0, + .expires = 0, +}; + +void mspHeadTrackerInit(void) +{ + if(headTrackerConfig()->devType == HEADTRACKER_MSP) { + headTrackerCommonSetDevice(&headTrackerMspDevice); + } +} + +void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) +{ + if(dataSize != sizeof(headtrackerMspMessage_t)) { + return; + } + + headtrackerMspMessage_t *status = (headtrackerMspMessage_t *)data; + + headTrackerMspDevice.pan = status->pan; + headTrackerMspDevice.tilt = status->tilt; + headTrackerMspDevice.roll = status->roll; + headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; + + UNUSED(status); +} + +#endif \ No newline at end of file diff --git a/src/main/io/headtracker_msp.h b/src/main/io/headtracker_msp.h new file mode 100644 index 00000000000..8c437314a9e --- /dev/null +++ b/src/main/io/headtracker_msp.h @@ -0,0 +1,38 @@ +/* + * This file is part of INAV. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + + +#pragma once + +#include + +#if (defined(USE_HEADTRACKER_MSP) && defined(USE_HEADTRACKER)) + +#include +#include + +#include "drivers/headtracker_common.h" + +typedef struct headtrackerMspMessage_s { + int16_t pan; // -2048~2047. Scale is min/max angle for gimbal + int16_t tilt; // -2048~2047. Scale is min/max angle for gimbal + int16_t roll; // -2048~2047. Scale is min/max angle for gimbal + int16_t sensitivity; // -16~15. Scale is min/max angle for gimbal +} __attribute__((packed)) headtrackerMspMessage_t; + +void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize); +#endif \ No newline at end of file diff --git a/src/main/msp/msp_protocol_v2_sensor.h b/src/main/msp/msp_protocol_v2_sensor.h index d913723be7d..b243448e9f9 100644 --- a/src/main/msp/msp_protocol_v2_sensor.h +++ b/src/main/msp/msp_protocol_v2_sensor.h @@ -22,4 +22,5 @@ #define MSP2_SENSOR_GPS 0x1F03 #define MSP2_SENSOR_COMPASS 0x1F04 #define MSP2_SENSOR_BAROMETER 0x1F05 -#define MSP2_SENSOR_AIRSPEED 0x1F06 \ No newline at end of file +#define MSP2_SENSOR_AIRSPEED 0x1F06 +#define MSP2_SENSOR_HEADTRACKER 0x1F07 \ No newline at end of file diff --git a/src/main/target/common.h b/src/main/target/common.h index 7f2a8b221f1..8bb735fc437 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -192,6 +192,8 @@ #define USE_SERIAL_GIMBAL #define USE_HEADTRACKER +#define USE_HEADTRACKER_SERIAL +#define USE_HEADTRACKER_MSP //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) From ab7f14c2c1da7a83a8f965f46bed462c882133c2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:41:38 +0200 Subject: [PATCH 153/429] Add init() call for msp head tracker --- src/main/fc/fc_init.c | 6 +++++- src/main/io/gimbal_serial.c | 5 +++-- src/main/io/gimbal_serial.h | 3 +-- src/main/io/headtracker_msp.h | 3 +++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index b57a60a9f69..e9ed6efe4c1 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -110,6 +110,7 @@ #include "io/displayport_srxl.h" #include "io/flashfs.h" #include "io/gimbal_serial.h" +#include "io/headtracker_msp.h" #include "io/gps.h" #include "io/ledstrip.h" #include "io/osd.h" @@ -698,10 +699,13 @@ void init(void) #ifdef USE_HEADTRACKER headTrackerCommonInit(); -#ifdef USE_SERIAL_GIMBAL +#ifdef USE_HEADTRACKER_SERIAL // Needs to be called after gimbalSerialInit gimbalSerialHeadTrackerInit(); #endif +#ifdef USE_HEADTRACKER_MSP + mspHeadTrackerInit(); +#endif #endif // Latch active features AGAIN since some may be modified by init(). diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 77f992b2b8a..ee0721b81bf 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -91,7 +91,7 @@ bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice) bool gimbalSerialInit(void) { - if(gimbalSerialDetect()) { + if (gimbalSerialDetect()) { SD(fprintf(stderr, "Setting gimbal device\n")); gimbalCommonSetDevice(&serialGimbalDevice); return true; @@ -108,6 +108,7 @@ bool gimbalSerialDetect(void) #else bool gimbalSerialDetect(void) { + SD(fprintf(stderr, "[GIMBAL]: serial Detect...\n")); serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_GIMBAL); bool singleUart = gimbalSerialConfig()->singleUart; @@ -321,7 +322,7 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) } } -#ifdef USE_HEADTRACKER +#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) static headTrackerVTable_t headTrackerVTable = { .process = headtrackerSerialProcess, diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 7e342994a38..4f7de6753b7 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -31,7 +31,6 @@ extern "C" { #ifdef USE_SERIAL_GIMBAL -#define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) #define HTKATTITUDE_SYNC0 0xA5 #define HTKATTITUDE_SYNC1 0x5A @@ -87,7 +86,7 @@ bool gimbalSerialHasHeadTracker(const gimbalDevice_t *gimbalDevice); void gimbalSerialHeadTrackerReceive(uint16_t c, void *data); -#ifdef USE_HEADTRACKER +#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) bool gimbalSerialHeadTrackerInit(void); bool gimbalSerialHeadTrackerDetect(void); void headtrackerSerialProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); diff --git a/src/main/io/headtracker_msp.h b/src/main/io/headtracker_msp.h index 8c437314a9e..4552bf1ea1b 100644 --- a/src/main/io/headtracker_msp.h +++ b/src/main/io/headtracker_msp.h @@ -34,5 +34,8 @@ typedef struct headtrackerMspMessage_s { int16_t sensitivity; // -16~15. Scale is min/max angle for gimbal } __attribute__((packed)) headtrackerMspMessage_t; +void mspHeadTrackerInit(void); + void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize); + #endif \ No newline at end of file From 5b16cdeb6ffe47bcaa6c7089ce4d34f523e8a4f4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:32:38 +0200 Subject: [PATCH 154/429] Add config reset functions --- src/main/drivers/headtracker_common.c | 13 ++++++++++--- src/main/io/gimbal_serial.c | 12 +++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index ed895e0bc47..d73aceaeae6 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -22,10 +22,13 @@ #include #include #include +#include #include #include +#include "settings_generated.h" + #include "common/time.h" #include "common/maths.h" @@ -37,12 +40,16 @@ #include "drivers/headtracker_common.h" - -PG_REGISTER(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); - +PG_REGISTER_WITH_RESET_FN(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); static headTrackerDevice_t *commonHeadTrackerDevice = NULL; +void pgResetFn_headTrackerConfig(headTrackerConfig_t *conf) +{ + memset(conf, 0, sizeof(headTrackerConfig_t)); + conf->devType = SETTING_HEADTRACKER_TYPE_DEFAULT; +} + void headTrackerCommonInit(void) { } diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index ee0721b81bf..da1f976fc9d 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "platform.h" @@ -41,7 +42,9 @@ #include -PG_REGISTER(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); +#include "settings_generated.h" + +PG_REGISTER_WITH_RESET_FN(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); @@ -72,6 +75,13 @@ static gimbalDevice_t serialGimbalDevice = { .vTable = &gimbalSerialVTable }; +void pgResetFn_gimbalSerialConfig(gimbalSerialConfig_t *conf) +{ + memset(conf, 0, sizeof(gimbalSerialConfig)); + conf->singleUart = SETTING_GIMBAL_SERIAL_SINGLE_UART_DEFAULT; +} + + gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) { UNUSED(gimbalDevice); From 7405383aed844aa1be86a14519d20c01a977218d Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:51:59 +0100 Subject: [PATCH 155/429] fix time settings --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- src/main/navigation/navigation_multicopter.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index a6cd597ef17..08a811debb3 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3584,7 +3584,7 @@ Multicopter hover throttle hint for altitude controller. Should be set to approx ### nav_mc_inverted_crash_detection -Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 3s. +Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or some other reason. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 4s. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 2dbda7569bb..068ddf63af4 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2416,7 +2416,7 @@ groups: field: general.flags.landing_bump_detection type: bool - name: nav_mc_inverted_crash_detection - description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 3s." + description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or some other reason. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 4s." default_value: 0 field: mc.inverted_crash_detection min: 0 diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 169876d240a..41903ff5f3f 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -808,7 +808,7 @@ bool isMulticopterCrashedInverted(void) return false; } else if (ABS(initialAltitude - navGetCurrentActualPositionAndVelocity()->pos.z) < 200) { /* Check altitude change < 2m during disarm timeout period indicating MR not in flight. - * Minimum 3s disarm delay + extra user set delay time = Min time of 5s given min user setting is 1s if enabled */ + * Minimum 3s disarm delay + extra user set delay time = Min time of 4s given min user setting is 1s if enabled */ uint16_t disarmTimeDelay = 3000 + S2MS(navConfig()->mc.inverted_crash_detection); return millis() - startTime > disarmTimeDelay; From 58faed455603d7c8bcc7c8744146ef0808d58df5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:07:56 +0200 Subject: [PATCH 156/429] Min and max values made defaults invalid Old values failed checks for +/-5Hz from main gyro lpf frequency --- docs/Settings.md | 4 ++-- src/main/fc/settings.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 7177d4a8ed1..2367cc8f1ab 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1618,7 +1618,7 @@ Maximum frequency for adaptive filter | Default | Min | Max | | --- | --- | --- | -| 150 | 100 | 500 | +| 150 | 0 | 505 | --- @@ -1628,7 +1628,7 @@ Minimum frequency for adaptive filter | Default | Min | Max | | --- | --- | --- | -| 50 | 30 | 250 | +| 50 | 0 | 250 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 886fbfad5f4..cfe40bb400f 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -344,15 +344,15 @@ groups: description: "Minimum frequency for adaptive filter" default_value: 50 field: adaptiveFilterMinHz - min: 30 + min: 0 max: 250 condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_max_hz description: "Maximum frequency for adaptive filter" default_value: 150 field: adaptiveFilterMaxHz - min: 100 - max: 500 + min: 0 + max: 505 condition: USE_ADAPTIVE_FILTER - name: gyro_adaptive_filter_std_lpf_hz description: "Standard deviation low pass filter cutoff frequency" From 2d2eab8b6cc8d8474c74362f4966a8d6358635f3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:30:25 +0200 Subject: [PATCH 157/429] Use reset template --- src/main/drivers/headtracker_common.c | 10 ++++------ src/main/io/gimbal_serial.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index d73aceaeae6..271bb25f8c2 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -40,15 +40,13 @@ #include "drivers/headtracker_common.h" -PG_REGISTER_WITH_RESET_FN(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); +PG_REGISTER_WITH_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); static headTrackerDevice_t *commonHeadTrackerDevice = NULL; -void pgResetFn_headTrackerConfig(headTrackerConfig_t *conf) -{ - memset(conf, 0, sizeof(headTrackerConfig_t)); - conf->devType = SETTING_HEADTRACKER_TYPE_DEFAULT; -} +PG_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, + .devType = SETTING_HEADTRACKER_TYPE_DEFAULT +); void headTrackerCommonInit(void) { diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index da1f976fc9d..03a44c02879 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -44,7 +44,7 @@ #include "settings_generated.h" -PG_REGISTER_WITH_RESET_FN(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); +PG_REGISTER_WITH_RESET_TEMPLATE(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); @@ -75,11 +75,9 @@ static gimbalDevice_t serialGimbalDevice = { .vTable = &gimbalSerialVTable }; -void pgResetFn_gimbalSerialConfig(gimbalSerialConfig_t *conf) -{ - memset(conf, 0, sizeof(gimbalSerialConfig)); - conf->singleUart = SETTING_GIMBAL_SERIAL_SINGLE_UART_DEFAULT; -} +PG_RESET_TEMPLATE(gimbalSerialConfig_t, gimbalSerialConfig, + .singleUart = SETTING_GIMBAL_SERIAL_SINGLE_UART_DEFAULT +); gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) From 6893844bb01595f08f4a770f358d06cd8f03e4c2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:31:56 +0200 Subject: [PATCH 158/429] group reset template --- src/main/drivers/headtracker_common.c | 4 ++-- src/main/io/gimbal_serial.c | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index 271bb25f8c2..670a412c501 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -42,12 +42,12 @@ PG_REGISTER_WITH_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); -static headTrackerDevice_t *commonHeadTrackerDevice = NULL; - PG_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, .devType = SETTING_HEADTRACKER_TYPE_DEFAULT ); +static headTrackerDevice_t *commonHeadTrackerDevice = NULL; + void headTrackerCommonInit(void) { } diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 03a44c02879..90216ea8c60 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -46,6 +46,10 @@ PG_REGISTER_WITH_RESET_TEMPLATE(gimbalSerialConfig_t, gimbalSerialConfig, PG_GIMBAL_SERIAL_CONFIG, 0); +PG_RESET_TEMPLATE(gimbalSerialConfig_t, gimbalSerialConfig, + .singleUart = SETTING_GIMBAL_SERIAL_SINGLE_UART_DEFAULT +); + STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_not_10); #define GIMBAL_SERIAL_BUFFER_SIZE 512 @@ -75,11 +79,6 @@ static gimbalDevice_t serialGimbalDevice = { .vTable = &gimbalSerialVTable }; -PG_RESET_TEMPLATE(gimbalSerialConfig_t, gimbalSerialConfig, - .singleUart = SETTING_GIMBAL_SERIAL_SINGLE_UART_DEFAULT -); - - gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) { UNUSED(gimbalDevice); From 2366b0e418e0f10a4e2b1bcb80d367f418f10217 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 00:15:24 +0200 Subject: [PATCH 159/429] Add headtracker to SITL --- src/main/target/SITL/target.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/target/SITL/target.h b/src/main/target/SITL/target.h index 4afab35aa4d..f6d80f74971 100644 --- a/src/main/target/SITL/target.h +++ b/src/main/target/SITL/target.h @@ -75,6 +75,9 @@ #define USE_MSP_OSD #define USE_OSD #define USE_SERIAL_GIMBAL +#define USE_HEADTRACKER +#define USE_HEADTRACKER_SERIAL +#define USE_HEADTRACKER_MSP #undef USE_DASHBOARD From 1123e59198b9af28c0aabebb10d476cca8f1a1fc Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 12 Jun 2024 09:30:48 +0200 Subject: [PATCH 160/429] Enable adaptive filter only when min and max are set --- src/main/fc/fc_tasks.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 0fd239127c2..1230f6f01d7 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -428,7 +428,11 @@ void fcTasksInit(void) #endif #ifdef USE_ADAPTIVE_FILTER - setTaskEnabled(TASK_ADAPTIVE_FILTER, (gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE)); + setTaskEnabled(TASK_ADAPTIVE_FILTER, ( + gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE && + gyroConfig()->adaptiveFilterMinHz > 0 && + gyroConfig()->adaptiveFilterMaxHz > 0 + )); #endif #if defined(SITL_BUILD) From 5a50f95f0822f8f7da67be77ee24b6468fef0b5e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:47:44 +0200 Subject: [PATCH 161/429] Increase max number of pwm outputs by 1, if a LED pin is defined --- src/main/drivers/pwm_mapping.c | 4 ++-- src/main/drivers/pwm_output.c | 4 ++-- src/main/drivers/pwm_output.h | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index e953c86b96e..5ed17d7bb9a 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -53,8 +53,8 @@ enum { typedef struct { int maxTimMotorCount; int maxTimServoCount; - const timerHardware_t * timMotors[MAX_PWM_OUTPUT_PORTS]; - const timerHardware_t * timServos[MAX_PWM_OUTPUT_PORTS]; + const timerHardware_t * timMotors[MAX_PWM_OUTPUTS]; + const timerHardware_t * timServos[MAX_PWM_OUTPUTS]; } timMotorServoHardware_t; static pwmInitError_e pwmInitError = PWM_INIT_ERROR_NONE; diff --git a/src/main/drivers/pwm_output.c b/src/main/drivers/pwm_output.c index d48f38679e9..faa9cd373d9 100644 --- a/src/main/drivers/pwm_output.c +++ b/src/main/drivers/pwm_output.c @@ -98,7 +98,7 @@ typedef struct { bool requestTelemetry; } pwmOutputMotor_t; -static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUT_PORTS]; +static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUTS]; static pwmOutputMotor_t motors[MAX_MOTORS]; static motorPwmProtocolTypes_e initMotorProtocol; @@ -142,7 +142,7 @@ static void pwmOutConfigTimer(pwmOutputPort_t * p, TCH_t * tch, uint32_t hz, uin static pwmOutputPort_t *pwmOutAllocatePort(void) { - if (allocatedOutputPortCount >= MAX_PWM_OUTPUT_PORTS) { + if (allocatedOutputPortCount >= MAX_PWM_OUTPUTS) { LOG_ERROR(PWM, "Attempt to allocate PWM output beyond MAX_PWM_OUTPUT_PORTS"); return NULL; } diff --git a/src/main/drivers/pwm_output.h b/src/main/drivers/pwm_output.h index b3c0fa6be0e..1041ace04fa 100644 --- a/src/main/drivers/pwm_output.h +++ b/src/main/drivers/pwm_output.h @@ -20,6 +20,12 @@ #include "drivers/io_types.h" #include "drivers/time.h" + +#if defined(WS2811_PIN) +#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS + 1) +#else +#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS) +#endif typedef enum { DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20, DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21, From 1c6499354edc1cf18a5c58b62da4f09a329c740b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:48:11 +0200 Subject: [PATCH 162/429] We already support 4 page fonts bump max number of chars for displayport_msp --- src/main/io/displayport_msp_osd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/displayport_msp_osd.c b/src/main/io/displayport_msp_osd.c index 2e425e6aecb..0b9be8c6d86 100644 --- a/src/main/io/displayport_msp_osd.c +++ b/src/main/io/displayport_msp_osd.c @@ -368,7 +368,7 @@ static uint32_t txBytesFree(const displayPort_t *displayPort) static bool getFontMetadata(displayFontMetadata_t *metadata, const displayPort_t *displayPort) { UNUSED(displayPort); - metadata->charCount = 512; + metadata->charCount = 1024; metadata->version = FONT_VERSION; return true; } From ff137b73e87002f771b6c1f69eba5304bace6b06 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:32:54 +0200 Subject: [PATCH 163/429] Add -j4 to allow parallel builds. Based on info available at https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111a0cc35c0..6129d4b4da8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} - name: Build targets (${{ matrix.id }}) - run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja ci + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja -j4 ci - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -66,7 +66,7 @@ jobs: echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV - name: Build SITL - run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j4 - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -101,7 +101,7 @@ jobs: run: | mkdir -p build_SITL && cd build_SITL cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -G Ninja .. - ninja + ninja -j3 - name: Upload artifacts uses: actions/upload-artifact@v3 @@ -137,7 +137,7 @@ jobs: echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV - name: Build SITL - run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j4 - name: Upload artifacts uses: actions/upload-artifact@v3 with: From 2e6fa1593b4e03a0c66d3faf442f361cfe3f1876 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:50:33 +0200 Subject: [PATCH 164/429] Switch to make, ninja seems ot be ignoring the -j4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6129d4b4da8..4cf4d7f68ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} - name: Build targets (${{ matrix.id }}) - run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja -j4 ci + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} .. && make -j4 ci - name: Upload artifacts uses: actions/upload-artifact@v3 with: From dad4c304c746455c420630d102bae55b12850fb5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:12:03 +0200 Subject: [PATCH 165/429] Try -pipe --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cf4d7f68ea..8a4c1bb4748 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} - name: Build targets (${{ matrix.id }}) - run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} .. && make -j4 ci + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -DMAIN_COMPILE_OPTIONS=-pipe .. && make -j4 ci - name: Upload artifacts uses: actions/upload-artifact@v3 with: From 75d85eb49525c8f01a120b601f55aed7b46d74bb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:20:21 +0200 Subject: [PATCH 166/429] Back to ninja, bump number of runners --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a4c1bb4748..272918902fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: - uses: actions/checkout@v3 @@ -36,7 +36,7 @@ jobs: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} - name: Build targets (${{ matrix.id }}) - run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -DMAIN_COMPILE_OPTIONS=-pipe .. && make -j4 ci + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -DMAIN_COMPILE_OPTIONS=-pipe -G Ninja .. && ninja -j4 ci - name: Upload artifacts uses: actions/upload-artifact@v3 with: From 3da647d6dd4467d32e29937db74ea5d7f0821d90 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:29:31 +0200 Subject: [PATCH 167/429] Tests don't really depend on build. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 272918902fd..187150695ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,7 +146,7 @@ jobs: test: - needs: [build] + #needs: [build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 0e5f7716acd7e495acec6ff8f33dbf99fb4e87e5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:38:49 +0200 Subject: [PATCH 168/429] Bump parallel task once more --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 187150695ac..b98e46ec570 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] steps: - uses: actions/checkout@v3 From 556a0fadd9dd21b2ef7eb4027841b7199db8ac9d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:48:36 +0200 Subject: [PATCH 169/429] 18 jobs. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b98e46ec570..019d6b87271 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] steps: - uses: actions/checkout@v3 From bbad573eff936fdbad3a4d687d301fbeeaae1e48 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:51:42 +0200 Subject: [PATCH 170/429] Strange things happening --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 019d6b87271..0330041607d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] + id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] steps: - uses: actions/checkout@v3 From 2e69f3746e591f10e31fffb53c69e4c6afb4c256 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:41:04 +0200 Subject: [PATCH 171/429] Update actions --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111a0cc35c0..481e6ad2858 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install ninja-build - name: Setup environment @@ -38,7 +38,7 @@ jobs: - name: Build targets (${{ matrix.id }}) run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja ci - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_NAME }} path: ./build/*.hex @@ -46,7 +46,7 @@ jobs: build-SITL-Linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install ninja-build - name: Setup environment @@ -68,15 +68,15 @@ jobs: - name: Build SITL run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: ${{ env.BUILD_NAME }}_SITL + name: ${{ env.BUILD_NAME }}_SITL-Linux path: ./build_SITL/*_SITL build-SITL-Mac: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: | brew install cmake ninja ruby @@ -104,7 +104,7 @@ jobs: ninja - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_NAME }}_SITL-MacOS path: ./build_SITL/*_SITL @@ -115,7 +115,7 @@ jobs: run: shell: C:\tools\cygwin\bin\bash.exe -o igncr '{0}' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Cygwin uses: egor-tensin/setup-cygwin@v4 with: @@ -139,7 +139,7 @@ jobs: - name: Build SITL run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_NAME }}_SITL-WIN path: ./build_SITL/*.exe @@ -149,7 +149,7 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install ninja-build - name: Run Tests From 6250e0bd94137e2fe4f1ef11eaa120d934f187a3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:43:15 +0200 Subject: [PATCH 172/429] Update cache action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 481e6ad2858..9caa077b82e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }') echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} From 31208fe2f7edeab43644a588e15f48df20f9d49b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:44:35 +0200 Subject: [PATCH 173/429] Update checkout action version --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 624a129c35d..edaaecdf3bb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install python3-yaml - name: Check that Settings.md is up to date From df9805236886d68d889679712b491b3f50ed7222 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:10:32 +0200 Subject: [PATCH 174/429] Break .zip file by matrix id, for now. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c989894188..c389884008d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.BUILD_NAME }} + name: ${{ env.BUILD_NAME }}.${{ matrix.id }} path: ./build/*.hex build-SITL-Linux: From af6f1b798f5b1007d9e357a20c234161ea769f43 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:55:34 +0200 Subject: [PATCH 175/429] Attempt at building master on sucessfull push --- .github/workflows/dev-builds.yml | 207 +++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 .github/workflows/dev-builds.yml diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml new file mode 100644 index 00000000000..81551a3a330 --- /dev/null +++ b/.github/workflows/dev-builds.yml @@ -0,0 +1,207 @@ +name: Build pre-release +# Don't enable CI on push, just on PR. If you +# are working on the main repo and want to trigger +# a CI build submit a draft PR. +on: + push: + branches: + - main + master + mmosca-update-github-actions + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + id: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get -y install ninja-build + - name: Setup environment + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + # This is the hash of the commit for the PR + # when the action is triggered by PR, empty otherwise + COMMIT_ID=${{ github.event.pull_request.head.sha }} + # This is the hash of the commit when triggered by push + # but the hash of refs/pull//merge, which is different + # from the hash of the latest commit in the PR, that's + # why we try github.event.pull_request.head.sha first + COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} + BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }') + echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + path: downloads + key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} + - name: Build targets (${{ matrix.id }}) + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja ci + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_NAME }}.${{ matrix.id }} + path: ./build/*.hex + + build-SITL-Linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get -y install ninja-build + - name: Setup environment + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + # This is the hash of the commit for the PR + # when the action is triggered by PR, empty otherwise + COMMIT_ID=${{ github.event.pull_request.head.sha }} + # This is the hash of the commit when triggered by push + # but the hash of refs/pull//merge, which is different + # from the hash of the latest commit in the PR, that's + # why we try github.event.pull_request.head.sha first + COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} + BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') + echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + - name: Build SITL + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: sitl-${{ env.BUILD_NAME }}-Linux + path: ./build_SITL/*_SITL + + build-SITL-Mac: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + brew install cmake ninja ruby + + - name: Setup environment + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + # This is the hash of the commit for the PR + # when the action is triggered by PR, empty otherwise + COMMIT_ID=${{ github.event.pull_request.head.sha }} + # This is the hash of the commit when triggered by push + # but the hash of refs/pull//merge, which is different + # from the hash of the latest commit in the PR, that's + # why we try github.event.pull_request.head.sha first + COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} + BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') + echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + - name: Build SITL + run: | + mkdir -p build_SITL && cd build_SITL + cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -G Ninja .. + ninja + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: sitl-${{ env.BUILD_NAME }}-MacOS + path: ./build_SITL/*_SITL + + build-SITL-Windows: + runs-on: windows-latest + defaults: + run: + shell: C:\tools\cygwin\bin\bash.exe -o igncr '{0}' + steps: + - uses: actions/checkout@v4 + - name: Setup Cygwin + uses: egor-tensin/setup-cygwin@v4 + with: + packages: cmake ruby ninja gcc-g++ + - name: Setup environment + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + # This is the hash of the commit for the PR + # when the action is triggered by PR, empty otherwise + COMMIT_ID=${{ github.event.pull_request.head.sha }} + # This is the hash of the commit when triggered by push + # but the hash of refs/pull//merge, which is different + # from the hash of the latest commit in the PR, that's + # why we try github.event.pull_request.head.sha first + COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} + BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') + echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + - name: Build SITL + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: sitl-${{ env.BUILD_NAME }}-WIN + path: ./build_SITL/*.exe + + + test: + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get -y install ninja-build + - name: Run Tests + run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check + + release: + needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test] + steps: + - name: download artifacts + uses: actions/download-artifact@v4 + path: hexes + with: + name: inav-* + merge-multiple: true + - name: download sitl linux + uses: actions/download-artifact@v4 + path: resources/sitl/linux + with: + name: sitl-*-Linux + merge-multiple: true + - name: download sitl windows + uses: actions/download-artifact@v4 + path: resources/sitl/windows + with: + name: sitl-*-WIN + merge-multiple: true + - name: download sitl mac + uses: actions/download-artifact@v4 + path: resources/sitl/macos + with: + name: sitl-*-MacOS + merge-multiple: true + - name: Consolidate sitl files + run: | + zip -a -9 sitl-resources.zip resources/ + + - name: Upload release artifacts + uses: softprops/action-gh-release@v2 + with: + name: inav-nightly + prerelease: true + draft: true + generate_release_notes: true + make_latest: false + files: | + hexes/*.hex + sitl-linux/*.hex + sitl-windows/*.exe + sitl-mac/*.hex + From 897587500118d7e3ca6dbad0e36ebc376be7df58 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:59:01 +0200 Subject: [PATCH 176/429] Trigger on pr --- .github/workflows/dev-builds.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 81551a3a330..7a07dd98457 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -8,6 +8,9 @@ on: - main master mmosca-update-github-actions + pull_request: + branches: + - mmosca-update-github-actions jobs: build: From bb6b8c278b9b10afa18b0029753c76f061f0626c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:08:35 +0200 Subject: [PATCH 177/429] update triggers --- .github/workflows/dev-builds.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 7a07dd98457..fef857f31aa 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -3,14 +3,14 @@ name: Build pre-release # are working on the main repo and want to trigger # a CI build submit a draft PR. on: - push: - branches: - - main - master - mmosca-update-github-actions +# push: +# branches: +# - main +# master +# mmosca-update-github-actions pull_request: - branches: - - mmosca-update-github-actions +# branches: +# - mmosca-update-github-actions jobs: build: From 6de946339dadb1c22b2499857907c1eb6f0f0926 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:12:17 +0200 Subject: [PATCH 178/429] fix path --- .github/workflows/dev-builds.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index fef857f31aa..24970628b8a 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -168,32 +168,31 @@ jobs: steps: - name: download artifacts uses: actions/download-artifact@v4 - path: hexes with: + path: hexes name: inav-* merge-multiple: true - name: download sitl linux uses: actions/download-artifact@v4 - path: resources/sitl/linux with: + path: resources/sitl/linux name: sitl-*-Linux merge-multiple: true - name: download sitl windows uses: actions/download-artifact@v4 - path: resources/sitl/windows with: + path: resources/sitl/windows name: sitl-*-WIN merge-multiple: true - name: download sitl mac uses: actions/download-artifact@v4 - path: resources/sitl/macos with: + path: resources/sitl/macos name: sitl-*-MacOS merge-multiple: true - name: Consolidate sitl files run: | zip -a -9 sitl-resources.zip resources/ - - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: @@ -204,7 +203,5 @@ jobs: make_latest: false files: | hexes/*.hex - sitl-linux/*.hex - sitl-windows/*.exe - sitl-mac/*.hex + sitl-resources.zip From 2c88008a2035b818f3e590219060ca3c479abf25 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:13:21 +0200 Subject: [PATCH 179/429] add runs-on --- .github/workflows/dev-builds.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 24970628b8a..2d4ace3d726 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -165,6 +165,7 @@ jobs: release: needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test] + runs-on: ubuntu-latest steps: - name: download artifacts uses: actions/download-artifact@v4 From 455bc7108dee293a2e19c396d4bf2c0411ae7ad4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:40:39 +0200 Subject: [PATCH 180/429] fix download artifact --- .github/workflows/dev-builds.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 2d4ace3d726..2b02fb396bd 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -3,14 +3,11 @@ name: Build pre-release # are working on the main repo and want to trigger # a CI build submit a draft PR. on: -# push: -# branches: -# - main -# master -# mmosca-update-github-actions + push: + branches: + - master + mmosca-update-github-actions pull_request: -# branches: -# - mmosca-update-github-actions jobs: build: @@ -154,7 +151,6 @@ jobs: test: - needs: [build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -171,25 +167,25 @@ jobs: uses: actions/download-artifact@v4 with: path: hexes - name: inav-* + pattern: inav-* merge-multiple: true - name: download sitl linux uses: actions/download-artifact@v4 with: path: resources/sitl/linux - name: sitl-*-Linux + pattern: sitl-*-Linux merge-multiple: true - name: download sitl windows uses: actions/download-artifact@v4 with: path: resources/sitl/windows - name: sitl-*-WIN + pattern: sitl-*-WIN merge-multiple: true - name: download sitl mac uses: actions/download-artifact@v4 with: path: resources/sitl/macos - name: sitl-*-MacOS + pattern: sitl-*-MacOS merge-multiple: true - name: Consolidate sitl files run: | From 3ee3c307229241f0e0957e4c9e0ce8ab745ca30e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:58:22 +0200 Subject: [PATCH 181/429] Fix zip --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 2b02fb396bd..63ec7f7f665 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -189,7 +189,7 @@ jobs: merge-multiple: true - name: Consolidate sitl files run: | - zip -a -9 sitl-resources.zip resources/ + zip -9 sitl-resources.zip resources/ - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: From b91831e26680b1e9355ea5ab1cde1aa6286dd38b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 22:20:41 +0200 Subject: [PATCH 182/429] attemp at fixing sitl files --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 63ec7f7f665..e0b0b514292 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -189,7 +189,7 @@ jobs: merge-multiple: true - name: Consolidate sitl files run: | - zip -9 sitl-resources.zip resources/ + zip -r -9 sitl-resources.zip resources/ - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: From 5a5c7f7172df6e8901f48ad051a7b90d9c4d85a1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 22:47:59 +0200 Subject: [PATCH 183/429] Test publishing to another repo --- .github/workflows/dev-builds.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index e0b0b514292..abd822585ad 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -32,7 +32,7 @@ jobs: # from the hash of the latest commit in the PR, that's # why we try github.event.pull_request.head.sha first COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} - BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }') echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV @@ -66,7 +66,7 @@ jobs: # from the hash of the latest commit in the PR, that's # why we try github.event.pull_request.head.sha first COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} - BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV @@ -98,7 +98,7 @@ jobs: # from the hash of the latest commit in the PR, that's # why we try github.event.pull_request.head.sha first COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} - BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV @@ -137,7 +137,7 @@ jobs: # from the hash of the latest commit in the PR, that's # why we try github.event.pull_request.head.sha first COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} - BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV @@ -193,7 +193,8 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly + name: inav-nightly-${{ GITHUB_RUN_NUMBER }} + repository: iNavFlight/inav-configurator prerelease: true draft: true generate_release_notes: true From fbbd4536d65115e3b93b7c7067cbb739d68e88ac Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 22:53:06 +0200 Subject: [PATCH 184/429] fix github.run_number --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index abd822585ad..65b08d5a180 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -193,7 +193,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly-${{ GITHUB_RUN_NUMBER }} + name: inav-nightly-${{ github.run_number }} repository: iNavFlight/inav-configurator prerelease: true draft: true From cda0b8cb550c078042fd3fba056d333c7073afc3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:12:30 +0200 Subject: [PATCH 185/429] massage release name --- .github/workflows/dev-builds.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 65b08d5a180..8291fec12a9 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -163,6 +163,10 @@ jobs: needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test] runs-on: ubuntu-latest steps: + - name: Get current date + id: date + run: | + echo "{release_tag}={$(date +'%Y%m%d')}" >> $GITHUB_STATE - name: download artifacts uses: actions/download-artifact@v4 with: @@ -193,8 +197,8 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly-${{ github.run_number }} - repository: iNavFlight/inav-configurator + name: inav-nightly-${{ env.release_tag }}-${{ github.sha}} + repository: iNavFlight/inav prerelease: true draft: true generate_release_notes: true From 7095dc7ca146d743f24b1f22888d6bda1d702940 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:38:19 +0200 Subject: [PATCH 186/429] just adding some place holders. It will need an actual secret created in the future --- .github/workflows/dev-builds.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 8291fec12a9..4a474055470 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -198,6 +198,8 @@ jobs: uses: softprops/action-gh-release@v2 with: name: inav-nightly-${{ env.release_tag }}-${{ github.sha}} + # To create release on a different repo, we need a token setup + #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav prerelease: true draft: true From 0e780408481a3877e75b68b046d8025ffca7051f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:08:49 +0200 Subject: [PATCH 187/429] At least create a different release --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 4a474055470..46305c69fdd 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -197,7 +197,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly-${{ env.release_tag }}-${{ github.sha}} + name: inav-nightly-${{ env.release_tag }}-${{ github.run_id }}-${{ github.sha}} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav From 044678404693fca0d7a026b162b389277e1936f6 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:12:31 +0200 Subject: [PATCH 188/429] fix variable name --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 46305c69fdd..b32bb72a6fa 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -166,7 +166,7 @@ jobs: - name: Get current date id: date run: | - echo "{release_tag}={$(date +'%Y%m%d')}" >> $GITHUB_STATE + echo "release_tag={$(date +'%Y%m%d')}" >> $GITHUB_STATE - name: download artifacts uses: actions/download-artifact@v4 with: From af8a561ed016c247182d1aa3b229140c4a95d683 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:12:48 +0100 Subject: [PATCH 189/429] inhibit failsafe on landing --- src/main/flight/failsafe.c | 16 ++++++++-------- src/main/navigation/navigation.c | 13 +++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/flight/failsafe.c b/src/main/flight/failsafe.c index 2a32dbbd12c..24896663dce 100644 --- a/src/main/flight/failsafe.c +++ b/src/main/flight/failsafe.c @@ -84,7 +84,7 @@ PG_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig, .failsafe_mission_delay = SETTING_FAILSAFE_MISSION_DELAY_DEFAULT, // Time delay before Failsafe activated during WP mission (s) #ifdef USE_GPS_FIX_ESTIMATION .failsafe_gps_fix_estimation_delay = SETTING_FAILSAFE_GPS_FIX_ESTIMATION_DELAY_DEFAULT, // Time delay before Failsafe activated when GPS Fix estimation is allied -#endif +#endif ); typedef enum { @@ -350,16 +350,16 @@ static failsafeProcedure_e failsafeChooseFailsafeProcedure(void) } } - // Inhibit Failsafe if emergency landing triggered manually - if (posControl.flags.manualEmergLandActive) { + // Inhibit Failsafe if emergency landing triggered manually or if landing is detected + if (posControl.flags.manualEmergLandActive || STATE(LANDING_DETECTED)) { return FAILSAFE_PROCEDURE_NONE; } // Craft is closer than minimum failsafe procedure distance (if set to non-zero) // GPS must also be working, and home position set if (failsafeConfig()->failsafe_min_distance > 0 && - ((sensors(SENSOR_GPS) && STATE(GPS_FIX)) -#ifdef USE_GPS_FIX_ESTIMATION + ((sensors(SENSOR_GPS) && STATE(GPS_FIX)) +#ifdef USE_GPS_FIX_ESTIMATION || STATE(GPS_ESTIMATED_FIX) #endif ) && STATE(GPS_FIX_HOME)) { @@ -429,8 +429,8 @@ void failsafeUpdateState(void) #ifdef USE_GPS_FIX_ESTIMATION if ( checkGPSFixFailsafe() ) { reprocessState = true; - } else -#endif + } else +#endif if (!receivingRxDataAndNotFailsafeMode) { if ((failsafeConfig()->failsafe_throttle_low_delay && (millis() > failsafeState.throttleLowPeriod)) || STATE(NAV_MOTOR_STOP_OR_IDLE)) { // JustDisarm: throttle was LOW for at least 'failsafe_throttle_low_delay' seconds or waiting for launch @@ -499,7 +499,7 @@ void failsafeUpdateState(void) } else if (failsafeChooseFailsafeProcedure() != FAILSAFE_PROCEDURE_NONE) { // trigger new failsafe procedure if changed failsafeState.phase = FAILSAFE_RX_LOSS_DETECTED; reprocessState = true; - } + } #ifdef USE_GPS_FIX_ESTIMATION else { if ( checkGPSFixFailsafe() ) { diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index cc4e269ef4b..3c87ced7a11 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -3321,10 +3321,6 @@ void calculateFarAwayTarget(fpVector3_t * farAwayPos, int32_t bearing, int32_t d *-----------------------------------------------------------*/ void updateLandingStatus(timeMs_t currentTimeMs) { - if (STATE(AIRPLANE) && !navConfig()->general.flags.disarm_on_landing) { - return; // no point using this with a fixed wing if not set to disarm - } - static timeMs_t lastUpdateTimeMs = 0; if ((currentTimeMs - lastUpdateTimeMs) <= HZ2MS(100)) { // limit update to 100Hz return; @@ -3354,8 +3350,13 @@ void updateLandingStatus(timeMs_t currentTimeMs) ENABLE_ARMING_FLAG(ARMING_DISABLED_LANDING_DETECTED); disarm(DISARM_LANDING); } else if (!navigationInAutomaticThrottleMode()) { - // for multirotor only - reactivate landing detector without disarm when throttle raised toward hover throttle - landingDetectorIsActive = rxGetChannelValue(THROTTLE) < (0.5 * (currentBatteryProfile->nav.mc.hover_throttle + getThrottleIdleValue())); + if (STATE(AIRPLANE) && isFlightDetected()) { + // Cancel landing detection flag if fixed wing redetected in flight + resetLandingDetector(); + } else { + // For multirotor - reactivate landing detector without disarm when throttle raised toward hover throttle + landingDetectorIsActive = rxGetChannelValue(THROTTLE) < (0.5 * (currentBatteryProfile->nav.mc.hover_throttle + getThrottleIdleValue())); + } } } else if (isLandingDetected()) { ENABLE_STATE(LANDING_DETECTED); From bb84bcd10797f174506071e6d04ee03df748aefb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:29:57 +0200 Subject: [PATCH 190/429] date --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index b32bb72a6fa..bc2490a033a 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -197,7 +197,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly-${{ env.release_tag }}-${{ github.run_id }}-${{ github.sha}} + name: inav-nightly-$(date '+%Y%m%d')-${{ github.run_id }}-${{ github.sha}} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav From 830ef4f3a2a70b4aebbfff664e81e983e5445962 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:47:53 +0200 Subject: [PATCH 191/429] rename --- .github/workflows/dev-builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index bc2490a033a..6b02719d24f 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -166,7 +166,7 @@ jobs: - name: Get current date id: date run: | - echo "release_tag={$(date +'%Y%m%d')}" >> $GITHUB_STATE + echo "RELEASE_DATE=$(date +'%Y%m%d')" >> $GITHUB_STATE - name: download artifacts uses: actions/download-artifact@v4 with: @@ -197,7 +197,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-nightly-$(date '+%Y%m%d')-${{ github.run_id }}-${{ github.sha}} + name: inav-dev-release-${{ env.RELEASE_DATE }}-${{ github.run_id }}-${{ github.sha}} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav From 59dd2533191d0b8f82f88a3ed40925b949d20f0d Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:47:23 +0100 Subject: [PATCH 192/429] Update navigation_multicopter.c --- src/main/navigation/navigation_multicopter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index b108ef6aa31..44264985cfb 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -802,8 +802,9 @@ bool isMulticopterLandingDetected(void) const timeMs_t currentTimeMs = millis(); #if defined(USE_BARO) - if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && isLandingGbumpDetected(currentTimeMs)) { - return true; // Landing flagged immediately if landing bump detected + /* Only allow landing G bump detection when xy velocity is low */ + if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING) { + return isLandingGbumpDetected(currentTimeMs); // Landing flagged immediately if landing bump detected } #endif From b289ba8356917b97c72e941514221c30534fd3ec Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:41:41 +0200 Subject: [PATCH 193/429] try to fix date --- .github/workflows/dev-builds.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 6b02719d24f..75c2fe80a44 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -165,8 +165,7 @@ jobs: steps: - name: Get current date id: date - run: | - echo "RELEASE_DATE=$(date +'%Y%m%d')" >> $GITHUB_STATE + run: echo "today=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT - name: download artifacts uses: actions/download-artifact@v4 with: @@ -197,7 +196,8 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-dev-release-${{ env.RELEASE_DATE }}-${{ github.run_id }}-${{ github.sha}} + name: inav-dev-release-${{ steps.date.outputs.today }}-${{ github.run_id }}-${{ github.sha}} + tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav From 01df8f7a1395418cc81bce0360c16092809588c1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:41:59 +0200 Subject: [PATCH 194/429] try to fix run number --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 75c2fe80a44..4bc468d3d19 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -196,7 +196,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-dev-release-${{ steps.date.outputs.today }}-${{ github.run_id }}-${{ github.sha}} + name: inav-dev-release-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha}} tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} From f41dd600f91b82eabbd8ea119503cfad094f26c3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:22:24 +0200 Subject: [PATCH 195/429] Fix version type definition --- .github/workflows/dev-builds.yml | 16 ++++++++++++---- CMakeLists.txt | 1 + src/main/build/version.h | 4 ++++ src/main/fc/cli.c | 10 ++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 4bc468d3d19..64a14ee4d57 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -139,10 +139,12 @@ jobs: COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') - echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV - echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + #echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + #echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + #echo "VERSION_TAG=-$(date '+%Y%m%d')" >> $GITHUB_ENV + echo "version=${VERSION}" >> $GITHUB_OUTPUT - name: Build SITL - run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE="dev" -G Ninja .. && ninja - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -163,6 +165,12 @@ jobs: needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test] runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Get version + id: version + run: | + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }') + echo "version=${VERSION}" >> $GITHUB_OUTPUT - name: Get current date id: date run: echo "today=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT @@ -196,7 +204,7 @@ jobs: - name: Upload release artifacts uses: softprops/action-gh-release@v2 with: - name: inav-dev-release-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha}} + name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }} tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup #token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index db8ec36897b..9b5f40f3337 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ set(COMMON_COMPILE_DEFINITIONS FC_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR} FC_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR} FC_VERSION_PATCH_LEVEL=${CMAKE_PROJECT_VERSION_PATCH} + FC_VERSION_TYPE="${VERSION_TYPE}" ) if (NOT SITL) diff --git a/src/main/build/version.h b/src/main/build/version.h index 49ec81d1b11..583cdd82dd8 100644 --- a/src/main/build/version.h +++ b/src/main/build/version.h @@ -18,8 +18,12 @@ #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) #define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL) +#ifndef FC_VERSION_TYPE +#define FC_VERSION_TYPE "" +#endif #define FC_FIRMWARE_NAME "INAV" + #define MW_VERSION 231 extern const char* const compilerVersion; diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 18243fdefce..7b9c1329884 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3662,13 +3662,14 @@ static void cliStatus(char *cmdline) char buf[MAX(FORMATTED_DATE_TIME_BUFSIZE, SETTING_MAX_NAME_LENGTH)]; dateTime_t dt; - cliPrintLinef("%s/%s %s %s / %s (%s)", + cliPrintLinef("%s/%s %s %s / %s (%s) %s", FC_FIRMWARE_NAME, targetName, FC_VERSION_STRING, buildDate, buildTime, - shortGitRevision + shortGitRevision, + FC_VERSION_TYPE ); cliPrintLinef("GCC-%s", compilerVersion @@ -3906,13 +3907,14 @@ static void cliVersion(char *cmdline) { UNUSED(cmdline); - cliPrintLinef("# %s/%s %s %s / %s (%s)", + cliPrintLinef("# %s/%s %s %s / %s (%s) %s", FC_FIRMWARE_NAME, targetName, FC_VERSION_STRING, buildDate, buildTime, - shortGitRevision + shortGitRevision, + FC_VERSION_TYPE ); cliPrintLinef("# GCC-%s", compilerVersion From 1fa882bf869c619a995dcd9d5c3954f5d488dcac Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:54:57 +0200 Subject: [PATCH 196/429] BUILD_TYPE on all builds --- .github/workflows/dev-builds.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 64a14ee4d57..426b3218ea2 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -41,7 +41,7 @@ jobs: path: downloads key: ${{ runner.os }}-downloads-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('**/cmake/*')}} - name: Build targets (${{ matrix.id }}) - run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -G Ninja .. && ninja ci + run: mkdir -p build && cd build && cmake -DWARNINGS_AS_ERRORS=ON -DCI_JOB_INDEX=${{ matrix.id }} -DCI_JOB_COUNT=${{ strategy.job-total }} -DBUILD_SUFFIX=${{ env.BUILD_SUFFIX }} -DVERSION_TYPE=dev -G Ninja .. && ninja ci - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -71,7 +71,7 @@ jobs: echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV - name: Build SITL - run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja -DVERSION_TYPE=dev .. && ninja - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -105,7 +105,7 @@ jobs: - name: Build SITL run: | mkdir -p build_SITL && cd build_SITL - cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -G Ninja .. + cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DVERSION_TYPE=dev -G Ninja .. ninja - name: Upload artifacts @@ -144,7 +144,7 @@ jobs: #echo "VERSION_TAG=-$(date '+%Y%m%d')" >> $GITHUB_ENV echo "version=${VERSION}" >> $GITHUB_OUTPUT - name: Build SITL - run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE="dev" -G Ninja .. && ninja + run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE=dev -G Ninja .. && ninja - name: Upload artifacts uses: actions/upload-artifact@v4 with: From 9f74b52732e86a56cdef916ac4f38205b8793edb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:27:32 +0200 Subject: [PATCH 197/429] Test non-daft --- .github/workflows/dev-builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 426b3218ea2..215b90c4aba 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -7,7 +7,7 @@ on: branches: - master mmosca-update-github-actions - pull_request: + #pull_request: jobs: build: @@ -210,7 +210,7 @@ jobs: #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav prerelease: true - draft: true + draft: false generate_release_notes: true make_latest: false files: | From 0c68faec4c60185fe52694d914ecfff6823c0dc9 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:30:17 +0200 Subject: [PATCH 198/429] re-enable on branch --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 215b90c4aba..950d1c3dbfd 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -7,7 +7,7 @@ on: branches: - master mmosca-update-github-actions - #pull_request: + pull_request: jobs: build: From 5d4e9f7ee92d338af3046f7d3ecd1af3cfb242c1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:46:32 +0200 Subject: [PATCH 199/429] re-enable, set as draft again --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 950d1c3dbfd..426b3218ea2 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -210,7 +210,7 @@ jobs: #token: ${{ secrets.GITHUB_TOKEN }} repository: iNavFlight/inav prerelease: true - draft: false + draft: true generate_release_notes: true make_latest: false files: | From 8449e0d3f6fe1e56e091aaec66ccd35568ea5ad8 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:18:01 +0100 Subject: [PATCH 200/429] add posStatus check --- src/main/navigation/navigation_multicopter.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 44264985cfb..179e475b218 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -802,9 +802,12 @@ bool isMulticopterLandingDetected(void) const timeMs_t currentTimeMs = millis(); #if defined(USE_BARO) - /* Only allow landing G bump detection when xy velocity is low */ - if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING) { - return isLandingGbumpDetected(currentTimeMs); // Landing flagged immediately if landing bump detected + /* G bump landing detection only active when xy velocity is usable and low */ + if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && + posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING && + isLandingGbumpDetected(currentTimeMs)) { // CR129 + + return true; // Landing flagged immediately if landing bump detected } #endif From 456c49a7927a979a8e6d9a0b532ef17e6f278442 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:54:17 +0100 Subject: [PATCH 201/429] add failsafe logic --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- src/main/navigation/navigation_multicopter.c | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 2367cc8f1ab..296d86931ee 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3474,7 +3474,7 @@ Defines at what altitude the descent velocity should start to be `nav_land_minal ### nav_landing_bump_detection -Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and currently only works for multirotors. +Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and GPS and currently only works for multirotors (Note: will work during Failsafe without need for a GPS). | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index cfe40bb400f..0d358f58ffb 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2463,7 +2463,7 @@ groups: min: 1 max: 15 - name: nav_landing_bump_detection - description: "Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and currently only works for multirotors." + description: "Allows immediate landing detection based on G bump at touchdown when set to ON. Requires a barometer and GPS and currently only works for multirotors (Note: will work during Failsafe without need for a GPS)." default_value: OFF field: general.flags.landing_bump_detection type: bool diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 179e475b218..b58431211df 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -802,11 +802,12 @@ bool isMulticopterLandingDetected(void) const timeMs_t currentTimeMs = millis(); #if defined(USE_BARO) - /* G bump landing detection only active when xy velocity is usable and low */ - if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && - posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING && - isLandingGbumpDetected(currentTimeMs)) { // CR129 + /* G bump landing detection only used when xy velocity is usable and low or failsafe is active */ + bool gBumpDetectionUsable = navConfig()->general.flags.landing_bump_detection && sensors(SENSOR_BARO) && + ((posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING) || + FLIGHT_MODE(FAILSAFE_MODE)); + if (gBumpDetectionUsable && isLandingGbumpDetected(currentTimeMs)) { return true; // Landing flagged immediately if landing bump detected } #endif From 29a2d6935bdd1f1910f1d2f3a6292f3697d54369 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:13:28 +0200 Subject: [PATCH 202/429] Add version header, in case we want to expand it in the future --- src/main/io/headtracker_msp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/io/headtracker_msp.h b/src/main/io/headtracker_msp.h index 4552bf1ea1b..d1d5bb68651 100644 --- a/src/main/io/headtracker_msp.h +++ b/src/main/io/headtracker_msp.h @@ -28,6 +28,7 @@ #include "drivers/headtracker_common.h" typedef struct headtrackerMspMessage_s { + uint8_t version; // 0 int16_t pan; // -2048~2047. Scale is min/max angle for gimbal int16_t tilt; // -2048~2047. Scale is min/max angle for gimbal int16_t roll; // -2048~2047. Scale is min/max angle for gimbal @@ -38,4 +39,4 @@ void mspHeadTrackerInit(void); void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize); -#endif \ No newline at end of file +#endif From d351af62ea1ba589f0ffc114ea36c259caf15acc Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Sat, 15 Jun 2024 10:11:39 +0100 Subject: [PATCH 203/429] [crsf] move LAND flight mode into ARMED section --- src/main/telemetry/crsf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/telemetry/crsf.c b/src/main/telemetry/crsf.c index 5ed25de73be..8b7f289db20 100755 --- a/src/main/telemetry/crsf.c +++ b/src/main/telemetry/crsf.c @@ -354,11 +354,11 @@ static void crsfFrameFlightMode(sbuf_t *dst) flightMode = "HOR"; } else if (FLIGHT_MODE(ANGLEHOLD_MODE)) { flightMode = "ANGH"; - } #ifdef USE_FW_AUTOLAND - } else if (FLIGHT_MODE(NAV_FW_AUTOLAND)) { - flightMode = "LAND"; + } else if (FLIGHT_MODE(NAV_FW_AUTOLAND)) { + flightMode = "LAND"; #endif + } #ifdef USE_GPS } else if (feature(FEATURE_GPS) && navConfig()->general.flags.extra_arming_safety && (!STATE(GPS_FIX) || !STATE(GPS_FIX_HOME))) { flightMode = "WAIT"; // Waiting for GPS lock From 68e749831e25d1518d6dff171971b7e3b2f4dfa8 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sun, 16 Jun 2024 08:24:45 +0100 Subject: [PATCH 204/429] Update navigation.c --- src/main/navigation/navigation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 3c87ced7a11..4c42ce900fd 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -3353,7 +3353,7 @@ void updateLandingStatus(timeMs_t currentTimeMs) if (STATE(AIRPLANE) && isFlightDetected()) { // Cancel landing detection flag if fixed wing redetected in flight resetLandingDetector(); - } else { + } else if (STATE(MULTIROTOR)) { // For multirotor - reactivate landing detector without disarm when throttle raised toward hover throttle landingDetectorIsActive = rxGetChannelValue(THROTTLE) < (0.5 * (currentBatteryProfile->nav.mc.hover_throttle + getThrottleIdleValue())); } From c1729b5b95ec03d05944ab329e03804f2b384d6e Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 12:10:20 +0200 Subject: [PATCH 205/429] Implemented basic lulu filtering system --- src/main/CMakeLists.txt | 2 + src/main/common/filter.c | 8 +- src/main/common/filter.h | 8 +- src/main/common/lulu.c | 186 +++++++++++++++++++++++++++ src/main/common/lulu.h | 14 ++ src/main/fc/config.c | 12 +- src/main/fc/settings.yaml | 14 +- src/main/sensors/gyro.c | 5 +- src/main/target/BETAFPVF411/target.h | 2 +- 9 files changed, 231 insertions(+), 20 deletions(-) create mode 100644 src/main/common/lulu.c create mode 100644 src/main/common/lulu.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 5e5efd62ec8..6317ac0f475 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -31,6 +31,8 @@ main_sources(COMMON_SRC common/gps_conversion.h common/log.c common/log.h + common/lulu.c + common/lulu.h common/maths.c common/maths.h common/memory.c diff --git a/src/main/common/filter.c b/src/main/common/filter.c index 86aa54a0364..524ebf98fc4 100644 --- a/src/main/common/filter.c +++ b/src/main/common/filter.c @@ -23,10 +23,10 @@ #include "platform.h" #include "common/filter.h" +#include "common/lulu.h" #include "common/maths.h" #include "common/utils.h" #include "common/time.h" - // NULL filter float nullFilterApply(void *filter, float input) { @@ -326,6 +326,8 @@ void initFilter(const uint8_t filterType, filter_t *filter, const float cutoffFr pt2FilterInit(&filter->pt2, pt2FilterGain(cutoffFrequency, dT)); } if (filterType == FILTER_PT3) { pt3FilterInit(&filter->pt3, pt3FilterGain(cutoffFrequency, dT)); + } if (filterType == FILTER_LULU) { + pt3FilterInit(&filter->lulu, cutoffFrequency); } else { biquadFilterInitLPF(&filter->biquad, cutoffFrequency, refreshRate); } @@ -341,8 +343,10 @@ void assignFilterApplyFn(uint8_t filterType, float cutoffFrequency, filterApplyF *applyFn = (filterApplyFnPtr) pt2FilterApply; } if (filterType == FILTER_PT3) { *applyFn = (filterApplyFnPtr) pt3FilterApply; + } if (filterType == FILTER_LULU) { + *applyFn = (filterApplyFnPtr) luluFilterApply; } else { *applyFn = (filterApplyFnPtr) biquadFilterApply; } } -} \ No newline at end of file +} diff --git a/src/main/common/filter.h b/src/main/common/filter.h index c6cedc86490..9be86b495ce 100644 --- a/src/main/common/filter.h +++ b/src/main/common/filter.h @@ -17,6 +17,8 @@ #pragma once +#include "lulu.h" + typedef struct rateLimitFilter_s { float state; } rateLimitFilter_t; @@ -50,13 +52,15 @@ typedef union { pt1Filter_t pt1; pt2Filter_t pt2; pt3Filter_t pt3; + luluFilter_t lulu; } filter_t; typedef enum { FILTER_PT1 = 0, FILTER_BIQUAD, FILTER_PT2, - FILTER_PT3 + FILTER_PT3, + FILTER_LULU } filterType_e; typedef enum { @@ -134,4 +138,4 @@ void alphaBetaGammaFilterInit(alphaBetaGammaFilter_t *filter, float alpha, float float alphaBetaGammaFilterApply(alphaBetaGammaFilter_t *filter, float input); void initFilter(uint8_t filterType, filter_t *filter, float cutoffFrequency, uint32_t refreshRate); -void assignFilterApplyFn(uint8_t filterType, float cutoffFrequency, filterApplyFnPtr *applyFn); \ No newline at end of file +void assignFilterApplyFn(uint8_t filterType, float cutoffFrequency, filterApplyFnPtr *applyFn); diff --git a/src/main/common/lulu.c b/src/main/common/lulu.c new file mode 100644 index 00000000000..7a279a98451 --- /dev/null +++ b/src/main/common/lulu.c @@ -0,0 +1,186 @@ +#include "lulu.h" + +#include +#include +#include +#include + +#include "platform.h" + +#include "common/filter.h" +#include "common/maths.h" +#include "common/utils.h" + +#ifdef __ARM_ACLE +#include +#endif /* __ARM_ACLE */ +#include + +void luluFilterInit(luluFilter_t *filter, int N) +{ + if (N > 15) + { + N = 15; + } + if (N < 1) + { + N = 1; + } + filter->N = N; + filter->windowSize = filter->N * 2 + 1; + filter->windowBufIndex = 0; + + memset(filter->luluInterim, 0, sizeof(float) * (filter->windowSize)); + memset(filter->luluInterimB, 0, sizeof(float) * (filter->windowSize)); +} + +FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, int windowSize) +{ + register float curVal = 0; + register float curValB = 0; + for (int N = 1; N <= filterN; N++) + { + int indexNeg = (index + windowSize - 2 * N) % windowSize; + register int curIndex = (indexNeg + 1) % windowSize; + register float prevVal = series[indexNeg]; + register float prevValB = seriesB[indexNeg]; + register int indexPos = (curIndex + N) % windowSize; + for (int i = windowSize - 2 * N; i < windowSize - N; i++) + { + if (indexPos >= windowSize) + { + indexPos = 0; + } + if (curIndex >= windowSize) + { + curIndex = 0; + } + // curIndex = (2 - 1) % 3 = 1 + curVal = series[curIndex]; + curValB = seriesB[curIndex]; + register float nextVal = series[indexPos]; + register float nextValB = seriesB[indexPos]; + // onbump (s, 1, 1, 3) + // if(onBump(series, curIndex, N, windowSize)) + if (prevVal < curVal && curVal > nextVal) + { + float maxValue = MAX(prevVal, nextVal); + + series[curIndex] = maxValue; + register int k = curIndex; + for (int j = 1; j < N; j++) + { + if (++k >= windowSize) + { + k = 0; + } + series[k] = maxValue; + } + } + + if (prevValB < curValB && curValB > nextValB) + { + float maxValue = MAX(prevValB, nextValB); + + curVal = maxValue; + seriesB[curIndex] = maxValue; + register int k = curIndex; + for (int j = 1; j < N; j++) + { + if (++k >= windowSize) + { + k = 0; + } + seriesB[k] = maxValue; + } + } + prevVal = curVal; + prevValB = curValB; + curIndex++; + indexPos++; + } + + curIndex = (indexNeg + 1) % windowSize; + prevVal = series[indexNeg]; + prevValB = seriesB[indexNeg]; + indexPos = (curIndex + N) % windowSize; + for (int i = windowSize - 2 * N; i < windowSize - N; i++) + { + if (indexPos >= windowSize) + { + indexPos = 0; + } + if (curIndex >= windowSize) + { + curIndex = 0; + } + // curIndex = (2 - 1) % 3 = 1 + curVal = series[curIndex]; + curValB = seriesB[curIndex]; + register float nextVal = series[indexPos]; + register float nextValB = seriesB[indexPos]; + + if (prevVal > curVal && curVal < nextVal) + { + float minValue = MIN(prevVal, nextVal); + + curVal = minValue; + series[curIndex] = minValue; + register int k = curIndex; + for (int j = 1; j < N; j++) + { + if (++k >= windowSize) + { + k = 0; + } + series[k] = minValue; + } + } + + if (prevValB > curValB && curValB < nextValB) + { + float minValue = MIN(prevValB, nextValB); + curValB = minValue; + seriesB[curIndex] = minValue; + register int k = curIndex; + for (int j = 1; j < N; j++) + { + if (++k >= windowSize) + { + k = 0; + } + seriesB[k] = minValue; + } + } + prevVal = curVal; + prevValB = curValB; + curIndex++; + indexPos++; + } + } + return (curVal - curValB) / 2; +} + +FAST_CODE float luluFilterPartialApply(luluFilter_t *filter, float input) +{ + // This is the value N of the LULU filter. + register int filterN = filter->N; + // This is the total window size for the rolling buffer + register int filterWindow = filter->windowSize; + + register int windowIndex = filter->windowBufIndex; + register float inputVal = input; + register int newIndex = (windowIndex + 1) % filterWindow; + filter->windowBufIndex = newIndex; + filter->luluInterim[windowIndex] = inputVal; + filter->luluInterimB[windowIndex] = -inputVal; + return fixRoad(filter->luluInterim, filter->luluInterimB, windowIndex, filterN, filterWindow); +} + +FAST_CODE float luluFilterApply(luluFilter_t *filter, float input) +{ + // This is the UL filter + float resultA = luluFilterPartialApply(filter, input); + // We use the median interpretation of this filter to remove bias in the output + return resultA; +} \ No newline at end of file diff --git a/src/main/common/lulu.h b/src/main/common/lulu.h new file mode 100644 index 00000000000..84f1ad93566 --- /dev/null +++ b/src/main/common/lulu.h @@ -0,0 +1,14 @@ +#pragma once + +// Max N = 15 +typedef struct +{ + int windowSize; + int windowBufIndex; + int N; + float luluInterim[32] __attribute__((aligned(128))); + float luluInterimB[32]; +} luluFilter_t; + +void luluFilterInit(luluFilter_t *filter, int N); +float luluFilterApply(luluFilter_t *filter, float input); diff --git a/src/main/fc/config.c b/src/main/fc/config.c index dc249df059b..8739c0ce630 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -193,13 +193,13 @@ void validateAndFixConfig(void) #ifdef USE_ADAPTIVE_FILTER // gyroConfig()->adaptiveFilterMinHz has to be at least 5 units lower than gyroConfig()->gyro_main_lpf_hz - if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { - gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; - } +// if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { +// gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; +// } //gyroConfig()->adaptiveFilterMaxHz has to be at least 5 units higher than gyroConfig()->gyro_main_lpf_hz - if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { - gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; - } +// if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { +// gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; +// } #endif if (accelerometerConfig()->acc_notch_cutoff >= accelerometerConfig()->acc_notch_hz) { diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index cfe40bb400f..fbbdfbbb29a 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -119,7 +119,7 @@ tables: - name: filter_type values: ["PT1", "BIQUAD"] - name: filter_type_full - values: ["PT1", "BIQUAD", "PT2", "PT3"] + values: ["PT1", "BIQUAD", "PT2", "PT3", "LULU"] - name: log_level values: ["ERROR", "WARNING", "INFO", "VERBOSE", "DEBUG"] - name: iterm_relax @@ -219,13 +219,13 @@ groups: default_value: 1000 max: 9000 - name: gyro_anti_aliasing_lpf_hz - description: "Gyro processing anti-aliasing filter cutoff frequency. In normal operation this filter setting should never be changed. In Hz" - default_value: 250 + description: "Gyro processing anti-aliasing filter cutoff frequency. In normal operation this filter setting should never be changed. In samples" + default_value: 1 field: gyro_anti_aliasing_lpf_hz max: 1000 - name: gyro_main_lpf_hz - description: "Software based gyro main lowpass filter. Value is cutoff frequency (Hz)" - default_value: 60 + description: "Software based gyro main lowpass filter. Value is samples" + default_value: 3 field: gyro_main_lpf_hz min: 0 max: 500 @@ -254,7 +254,7 @@ groups: max: 10 - name: dynamic_gyro_notch_enabled description: "Enable/disable dynamic gyro notch also known as Matrix Filter" - default_value: ON + default_value: OFF field: dynamicGyroNotchEnabled condition: USE_DYNAMIC_FILTERS type: bool @@ -293,7 +293,7 @@ groups: default_value: 0 - name: setpoint_kalman_enabled description: "Enable Kalman filter on the gyro data" - default_value: ON + default_value: OFF condition: USE_GYRO_KALMAN field: kalmanEnabled type: bool diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 2b0b7d8c9bd..de0ad438d1c 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -244,9 +244,10 @@ static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t { *applyFn = nullFilterApply; if (cutoff > 0) { - *applyFn = (filterApplyFnPtr)pt1FilterApply; + *applyFn = (filterApplyFnPtr)luluFilterApply; for (int axis = 0; axis < 3; axis++) { - pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); +// pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); + luluFilterInit(&state[axis].lulu, cutoff); } } } diff --git a/src/main/target/BETAFPVF411/target.h b/src/main/target/BETAFPVF411/target.h index 1f57281d2f4..50b8bb13c10 100644 --- a/src/main/target/BETAFPVF411/target.h +++ b/src/main/target/BETAFPVF411/target.h @@ -71,7 +71,7 @@ // *************** SPI FLASH ************************** #define USE_FLASHFS #define USE_FLASH_M25P16 -#define M25P16_CS_PIN PB2 +#define M25P16_CS_PIN PA0 #define M25P16_SPI_BUS BUS_SPI2 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT From 8eb6fbaae7776ec815ddd976bcae9675d4912318 Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 12:15:34 +0200 Subject: [PATCH 206/429] Fixed bug --- src/main/common/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/common/filter.c b/src/main/common/filter.c index 524ebf98fc4..5fd72965d85 100644 --- a/src/main/common/filter.c +++ b/src/main/common/filter.c @@ -327,7 +327,7 @@ void initFilter(const uint8_t filterType, filter_t *filter, const float cutoffFr } if (filterType == FILTER_PT3) { pt3FilterInit(&filter->pt3, pt3FilterGain(cutoffFrequency, dT)); } if (filterType == FILTER_LULU) { - pt3FilterInit(&filter->lulu, cutoffFrequency); + luluFilterInit(&filter->lulu, cutoffFrequency); } else { biquadFilterInitLPF(&filter->biquad, cutoffFrequency, refreshRate); } From 895ff5b77907f2be8b51e1e0d3ba4931b3bbe11b Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 12:27:12 +0200 Subject: [PATCH 207/429] Undid target change --- src/main/target/BETAFPVF411/target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/BETAFPVF411/target.h b/src/main/target/BETAFPVF411/target.h index 50b8bb13c10..1f57281d2f4 100644 --- a/src/main/target/BETAFPVF411/target.h +++ b/src/main/target/BETAFPVF411/target.h @@ -71,7 +71,7 @@ // *************** SPI FLASH ************************** #define USE_FLASHFS #define USE_FLASH_M25P16 -#define M25P16_CS_PIN PA0 +#define M25P16_CS_PIN PB2 #define M25P16_SPI_BUS BUS_SPI2 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT From 58fc4ed8ec83af48fa38fde0ed0bbf5abfdb9543 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:55:19 +0200 Subject: [PATCH 208/429] Update dev-builds.yml Use newly created secret --- .github/workflows/dev-builds.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 426b3218ea2..d93f94dd1e8 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -207,10 +207,10 @@ jobs: name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }} tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup - #token: ${{ secrets.GITHUB_TOKEN }} - repository: iNavFlight/inav + token: ${{ secrets.NIGHTLY_TOKEN }} + repository: iNavFlight/inav-nightly prerelease: true - draft: true + draft: false generate_release_notes: true make_latest: false files: | From 91f4569c3a564804b77184e3c5cfe92b414310f2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:31:24 +0200 Subject: [PATCH 209/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index d93f94dd1e8..becbea70546 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -208,7 +208,8 @@ jobs: tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup token: ${{ secrets.NIGHTLY_TOKEN }} - repository: iNavFlight/inav-nightly + #repository: iNavFlight/inav-nightly + reposiroty: mmosca-test-org/test-repo prerelease: true draft: false generate_release_notes: true From 96217f39a3d47ec664f3353b230714eedf34f3e4 Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 14:38:11 +0200 Subject: [PATCH 210/429] Made improvements as requested --- src/main/common/lulu.c | 12 ++---------- src/main/fc/config.c | 14 +++++++------- src/main/fc/settings.yaml | 19 ++++++++++++------- src/main/sensors/gyro.c | 22 +++++++++++++++------- src/main/sensors/gyro.h | 5 ++++- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/main/common/lulu.c b/src/main/common/lulu.c index 7a279a98451..c44d6724ec1 100644 --- a/src/main/common/lulu.c +++ b/src/main/common/lulu.c @@ -18,15 +18,7 @@ void luluFilterInit(luluFilter_t *filter, int N) { - if (N > 15) - { - N = 15; - } - if (N < 1) - { - N = 1; - } - filter->N = N; + filter->N = constrain(N, 1, 15); filter->windowSize = filter->N * 2 + 1; filter->windowBufIndex = 0; @@ -183,4 +175,4 @@ FAST_CODE float luluFilterApply(luluFilter_t *filter, float input) float resultA = luluFilterPartialApply(filter, input); // We use the median interpretation of this filter to remove bias in the output return resultA; -} \ No newline at end of file +} diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 8739c0ce630..fb2a83061d8 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -192,14 +192,14 @@ void validateAndFixConfig(void) { #ifdef USE_ADAPTIVE_FILTER - // gyroConfig()->adaptiveFilterMinHz has to be at least 5 units lower than gyroConfig()->gyro_main_lpf_hz -// if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { -// gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; -// } +// gyroConfig()->adaptiveFilterMinHz has to be at least 5 units lower than gyroConfig()->gyro_main_lpf_hz + if (gyroConfig()->adaptiveFilterMinHz + 5 > gyroConfig()->gyro_main_lpf_hz) { + gyroConfigMutable()->adaptiveFilterMinHz = gyroConfig()->gyro_main_lpf_hz - 5; + } //gyroConfig()->adaptiveFilterMaxHz has to be at least 5 units higher than gyroConfig()->gyro_main_lpf_hz -// if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { -// gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; -// } + if (gyroConfig()->adaptiveFilterMaxHz - 5 < gyroConfig()->gyro_main_lpf_hz) { + gyroConfigMutable()->adaptiveFilterMaxHz = gyroConfig()->gyro_main_lpf_hz + 5; + } #endif if (accelerometerConfig()->acc_notch_cutoff >= accelerometerConfig()->acc_notch_hz) { diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index fb773b80eae..14484e58ea7 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -192,7 +192,7 @@ tables: values: ["SHARED_LOW", "SHARED_HIGH", "LOW", "HIGH"] enum: led_pin_pwm_mode_e - name: gyro_filter_mode - values: ["STATIC", "DYNAMIC", "ADAPTIVE"] + values: ["STATIC", "DYNAMIC", "ADAPTIVE", "LULU"] enum: gyroFilterType_e constants: @@ -216,22 +216,27 @@ groups: members: - name: looptime description: "This is the main loop time (in us). Changing this affects PID effect with some PID controllers (see PID section for details). A very conservative value of 3500us/285Hz should work for everyone. Setting it to zero does not limit loop time, so it will go as fast as possible." - default_value: 1000 + default_value: 500 max: 9000 - name: gyro_anti_aliasing_lpf_hz - description: "Gyro processing anti-aliasing filter cutoff frequency. In normal operation this filter setting should never be changed. In samples" - default_value: 1 + description: "Gyro processing anti-aliasing filter cutoff frequency. In normal operation this filter setting should never be changed. In Hz" + default_value: 250 field: gyro_anti_aliasing_lpf_hz max: 1000 - - name: gyro_main_lpf_hz - description: "Software based gyro main lowpass filter. Value is samples" + - name: gyro_lulu_sample_count + description: "Gyro lulu sample count, in number of samples." default_value: 3 + field: gyroLuluSampleCount + max: 15 + - name: gyro_main_lpf_hz + description: "Software based gyro main lowpass filter. Value is Hz" + default_value: 60 field: gyro_main_lpf_hz min: 0 max: 500 - name: gyro_filter_mode description: "Specifies the type of the software LPF of the gyro signals." - default_value: "STATIC" + default_value: "LULU" field: gyroFilterMode table: gyro_filter_mode - name: gyro_dyn_lpf_min_hz diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index de0ad438d1c..7a90215be5c 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -240,14 +240,18 @@ STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHard return gyroHardware; } -static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t cutoff, uint32_t looptime) +static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t cutoff, uint32_t looptime, filterType_e filterType) { *applyFn = nullFilterApply; if (cutoff > 0) { - *applyFn = (filterApplyFnPtr)luluFilterApply; for (int axis = 0; axis < 3; axis++) { -// pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); - luluFilterInit(&state[axis].lulu, cutoff); + if(filterType == FILTER_LULU) { + luluFilterInit(&state[axis].lulu, cutoff); + *applyFn = (filterApplyFnPtr)luluFilterApply; + } else { + pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); + *applyFn = (filterApplyFnPtr)pt1FilterApply; + } } } } @@ -255,10 +259,14 @@ static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t static void gyroInitFilters(void) { //First gyro LPF running at full gyro frequency 8kHz - initGyroFilter(&gyroLpfApplyFn, gyroLpfState, gyroConfig()->gyro_anti_aliasing_lpf_hz, getGyroLooptime()); + initGyroFilter(&gyroLpfApplyFn, gyroLpfState, gyroConfig()->gyro_anti_aliasing_lpf_hz, getGyroLooptime(), FILTER_PT1); - //Second gyro LPF runnig and PID frequency - this filter is dynamic when gyro_use_dyn_lpf = ON - initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime()); + if(gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_LULU) { + initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyroLuluSampleCount, getLooptime(), FILTER_LULU); + } else { + //Second gyro LPF runnig and PID frequency - this filter is dynamic when gyro_use_dyn_lpf = ON + initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime(), FILTER_PT1); + } #ifdef USE_ADAPTIVE_FILTER if (gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE) { diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 910dac2ea00..4b67081a5ae 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -55,7 +55,8 @@ typedef enum { typedef enum { GYRO_FILTER_MODE_STATIC = 0, GYRO_FILTER_MODE_DYNAMIC = 1, - GYRO_FILTER_MODE_ADAPTIVE = 2 + GYRO_FILTER_MODE_ADAPTIVE = 2, + GYRO_FILTER_MODE_LULU = 3 } gyroFilterMode_e; typedef struct gyro_s { @@ -102,6 +103,8 @@ typedef struct gyroConfig_s { float adaptiveFilterIntegratorThresholdLow; #endif uint8_t gyroFilterMode; + + uint8_t gyroLuluSampleCount; } gyroConfig_t; PG_DECLARE(gyroConfig_t, gyroConfig); From 0116404b27e38fcfdff656bd7e25476dfe3875fc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:51:44 +0200 Subject: [PATCH 211/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index becbea70546..ea767900b04 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -209,7 +209,7 @@ jobs: # To create release on a different repo, we need a token setup token: ${{ secrets.NIGHTLY_TOKEN }} #repository: iNavFlight/inav-nightly - reposiroty: mmosca-test-org/test-repo + repository: mmosca-test-org/test-repo prerelease: true draft: false generate_release_notes: true From 4e8bd5c6b36ad8cfb76da86ea719deef2855cca3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:23:59 +0200 Subject: [PATCH 212/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index ea767900b04..ed5540fcec8 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -205,7 +205,7 @@ jobs: uses: softprops/action-gh-release@v2 with: name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }} - tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} + # tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup token: ${{ secrets.NIGHTLY_TOKEN }} #repository: iNavFlight/inav-nightly From 6675361ff2d82e0bbdac5c0485c3b918cf200494 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:42:09 +0200 Subject: [PATCH 213/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index ed5540fcec8..d93f94dd1e8 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -205,11 +205,10 @@ jobs: uses: softprops/action-gh-release@v2 with: name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }} - # tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} + tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup token: ${{ secrets.NIGHTLY_TOKEN }} - #repository: iNavFlight/inav-nightly - repository: mmosca-test-org/test-repo + repository: iNavFlight/inav-nightly prerelease: true draft: false generate_release_notes: true From 88fb1d0216679e23c8c85b36207334ea3221070b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:03:36 +0200 Subject: [PATCH 214/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index d93f94dd1e8..ee9494e1e11 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -211,9 +211,23 @@ jobs: repository: iNavFlight/inav-nightly prerelease: true draft: false - generate_release_notes: true + #generate_release_notes: true make_latest: false files: | hexes/*.hex sitl-resources.zip + body: | + ${{ steps.notes.outputs.notes }} + + ### Repository: + ${{ github.repository }} ([link](${{ github.event.repository.html_url }})) + + ### Branch: + ${{ github.ref_name }} ([link](${{ github.event.repository.html_url }}/tree/${{ github.ref_name }})) + + ### Latest changeset: + ${{ github.event.head_commit.id }} ([link](${{ github.event.head_commit.url }})) + + ### Changes: + ${{ github.event.head_commit.message }} From e2e37c7113d52cccadf52e4a9ea10e7ef8383fc4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:19:20 +0200 Subject: [PATCH 215/429] Update dev-builds.yml Don't trigger on prs --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index ee9494e1e11..c1dac23c067 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -7,7 +7,7 @@ on: branches: - master mmosca-update-github-actions - pull_request: + #pull_request: jobs: build: From 6d6a4870d49e2aaafa146f70b32b86a0943a9226 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:30:55 +0200 Subject: [PATCH 216/429] Update dev-builds.yml --- .github/workflows/dev-builds.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index c1dac23c067..8bfa1dbc5ef 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -6,8 +6,6 @@ on: push: branches: - master - mmosca-update-github-actions - #pull_request: jobs: build: From 9117cfcccafab9dc0aadb216c412a218c619942d Mon Sep 17 00:00:00 2001 From: rmaia <9812730+rmaia3d@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:08:43 -0300 Subject: [PATCH 217/429] - Remove unused, commented out, legacy function --- src/main/io/osd.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 43e74530337..7feba3d9272 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -477,37 +477,6 @@ static void osdFormatWindSpeedStr(char *buff, int32_t ws, bool isValid) } #endif -/* - * This is a simplified altitude conversion code that does not use any scaling - * but is fully compatible with the DJI G2 MSP Displayport OSD implementation. - */ -/* void osdSimpleAltitudeSymbol(char *buff, int32_t alt) { - - int32_t convertedAltutude = 0; - char suffix = '\0'; - - switch ((osd_unit_e)osdConfig()->units) { - case OSD_UNIT_UK: - FALLTHROUGH; - case OSD_UNIT_GA: - FALLTHROUGH; - case OSD_UNIT_IMPERIAL: - convertedAltutude = CENTIMETERS_TO_FEET(alt); - suffix = SYM_ALT_FT; - break; - case OSD_UNIT_METRIC_MPH: - FALLTHROUGH; - case OSD_UNIT_METRIC: - convertedAltutude = CENTIMETERS_TO_METERS(alt); - suffix = SYM_ALT_M; - break; - } - - tfp_sprintf(buff, "%4d", (int) convertedAltutude); - buff[4] = suffix; - buff[5] = '\0'; -} */ - /** * Converts altitude into a string based on the current unit system * prefixed by a a symbol to indicate the unit used. From fc4db8a3e0fc322f0efed4103721dcf380facbab Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 17:35:28 +0200 Subject: [PATCH 218/429] Updated CLI settings --- docs/Settings.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 296d86931ee..e89e43e8c0d 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -808,7 +808,7 @@ Enable/disable dynamic gyro notch also known as Matrix Filter | Default | Min | Max | | --- | --- | --- | -| ON | OFF | ON | +| OFF | OFF | ON | --- @@ -1698,13 +1698,23 @@ Specifies the type of the software LPF of the gyro signals. | Default | Min | Max | | --- | --- | --- | -| STATIC | | | +| LULU | | | + +--- + +### gyro_lulu_sample_count + +Gyro lulu sample count, in number of samples. + +| Default | Min | Max | +| --- | --- | --- | +| 3 | | 15 | --- ### gyro_main_lpf_hz -Software based gyro main lowpass filter. Value is cutoff frequency (Hz) +Software based gyro main lowpass filter. Value is Hz | Default | Min | Max | | --- | --- | --- | @@ -2198,7 +2208,7 @@ This is the main loop time (in us). Changing this affects PID effect with some P | Default | Min | Max | | --- | --- | --- | -| 1000 | | 9000 | +| 500 | | 9000 | --- @@ -5728,7 +5738,7 @@ Enable Kalman filter on the gyro data | Default | Min | Max | | --- | --- | --- | -| ON | OFF | ON | +| OFF | OFF | ON | --- From 6e5704f5ff33d72096b5cfdb36fe165fb83e5a82 Mon Sep 17 00:00:00 2001 From: Peter Peiser Date: Mon, 17 Jun 2024 17:38:31 +0200 Subject: [PATCH 219/429] Reverted unnecessary changes in setting descriptions --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index e89e43e8c0d..1a2de99f720 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1714,7 +1714,7 @@ Gyro lulu sample count, in number of samples. ### gyro_main_lpf_hz -Software based gyro main lowpass filter. Value is Hz +Software based gyro main lowpass filter. Value is cutoff frequency (Hz) | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 14484e58ea7..289b4eae84a 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -229,7 +229,7 @@ groups: field: gyroLuluSampleCount max: 15 - name: gyro_main_lpf_hz - description: "Software based gyro main lowpass filter. Value is Hz" + description: "Software based gyro main lowpass filter. Value is cutoff frequency (Hz)" default_value: 60 field: gyro_main_lpf_hz min: 0 From 0849408fa1ad5fd56e22e46b8b3a04724e3594bc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:51:41 +0200 Subject: [PATCH 220/429] Add headtracker axis ratios --- docs/Settings.md | 30 +++++++++++++++++++++++++++ src/main/drivers/headtracker_common.c | 2 +- src/main/drivers/headtracker_common.h | 3 +++ src/main/fc/settings.yaml | 21 +++++++++++++++++++ src/main/io/gimbal_serial.c | 6 +++--- src/main/io/headtracker_msp.c | 6 +++--- 6 files changed, 61 insertions(+), 7 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 102f520b80a..cd58bb0cfbf 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1822,6 +1822,36 @@ This setting limits yaw rotation rate that HEADING_HOLD controller can request f --- +### headtracker_pan_ratio + +Head pan movement vs camera movement ratio + +| Default | Min | Max | +| --- | --- | --- | +| 1 | 0 | 3 | + +--- + +### headtracker_roll_ratio + +Head roll movement vs camera movement ratio + +| Default | Min | Max | +| --- | --- | --- | +| 1 | 0 | 3 | + +--- + +### headtracker_tilt_ratio + +Head tilt movement vs camera movement ratio + +| Default | Min | Max | +| --- | --- | --- | +| 1 | 0 | 3 | + +--- + ### headtracker_type Type of headtrackr dervice diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index 670a412c501..84484cfb00d 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -40,7 +40,7 @@ #include "drivers/headtracker_common.h" -PG_REGISTER_WITH_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 0); +PG_REGISTER_WITH_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 1); PG_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, .devType = SETTING_HEADTRACKER_TYPE_DEFAULT diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index 092a00ab0a4..f8b894f9127 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -70,6 +70,9 @@ typedef struct headTrackerVTable_s { typedef struct headTrackerConfig_s { headTrackerDevType_e devType; + float pan_ratio; + float tilt_ratio; + float roll_ratio; } headTrackerConfig_t; PG_DECLARE(headTrackerConfig_t, headTrackerConfig); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 66d2b098f4b..0cd859462ec 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4251,3 +4251,24 @@ groups: field: devType type: uint8_t table: headtracker_dev_type + - name: headtracker_pan_ratio + description: "Head pan movement vs camera movement ratio" + type: float + default_value: 1 + field: tilt_ratio + min: 0 + max: 3 + - name: headtracker_tilt_ratio + description: "Head tilt movement vs camera movement ratio" + type: float + default_value: 1 + field: tilt_ratio + min: 0 + max: 3 + - name: headtracker_roll_ratio + description: "Head roll movement vs camera movement ratio" + type: float + default_value: 1 + field: tilt_ratio + min: 0 + max: 3 \ No newline at end of file diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 90216ea8c60..f73f6759bfa 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -317,9 +317,9 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { state->expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - state->pan = state->attitude.pan; - state->tilt = state->attitude.tilt; - state->roll = state->attitude.roll; + state->pan = constrain(state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); + state->tilt = constrain(state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); + state->roll = constrain(state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); } else { DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index 35757665d5e..a1d85bc1bb1 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -73,9 +73,9 @@ void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) headtrackerMspMessage_t *status = (headtrackerMspMessage_t *)data; - headTrackerMspDevice.pan = status->pan; - headTrackerMspDevice.tilt = status->tilt; - headTrackerMspDevice.roll = status->roll; + headTrackerMspDevice.pan = constrain((status->pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); + headTrackerMspDevice.tilt = constrain((status->tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); + headTrackerMspDevice.roll = constrain((status->roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; UNUSED(status); From 2f268e9d5ba1a1aa7560b02f93fc74fd6f7d946a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:54:18 +0200 Subject: [PATCH 221/429] build fixes --- src/main/io/gimbal_serial.c | 6 +++--- src/main/io/headtracker_msp.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index f73f6759bfa..bce0f26f3ab 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -317,9 +317,9 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { state->expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - state->pan = constrain(state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); - state->tilt = constrain(state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); - state->roll = constrain(state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); + state->pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); + state->tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); + state->roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); } else { DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index a1d85bc1bb1..1f0e20b45d2 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -23,6 +23,7 @@ #include "common/utils.h" #include "common/time.h" +#include "common/maths.h" #include "drivers/headtracker_common.h" From 528e7b4332918189f0c83d87ef7bdff5207c59bc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 20:00:00 +0200 Subject: [PATCH 222/429] Fix sitl warnings --- src/main/io/gimbal_serial.c | 6 +++--- src/main/io/gimbal_serial.h | 12 ++++++------ src/main/io/headtracker_msp.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index bce0f26f3ab..39b8f8a3f97 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -317,9 +317,9 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { state->expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - state->pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); - state->tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); - state->roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); + state->pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); + state->tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); + state->roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); } else { DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 4f7de6753b7..61d6599e0ed 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -37,12 +37,12 @@ extern "C" { typedef struct gimbalHtkAttitudePkt_s { uint8_t sync[2]; //data synchronization 0xA5, 0x5A - uint64_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] - int64_t sensibility:5; // Stabilization sensibility [-16~15] - uint64_t reserved:4; //hold on to one's reserve - int64_t roll:12; //Roll angle [-2048~2047] => [-180~180] - int64_t tilt:12; //Pich angle [-2048~2047] => [-180~180] - int64_t pan:12; //Yaw angle [-2048~2047] => [-180~180] + uint8_t mode:3; //Gimbal Mode [0~7] [Only 0 1 2 modes are supported for the time being] + int16_t sensibility:5; // Stabilization sensibility [-16~15] + uint8_t reserved:4; //hold on to one's reserve + int32_t roll:12; //Roll angle [-2048~2047] => [-180~180] + int32_t tilt:12; //Pich angle [-2048~2047] => [-180~180] + int32_t pan:12; //Yaw angle [-2048~2047] => [-180~180] uint8_t crch; //Data validation H uint8_t crcl; //Data validation L } __attribute__((packed)) gimbalHtkAttitudePkt_t; diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index 1f0e20b45d2..6f0fdf3b3f2 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -74,9 +74,9 @@ void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) headtrackerMspMessage_t *status = (headtrackerMspMessage_t *)data; - headTrackerMspDevice.pan = constrain((status->pan * headTrackerConfig()->pan_ratio) + 0.5, -2048, 2047); - headTrackerMspDevice.tilt = constrain((status->tilt * headTrackerConfig()->tilt_ratio) + 0.5, -2048, 2047); - headTrackerMspDevice.roll = constrain((status->roll * headTrackerConfig()->roll_ratio) + 0.5, -2048, 2047); + headTrackerMspDevice.pan = constrain((status->pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); + headTrackerMspDevice.tilt = constrain((status->tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); + headTrackerMspDevice.roll = constrain((status->roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; UNUSED(status); From 74c309f2b4536322f8dbfeb928a0376e169ae209 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 20:07:15 +0200 Subject: [PATCH 223/429] fix reset function --- src/main/drivers/headtracker_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index 84484cfb00d..d08c5d818bf 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -43,7 +43,10 @@ PG_REGISTER_WITH_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, PG_HEADTRACKER_CONFIG, 1); PG_RESET_TEMPLATE(headTrackerConfig_t, headTrackerConfig, - .devType = SETTING_HEADTRACKER_TYPE_DEFAULT + .devType = SETTING_HEADTRACKER_TYPE_DEFAULT, + .pan_ratio = SETTING_HEADTRACKER_PAN_RATIO_DEFAULT, + .tilt_ratio = SETTING_HEADTRACKER_TILT_RATIO_DEFAULT, + .roll_ratio = SETTING_HEADTRACKER_ROLL_RATIO_DEFAULT, ); static headTrackerDevice_t *commonHeadTrackerDevice = NULL; From a8255fbceeff527b3263826f06a473d2cc5e3e7f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:39:04 -0400 Subject: [PATCH 224/429] Update dev-builds.yml Make tag more readable. --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 8bfa1dbc5ef..5510b258b2f 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -203,7 +203,7 @@ jobs: uses: softprops/action-gh-release@v2 with: name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }} - tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} + tag_name: v${{ steps.version.outputs.version }}-${{ steps.date.outputs.today }}.${{ github.run_number }} # To create release on a different repo, we need a token setup token: ${{ secrets.NIGHTLY_TOKEN }} repository: iNavFlight/inav-nightly From b402d685c650bb33d9848ceaa9eaec1f8727c63b Mon Sep 17 00:00:00 2001 From: Sensei Date: Tue, 18 Jun 2024 02:10:18 -0500 Subject: [PATCH 225/429] Programming framework doc - loiter radius Clarified worsing --- docs/Programming Framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Programming Framework.md b/docs/Programming Framework.md index e0199cfd714..4eb7744e54e 100644 --- a/docs/Programming Framework.md +++ b/docs/Programming Framework.md @@ -86,7 +86,7 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | 38 | Override RC Channel | Overrides channel set by `Operand A` to value of `Operand B`. Note operand A should normally be set as a "Value", NOT as "Get RC Channel"| | 39 | Set Heading Target | Sets heading-hold target to `Operand A`, in centidegrees. Value wraps-around. | | 40 | Modulo | Modulo. Divide `Operand A` by `Operand B` and returns the remainder | -| 41 | Override Loiter Radius | Sets the loiter radius to `Operand A` [`0` : `100000`] in cm. If the value is lower than the loiter radius set in the **Advanced Tuning**, that will be used. | +| 41 | Override Loiter Radius | Sets the loiter radius to `Operand A` [`0` : `100000`] in cm. Must be larger than the loiter radius set in the **Advanced Tuning**. | | 42 | Set Control Profile | Sets the active config profile (PIDFF/Rates/Filters/etc) to `Operand A`. `Operand A` must be a valid profile number, currently from 1 to 3. If not, the profile will not change | | 43 | Use Lowest Value | Finds the lowest value of `Operand A` and `Operand B` | | 44 | Use Highest Value | Finds the highest value of `Operand A` and `Operand B` | From 1e1962413061991495cf19a6999cee28327992f6 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 18 Jun 2024 12:59:37 +0200 Subject: [PATCH 226/429] Update release notes with recommendation fro full chip erase. --- .github/workflows/dev-builds.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index 5510b258b2f..ca31566da19 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -217,6 +217,10 @@ jobs: body: | ${{ steps.notes.outputs.notes }} + ### Flashing + These are nightly builds and configuration settings can be added and removed often. Flashing with Full chip erase is strongly recommended to avoid issues. + Firmware related issues should be open in the iNavflight/inav repository, not in inav-nightly. + ### Repository: ${{ github.repository }} ([link](${{ github.event.repository.html_url }})) From 305f7231d72b9abc412cf771a31dd3cb45bac8b1 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:38:04 +0100 Subject: [PATCH 227/429] change to using Baro rate --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- src/main/navigation/navigation.h | 2 +- src/main/navigation/navigation_multicopter.c | 62 ++++++++++--------- .../navigation/navigation_pos_estimator.c | 2 +- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 08a811debb3..0009455db5a 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3584,7 +3584,7 @@ Multicopter hover throttle hint for altitude controller. Should be set to approx ### nav_mc_inverted_crash_detection -Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or some other reason. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 4s. +Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 068ddf63af4..40a65f3441f 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2416,7 +2416,7 @@ groups: field: general.flags.landing_bump_detection type: bool - name: nav_mc_inverted_crash_detection - description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or some other reason. When enabled the setting defines the additional number of seconds before disarm beyond a minimum fixed time delay such that the minimum possible time delay before disarm is 4s." + description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work." default_value: 0 field: mc.inverted_crash_detection min: 0 diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 1a19de7b34d..101b41cd637 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -689,7 +689,7 @@ float getEstimatedAglPosition(void); bool isEstimatedAglTrusted(void); void checkManualEmergencyLandingControl(bool forcedActivation); -float updateBaroAltitudeRate(float newBaroAltRate, bool updateValue); +void updateBaroAltitudeRate(float newBaroAltRate); bool rthAltControlStickOverrideCheck(uint8_t axis); int8_t navCheckActiveAngleHoldAxis(void); diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 41903ff5f3f..7206ac2472d 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -757,15 +757,12 @@ bool isMulticopterFlying(void) /*----------------------------------------------------------- * Multicopter land detector *-----------------------------------------------------------*/ - #if defined(USE_BARO) -float updateBaroAltitudeRate(float newBaroAltRate, bool updateValue) -{ - static float baroAltRate; - if (updateValue) { - baroAltRate = newBaroAltRate; - } +#if defined(USE_BARO) +static float baroAltRate; - return baroAltRate; +void updateBaroAltitudeRate(float newBaroAltRate) +{ + baroAltRate = newBaroAltRate; } static bool isLandingGbumpDetected(timeMs_t currentTimeMs) @@ -776,7 +773,6 @@ static bool isLandingGbumpDetected(timeMs_t currentTimeMs) * Throttle trigger: must be below hover throttle with lower threshold for manual throttle control */ static timeMs_t gSpikeDetectTimeMs = 0; - float baroAltRate = updateBaroAltitudeRate(0, false); if (!gSpikeDetectTimeMs && acc.accADCf[Z] > 2.0f && baroAltRate < 0.0f) { gSpikeDetectTimeMs = currentTimeMs; @@ -794,46 +790,52 @@ static bool isLandingGbumpDetected(timeMs_t currentTimeMs) return false; } -#endif -bool isMulticopterCrashedInverted(void) + +bool isMulticopterCrashedInverted(timeMs_t currentTimeMs) { - static timeMs_t startTime = 0; + /* Disarms MR if inverted on the ground. Checks vertical velocity is low based on Baro rate below 2 m/s */ - if (ABS(attitude.values.roll) > 1000 || ABS(attitude.values.pitch) > 700) { - static uint32_t initialAltitude; + static timeMs_t startTime = 0; + if ((ABS(attitude.values.roll) > 1000 || ABS(attitude.values.pitch) > 700) && fabsf(baroAltRate) < 200.0f) { if (startTime == 0) { - startTime = millis(); - initialAltitude = navGetCurrentActualPositionAndVelocity()->pos.z; - return false; - } else if (ABS(initialAltitude - navGetCurrentActualPositionAndVelocity()->pos.z) < 200) { - /* Check altitude change < 2m during disarm timeout period indicating MR not in flight. - * Minimum 3s disarm delay + extra user set delay time = Min time of 4s given min user setting is 1s if enabled */ - - uint16_t disarmTimeDelay = 3000 + S2MS(navConfig()->mc.inverted_crash_detection); - return millis() - startTime > disarmTimeDelay; + startTime = currentTimeMs; } + + /* Minimum 3s disarm delay + extra user set delay time (min overall delay of 4s) */ + uint16_t disarmTimeDelay = 3000 + S2MS(navConfig()->mc.inverted_crash_detection); + return currentTimeMs - startTime > disarmTimeDelay; } startTime = 0; return false; } +#endif bool isMulticopterLandingDetected(void) { DEBUG_SET(DEBUG_LANDING, 4, 0); DEBUG_SET(DEBUG_LANDING, 3, averageAbsGyroRates() * 100); - if (navConfig()->mc.inverted_crash_detection && isMulticopterCrashedInverted()) { - ENABLE_ARMING_FLAG(ARMING_DISABLED_LANDING_DETECTED); - disarm(DISARM_LANDING); - } - const timeMs_t currentTimeMs = millis(); #if defined(USE_BARO) - if (sensors(SENSOR_BARO) && navConfig()->general.flags.landing_bump_detection && isLandingGbumpDetected(currentTimeMs)) { - return true; // Landing flagged immediately if landing bump detected + if (sensors(SENSOR_BARO)) { + /* Inverted crash landing detection - immediate disarm */ + if (navConfig()->mc.inverted_crash_detection && isMulticopterCrashedInverted(currentTimeMs)) { + ENABLE_ARMING_FLAG(ARMING_DISABLED_LANDING_DETECTED); + disarm(DISARM_LANDING); + } + + /* G bump landing detection * + * Only used when xy velocity is low or failsafe is active */ + bool gBumpDetectionUsable = navConfig()->general.flags.landing_bump_detection && + ((posControl.flags.estPosStatus >= EST_USABLE && posControl.actualState.velXY < MC_LAND_CHECK_VEL_XY_MOVING) || + FLIGHT_MODE(FAILSAFE_MODE)); + + if (gBumpDetectionUsable && isLandingGbumpDetected(currentTimeMs)) { + return true; // Landing flagged immediately if landing bump detected + } } #endif diff --git a/src/main/navigation/navigation_pos_estimator.c b/src/main/navigation/navigation_pos_estimator.c index 30fa4012e46..d5a342173d3 100755 --- a/src/main/navigation/navigation_pos_estimator.c +++ b/src/main/navigation/navigation_pos_estimator.c @@ -299,7 +299,7 @@ void updatePositionEstimator_BaroTopic(timeUs_t currentTimeUs) static float baroAltPrevious = 0; posEstimator.baro.baroAltRate = (posEstimator.baro.alt - baroAltPrevious) / US2S(baroDtUs); baroAltPrevious = posEstimator.baro.alt; - updateBaroAltitudeRate(posEstimator.baro.baroAltRate, true); + updateBaroAltitudeRate(posEstimator.baro.baroAltRate); } } else { From 500bedb5bf9544c7598a7fa240f654d683155787 Mon Sep 17 00:00:00 2001 From: 0crap <31951195+0crap@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:12:29 +0200 Subject: [PATCH 228/429] Update dev-builds.yml Grammar --- .github/workflows/dev-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index ca31566da19..e0f648e003e 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -219,7 +219,7 @@ jobs: ### Flashing These are nightly builds and configuration settings can be added and removed often. Flashing with Full chip erase is strongly recommended to avoid issues. - Firmware related issues should be open in the iNavflight/inav repository, not in inav-nightly. + Firmware related issues should be opened in the iNavflight/inav repository, not in inav-nightly. ### Repository: ${{ github.repository }} ([link](${{ github.event.repository.html_url }})) From ee4dd48a042060d79b11f31c49f77a02def6d399 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:53:49 +0100 Subject: [PATCH 229/429] fix landed state message priority --- src/main/io/osd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 207b3cb73ec..8cfde49c768 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5644,9 +5644,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter const char *invertedInfoMessage = NULL; if (ARMING_FLAG(ARMED)) { - if (STATE(LANDING_DETECTED)) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); - } else if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { + if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { /* ADDS MAXIMUM OF 5 MESSAGES TO TOTAL */ if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); @@ -5703,7 +5701,10 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter // if RTH activated whilst WP mode selected, remind pilot to cancel WP mode to exit RTH messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_WP_RTH_CANCEL); } - } else { /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active */ + } else if (STATE(LANDING_DETECTED)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); + } else { + /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active and landed state inactive */ /* ADDS MAXIMUM OF 4 MESSAGES TO TOTAL */ if (STATE(AIRPLANE)) { /* ADDS MAXIMUM OF 3 MESSAGES TO TOTAL */ #ifdef USE_FW_AUTOLAND From f6c034886d0f69177247f7bf9d2a18a443f798f2 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Tue, 18 Jun 2024 21:05:05 +0100 Subject: [PATCH 230/429] fix mission planner message --- src/main/io/osd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 8cfde49c768..01bdc1764fb 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -5645,7 +5645,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter if (ARMING_FLAG(ARMED)) { if (FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding()) { - /* ADDS MAXIMUM OF 5 MESSAGES TO TOTAL */ + /* ADDS MAXIMUM OF 3 MESSAGES TO TOTAL NORMALLY, 5 MESSAGES DURING FAILSAFE */ if (navGetCurrentStateFlags() & NAV_AUTO_WP_DONE) { messages[messageCount++] = STATE(LANDING_DETECTED) ? OSD_MESSAGE_STR(OSD_MSG_WP_LANDED) : OSD_MESSAGE_STR(OSD_MSG_WP_FINISHED); } else if (NAV_Status.state == MW_NAV_STATE_WP_ENROUTE) { @@ -5705,7 +5705,7 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_LANDED); } else { /* Messages shown only when Failsafe, WP, RTH or Emergency Landing not active and landed state inactive */ - /* ADDS MAXIMUM OF 4 MESSAGES TO TOTAL */ + /* ADDS MAXIMUM OF 3 MESSAGES TO TOTAL */ if (STATE(AIRPLANE)) { /* ADDS MAXIMUM OF 3 MESSAGES TO TOTAL */ #ifdef USE_FW_AUTOLAND if (canFwLandingBeCancelled()) { @@ -5763,10 +5763,6 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_ALTITUDE_HOLD); } } - - if (posControl.flags.wpMissionPlannerActive) { - messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); - } } } else if (ARMING_FLAG(ARMING_DISABLED_ALL_FLAGS)) { /* ADDS MAXIMUM OF 2 MESSAGES TO TOTAL */ unsigned invalidIndex; @@ -5795,7 +5791,11 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter } } - /* Messages that are shown regardless of Arming state - ADDS MAXIMUM OF 1 MESSAGES TO TOTAL */ + /* Messages that are shown regardless of Arming state */ + /* ADDS MAXIMUM OF 2 MESSAGES TO TOTAL NORMALLY, 1 MESSAGE DURING FAILSAFE */ + if (posControl.flags.wpMissionPlannerActive && !FLIGHT_MODE(FAILSAFE_MODE)) { + messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_MISSION_PLANNER); + } // The following has been commented out as it will be added in #9688 // uint16_t rearmMs = (emergInflightRearmEnabled()) ? emergencyInFlightRearmTimeMS() : 0; From 0843ff7c7d1509a5920a1859643348addbf9fa42 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:50:47 +0200 Subject: [PATCH 231/429] Fix copy and paste error on settings.yaml --- src/main/fc/settings.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 169d52024fb..6430ae9ceee 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4255,7 +4255,7 @@ groups: description: "Head pan movement vs camera movement ratio" type: float default_value: 1 - field: tilt_ratio + field: pan_ratio min: 0 max: 3 - name: headtracker_tilt_ratio @@ -4269,6 +4269,6 @@ groups: description: "Head roll movement vs camera movement ratio" type: float default_value: 1 - field: tilt_ratio + field: roll_ratio min: 0 max: 3 \ No newline at end of file From 1dbe0b781179464af14bd28974cb9d8fa34ac503 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:44:25 +0100 Subject: [PATCH 232/429] inhibit during turtle mode --- src/main/navigation/navigation_multicopter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/navigation/navigation_multicopter.c b/src/main/navigation/navigation_multicopter.c index 7206ac2472d..cd23edd6b32 100644 --- a/src/main/navigation/navigation_multicopter.c +++ b/src/main/navigation/navigation_multicopter.c @@ -822,7 +822,7 @@ bool isMulticopterLandingDetected(void) #if defined(USE_BARO) if (sensors(SENSOR_BARO)) { /* Inverted crash landing detection - immediate disarm */ - if (navConfig()->mc.inverted_crash_detection && isMulticopterCrashedInverted(currentTimeMs)) { + if (navConfig()->mc.inverted_crash_detection && !FLIGHT_MODE(TURTLE_MODE) && isMulticopterCrashedInverted(currentTimeMs)) { ENABLE_ARMING_FLAG(ARMING_DISABLED_LANDING_DETECTED); disarm(DISARM_LANDING); } From 70717526b8b2c2f7c6326188f6263c0f63b3f31c Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:51:04 +0100 Subject: [PATCH 233/429] improve setting description --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 4c32a2b60e3..36b6abb54eb 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3654,7 +3654,7 @@ Multicopter hover throttle hint for altitude controller. Should be set to approx ### nav_mc_inverted_crash_detection -Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work. +Setting a value > 0 enables inverted crash detection for multirotors. It will auto disarm in situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 97f37276508..44d77f18019 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2468,7 +2468,7 @@ groups: field: general.flags.landing_bump_detection type: bool - name: nav_mc_inverted_crash_detection - description: "Setting a value > 0 enables inverted crash detection for multirotors. It is intended for situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work." + description: "Setting a value > 0 enables inverted crash detection for multirotors. It will auto disarm in situations where the multirotor has crashed inverted on the ground and can't be manually disarmed due to loss of control or for some other reason. When enabled this setting defines the additional number of seconds before disarm beyond a minimum fixed time delay of 3s. Requires a barometer to work." default_value: 0 field: mc.inverted_crash_detection min: 0 From ac3834f2934a199da25b69447f6f7a7d2680b1ae Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:47:22 +0200 Subject: [PATCH 234/429] Cleanup --- src/main/drivers/headtracker_common.h | 1 - src/main/io/gimbal_serial.c | 77 ++++++++++++++------------- src/main/io/gimbal_serial.h | 4 -- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index f8b894f9127..769bfb206eb 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -90,7 +90,6 @@ int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice); - void taskUpdateHeadTracker(timeUs_t currentTimeUs); bool headtrackerCommonIsEnabled(void); diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 39b8f8a3f97..dbb30d08a47 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -58,7 +58,6 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_ static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; static gimbalSerialHtrkState_t headTrackerState = { - .expires = 0, .payloadSize = 0, .state = WAITING_HDR1, }; @@ -79,6 +78,30 @@ static gimbalDevice_t serialGimbalDevice = { .vTable = &gimbalSerialVTable }; +#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) + +static headTrackerVTable_t headTrackerVTable = { + .process = headtrackerSerialProcess, + .getDeviceType = headtrackerSerialGetDeviceType, + .isReady = headTrackerSerialIsReady, + .isValid = headTrackerSerialIsValid, + .getPanPWM = headTrackerSerialGetPanPWM, + .getTiltPWM = headTrackerSerialGetTiltPWM, + .getRollPWM = headTrackerSerialGetRollPWM, +}; + + +headTrackerDevice_t headTrackerDevice = { + .vTable = &headTrackerVTable, + .pan = 0, + .tilt = 0, + .roll = 0, + .expires = 0 +}; + +#endif + + gimbalDevType_e gimbalSerialGetDeviceType(const gimbalDevice_t *gimbalDevice) { UNUSED(gimbalDevice); @@ -207,14 +230,14 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) } if(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { - if (gimbalCommonHtrkIsEnabled() && (micros() < headTrackerState.expires)) { - attitude.tilt = headTrackerState.tilt; - attitude.pan = headTrackerState.pan; - attitude.roll = headTrackerState.roll; + if (gimbalCommonHtrkIsEnabled() && (micros() < headTrackerDevice.expires)) { + attitude.pan = headTrackerDevice.pan; + attitude.tilt = headTrackerDevice.tilt; + attitude.roll = headTrackerDevice.roll; DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { - attitude.tilt = 0; attitude.pan = 0; + attitude.tilt = 0; attitude.roll = 0; DEBUG_SET(DEBUG_HEADTRACKING, 4, -1); } @@ -316,10 +339,10 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) case WAITING_CRCL: state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { - state->expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - state->pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); - state->tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); - state->roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); + headTrackerDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; + headTrackerDevice.pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); + headTrackerDevice.tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); + headTrackerDevice.roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); } else { DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); @@ -331,20 +354,6 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) #if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) -static headTrackerVTable_t headTrackerVTable = { - .process = headtrackerSerialProcess, - .getDeviceType = headtrackerSerialGetDeviceType, - .isReady = headTrackerSerialIsReady, - .isValid = headTrackerSerialIsValid, - .getPanPWM = headTrackerSerialGetPanPWM, - .getTiltPWM = headTrackerSerialGetTiltPWM, - .getRollPWM = headTrackerSerialGetRollPWM, -}; - -headTrackerDevice_t headTrackerDevice = { - .vTable = &headTrackerVTable, -}; - bool gimbalSerialHeadTrackerDetect(void) { bool singleUart = gimbalSerialConfig()->singleUart; @@ -389,8 +398,8 @@ bool gimbalSerialHeadTrackerInit(void) void headtrackerSerialProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs) { + UNUSED(headTrackerDevice); UNUSED(currentTimeUs); - headTrackerDevice->expires = headTrackerState.expires; return; } @@ -413,15 +422,13 @@ bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice) bool headTrackerSerialIsValid(const headTrackerDevice_t *headTrackerDevice) { - UNUSED(headTrackerDevice); - return micros() < headTrackerState.expires; + return micros() < headTrackerDevice->expires; } int headTrackerSerialGetPanPWM(const headTrackerDevice_t *headTrackerDevice) { - UNUSED(headTrackerDevice); - if(micros() < headTrackerState.expires) { - return scaleRange(headTrackerState.pan, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + if(micros() < headTrackerDevice->expires) { + return scaleRange(headTrackerDevice->pan, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); } return PWM_RANGE_MIDDLE; @@ -429,9 +436,8 @@ int headTrackerSerialGetPanPWM(const headTrackerDevice_t *headTrackerDevice) int headTrackerSerialGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) { - UNUSED(headTrackerDevice); - if(micros() < headTrackerState.expires) { - return scaleRange(headTrackerState.tilt, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + if(micros() < headTrackerDevice->expires) { + return scaleRange(headTrackerDevice->tilt, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); } return PWM_RANGE_MIDDLE; @@ -439,9 +445,8 @@ int headTrackerSerialGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) int headTrackerSerialGetRollPWM(const headTrackerDevice_t *headTrackerDevice) { - UNUSED(headTrackerDevice); - if(micros() < headTrackerState.expires) { - return scaleRange(headTrackerState.roll, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); + if(micros() < headTrackerDevice->expires) { + return scaleRange(headTrackerDevice->roll, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); } return PWM_RANGE_MIDDLE; diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 61d6599e0ed..6c6bf427672 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -59,11 +59,7 @@ typedef enum { } gimbalHeadtrackerState_e; typedef struct gimbalSerialHtrkState_s { - timeUs_t expires; uint8_t payloadSize; - int16_t roll; //Roll angle [-2048~2047] => [-180~180] - int16_t tilt; //Pich angle [-2048~2047] => [-180~180] - int16_t pan; //Yaw angle [-2048~2047] => [-180~180] gimbalHeadtrackerState_e state; gimbalHtkAttitudePkt_t attitude; } gimbalSerialHtrkState_t; From 4e99f80c62455702597edbb2d7dfd3d6fac4bde1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:59:11 +0200 Subject: [PATCH 235/429] Increase max for heatracker ratio --- docs/Settings.md | 6 +++--- src/main/fc/settings.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index e2968169e1c..bd4f06b0cb4 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1828,7 +1828,7 @@ Head pan movement vs camera movement ratio | Default | Min | Max | | --- | --- | --- | -| 1 | 0 | 3 | +| 1 | 0 | 5 | --- @@ -1838,7 +1838,7 @@ Head roll movement vs camera movement ratio | Default | Min | Max | | --- | --- | --- | -| 1 | 0 | 3 | +| 1 | 0 | 5 | --- @@ -1848,7 +1848,7 @@ Head tilt movement vs camera movement ratio | Default | Min | Max | | --- | --- | --- | -| 1 | 0 | 3 | +| 1 | 0 | 5 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 6430ae9ceee..a0ae4c402bc 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4257,18 +4257,18 @@ groups: default_value: 1 field: pan_ratio min: 0 - max: 3 + max: 5 - name: headtracker_tilt_ratio description: "Head tilt movement vs camera movement ratio" type: float default_value: 1 field: tilt_ratio min: 0 - max: 3 + max: 5 - name: headtracker_roll_ratio description: "Head roll movement vs camera movement ratio" type: float default_value: 1 field: roll_ratio min: 0 - max: 3 \ No newline at end of file + max: 5 \ No newline at end of file From 439c561b30f391cc3fb2411d5c40692c56492ede Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:39:45 -0400 Subject: [PATCH 236/429] Add link to nightly builds --- readme.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.md b/readme.md index fac247ef9ab..7b4b14cbc69 100644 --- a/readme.md +++ b/readme.md @@ -124,3 +124,10 @@ Please refer to the development section in the [docs/development](https://github ## INAV Releases https://github.com/iNavFlight/inav/releases + +## Nightly builds + +https://github.com/iNavFlight/inav-nightly/releases + +https://github.com/iNavFlight/inav-configurator-nightly/releases + From 8f5a9b86e2443b97444035a52e10bb9480a836d5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:42:28 -0400 Subject: [PATCH 237/429] Downgrade links into developer section --- readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 7b4b14cbc69..6376efc7726 100644 --- a/readme.md +++ b/readme.md @@ -122,12 +122,13 @@ Before creating new issues please check to see if there is an existing one, sear Please refer to the development section in the [docs/development](https://github.com/iNavFlight/inav/tree/master/docs/development) folder. -## INAV Releases -https://github.com/iNavFlight/inav/releases - -## Nightly builds +Nightly builds are avaialble for testing on the following links: https://github.com/iNavFlight/inav-nightly/releases https://github.com/iNavFlight/inav-configurator-nightly/releases +## INAV Releases +https://github.com/iNavFlight/inav/releases + + From 0550aac4f63b1248a6f61301a2843995e4337ab5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:35:49 +0200 Subject: [PATCH 238/429] Change default headtracker type to NONE --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index bd4f06b0cb4..a23ff66a4d2 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1858,7 +1858,7 @@ Type of headtrackr dervice | Default | Min | Max | | --- | --- | --- | -| SERIAL | | | +| NONE | | | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index a0ae4c402bc..df5be7efca6 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4247,7 +4247,7 @@ groups: members: - name: headtracker_type description: "Type of headtrackr dervice" - default_value: "SERIAL" + default_value: "NONE" field: devType type: uint8_t table: headtracker_dev_type From 005a8188b7466297cfd6b9899a50e4218af77f3d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:05:08 +0200 Subject: [PATCH 239/429] Cleanup and simplification. --- src/main/drivers/headtracker_common.c | 44 +++++++++++++++++++++++---- src/main/drivers/headtracker_common.h | 10 ++++++ src/main/io/gimbal_serial.c | 21 ++++++++----- src/main/io/headtracker_msp.c | 20 +++++++++--- src/main/io/headtracker_msp.h | 2 ++ 5 files changed, 78 insertions(+), 19 deletions(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index d08c5d818bf..5bd7977cfe2 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -90,31 +90,63 @@ bool headTrackerCommonIsReady(const headTrackerDevice_t *headTrackerDevice) return false; } +int headTrackerCommonGetPan(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPan) { + return headTrackerDevice->vTable->getPan(headTrackerDevice); + } + + return constrain(headTrackerDevice->pan * headTrackerConfig()->pan_ratio, -2048, 2047); +} + +int headTrackerCommonGetTilt(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getTilt) { + return headTrackerDevice->vTable->getTilt(headTrackerDevice); + } + + return constrain(headTrackerDevice->tilt * headTrackerConfig()->tilt_ratio, -2048, 2047); +} + +int headTrackerCommonGetRoll(const headTrackerDevice_t *headTrackerDevice) +{ + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getRoll) { + return headTrackerDevice->vTable->getRollPWM(headTrackerDevice); + } + + return constrain(headTrackerDevice->roll * headTrackerConfig()->roll_ratio, -2048, 2047); +} + +int headTracker2PWM(int value) +{ + return constrain(scaleRange(value, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX), PWM_RANGE_MIN, PWM_RANGE_MAX); +} + int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice) { if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { return headTrackerDevice->vTable->getPanPWM(headTrackerDevice); } - return constrain(headTrackerDevice->pan, PWM_RANGE_MIN, PWM_RANGE_MAX); + return headTracker2PWM(headTrackerCommonGetPan(headTrackerDevice)); } int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) { - if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getTiltPWM) { return headTrackerDevice->vTable->getTiltPWM(headTrackerDevice); } - return constrain(headTrackerDevice->tilt, PWM_RANGE_MIN, PWM_RANGE_MAX); + return headTracker2PWM(headTrackerCommonGetTilt(headTrackerDevice)); } int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice) { - if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getPanPWM) { - return headTrackerDevice->vTable->getTiltPWM(headTrackerDevice); + if(headTrackerDevice && headTrackerDevice->vTable && headTrackerDevice->vTable->getRollPWM) { + return headTrackerDevice->vTable->getRollPWM(headTrackerDevice); } - return constrain(headTrackerDevice->roll, PWM_RANGE_MIN, PWM_RANGE_MAX); + return headTracker2PWM(headTrackerCommonGetRoll(headTrackerDevice)); } diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index 769bfb206eb..1f6a67a5a50 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -65,6 +65,9 @@ typedef struct headTrackerVTable_s { int (*getPanPWM)(const headTrackerDevice_t *headTrackerDevice); int (*getTiltPWM)(const headTrackerDevice_t *headTrackerDevice); int (*getRollPWM)(const headTrackerDevice_t *headTrackerDevice); + int (*getPan)(const headTrackerDevice_t *headTrackerDevice); + int (*getTilt)(const headTrackerDevice_t *headTrackerDevice); + int (*getRoll)(const headTrackerDevice_t *headTrackerDevice); } headTrackerVTable_t; @@ -86,10 +89,17 @@ void headTrackerCommonProcess(headTrackerDevice_t *headTrackerDevice, timeUs_t c headTrackerDevType_e headTrackerCommonGetDeviceType(const headTrackerDevice_t *headTrackerDevice); bool headTrackerCommonIsReady(const headTrackerDevice_t *headtrackerDevice); bool headTrackerCommonIsValid(const headTrackerDevice_t *headtrackerDevice); + +// Scaled value, constrained to PWM_RANGE_MIN~PWM_RANGE_MAX int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetTiltPWM(const headTrackerDevice_t *headTrackerDevice); int headTrackerCommonGetRollPWM(const headTrackerDevice_t *headTrackerDevice); +// Scaled value, constrained to -2048~2047 +int headTrackerCommonGetPan(const headTrackerDevice_t *headTrackerDevice); +int headTrackerCommonGetTilt(const headTrackerDevice_t *headTrackerDevice); +int headTrackerCommonGetRoll(const headTrackerDevice_t *headTrackerDevice); + void taskUpdateHeadTracker(timeUs_t currentTimeUs); bool headtrackerCommonIsEnabled(void); diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index dbb30d08a47..e20ed2931e7 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -83,11 +83,11 @@ static gimbalDevice_t serialGimbalDevice = { static headTrackerVTable_t headTrackerVTable = { .process = headtrackerSerialProcess, .getDeviceType = headtrackerSerialGetDeviceType, - .isReady = headTrackerSerialIsReady, + //.isReady = headTrackerSerialIsReady, .isValid = headTrackerSerialIsValid, - .getPanPWM = headTrackerSerialGetPanPWM, - .getTiltPWM = headTrackerSerialGetTiltPWM, - .getRollPWM = headTrackerSerialGetRollPWM, + //.getPanPWM = headTrackerSerialGetPanPWM, + //.getTiltPWM = headTrackerSerialGetTiltPWM, + //.getRollPWM = headTrackerSerialGetRollPWM, }; @@ -229,11 +229,13 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) } } +#ifdef USE_HEADTRACKER if(IS_RC_MODE_ACTIVE(BOXGIMBALHTRK)) { - if (gimbalCommonHtrkIsEnabled() && (micros() < headTrackerDevice.expires)) { - attitude.pan = headTrackerDevice.pan; - attitude.tilt = headTrackerDevice.tilt; - attitude.roll = headTrackerDevice.roll; + headTrackerDevice_t *dev = headTrackerCommonDevice(); + if (gimbalCommonHtrkIsEnabled() && dev && headTrackerCommonIsValid(dev)) { + attitude.pan = headTrackerCommonGetPan(dev); + attitude.tilt = headTrackerCommonGetTilt(dev); + attitude.roll = headTrackerCommonGetRoll(dev); DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { attitude.pan = 0; @@ -242,6 +244,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) DEBUG_SET(DEBUG_HEADTRACKING, 4, -1); } } else { +#else + { +#endif DEBUG_SET(DEBUG_HEADTRACKING, 4, 0); // Radio endpoints may need to be adjusted, as it seems ot go a bit // bananas at the extremes diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index 6f0fdf3b3f2..7f0c4a5d795 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -16,6 +16,7 @@ */ #include +#include #if (defined(USE_HEADTRACKER_MSP) && defined(USE_HEADTRACKER)) @@ -43,12 +44,12 @@ typedef struct headTrackerVTable_s { static headTrackerVTable_t headTrackerMspVTable = { .process = NULL, - .getDeviceType = NULL, + .getDeviceType = heatTrackerMspGetDeviceType, .isReady = NULL, - .isValid = headTrackerCommonIsValid, - .getPanPWM = headTrackerCommonGetPanPWM, - .getTiltPWM = headTrackerCommonGetTiltPWM, - .getRollPWM = headTrackerCommonGetRollPWM, + .isValid = NULL, + //.getPanPWM = headTrackerCommonGetPanPWM, + //.getTiltPWM = headTrackerCommonGetTiltPWM, + //.getRollPWM = headTrackerCommonGetRollPWM, }; static headTrackerDevice_t headTrackerMspDevice = { @@ -69,6 +70,7 @@ void mspHeadTrackerInit(void) void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) { if(dataSize != sizeof(headtrackerMspMessage_t)) { + SD(fprintf(stderr, "[headTracker]: invalid data size %d\n", dataSize)); return; } @@ -79,7 +81,15 @@ void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) headTrackerMspDevice.roll = constrain((status->roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; + SD(fprintf(stderr, "[headTracker]: pan: %d tilt: %d roll: %d\n", status->pan, status->tilt, status->roll)); + SD(fprintf(stderr, "[headTracker]: scaled pan: %d tilt: %d roll: %d\n", headTrackerMspDevice.pan, headTrackerMspDevice.tilt, headTrackerMspDevice.roll)); + UNUSED(status); } +headTrackerDevType_e heatTrackerMspGetDeviceType(const headTrackerDevice_t *headTrackerDevice) { + UNUSED(headTrackerDevice); + return HEADTRACKER_MSP; +} + #endif \ No newline at end of file diff --git a/src/main/io/headtracker_msp.h b/src/main/io/headtracker_msp.h index d1d5bb68651..edcfb465874 100644 --- a/src/main/io/headtracker_msp.h +++ b/src/main/io/headtracker_msp.h @@ -39,4 +39,6 @@ void mspHeadTrackerInit(void); void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize); +headTrackerDevType_e heatTrackerMspGetDeviceType(const headTrackerDevice_t *headTrackerDevice); + #endif From 69123b17a7b277c9944e99fee3c258c5bb8ccd6e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:34:53 +0200 Subject: [PATCH 240/429] Clean up --- src/main/io/gimbal_serial.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index e20ed2931e7..95d74eb7b88 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -84,7 +84,7 @@ static headTrackerVTable_t headTrackerVTable = { .process = headtrackerSerialProcess, .getDeviceType = headtrackerSerialGetDeviceType, //.isReady = headTrackerSerialIsReady, - .isValid = headTrackerSerialIsValid, + //.isValid = headTrackerSerialIsValid, //.getPanPWM = headTrackerSerialGetPanPWM, //.getTiltPWM = headTrackerSerialGetTiltPWM, //.getRollPWM = headTrackerSerialGetRollPWM, @@ -414,12 +414,13 @@ headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *h return HEADTRACKER_SERIAL; } +/* bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice) { UNUSED(headTrackerDevice); if(headTrackerPort || (gimbalSerialConfig()->singleUart && gimbalPort)) { - return headTrackerSerialIsValid(headTrackerDevice); + return headTrackerCommonIsReady(headTrackerDevice); } return false; @@ -456,6 +457,7 @@ int headTrackerSerialGetRollPWM(const headTrackerDevice_t *headTrackerDevice) return PWM_RANGE_MIDDLE; } +*/ #endif From 9a4a74186ffa33a92a7d16871953466e1a5838bd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 20:50:10 +0200 Subject: [PATCH 241/429] More cleanup. Most of the functionality is on headtracker_common. --- src/main/io/gimbal_serial.c | 50 ----------------------------------- src/main/io/headtracker_msp.c | 3 --- 2 files changed, 53 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 95d74eb7b88..37b0583a8a9 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -83,11 +83,6 @@ static gimbalDevice_t serialGimbalDevice = { static headTrackerVTable_t headTrackerVTable = { .process = headtrackerSerialProcess, .getDeviceType = headtrackerSerialGetDeviceType, - //.isReady = headTrackerSerialIsReady, - //.isValid = headTrackerSerialIsValid, - //.getPanPWM = headTrackerSerialGetPanPWM, - //.getTiltPWM = headTrackerSerialGetTiltPWM, - //.getRollPWM = headTrackerSerialGetRollPWM, }; @@ -414,51 +409,6 @@ headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *h return HEADTRACKER_SERIAL; } -/* -bool headTrackerSerialIsReady(const headTrackerDevice_t *headTrackerDevice) -{ - UNUSED(headTrackerDevice); - - if(headTrackerPort || (gimbalSerialConfig()->singleUart && gimbalPort)) { - return headTrackerCommonIsReady(headTrackerDevice); - } - - return false; -} - -bool headTrackerSerialIsValid(const headTrackerDevice_t *headTrackerDevice) -{ - return micros() < headTrackerDevice->expires; -} - -int headTrackerSerialGetPanPWM(const headTrackerDevice_t *headTrackerDevice) -{ - if(micros() < headTrackerDevice->expires) { - return scaleRange(headTrackerDevice->pan, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); - } - - return PWM_RANGE_MIDDLE; -} - -int headTrackerSerialGetTiltPWM(const headTrackerDevice_t *headTrackerDevice) -{ - if(micros() < headTrackerDevice->expires) { - return scaleRange(headTrackerDevice->tilt, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); - } - - return PWM_RANGE_MIDDLE; -} - -int headTrackerSerialGetRollPWM(const headTrackerDevice_t *headTrackerDevice) -{ - if(micros() < headTrackerDevice->expires) { - return scaleRange(headTrackerDevice->roll, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX); - } - - return PWM_RANGE_MIDDLE; -} -*/ - #endif #endif diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index 7f0c4a5d795..c3da186aaa1 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -47,9 +47,6 @@ static headTrackerVTable_t headTrackerMspVTable = { .getDeviceType = heatTrackerMspGetDeviceType, .isReady = NULL, .isValid = NULL, - //.getPanPWM = headTrackerCommonGetPanPWM, - //.getTiltPWM = headTrackerCommonGetTiltPWM, - //.getRollPWM = headTrackerCommonGetRollPWM, }; static headTrackerDevice_t headTrackerMspDevice = { From 188cc0038bdf9f5e9432b278fb297ed5476908a2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:37:28 +0200 Subject: [PATCH 242/429] Build fixes for when different parts of heatracker / gimbal are disabled --- src/main/io/gimbal_serial.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 37b0583a8a9..7c26a0c17af 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -57,12 +57,15 @@ STATIC_ASSERT(sizeof(gimbalHtkAttitudePkt_t) == 10, gimbalHtkAttitudePkt_t_size_ #ifndef GIMBAL_UNIT_TEST static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; +#if defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL) static gimbalSerialHtrkState_t headTrackerState = { .payloadSize = 0, .state = WAITING_HDR1, }; #endif +#endif + static serialPort_t *headTrackerPort = NULL; static serialPort_t *gimbalPort = NULL; @@ -141,7 +144,7 @@ bool gimbalSerialDetect(void) if (portConfig) { SD(fprintf(stderr, "[GIMBAL]: found port...\n")); -#ifdef USE_HEADTRACKER +#if defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL) gimbalPort = openSerialPort(portConfig->identifier, FUNCTION_GIMBAL, singleUart ? gimbalSerialHeadTrackerReceive : NULL, singleUart ? &headTrackerState : NULL, baudRates[portConfig->peripheral_baudrateIndex], MODE_RXTX, SERIAL_NOT_INVERTED); #else @@ -278,6 +281,8 @@ int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) } #ifndef GIMBAL_UNIT_TEST + +#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) static void resetState(gimbalSerialHtrkState_t *state) { state->state = WAITING_HDR1; @@ -297,7 +302,6 @@ static bool checkCrc(gimbalHtkAttitudePkt_t *attitude) (attitude->crcl == (crc & 0xFF)); } - void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) { static int charCount = 0; @@ -352,7 +356,6 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) } } -#if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) bool gimbalSerialHeadTrackerDetect(void) { @@ -409,6 +412,14 @@ headTrackerDevType_e headtrackerSerialGetDeviceType(const headTrackerDevice_t *h return HEADTRACKER_SERIAL; } +#else + +void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) +{ + UNUSED(c); + UNUSED(data); +} + #endif #endif From 677734d3ff3b1df0b5232d9201f2c1673aa7f731 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:15:28 +0200 Subject: [PATCH 243/429] Move scaling to headtracker_common --- src/main/drivers/headtracker_common.c | 8 ++++---- src/main/drivers/headtracker_common.h | 2 ++ src/main/io/gimbal_serial.c | 6 +++--- src/main/io/headtracker_msp.c | 6 +++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/drivers/headtracker_common.c b/src/main/drivers/headtracker_common.c index 5bd7977cfe2..feec581da8a 100644 --- a/src/main/drivers/headtracker_common.c +++ b/src/main/drivers/headtracker_common.c @@ -96,7 +96,7 @@ int headTrackerCommonGetPan(const headTrackerDevice_t *headTrackerDevice) return headTrackerDevice->vTable->getPan(headTrackerDevice); } - return constrain(headTrackerDevice->pan * headTrackerConfig()->pan_ratio, -2048, 2047); + return constrain((headTrackerDevice->pan * headTrackerConfig()->pan_ratio) + 0.5f, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); } int headTrackerCommonGetTilt(const headTrackerDevice_t *headTrackerDevice) @@ -105,7 +105,7 @@ int headTrackerCommonGetTilt(const headTrackerDevice_t *headTrackerDevice) return headTrackerDevice->vTable->getTilt(headTrackerDevice); } - return constrain(headTrackerDevice->tilt * headTrackerConfig()->tilt_ratio, -2048, 2047); + return constrain((headTrackerDevice->tilt * headTrackerConfig()->tilt_ratio) + 0.5f, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); } int headTrackerCommonGetRoll(const headTrackerDevice_t *headTrackerDevice) @@ -114,12 +114,12 @@ int headTrackerCommonGetRoll(const headTrackerDevice_t *headTrackerDevice) return headTrackerDevice->vTable->getRollPWM(headTrackerDevice); } - return constrain(headTrackerDevice->roll * headTrackerConfig()->roll_ratio, -2048, 2047); + return constrain((headTrackerDevice->roll * headTrackerConfig()->roll_ratio) + 0.5f, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); } int headTracker2PWM(int value) { - return constrain(scaleRange(value, -2048, 2047, PWM_RANGE_MIN, PWM_RANGE_MAX), PWM_RANGE_MIN, PWM_RANGE_MAX); + return constrain(scaleRange(value, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX, PWM_RANGE_MIN, PWM_RANGE_MAX), PWM_RANGE_MIN, PWM_RANGE_MAX); } int headTrackerCommonGetPanPWM(const headTrackerDevice_t *headTrackerDevice) diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index 1f6a67a5a50..7b46b5390b8 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -30,6 +30,8 @@ #include "config/feature.h" #define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) +#define HEADTRACKER_RANGE_MIN -2048 +#define HEADTRACKER_RANGE_MAX 2047 #ifdef __cplusplus extern "C" { diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 7c26a0c17af..323bc99e564 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -344,9 +344,9 @@ void gimbalSerialHeadTrackerReceive(uint16_t c, void *data) state->attitude.crcl = c; if(checkCrc(&(state->attitude))) { headTrackerDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - headTrackerDevice.pan = constrain((state->attitude.pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); - headTrackerDevice.tilt = constrain((state->attitude.tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); - headTrackerDevice.roll = constrain((state->attitude.roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); + headTrackerDevice.pan = constrain(state->attitude.pan, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + headTrackerDevice.tilt = constrain(state->attitude.tilt, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + headTrackerDevice.roll = constrain(state->attitude.roll, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); DEBUG_SET(DEBUG_HEADTRACKING, 2, pktCount++); } else { DEBUG_SET(DEBUG_HEADTRACKING, 3, errorCount++); diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index c3da186aaa1..6a4b73dbbfb 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -73,9 +73,9 @@ void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) headtrackerMspMessage_t *status = (headtrackerMspMessage_t *)data; - headTrackerMspDevice.pan = constrain((status->pan * headTrackerConfig()->pan_ratio) + 0.5f, -2048, 2047); - headTrackerMspDevice.tilt = constrain((status->tilt * headTrackerConfig()->tilt_ratio) + 0.5f, -2048, 2047); - headTrackerMspDevice.roll = constrain((status->roll * headTrackerConfig()->roll_ratio) + 0.5f, -2048, 2047); + headTrackerMspDevice.pan = constrain(status->pan, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + headTrackerMspDevice.tilt = constrain(status->tilt, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + headTrackerMspDevice.roll = constrain(status->roll, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; SD(fprintf(stderr, "[headTracker]: pan: %d tilt: %d roll: %d\n", status->pan, status->tilt, status->roll)); From 0aecc4fcd3ca538113b0cf74b7a6968cad880d39 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:22:40 +0200 Subject: [PATCH 244/429] Add axis trim --- docs/Settings.md | 30 ++++++++++++++++++++++++++++++ src/main/drivers/gimbal_common.c | 13 ++++++++++++- src/main/drivers/gimbal_common.h | 3 +++ src/main/fc/settings.yaml | 18 ++++++++++++++++++ src/main/io/gimbal_serial.c | 6 +++--- 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index a23ff66a4d2..c29b6adc6f8 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1472,6 +1472,16 @@ Gimbal pan rc channel index. 0 is no channel. --- +### gimbal_pan_trim + +Trim gimbal pan center position. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | -500 | 500 | + +--- + ### gimbal_roll_channel Gimbal roll rc channel index. 0 is no channel. @@ -1482,6 +1492,16 @@ Gimbal roll rc channel index. 0 is no channel. --- +### gimbal_roll_trim + +Trim gimbal roll center position. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | -500 | 500 | + +--- + ### gimbal_sensitivity Gimbal sensitivity is similar to gain and will affect how quickly the gimbal will react. @@ -1512,6 +1532,16 @@ Gimbal tilt rc channel index. 0 is no channel. --- +### gimbal_tilt_trim + +Trim gimbal tilt center position. + +| Default | Min | Max | +| --- | --- | --- | +| 0 | -500 | 500 | + +--- + ### gps_auto_baud Automatic configuration of GPS baudrate(The specified baudrate in configured in ports will be used) when used with UBLOX GPS diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index bf2db50a261..a7a83b98e65 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -32,9 +32,20 @@ #include "drivers/gimbal_common.h" +#include "settings_generated.h" -PG_REGISTER(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 0); +PG_REGISTER_WITH_RESET_TEMPLATE(gimbalConfig_t, gimbalConfig, PG_GIMBAL_CONFIG, 1); + +PG_RESET_TEMPLATE(gimbalConfig_t, gimbalConfig, + .panChannel = SETTING_GIMBAL_PAN_CHANNEL_DEFAULT, + .tiltChannel = SETTING_GIMBAL_TILT_CHANNEL_DEFAULT, + .rollChannel = SETTING_GIMBAL_ROLL_CHANNEL_DEFAULT, + .sensitivity = SETTING_GIMBAL_SENSITIVITY_DEFAULT, + .panTrim = SETTING_GIMBAL_PAN_TRIM_DEFAULT, + .tiltTrim = SETTING_GIMBAL_TILT_TRIM_DEFAULT, + .rollTrim = SETTING_GIMBAL_ROLL_TRIM_DEFAULT +); static gimbalDevice_t *commonGimbalDevice = NULL; diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 2d914bbf77a..96614fb6ea9 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -60,6 +60,9 @@ typedef struct gimbalConfig_s { uint8_t tiltChannel; uint8_t rollChannel; uint8_t sensitivity; + uint16_t panTrim; + uint16_t tiltTrim; + uint16_t rollTrim; } gimbalConfig_t; PG_DECLARE(gimbalConfig_t, gimbalConfig); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index df5be7efca6..fe0cd358b94 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -4230,6 +4230,24 @@ groups: field: sensitivity min: -16 max: 15 + - name: gimbal_pan_trim + field: panTrim + description: "Trim gimbal pan center position." + default_value: 0 + min: -500 + max: 500 + - name: gimbal_tilt_trim + field: tiltTrim + description: "Trim gimbal tilt center position." + default_value: 0 + min: -500 + max: 500 + - name: gimbal_roll_trim + field: rollTrim + description: "Trim gimbal roll center position." + default_value: 0 + min: -500 + max: 500 - name: PG_GIMBAL_SERIAL_CONFIG type: gimbalSerialConfig_t headers: ["io/gimbal_serial.h"] diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 323bc99e564..af3dd01115a 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -193,9 +193,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) const gimbalConfig_t *cfg = gimbalConfig(); - int pan = PWM_RANGE_MIDDLE; - int tilt = PWM_RANGE_MIDDLE; - int roll = PWM_RANGE_MIDDLE; + int pan = PWM_RANGE_MIDDLE + cfg->panTrim; + int tilt = PWM_RANGE_MIDDLE + cfg->tiltTrim; + int roll = PWM_RANGE_MIDDLE + cfg->rollTrim; if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { attitude.mode |= GIMBAL_MODE_TILT_LOCK; From da4b30014ab79af711ec26088bcbce03d881bac6 Mon Sep 17 00:00:00 2001 From: jamming Date: Fri, 21 Jun 2024 11:22:45 +0800 Subject: [PATCH 245/429] Fix DMA conflict between SPI,I2C and PWM Channels --- src/main/target/KAKUTEF4WING/hardware_setup.c | 6 +-- src/main/target/KAKUTEF4WING/target.c | 14 +++---- src/main/target/KAKUTEF4WING/target.h | 37 +++++++++---------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/main/target/KAKUTEF4WING/hardware_setup.c b/src/main/target/KAKUTEF4WING/hardware_setup.c index f78fd65cd4c..d2045cc0f01 100644 --- a/src/main/target/KAKUTEF4WING/hardware_setup.c +++ b/src/main/target/KAKUTEF4WING/hardware_setup.c @@ -31,9 +31,9 @@ void initialisePreBootHardware(void) { // User1 - IOInit(DEFIO_IO(PB7), OWNER_SYSTEM, RESOURCE_OUTPUT, 0); - IOConfigGPIO(DEFIO_IO(PB7), IOCFG_OUT_PP); - IOLo(DEFIO_IO(PB7)); + IOInit(DEFIO_IO(PB14), OWNER_SYSTEM, RESOURCE_OUTPUT, 0); + IOConfigGPIO(DEFIO_IO(PB14), IOCFG_OUT_PP); + IOLo(DEFIO_IO(PB14)); // User2 IOInit(DEFIO_IO(PB15), OWNER_SYSTEM, RESOURCE_OUTPUT, 0); diff --git a/src/main/target/KAKUTEF4WING/target.c b/src/main/target/KAKUTEF4WING/target.c index 8f717ed5fd2..8c2240a9c3b 100755 --- a/src/main/target/KAKUTEF4WING/target.c +++ b/src/main/target/KAKUTEF4WING/target.c @@ -29,14 +29,14 @@ #include "drivers/timer.h" timerHardware_t timerHardware[] = { - DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S1_OUT - DMA1_ST5 - DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT - DMA1_ST0 - DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3_OUT - DMA1_ST7 - DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4_OUT - DMA1_ST2 - DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT - DMA2_ST2 - DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT - DMA2_ST7 + DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S1_OUT - DMA2_ST1_CH6 + DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT - DMA2_ST6_CH0 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3_OUT - DMA1_ST7_CH5 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4_OUT - DMA1_ST2_CH5 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT - DMA2_ST2_CH0 + DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT - DMA2_ST7_CH7 - DEF_TIM(TIM5, CH2, PA1, TIM_USE_LED, 0, 0), // LED_STRIP - DMA1_ST4 + DEF_TIM(TIM2, CH2, PA1, TIM_USE_LED, 0, 0), // LED_STRIP-DMA1_ST6_CH3 }; const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/KAKUTEF4WING/target.h b/src/main/target/KAKUTEF4WING/target.h index 27e600e5d45..cb29473d06a 100644 --- a/src/main/target/KAKUTEF4WING/target.h +++ b/src/main/target/KAKUTEF4WING/target.h @@ -40,24 +40,21 @@ #define ICM42605_EXTI_PIN PB12 // *************** I2C **************** -#define USE_I2C -#define USE_I2C_DEVICE_1 -#define I2C1_SCL PB8 -#define I2C1_SDA PB9 +#define USE_I2C #define USE_I2C_DEVICE_2 #define I2C2_SCL PB10 #define I2C2_SDA PB11 -// ********** External MAG On I2C1****** +// ********** External MAG On I2C2****** #define USE_MAG -#define MAG_I2C_BUS BUS_I2C1 +#define MAG_I2C_BUS BUS_I2C2 #define USE_MAG_ALL -// ********** External Devices On I2C1****** -#define TEMPERATURE_I2C_BUS BUS_I2C1 -#define PITOT_I2C_BUS BUS_I2C1 +// ********** External Devices On I2C2****** +#define TEMPERATURE_I2C_BUS BUS_I2C2 +#define PITOT_I2C_BUS BUS_I2C2 #define USE_RANGEFINDER -#define RANGEFINDER_I2C_BUS BUS_I2C1 +#define RANGEFINDER_I2C_BUS BUS_I2C2 // ********** Internal BARO On I2C2********* #define USE_BARO @@ -81,23 +78,23 @@ // *************** USB VCP ******************** #define USB_IO #define USE_VCP -#define VBUS_SENSING_PIN PA8 +#define VBUS_SENSING_PIN PA10 #define VBUS_SENSING_ENABLED // *************** UART ******************** #define USE_UART_INVERTER //UART1 #define USE_UART1 -#define UART1_RX_PIN PA10 -#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PB7 +#define UART1_TX_PIN PB6 //UART2 #define USE_UART2 #define UART2_RX_PIN PA3 #define UART2_TX_PIN PA2 -//The 5V pads close to UART3 a are powered by both BEC and USB -//We config UART3 to serialRX, So Receiver is powered when USB Plug-IN. +//The 4V5 pads close to UART3 are powered by both BEC and USB +//Config UART3 to serialRX, So Receiver is powered when USB Plug-IN. //UART3: SerialRX by Default #define USE_UART3 #define UART3_RX_PIN PC11 @@ -142,6 +139,8 @@ // *************** Battery Voltage Sense*********** #define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_STREAM DMA2_Stream4 #define ADC_CHANNEL_1_PIN PC0 #define ADC_CHANNEL_2_PIN PC1 #define VBAT_ADC_CHANNEL ADC_CHN_1 @@ -152,14 +151,14 @@ // *************** LED_STRIP ********************** #define USE_LED_STRIP #define WS2811_PIN PA1 -#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST4_HANDLER -#define WS2811_DMA_STREAM DMA1_Stream4 -#define WS2811_DMA_CHANNEL DMA_Channel_6 +#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST6_HANDLER +#define WS2811_DMA_STREAM DMA1_Stream6 +#define WS2811_DMA_CHANNEL DMA_Channel_3 // *************** PINIO *************************** #define USE_PINIO #define USE_PINIOBOX -#define PINIO1_PIN PB7 // USER1 +#define PINIO1_PIN PB14 // USER1 #define PINIO2_PIN PB15 // USER2 #define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_GPS) From aa9451432a027ac93a80ab2caa8c6fd42434199a Mon Sep 17 00:00:00 2001 From: 0crap <31951195+0crap@users.noreply.github.com> Date: Fri, 21 Jun 2024 09:06:41 +0200 Subject: [PATCH 246/429] Update readme.md Typo --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 6376efc7726..53710d519aa 100644 --- a/readme.md +++ b/readme.md @@ -122,7 +122,7 @@ Before creating new issues please check to see if there is an existing one, sear Please refer to the development section in the [docs/development](https://github.com/iNavFlight/inav/tree/master/docs/development) folder. -Nightly builds are avaialble for testing on the following links: +Nightly builds are available for testing on the following links: https://github.com/iNavFlight/inav-nightly/releases From b9be14c70143ebd98118fd1551d71ffa0e0f5893 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:52:02 +0200 Subject: [PATCH 247/429] Add trim when headtracker info is stale. Stale headtracker info results in center position of gimbal. --- src/main/io/gimbal_serial.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index af3dd01115a..58ba5212a30 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -193,9 +193,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) const gimbalConfig_t *cfg = gimbalConfig(); - int pan = PWM_RANGE_MIDDLE + cfg->panTrim; - int tilt = PWM_RANGE_MIDDLE + cfg->tiltTrim; - int roll = PWM_RANGE_MIDDLE + cfg->rollTrim; + int panPWM = PWM_RANGE_MIDDLE + cfg->panTrim; + int tiltPWM = PWM_RANGE_MIDDLE + cfg->tiltTrim; + int rollPWM = PWM_RANGE_MIDDLE + cfg->rollTrim; if (IS_RC_MODE_ACTIVE(BOXGIMBALTLOCK)) { attitude.mode |= GIMBAL_MODE_TILT_LOCK; @@ -212,18 +212,18 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { - pan = rxGetChannelValue(cfg->panChannel - 1); - pan = constrain(pan, PWM_RANGE_MIN, PWM_RANGE_MAX); + panPWM = rxGetChannelValue(cfg->panChannel - 1); + panPWM = constrain(panPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->tiltChannel > 0) { - tilt = rxGetChannelValue(cfg->tiltChannel - 1); - tilt = constrain(tilt, PWM_RANGE_MIN, PWM_RANGE_MAX); + tiltPWM = rxGetChannelValue(cfg->tiltChannel - 1); + tiltPWM = constrain(tiltPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->rollChannel > 0) { - roll = rxGetChannelValue(cfg->rollChannel - 1); - roll = constrain(roll, PWM_RANGE_MIN, PWM_RANGE_MAX); + rollPWM = rxGetChannelValue(cfg->rollChannel - 1); + rollPWM = constrain(rollPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } } @@ -236,9 +236,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attitude.roll = headTrackerCommonGetRoll(dev); DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { - attitude.pan = 0; - attitude.tilt = 0; - attitude.roll = 0; + attitude.pan = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->panTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); + attitude.tilt = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->tiltTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); + attitude.roll = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->rollTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); DEBUG_SET(DEBUG_HEADTRACKING, 4, -1); } } else { @@ -248,9 +248,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) DEBUG_SET(DEBUG_HEADTRACKING, 4, 0); // Radio endpoints may need to be adjusted, as it seems ot go a bit // bananas at the extremes - attitude.pan = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, pan); - attitude.tilt = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, tilt); - attitude.roll = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, roll); + attitude.pan = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, panPWM); + attitude.tilt = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, tiltPWM); + attitude.roll = gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, rollPWM); } DEBUG_SET(DEBUG_HEADTRACKING, 5, attitude.pan); @@ -276,7 +276,7 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) { int16_t ret = 0; - ret = scaleRange(value, inputMin, inputMax, -2048, 2047); + ret = scaleRange(value, inputMin, inputMax, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); return ret; } From 91b20689edb739ad12b689277a751451edd62d62 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:10:51 +0200 Subject: [PATCH 248/429] fix test build --- src/main/drivers/headtracker_common.h | 7 ++++--- src/test/unit/gimbal_serial_unittest.cc | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/headtracker_common.h b/src/main/drivers/headtracker_common.h index 7b46b5390b8..8c177e3e0f0 100644 --- a/src/main/drivers/headtracker_common.h +++ b/src/main/drivers/headtracker_common.h @@ -19,6 +19,10 @@ #include "platform.h" +#define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) +#define HEADTRACKER_RANGE_MIN -2048 +#define HEADTRACKER_RANGE_MAX 2047 + #ifdef USE_HEADTRACKER #include @@ -29,9 +33,6 @@ #include "config/feature.h" -#define MAX_HEADTRACKER_DATA_AGE_US HZ2US(25) -#define HEADTRACKER_RANGE_MIN -2048 -#define HEADTRACKER_RANGE_MAX 2047 #ifdef __cplusplus extern "C" { diff --git a/src/test/unit/gimbal_serial_unittest.cc b/src/test/unit/gimbal_serial_unittest.cc index 77ae4c93df8..1f0c47231c6 100644 --- a/src/test/unit/gimbal_serial_unittest.cc +++ b/src/test/unit/gimbal_serial_unittest.cc @@ -24,6 +24,7 @@ #include "unittest_macros.h" #include "io/gimbal_serial.h" +#include "drivers/headtracker_common.h" void dumpMemory(uint8_t *mem, int size) { From ea7564cfb6216f9aa2ffbbae24f2a52071ee95bc Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 21 Jun 2024 12:07:45 +0200 Subject: [PATCH 249/429] Add ICM42688-G to IFLIGHTF4_SUCCEXD --- src/main/target/IFLIGHTF4_SUCCEXD/target.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/target/IFLIGHTF4_SUCCEXD/target.h b/src/main/target/IFLIGHTF4_SUCCEXD/target.h index 6ba059bb63c..3cc4f030721 100644 --- a/src/main/target/IFLIGHTF4_SUCCEXD/target.h +++ b/src/main/target/IFLIGHTF4_SUCCEXD/target.h @@ -39,6 +39,11 @@ #define MPU6000_CS_PIN PA4 #define MPU6000_SPI_BUS BUS_SPI1 +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW180_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 + // *************** SPI2 OSD ***************************** #define USE_SPI_DEVICE_2 #define SPI2_SCK_PIN PB13 From 813d3d37be4253c9d4c72de7a8402cae2eee8769 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:41:06 +0100 Subject: [PATCH 250/429] Update navigation.c --- src/main/navigation/navigation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 36c320561b9..6eed742e804 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -119,7 +119,7 @@ STATIC_ASSERT(NAV_MAX_WAYPOINTS < 254, NAV_MAX_WAYPOINTS_exceeded_allowable_rang PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 2); #endif -PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 6); +PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 7); PG_RESET_TEMPLATE(navConfig_t, navConfig, .general = { From 9c6dbbb08fa0673ec924768f4b7028dabf35fb6e Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Fri, 21 Jun 2024 12:49:02 +0100 Subject: [PATCH 251/429] Update Controls.md Updated `Profile` to `Control Profile` to match recent changes. --- docs/Controls.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Controls.md b/docs/Controls.md index 3cc62b4e740..6dbc26df5fc 100644 --- a/docs/Controls.md +++ b/docs/Controls.md @@ -23,9 +23,9 @@ The stick positions are combined to activate different functions: | Function | Throttle | Yaw | Pitch | Roll | | ----------------------------- | -------- | ------- | ------ | ------ | -| Profile 1 | LOW | LOW | CENTER | LOW | -| Profile 2 | LOW | LOW | HIGH | CENTER | -| Profile 3 | LOW | LOW | CENTER | HIGH | +| Control Profile 1 | LOW | LOW | CENTER | LOW | +| Control Profile 2 | LOW | LOW | HIGH | CENTER | +| Control Profile 3 | LOW | LOW | CENTER | HIGH | | Battery profile 1 | HIGH | LOW | CENTER | LOW | | Battery profile 2 | HIGH | LOW | HIGH | CENTER | | Battery profile 3 | HIGH | LOW | CENTER | HIGH | From 34e949ae0815c898bab21e6361631ff78507cf00 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:41:55 +0200 Subject: [PATCH 252/429] Don't run biulds for documentation only changes --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c389884008d..8ab3b5ae8d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,16 @@ name: Build firmware # Don't enable CI on push, just on PR. If you # are working on the main repo and want to trigger # a CI build submit a draft PR. -on: pull_request +on: + pull_request: + paths: + - src/** + - .github/** + - cmake/** + - lib/** + - docs/Settings.md + - CMakeLists.txt + - *.sh jobs: build: From 27a630fd4e37b349a023ff73d821563d9ca5acc8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:44:27 +0200 Subject: [PATCH 253/429] synthax fix --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ab3b5ae8d1..92862bb4300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,13 @@ name: Build firmware on: pull_request: paths: - - src/** - - .github/** - - cmake/** - - lib/** - - docs/Settings.md - - CMakeLists.txt - - *.sh + - 'src/**' + - '.github/**' + - 'cmake/**' + - 'lib/**' + - 'docs/Settings.md' + - 'CMakeLists.txt' + - '*.sh' jobs: build: From 6b574df70b91d36e84a1c5833e2c7e4c5b759b16 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:37:43 +0200 Subject: [PATCH 254/429] Take gimbal input into account for pan servo compensation and center indication --- src/main/drivers/gimbal_common.c | 11 +++++++++++ src/main/drivers/gimbal_common.h | 4 ++++ src/main/io/gimbal_serial.c | 14 +++++++++++++- src/main/io/gimbal_serial.h | 3 ++- src/main/io/osd.c | 10 +++++++++- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index a7a83b98e65..a81b1b51c10 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -31,6 +31,7 @@ #include "fc/cli.h" #include "drivers/gimbal_common.h" +#include "rx/rx.h" #include "settings_generated.h" @@ -125,4 +126,14 @@ bool gimbalCommonHtrkIsEnabled(void) return false; } + +int16_t gimbalCommonGetPanPwm(const gimbalDevice_t *gimbalDevice) +{ + if (gimbalDevice && gimbalDevice->vTable->getGimbalPanPWM) { + return gimbalDevice->vTable->getGimbalPanPWM(gimbalDevice); + } + + return gimbalDevice ? gimbalDevice->currentPanPWM : PWM_RANGE_MIDDLE; +} + #endif \ No newline at end of file diff --git a/src/main/drivers/gimbal_common.h b/src/main/drivers/gimbal_common.h index 96614fb6ea9..879e81116a0 100644 --- a/src/main/drivers/gimbal_common.h +++ b/src/main/drivers/gimbal_common.h @@ -41,6 +41,7 @@ struct gimbalVTable_s; typedef struct gimbalDevice_s { const struct gimbalVTable_s *vTable; + int16_t currentPanPWM; } gimbalDevice_t; // {set,get}BandAndChannel: band and channel are 1 origin @@ -52,6 +53,7 @@ typedef struct gimbalVTable_s { gimbalDevType_e (*getDeviceType)(const gimbalDevice_t *gimbalDevice); bool (*isReady)(const gimbalDevice_t *gimbalDevice); bool (*hasHeadTracker)(const gimbalDevice_t *gimbalDevice); + int16_t (*getGimbalPanPWM)(const gimbalDevice_t *gimbalDevice); } gimbalVTable_t; @@ -93,6 +95,8 @@ void taskUpdateGimbal(timeUs_t currentTimeUs); bool gimbalCommonIsEnabled(void); bool gimbalCommonHtrkIsEnabled(void); +int16_t gimbalCommonGetPanPwm(const gimbalDevice_t *gimbalDevice); + #ifdef __cplusplus } #endif diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 58ba5212a30..6e6b7e93240 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -78,7 +78,8 @@ gimbalVTable_t gimbalSerialVTable = { }; static gimbalDevice_t serialGimbalDevice = { - .vTable = &gimbalSerialVTable + .vTable = &gimbalSerialVTable, + .currentPanPWM = PWM_RANGE_MIDDLE }; #if (defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL)) @@ -234,6 +235,7 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attitude.pan = headTrackerCommonGetPan(dev); attitude.tilt = headTrackerCommonGetTilt(dev); attitude.roll = headTrackerCommonGetRoll(dev); + DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { attitude.pan = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->panTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); @@ -267,12 +269,22 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) attitude.crch = (crc16 >> 8) & 0xFF; attitude.crcl = crc16 & 0xFF; + serialGimbalDevice.currentPanPWM = gimbal2pwm(attitude.pan); + serialBeginWrite(gimbalPort); serialWriteBuf(gimbalPort, (uint8_t *)&attitude, sizeof(gimbalHtkAttitudePkt_t)); serialEndWrite(gimbalPort); } #endif +int16_t gimbal2pwm(int16_t value) +{ + int16_t ret = 0; + ret = scaleRange(value, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX, PWM_RANGE_MIN, PWM_RANGE_MAX); + return ret; +} + + int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value) { int16_t ret = 0; diff --git a/src/main/io/gimbal_serial.h b/src/main/io/gimbal_serial.h index 6c6bf427672..6c9a3251f89 100644 --- a/src/main/io/gimbal_serial.h +++ b/src/main/io/gimbal_serial.h @@ -70,9 +70,10 @@ typedef struct gimbalSerialConfig_s { PG_DECLARE(gimbalSerialConfig_t, gimbalSerialConfig); - int16_t gimbal_scale12(int16_t inputMin, int16_t inputMax, int16_t value); +int16_t gimbal2pwm(int16_t value); + bool gimbalSerialInit(void); bool gimbalSerialDetect(void); void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime); diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 3b6ca7ce0de..d5ffcd9589e 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -62,6 +62,7 @@ #include "drivers/osd_symbols.h" #include "drivers/time.h" #include "drivers/vtx_common.h" +#include "drivers/gimbal_common.h" #include "io/adsb.h" #include "io/flashfs.h" @@ -1203,8 +1204,15 @@ int16_t osdGetHeading(void) int16_t osdGetPanServoOffset(void) { int8_t servoIndex = osdConfig()->pan_servo_index; - int16_t servoPosition = servo[servoIndex]; int16_t servoMiddle = servoParams(servoIndex)->middle; + int16_t servoPosition = servo[servoIndex]; + + gimbalDevice_t *dev = gimbalCommonDevice(); + if (dev && gimbalCommonIsReady(dev)) { + servoPosition = gimbalCommonGetPanPwm(dev); + servoMiddle = PWM_RANGE_MIDDLE; + } + return (int16_t)CENTIDEGREES_TO_DEGREES((servoPosition - servoMiddle) * osdConfig()->pan_servo_pwm2centideg); } From ffb536db5d2ea60153c0b28b8abbb83016e7d49b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:03:58 +0200 Subject: [PATCH 255/429] Cleanup --- src/main/io/headtracker_msp.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main/io/headtracker_msp.c b/src/main/io/headtracker_msp.c index 6a4b73dbbfb..8a800b3f46e 100644 --- a/src/main/io/headtracker_msp.c +++ b/src/main/io/headtracker_msp.c @@ -30,18 +30,6 @@ #include "io/headtracker_msp.h" -/* -typedef struct headTrackerVTable_s { - void (*process)(headTrackerDevice_t *headTrackerDevice, timeUs_t currentTimeUs); - headTrackerDevType_e (*getDeviceType)(const headTrackerDevice_t *headTrackerDevice); - bool (*isReady)(const headTrackerDevice_t *headTrackerDevice); - bool (*isValid)(const headTrackerDevice_t *headTrackerDevice); - int (*getPanPWM)(const headTrackerDevice_t *headTrackerDevice); - int (*getTiltPWM)(const headTrackerDevice_t *headTrackerDevice); - int (*getRollPWM)(const headTrackerDevice_t *headTrackerDevice); -} headtrackerVTable_t; -*/ - static headTrackerVTable_t headTrackerMspVTable = { .process = NULL, .getDeviceType = heatTrackerMspGetDeviceType, @@ -78,9 +66,6 @@ void mspHeadTrackerReceiverNewData(uint8_t *data, int dataSize) headTrackerMspDevice.roll = constrain(status->roll, HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); headTrackerMspDevice.expires = micros() + MAX_HEADTRACKER_DATA_AGE_US; - SD(fprintf(stderr, "[headTracker]: pan: %d tilt: %d roll: %d\n", status->pan, status->tilt, status->roll)); - SD(fprintf(stderr, "[headTracker]: scaled pan: %d tilt: %d roll: %d\n", headTrackerMspDevice.pan, headTrackerMspDevice.tilt, headTrackerMspDevice.roll)); - UNUSED(status); } From e0d141a1ef691cc6dd6c8299f2ec1acd08083349 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:23:58 +0200 Subject: [PATCH 256/429] Set digital channels --- src/main/io/servo_sbus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/io/servo_sbus.c b/src/main/io/servo_sbus.c index ba0edcc5327..bfcd71b1158 100644 --- a/src/main/io/servo_sbus.c +++ b/src/main/io/servo_sbus.c @@ -109,6 +109,8 @@ void sbusServoUpdate(uint8_t index, uint16_t value) case 13: sbusFrame.channels.chan13 = sbusEncodeChannelValue(value); break; case 14: sbusFrame.channels.chan14 = sbusEncodeChannelValue(value); break; case 15: sbusFrame.channels.chan15 = sbusEncodeChannelValue(value); break; + case 16: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_17) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_17) ; break; + case 17: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_18) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_18) ; break; default: break; } From 1a0b6e18615c8db104222ea05b5a3e4e5a80212c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:27:32 +0200 Subject: [PATCH 257/429] Bump max servos to 18 --- src/main/drivers/pwm_mapping.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index cfb96afadbf..08123130f2c 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -24,13 +24,12 @@ #if defined(TARGET_MOTOR_COUNT) #define MAX_MOTORS TARGET_MOTOR_COUNT -#define MAX_SERVOS 16 - #else #define MAX_MOTORS 12 -#define MAX_SERVOS 16 #endif +#define MAX_SERVOS 18 + #define PWM_TIMER_HZ 1000000 #define PULSE_1MS (1000) // 1ms pulse width From b6f29761270b261290d549bcf02a64ff43d33d61 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:31:46 +0200 Subject: [PATCH 258/429] Expand servo count to 18 --- src/main/flight/servos.h | 2 +- src/main/rx/sbus_channels.c | 2 -- src/main/rx/sbus_channels.h | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index d271142ece0..1ae7d536a65 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 16 +#define MAX_SUPPORTED_SERVOS 18 // These must be consecutive typedef enum { diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 380b1b32240..99ca76393d6 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -28,8 +28,6 @@ #include "rx/sbus_channels.h" -#define SBUS_FLAG_CHANNEL_17 (1 << 0) -#define SBUS_FLAG_CHANNEL_18 (1 << 1) #define SBUS_DIGITAL_CHANNEL_MIN 173 #define SBUS_DIGITAL_CHANNEL_MAX 1812 diff --git a/src/main/rx/sbus_channels.h b/src/main/rx/sbus_channels.h index 5e8a6a02681..467fdda5afc 100644 --- a/src/main/rx/sbus_channels.h +++ b/src/main/rx/sbus_channels.h @@ -22,6 +22,8 @@ #define SBUS_MAX_CHANNEL 18 +#define SBUS_FLAG_CHANNEL_17 (1 << 0) +#define SBUS_FLAG_CHANNEL_18 (1 << 1) #define SBUS_FLAG_SIGNAL_LOSS (1 << 2) #define SBUS_FLAG_FAILSAFE_ACTIVE (1 << 3) From 47bc883c7e19f5b214919588fe1c14b84047c9aa Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:00:49 +0200 Subject: [PATCH 259/429] Expand inputs and mixer to full 24 channels --- src/main/fc/rc_controls.h | 34 ++++++++++++++++++++++------------ src/main/flight/servos.c | 10 ++++++++++ src/main/flight/servos.h | 10 ++++++++++ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 8d5ee66bd73..3705a29c3a1 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -26,18 +26,28 @@ typedef enum rc_alias { PITCH, YAW, THROTTLE, - AUX1, - AUX2, - AUX3, - AUX4, - AUX5, - AUX6, - AUX7, - AUX8, - AUX9, - AUX10, - AUX11, - AUX12 + AUX1, // 5 + AUX2, // 6 + AUX3, // 7 + AUX4, // 8 + AUX5, // 9 + AUX6, // 10 + AUX7, // 11 + AUX8, // 12 + AUX9, // 13 + AUX10, // 14 + AUX11, // 15 + AUX12, // 16 + AUX13, // 17 + AUX14, // 18 +#ifdef USE_24CHANNELS + AUX15, // 19 + AUX16, // 20 + AUX17, // 21 + AUX18, // 22 + AUX19, // 23 + AUX20, // 24 +#endif } rc_alias_e; typedef enum { diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index e77e0788904..5ac98f78215 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -347,6 +347,16 @@ void servoMixer(float dT) input[INPUT_RC_CH14] = GET_RX_CHANNEL_INPUT(AUX10); input[INPUT_RC_CH15] = GET_RX_CHANNEL_INPUT(AUX11); input[INPUT_RC_CH16] = GET_RX_CHANNEL_INPUT(AUX12); + input[INPUT_RC_CH17] = GET_RX_CHANNEL_INPUT(AUX13); + input[INPUT_RC_CH18] = GET_RX_CHANNEL_INPUT(AUX14); +#ifdef USE_24CHANNELS + input[INPUT_RC_CH19] = GET_RX_CHANNEL_INPUT(AUX15); + input[INPUT_RC_CH20] = GET_RX_CHANNEL_INPUT(AUX16); + input[INPUT_RC_CH21] = GET_RX_CHANNEL_INPUT(AUX17); + input[INPUT_RC_CH22] = GET_RX_CHANNEL_INPUT(AUX18); + input[INPUT_RC_CH23] = GET_RX_CHANNEL_INPUT(AUX19); + input[INPUT_RC_CH24] = GET_RX_CHANNEL_INPUT(AUX20); +#endif #undef GET_RX_CHANNEL_INPUT #ifdef USE_HEADTRACKER diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 1ae7d536a65..4f6e5777967 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -66,6 +66,16 @@ typedef enum { INPUT_HEADTRACKER_PAN = 39, INPUT_HEADTRACKER_TILT = 40, INPUT_HEADTRACKER_ROLL = 41, + INPUT_RC_CH17 = 42, + INPUT_RC_CH18 = 43, +#ifdef USE_24CHANNELS + INPUT_RC_CH19 = 44, + INPUT_RC_CH20 = 45, + INPUT_RC_CH21 = 46, + INPUT_RC_CH22 = 47, + INPUT_RC_CH23 = 48, + INPUT_RC_CH24 = 49, +#endif INPUT_SOURCE_COUNT } inputSource_e; From 74b638d6a9b9a448b929379074edf0b1fcb9b96a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:26:18 +0200 Subject: [PATCH 260/429] Use printf for LOG_DEBUG in sitl. --- src/main/common/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/common/log.c b/src/main/common/log.c index 20faa4a53db..49eb5a8b985 100644 --- a/src/main/common/log.c +++ b/src/main/common/log.c @@ -20,11 +20,12 @@ #include #include -#if defined(SEMIHOSTING) +#if defined(SEMIHOSTING) || defined(SITL_BUILD) #include #endif #include "build/version.h" +#include "build/debug.h" #include "drivers/serial.h" #include "drivers/time.h" @@ -125,6 +126,7 @@ static void logPrint(const char *buf, size_t size) fputc(buf[ii], stdout); } #endif + SD(printf("%s\n", buf)); if (logPort) { // Send data via UART (if configured & connected - a safeguard against zombie VCP) if (serialIsConnected(logPort)) { From 3e285b0c057e58818377150d51affe0523bc002e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:57:48 +0200 Subject: [PATCH 261/429] Add CRSF bind command. Also add MSP message to trigger bind. Bind commands should work for srxl2 and crsf --- src/main/fc/cli.c | 7 +++++++ src/main/fc/fc_msp.c | 25 ++++++++++++++++++++++++- src/main/msp/msp_protocol_v2_common.h | 1 + src/main/rx/crsf.c | 7 +++++++ src/main/rx/crsf.h | 11 +++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 7b9c1329884..0d54cab4398 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -104,6 +104,7 @@ bool cliMode = false; #include "rx/rx.h" #include "rx/spektrum.h" #include "rx/srxl2.h" +#include "rx/crsf.h" #include "scheduler/scheduler.h" @@ -3224,6 +3225,12 @@ void cliRxBind(char *cmdline){ srxl2Bind(); cliPrint("Binding SRXL2 receiver..."); break; +#endif +#if defined(USE_SERIALRX_CRSF) + case SERIALRX_CRSF: + crsfBind(); + cliPrint("Binding CRSF receiver..."); + break; #endif } } diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 6362901e45b..acbf0c2dcb4 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -110,6 +110,8 @@ #include "rx/rx.h" #include "rx/msp.h" +#include "rx/srxl2.h" +#include "rx/crsf.h" #include "scheduler/scheduler.h" @@ -1030,6 +1032,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF case MSP_MIXER: sbufWriteU8(dst, 3); // mixerMode no longer supported, send 3 (QuadX) as fallback break; + case MSP_RX_CONFIG: sbufWriteU8(dst, rxConfig()->serialrx_provider); @@ -2887,7 +2890,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) } else return MSP_RESULT_ERROR; break; - + case MSP_SET_FAILSAFE_CONFIG: if (dataSize == 20) { failsafeConfigMutable()->failsafe_delay = sbufReadU8(src); @@ -3352,6 +3355,26 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) break; + case MSP2_BETAFLIGHT_BIND: + if (rxConfig()->receiverType == RX_TYPE_SERIAL) { + switch (rxConfig()->serialrx_provider) { + default: + return MSP_RESULT_ERROR; + #if defined(USE_SERIALRX_SRXL2) + case SERIALRX_SRXL2: + srxl2Bind(); + break; + #endif + #if defined(USE_SERIALRX_CRSF) + case SERIALRX_CRSF: + crsfBind(); + break; + #endif + } + } else { + return MSP_RESULT_ERROR; + } + break; default: return MSP_RESULT_ERROR; diff --git a/src/main/msp/msp_protocol_v2_common.h b/src/main/msp/msp_protocol_v2_common.h index 82b7f754079..e778a1808c9 100644 --- a/src/main/msp/msp_protocol_v2_common.h +++ b/src/main/msp/msp_protocol_v2_common.h @@ -33,3 +33,4 @@ #define MSP2_COMMON_SET_RADAR_POS 0x100B //SET radar position information #define MSP2_COMMON_SET_RADAR_ITD 0x100C //SET radar information to display +#define MSP2_BETAFLIGHT_BIND 0x3000 diff --git a/src/main/rx/crsf.c b/src/main/rx/crsf.c index 85820f7fa20..f325859a8a0 100755 --- a/src/main/rx/crsf.c +++ b/src/main/rx/crsf.c @@ -331,4 +331,11 @@ bool crsfRxIsActive(void) { return serialPort != NULL; } + + +void crsfBind(void) +{ + +} + #endif diff --git a/src/main/rx/crsf.h b/src/main/rx/crsf.h index f3bc7933494..69777a0390c 100755 --- a/src/main/rx/crsf.h +++ b/src/main/rx/crsf.h @@ -104,6 +104,15 @@ typedef enum { CRSF_FRAMETYPE_DISPLAYPORT_CMD = 0x7D, // displayport control command } crsfFrameType_e; +enum { + CRSF_COMMAND_SUBCMD_RX = 0x10, // receiver command + CRSF_COMMAND_SUBCMD_GENERAL = 0x0A, // general command +}; + +enum { + CRSF_COMMAND_SUBCMD_RX_BIND = 0x01, // bind command +}; + typedef struct crsfFrameDef_s { uint8_t deviceAddress; uint8_t frameLength; @@ -124,3 +133,5 @@ struct rxConfig_s; struct rxRuntimeConfig_s; bool crsfRxInit(const struct rxConfig_s *initialRxConfig, struct rxRuntimeConfig_s *rxRuntimeConfig); bool crsfRxIsActive(void); + +void crsfBind(void); From a33e13aff9268462beba563f9b1c541ed840d8b4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 00:08:39 +0200 Subject: [PATCH 262/429] Almost forgot to commit the important bits :) --- src/main/rx/crsf.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/rx/crsf.c b/src/main/rx/crsf.c index f325859a8a0..a791b2e9dd8 100755 --- a/src/main/rx/crsf.c +++ b/src/main/rx/crsf.c @@ -335,7 +335,20 @@ bool crsfRxIsActive(void) void crsfBind(void) { - + if (serialPort != NULL) { + uint8_t bindFrame[] = { + CRSF_SYNC_BYTE, + 0x07, // frame length + CRSF_FRAMETYPE_COMMAND, + CRSF_ADDRESS_CRSF_RECEIVER, + CRSF_ADDRESS_FLIGHT_CONTROLLER, + CRSF_COMMAND_SUBCMD_RX, + CRSF_COMMAND_SUBCMD_RX_BIND, + 0x9E, // Command CRC8 + 0xE8, // Packet CRC8 + }; + serialWriteBuf(serialPort, bindFrame, 9); + } } #endif From 646bb78064db2f7ff3a329c9a4c6c36e9c4c9ae8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 12:17:13 +0200 Subject: [PATCH 263/429] Basics. Needs filling in values and sending out frames --- src/main/CMakeLists.txt | 2 + src/main/telemetry/sbus2.c | 27 ++++++++++ src/main/telemetry/sbus2.h | 104 +++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 src/main/telemetry/sbus2.c create mode 100644 src/main/telemetry/sbus2.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 2e2b6cb2b20..8644101e930 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -610,6 +610,8 @@ main_sources(COMMON_SRC telemetry/mavlink.h telemetry/msp_shared.c telemetry/msp_shared.h + telemetry/sbus2.c + telemetry/sbus2.h telemetry/smartport.c telemetry/smartport.h telemetry/sim.c diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c new file mode 100644 index 00000000000..f192160f8a2 --- /dev/null +++ b/src/main/telemetry/sbus2.c @@ -0,0 +1,27 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include "sbus2.h" + +const uint8_t Slot_ID[SBUS2_SLOT_COUNT] = { + 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, + 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, + 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, + 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB +}; + + diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h new file mode 100644 index 00000000000..c5b13e12fc7 --- /dev/null +++ b/src/main/telemetry/sbus2.h @@ -0,0 +1,104 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + + +#pragma once + +#include + +#define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 + +#define SBUS2_SLOT_COUNT 32 + +// Information on SBUS2 sensors from: https://github.com/BrushlessPower/SBUS2-Telemetry/tree/master + +extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; + + +// Temperature: +// Max 125C +// value | 0x4000 +typedef struct sbus2_telemetry_temp_payload_s { + uint8_t tempHigh; // temp | 0x4000; // 125c + uint8_t tempLow; +} sbsu2_telemetry_temp_payload_t; + + +// Temperature: +// Max 200C +// temp | 0x8000 +typedef struct sbus2_telemetry_temp200_payload_s { + uint8_t tempLow; // temp | 0x8000; // 200c + uint8_t tempHigh; +} sbsu2_telemetry_temp200_payload_t; + +// RPM: +// (RPM / 6) max: 0xFFFF +typedef struct sbus2_telemetry_rpm_payload_s { + uint8_t rpmHigh; // RPM / 6, capped at 0xFFFF + uint8_t rpmLow; +} sbsu2_telemetry_rpm_payload_t; + +// Voltage: 1 or 2 slots +// 0x8000 = rx voltage? +// max input: 0x1FFF +typedef struct sbus2_telemetry_voltage_payload_s { + uint8_t voltageHigh; // 2 slots // Voltage 1: value | 0x8000 + uint8_t voltageLow; // max input value: 0x1FFF +} sbsu2_telemetry_voltage_payload_t; + +// Current +// 3 frames +// 1: current +// Max input: 0x3FFF +// input |= 0x4000 +// input &= 0x7FFF +// 2: voltage +// same as voltage frame. may not need ot be capped. +// 3: Capacity +typedef struct sbus2_telemetry_current_payload_s { + uint8_t currentHigh; + uint8_t currentLow; +} sbsu2_telemetry_current_payload_t; + +typedef struct sbus2_telemetry_capacity_payload_s { + uint8_t capacityHigh; + uint8_t capacityLow; +} sbsu2_telemetry_capacity_payload_t; + + +// GPS +// frames: +// 1: Speed +// 2: Altitude +// 3: Vario +// 4,5: LAT +// 5,6: LON + + +typedef struct sbus2_telemetry_frame_s { + uint8_t slotId; + union { + uint8_t data[2]; + sbsu2_telemetry_temp_payload_t temp125; + sbsu2_telemetry_temp200_payload_t temp200; + sbsu2_telemetry_rpm_payload_t rpm; + sbsu2_telemetry_voltage_payload_t voltage; + sbsu2_telemetry_current_payload_t current; + sbsu2_telemetry_capacity_payload_t capacity; + } payload; +} sbus2_telemetry_frame_t; From f4ce36f6cb311c4a703ee5a10afb355b57bbd100 Mon Sep 17 00:00:00 2001 From: error414 Date: Mon, 1 Apr 2024 14:39:10 +0200 Subject: [PATCH 264/429] Fixed position for formation flight / inav radar --- docs/Settings.md | 10 ++++ src/main/common/maths.c | 9 +++ src/main/common/maths.h | 1 + src/main/fc/settings.yaml | 6 ++ src/main/io/osd.c | 119 +++++++++++++++++++++++++++++++++++++- src/main/io/osd.h | 8 ++- 6 files changed, 149 insertions(+), 4 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 38f37649b39..98b0eecaa3d 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -4942,6 +4942,16 @@ Number of leading digits removed from plus code. Removing 2, 4 and 6 digits requ --- +### osd_radar_peers_display_time + +Time in seconds to display next peer + +| Default | Min | Max | +| --- | --- | --- | +| 3 | 1 | 10 | + +--- + ### osd_right_sidebar_scroll Scroll type for the right sidebar diff --git a/src/main/common/maths.c b/src/main/common/maths.c index b8ec59c33a2..993634d902d 100644 --- a/src/main/common/maths.c +++ b/src/main/common/maths.c @@ -123,6 +123,15 @@ int32_t wrap_18000(int32_t angle) return angle; } +int16_t wrap_180(int16_t angle) +{ + if (angle > 180) + angle -= 360; + if (angle < -180) + angle += 360; + return angle; +} + int32_t wrap_36000(int32_t angle) { if (angle >= 36000) diff --git a/src/main/common/maths.h b/src/main/common/maths.h index ce96b7064fd..b8d3803613f 100644 --- a/src/main/common/maths.h +++ b/src/main/common/maths.h @@ -166,6 +166,7 @@ int scaleRange(int x, int srcMin, int srcMax, int destMin, int destMax); float scaleRangef(float x, float srcMin, float srcMax, float destMin, float destMax); int32_t wrap_18000(int32_t angle); +int16_t wrap_180(int16_t angle); int32_t wrap_36000(int32_t angle); int32_t quickMedianFilter3(int32_t * v); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index b60c1546694..9e501c7078c 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -3486,6 +3486,12 @@ groups: min: 1 max: 10 default_value: 3 + - name: osd_radar_peers_display_time + description: "Time in seconds to display next peer " + field: radar_peers_display_time + min: 1 + max: 10 + default_value: 3 - name: osd_hud_wp_disp description: "How many navigation waypoints are displayed, set to 0 (zero) to disable. As sample, if set to 2, and you just passed the 3rd waypoint of the mission, you'll see markers for the 4th waypoint (marked 1) and the 5th waypoint (marked 2)" default_value: 0 diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 3b6ca7ce0de..9ab45f2736d 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -2505,6 +2505,121 @@ static bool osdDrawSingleElement(uint8_t item) } #endif + case OSD_FORMATION_FLIGHT: + { + static uint8_t currentPeerIndex = 0; + static timeMs_t lastPeerSwitch; + + if ((STATE(GPS_FIX) && isImuHeadingValid())) { + if ((radar_pois[currentPeerIndex].gps.lat == 0 || radar_pois[currentPeerIndex].gps.lon == 0 || radar_pois[currentPeerIndex].state >= 2) || (millis() > (osdConfig()->radar_peers_display_time * 1000) + lastPeerSwitch)) { + lastPeerSwitch = millis(); + + for(uint8_t i = 1; i < RADAR_MAX_POIS - 1; i++) { + uint8_t nextPeerIndex = (currentPeerIndex + i) % (RADAR_MAX_POIS - 1); + if (radar_pois[nextPeerIndex].gps.lat != 0 && radar_pois[nextPeerIndex].gps.lon != 0 && radar_pois[nextPeerIndex].state < 2) { + currentPeerIndex = nextPeerIndex; + break; + } + } + } + + radar_pois_t *currentPeer = &(radar_pois[currentPeerIndex]); + if (currentPeer->gps.lat != 0 && currentPeer->gps.lon != 0 && currentPeer->state < 2) { + fpVector3_t poi; + geoConvertGeodeticToLocal(&poi, &posControl.gpsOrigin, ¤tPeer->gps, GEO_ALT_RELATIVE); + + currentPeer->distance = calculateDistanceToDestination(&poi) / 100; // In m + currentPeer->altitude = (int16_t )((currentPeer->gps.alt - osdGetAltitudeMsl()) / 100); + currentPeer->direction = (int16_t )(calculateBearingToDestination(&poi) / 100); // In ° + + int16_t panServoDirOffset = 0; + if (osdConfig()->pan_servo_pwm2centideg != 0){ + panServoDirOffset = osdGetPanServoOffset(); + } + + //line 1 + //[peer heading][peer ID][LQ][direction to peer] + + //[peer heading] + int relativePeerHeading = osdGetHeadingAngle(currentPeer->heading - (int)DECIDEGREES_TO_DEGREES(osdGetHeading())); + displayWriteChar(osdDisplayPort, elemPosX, elemPosY, SYM_DECORATION + ((relativePeerHeading + 22) / 45) % 8); + + //[peer ID] + displayWriteChar(osdDisplayPort, elemPosX + 1, elemPosY, 65 + currentPeerIndex); + + //[LQ] + displayWriteChar(osdDisplayPort, elemPosX + 2, elemPosY, SYM_HUD_SIGNAL_0 + currentPeer->lq); + + //[direction to peer] + int directionToPeerError = wrap_180(osdGetHeadingAngle(currentPeer->direction) + panServoDirOffset - (int)DECIDEGREES_TO_DEGREES(osdGetHeading())); + uint16_t iconIndexOffset = constrain(((directionToPeerError + 180) / 30), 0, 12); + if (iconIndexOffset == 12) { + iconIndexOffset = 0; // Directly behind + } + displayWriteChar(osdDisplayPort, elemPosX + 3, elemPosY, SYM_HUD_CARDINAL + iconIndexOffset); + + + //line 2 + switch ((osd_unit_e)osdConfig()->units) { + case OSD_UNIT_UK: + FALLTHROUGH; + case OSD_UNIT_IMPERIAL: + osdFormatCentiNumber(buff, CENTIMETERS_TO_CENTIFEET(currentPeer->distance * 100), FEET_PER_MILE, 0, 4, 4, false); + break; + case OSD_UNIT_GA: + osdFormatCentiNumber(buff, CENTIMETERS_TO_CENTIFEET(currentPeer->distance * 100), (uint32_t)FEET_PER_NAUTICALMILE, 0, 4, 4, false); + break; + default: + FALLTHROUGH; + case OSD_UNIT_METRIC_MPH: + FALLTHROUGH; + case OSD_UNIT_METRIC: + osdFormatCentiNumber(buff, currentPeer->distance * 100, METERS_PER_KILOMETER, 0, 4, 4, false); + break; + } + displayWrite(osdDisplayPort, elemPosX, elemPosY + 1, buff); + + + //line 3 + displayWriteChar(osdDisplayPort, elemPosX, elemPosY + 2, (currentPeer->altitude >= 0) ? SYM_AH_DECORATION_UP : SYM_AH_DECORATION_DOWN); + + int altc = currentPeer->altitude; + switch ((osd_unit_e)osdConfig()->units) { + case OSD_UNIT_UK: + FALLTHROUGH; + case OSD_UNIT_GA: + FALLTHROUGH; + case OSD_UNIT_IMPERIAL: + // Convert to feet + altc = CENTIMETERS_TO_FEET(altc * 100); + break; + default: + FALLTHROUGH; + case OSD_UNIT_METRIC_MPH: + FALLTHROUGH; + case OSD_UNIT_METRIC: + // Already in metres + break; + } + + altc = ABS(constrain(altc, -999, 999)); + tfp_sprintf(buff, "%3d", altc); + displayWrite(osdDisplayPort, elemPosX + 1, elemPosY + 2, buff); + + return true; + } + } + + //clear screen + for(uint8_t i = 0; i < 4; i++){ + displayWriteChar(osdDisplayPort, elemPosX + i, elemPosY, SYM_BLANK); + displayWriteChar(osdDisplayPort, elemPosX + i, elemPosY + 1, SYM_BLANK); + displayWriteChar(osdDisplayPort, elemPosX + i, elemPosY + 2, SYM_BLANK); + } + + return true; + } + case OSD_CROSSHAIRS: // Hud is a sub-element of the crosshair osdCrosshairPosition(&elemPosX, &elemPosY); @@ -3922,7 +4037,9 @@ PG_RESET_TEMPLATE(osdConfig_t, osdConfig, .stats_energy_unit = SETTING_OSD_STATS_ENERGY_UNIT_DEFAULT, .stats_page_auto_swap_time = SETTING_OSD_STATS_PAGE_AUTO_SWAP_TIME_DEFAULT, - .stats_show_metric_efficiency = SETTING_OSD_STATS_SHOW_METRIC_EFFICIENCY_DEFAULT + .stats_show_metric_efficiency = SETTING_OSD_STATS_SHOW_METRIC_EFFICIENCY_DEFAULT, + + .radar_peers_display_time = SETTING_OSD_RADAR_PEERS_DISPLAY_TIME_DEFAULT ); void pgResetFn_osdLayoutsConfig(osdLayoutsConfig_t *osdLayoutsConfig) diff --git a/src/main/io/osd.h b/src/main/io/osd.h index 7ac14054994..a73db015793 100644 --- a/src/main/io/osd.h +++ b/src/main/io/osd.h @@ -283,9 +283,10 @@ typedef enum { OSD_CUSTOM_ELEMENT_1, OSD_CUSTOM_ELEMENT_2, OSD_CUSTOM_ELEMENT_3, - OSD_ADSB_WARNING, + OSD_ADSB_WARNING, //150 OSD_ADSB_INFO, OSD_BLACKBOX, + OSD_FORMATION_FLIGHT, //153 OSD_ITEM_COUNT // MUST BE LAST } osd_items_e; @@ -460,11 +461,12 @@ typedef struct osdConfig_s { #ifndef DISABLE_MSP_DJI_COMPAT bool highlight_djis_missing_characters; // If enabled, show question marks where there is no character in DJI's font to represent an OSD element symbol #endif -#ifdef USE_ADSB + #ifdef USE_ADSB uint16_t adsb_distance_warning; // in metres uint16_t adsb_distance_alert; // in metres uint16_t adsb_ignore_plane_above_me_limit; // in metres -#endif + #endif + uint8_t radar_peers_display_time; // in seconds } osdConfig_t; PG_DECLARE(osdConfig_t, osdConfig); From 055642ac67211923516a2ec3bea3657fcc78a7b1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 12:42:31 +0200 Subject: [PATCH 265/429] Add pan trim to stick inputs and center checks Add pan trim to rc inputs so it can match center flight mode. Also add pan trim to osd center checks. I did not add pan trim to headtracker output, as that would probably confuse the user more than not. And not adding it to the headtracker input, the osd will still match the expected position. You probably shouldn't be mounting your gimbal sideways, anyway. ;) --- src/main/drivers/gimbal_common.c | 2 +- src/main/io/gimbal_serial.c | 6 +++--- src/main/io/osd.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/drivers/gimbal_common.c b/src/main/drivers/gimbal_common.c index a81b1b51c10..e03e7fd9ddd 100644 --- a/src/main/drivers/gimbal_common.c +++ b/src/main/drivers/gimbal_common.c @@ -133,7 +133,7 @@ int16_t gimbalCommonGetPanPwm(const gimbalDevice_t *gimbalDevice) return gimbalDevice->vTable->getGimbalPanPWM(gimbalDevice); } - return gimbalDevice ? gimbalDevice->currentPanPWM : PWM_RANGE_MIDDLE; + return gimbalDevice ? gimbalDevice->currentPanPWM : PWM_RANGE_MIDDLE + gimbalConfig()->panTrim; } #endif \ No newline at end of file diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 6e6b7e93240..311d790a9cd 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -213,17 +213,17 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) if (rxAreFlightChannelsValid() && !IS_RC_MODE_ACTIVE(BOXGIMBALCENTER)) { if (cfg->panChannel > 0) { - panPWM = rxGetChannelValue(cfg->panChannel - 1); + panPWM = rxGetChannelValue(cfg->panChannel - 1) + cfg->panTrim; panPWM = constrain(panPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->tiltChannel > 0) { - tiltPWM = rxGetChannelValue(cfg->tiltChannel - 1); + tiltPWM = rxGetChannelValue(cfg->tiltChannel - 1) + cfg->tiltTrim; tiltPWM = constrain(tiltPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } if (cfg->rollChannel > 0) { - rollPWM = rxGetChannelValue(cfg->rollChannel - 1); + rollPWM = rxGetChannelValue(cfg->rollChannel - 1) + cfg->rollTrim; rollPWM = constrain(rollPWM, PWM_RANGE_MIN, PWM_RANGE_MAX); } } diff --git a/src/main/io/osd.c b/src/main/io/osd.c index d5ffcd9589e..1b183ff58f7 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -1210,7 +1210,7 @@ int16_t osdGetPanServoOffset(void) gimbalDevice_t *dev = gimbalCommonDevice(); if (dev && gimbalCommonIsReady(dev)) { servoPosition = gimbalCommonGetPanPwm(dev); - servoMiddle = PWM_RANGE_MIDDLE; + servoMiddle = PWM_RANGE_MIDDLE + gimbalConfig()->panTrim; } return (int16_t)CENTIDEGREES_TO_DEGREES((servoPosition - servoMiddle) * osdConfig()->pan_servo_pwm2centideg); From 8d74e702b6f69a55d218b1f37e9be9f9c3c440f8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 06:53:31 -0400 Subject: [PATCH 266/429] Update CMakeLists.txt tabs vs spaces --- src/main/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 8644101e930..9a0b09090af 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -610,8 +610,8 @@ main_sources(COMMON_SRC telemetry/mavlink.h telemetry/msp_shared.c telemetry/msp_shared.h - telemetry/sbus2.c - telemetry/sbus2.h + telemetry/sbus2.c + telemetry/sbus2.h telemetry/smartport.c telemetry/smartport.h telemetry/sim.c From 7ffb0bc5008ebf75ec2b9fe932f2a5ee43e8acb0 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:03:06 +0200 Subject: [PATCH 267/429] Fix center when no valid headtracker data is available --- src/main/io/gimbal_serial.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/io/gimbal_serial.c b/src/main/io/gimbal_serial.c index 311d790a9cd..4eec2903947 100644 --- a/src/main/io/gimbal_serial.c +++ b/src/main/io/gimbal_serial.c @@ -60,6 +60,7 @@ static volatile uint8_t txBuffer[GIMBAL_SERIAL_BUFFER_SIZE]; #if defined(USE_HEADTRACKER) && defined(USE_HEADTRACKER_SERIAL) static gimbalSerialHtrkState_t headTrackerState = { .payloadSize = 0, + .attitude = {}, .state = WAITING_HDR1, }; #endif @@ -189,7 +190,10 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) gimbalHtkAttitudePkt_t attitude = { .sync = {HTKATTITUDE_SYNC0, HTKATTITUDE_SYNC1}, - .mode = GIMBAL_MODE_DEFAULT + .mode = GIMBAL_MODE_DEFAULT, + .pan = 0, + .tilt = 0, + .roll = 0 }; const gimbalConfig_t *cfg = gimbalConfig(); @@ -238,9 +242,9 @@ void gimbalSerialProcess(gimbalDevice_t *gimbalDevice, timeUs_t currentTime) DEBUG_SET(DEBUG_HEADTRACKING, 4, 1); } else { - attitude.pan = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->panTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); - attitude.tilt = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->tiltTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); - attitude.roll = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->rollTrim), PWM_RANGE_MIN, PWM_RANGE_MAX); + attitude.pan = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->panTrim), HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + attitude.tilt = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->tiltTrim), HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); + attitude.roll = constrain(gimbal_scale12(PWM_RANGE_MIN, PWM_RANGE_MAX, PWM_RANGE_MIDDLE + cfg->rollTrim), HEADTRACKER_RANGE_MIN, HEADTRACKER_RANGE_MAX); DEBUG_SET(DEBUG_HEADTRACKING, 4, -1); } } else { From 7b495664afe7308d0a595391239fc16dac0aaecc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:36:37 +0200 Subject: [PATCH 268/429] Update bind_rx cli documentation --- docs/Cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Cli.md b/docs/Cli.md index b0cf7d20bfc..a3e18229fc0 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -71,7 +71,7 @@ While connected to the CLI, all Logical Switches are temporarily disabled (5.1.0 | `batch` | Start or end a batch of commands | | `battery_profile` | Change battery profile | | `beeper` | Show/set beeper (buzzer) [usage](Buzzer.md) | -| `bind_rx` | Initiate binding for RX SPI or SRXL2 | +| `bind_rx` | Initiate binding for SRXL2 or CRSF receivers | | `blackbox` | Configure blackbox fields | | `bootlog` | Show boot events | | `color` | Configure colors | From a8b0ff612cf0de184bc25287ce6a40433607b433 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:44:31 +0200 Subject: [PATCH 269/429] Attempt at passing branch protection for non-code commits --- .github/workflows/non-code-change.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/non-code-change.yaml diff --git a/.github/workflows/non-code-change.yaml b/.github/workflows/non-code-change.yaml new file mode 100644 index 00000000000..5c30c6e6ead --- /dev/null +++ b/.github/workflows/non-code-change.yaml @@ -0,0 +1,25 @@ +name: Build firmware +# Don't enable CI on push, just on PR. If you +# are working on the main repo and want to trigger +# a CI build submit a draft PR. +on: + pull_request: + paths-ignore: + - 'src/**' + - '.github/**' + - 'cmake/**' + - 'lib/**' + - 'docs/Settings.md' + - 'CMakeLists.txt' + - '*.sh' + +jobs: + test: + #needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get -y install ninja-build + - name: Run Tests + run: mkdir -p build && cd build && cmake -DTOOLCHAIN=none -G Ninja .. && ninja check From bc9975b02a79b730106685e266d5a0241faa6132 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 09:41:20 -0400 Subject: [PATCH 270/429] Update Cli.md Update list of serial functions. Another test for not building the firmware on doc only changes. --- docs/Cli.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Cli.md b/docs/Cli.md index a3e18229fc0..6a48244a13a 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -157,6 +157,8 @@ A shorter form is also supported to enable and disable a single function using ` | TELEMETRY_SMARTPORT_MASTER | 23 | 8388608 | | UNUSED | 24 | 16777216 | | MSP_DISPLAYPORT | 25 | 33554432 | +| GIMBAL_SERIAL | 26 | 67108864 | +| HEADTRACKER_SERIAL | 27 | 134217728 | Thus, to enable MSP and LTM on a port, one would use the function **value** of 17 (1 << 0)+(1<<4), aka 1+16, aka 17. From ba199c57364746421721d813b56fe96fcaab3376 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 09:43:45 -0400 Subject: [PATCH 271/429] Only generate nightly build release if the change includes code. --- .github/workflows/dev-builds.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/dev-builds.yml b/.github/workflows/dev-builds.yml index e0f648e003e..94492966f79 100644 --- a/.github/workflows/dev-builds.yml +++ b/.github/workflows/dev-builds.yml @@ -6,6 +6,14 @@ on: push: branches: - master + paths: + - 'src/**' + - '.github/**' + - 'cmake/**' + - 'lib/**' + - 'docs/Settings.md' + - 'CMakeLists.txt' + - '*.sh' jobs: build: From c5d6a4ffb31b298e0e19477dbc32436312e25402 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 10:29:51 -0400 Subject: [PATCH 272/429] Update osd.c Looks like it was bumped to 11 on master already, going +1 --- src/main/io/osd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 9ab45f2736d..757ecc7c909 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -223,7 +223,7 @@ static bool osdDisplayHasCanvas; #define AH_MAX_PITCH_DEFAULT 20 // Specify default maximum AHI pitch value displayed (degrees) -PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 11); +PG_REGISTER_WITH_RESET_TEMPLATE(osdConfig_t, osdConfig, PG_OSD_CONFIG, 12); PG_REGISTER_WITH_RESET_FN(osdLayoutsConfig_t, osdLayoutsConfig, PG_OSD_LAYOUTS_CONFIG, 1); void osdStartedSaveProcess(void) { From bb91342e5dbc3d5ba3da9be042a4b44f0ce9bac4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 20:40:48 +0200 Subject: [PATCH 273/429] Fix ublox crc calculation. --- src/utils/assistnow.py | 47 +++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index 066029b4320..c9f19fe6efd 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -9,6 +9,9 @@ import requests import yaml import sys +import socket +import selectors +import types import serial import getopt import io @@ -160,19 +163,29 @@ def crc8_dvb_s2( crc:int, b:int) -> int: def ubloxToMsp(ubxCmd): ubloxLen = len(ubxCmd) - msp = bytearray(b'$X>\x00\x50\x20') + #msp = bytearray(b"$X<\x00d\x00\x00\x00\x8F") + crc = 0 + msp = bytearray(b"$X<\x00\x50\x20") + crc = crc8_dvb_s2(crc, 0x00) + crc = crc8_dvb_s2(crc, 0x50) + crc = crc8_dvb_s2(crc, 0x20) msp.append(ubloxLen & 0xFF) + crc = crc8_dvb_s2(crc, ubloxLen & 0xFF) msp.append((ubloxLen >> 8) & 0xFF) + crc = crc8_dvb_s2(crc, (ubloxLen >> 8) & 0xFF) + + if(len(msp) != 8): + print ("Wrong size") for i in range(ubloxLen): msp.append(ubxCmd[i]) + crc = crc8_dvb_s2(crc, ubxCmd[i]) - crc = 0 - for i in range(ubloxLen + 5): - crc = crc8_dvb_s2(crc, int(msp[i + 3])) - #print ("msp: %s" % (bytes(msp))) + msp.append(crc & 0xFF) + print ("CRC: %i" % (crc)) + return bytes(msp) @@ -191,24 +204,26 @@ def sendUbxMessages(s, ubxMessages): print (err) print (cmd) break - time.sleep(1.0) + #time.sleep(0.1) def sendMspMessages(s, ubxMessages): printed = 0 for cmd in ubxMessages: msp = ubloxToMsp(cmd) + #msp = bytearray(b"$X<\x00d\x00\x00\x00\x8F") printed += 1 if(len(msp) > 8): print ("%i/%i msp: %i ubx: %i" % (printed, len(ubxMessages), len(msp), len(cmd))) try: - s.write(msp) + #s.write(msp) + s.sendall(msp) except serial.SerialException as err: print (err) print (cmd) print (msp) break - time.sleep(1.0) + #time.sleep(1.0) try: opts, args = getopt.getopt(sys.argv[1:], "s:t:pd", ["serial=", "tokens=", "passthrough", "dry-run"]) @@ -231,9 +246,9 @@ def sendMspMessages(s, ubxMessages): usage() sys.exit(2) -if serial_port == None and not dry_run: - usage() - sys.exit(2) +#if serial_port == None and not dry_run: +# usage() +# sys.exit(2) loadTokens(token_file) @@ -297,7 +312,11 @@ def sendMspMessages(s, ubxMessages): of.write(offline_req.content) of.close() -s = serial.Serial(serial_port, 230400) +print ("Connecting...") +#s = serial.Serial(serial_port, 230400) +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.connect(('localhost', 5760)) +print ("Connected.") if not dry_run: if not passthrough: @@ -306,7 +325,7 @@ def sendMspMessages(s, ubxMessages): print ("Online cmds...") sendMspMessages(s, online_cmds) else: - serial.write('#\r\n') - serial.write('gpspassthrough\r\n') + #serial.write('#\r\n') + #serial.write('gpspassthrough\r\n') sendUbxMessages(s, offline_cmds) sendUbxMessages(s, online_cmds) From 2a409138a9e030b6a01cd5081a5d5f0e6f7af1e8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 20:41:47 +0200 Subject: [PATCH 274/429] Switch back to serial comms --- src/utils/assistnow.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/assistnow.py b/src/utils/assistnow.py index c9f19fe6efd..4968a85a9dd 100755 --- a/src/utils/assistnow.py +++ b/src/utils/assistnow.py @@ -216,8 +216,8 @@ def sendMspMessages(s, ubxMessages): if(len(msp) > 8): print ("%i/%i msp: %i ubx: %i" % (printed, len(ubxMessages), len(msp), len(cmd))) try: - #s.write(msp) - s.sendall(msp) + s.write(msp) + #s.sendall(msp) except serial.SerialException as err: print (err) print (cmd) @@ -313,9 +313,9 @@ def sendMspMessages(s, ubxMessages): of.close() print ("Connecting...") -#s = serial.Serial(serial_port, 230400) -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.connect(('localhost', 5760)) +s = serial.Serial(serial_port, 230400) +#s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +#s.connect(('localhost', 5760)) print ("Connected.") if not dry_run: From b6e7a4bb063146758f0eb551190636b96017885f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 20:48:59 +0200 Subject: [PATCH 275/429] Add some debug messages to SITL Great to diagnose your msp messages are actually being delivered. :) --- src/main/fc/fc_msp.c | 4 ++++ src/main/msp/msp_serial.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 8427f94b9c4..c8ae27f270d 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -3290,9 +3291,11 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) #endif case MSP2_INAV_GPS_UBLOX_COMMAND: if(dataSize < 8 || !isGpsUblox()) { + SD(fprintf(stderr, "[GPS] Not ublox!\n")); return MSP_RESULT_ERROR; } + SD(fprintf(stderr, "[GPS] Sending ubx command: %i!\n", dataSize)); gpsUbloxSendCommand(src->ptr, dataSize, 0); break; @@ -4142,6 +4145,7 @@ mspResult_e mspFcProcessCommand(mspPacket_t *cmd, mspPacket_t *reply, mspPostPro // initialize reply by default reply->cmd = cmd->cmd; + SD(fprintf(stderr, "[MSP] CommandId: 0x%04x bytes: %i!\n", cmdMSP, sbufBytesRemaining(src))); if (MSP2_IS_SENSOR_MESSAGE(cmdMSP)) { ret = mspProcessSensorCommand(cmdMSP, src); } else if (mspFcProcessOutCommand(cmdMSP, dst, mspPostProcessFn)) { diff --git a/src/main/msp/msp_serial.c b/src/main/msp/msp_serial.c index 0aaecba2d7d..0dbc1768b8a 100644 --- a/src/main/msp/msp_serial.c +++ b/src/main/msp/msp_serial.c @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include "platform.h" @@ -171,8 +173,10 @@ static bool mspSerialProcessReceivedData(mspPort_t *mspPort, uint8_t c) case MSP_CHECKSUM_V1: if (mspPort->checksum1 == c) { mspPort->c_state = MSP_COMMAND_RECEIVED; + SD(fprintf(stderr, "[MSPV1] Command received\n")); } else { mspPort->c_state = MSP_IDLE; + SD(fprintf(stderr, "[MSPV1] Checksum error!\n")); } break; @@ -225,6 +229,7 @@ static bool mspSerialProcessReceivedData(mspPort_t *mspPort, uint8_t c) // Check for potential buffer overflow if (hdrv2->size > MSP_PORT_INBUF_SIZE) { mspPort->c_state = MSP_IDLE; + SD(fprintf(stderr, "[MSPV2] Potential buffer overflow!\n")); } else { mspPort->dataSize = hdrv2->size; @@ -248,7 +253,9 @@ static bool mspSerialProcessReceivedData(mspPort_t *mspPort, uint8_t c) case MSP_CHECKSUM_V2_NATIVE: if (mspPort->checksum2 == c) { mspPort->c_state = MSP_COMMAND_RECEIVED; + SD(fprintf(stderr, "[MSPV2] command received!\n")); } else { + SD(fprintf(stderr, "[MSPV2] Checksum error!\n")); mspPort->c_state = MSP_IDLE; } break; @@ -472,6 +479,7 @@ void mspSerialProcessOnePort(mspPort_t * const mspPort, mspEvaluateNonMspData_e const uint8_t c = serialRead(mspPort->port); const bool consumed = mspSerialProcessReceivedData(mspPort, c); + //SD(fprintf(stderr, "[MSP]: received char: %02x (%c) state: %i\n", c, isprint(c) ? c : '.', mspPort->c_state)); if (!consumed && evaluateNonMspData == MSP_EVALUATE_NON_MSP_DATA) { mspEvaluateNonMspData(mspPort, c); } From d9d6f9ff85fd4fb4c495906e6981c141fdcbf28a Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 22 Jun 2024 23:06:08 +0200 Subject: [PATCH 276/429] Cleanup before merge --- src/main/io/gps_ublox.c | 7 ++----- src/main/msp/msp_protocol_v2_inav.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index f21b02f114c..52b6329d9f2 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -214,6 +214,8 @@ static uint8_t gpsMapFixType(bool fixValid, uint8_t ubloxFixType) bool gpsUbloxSendCommand(uint8_t *rawCommand, uint16_t commandLen, uint16_t timeout) { + UNUSED(timeout); + serialWriteBuf(gpsState.gpsPort, rawCommand, commandLen); union send_buffer_t *sb = (union send_buffer_t *)(rawCommand); @@ -221,11 +223,6 @@ bool gpsUbloxSendCommand(uint8_t *rawCommand, uint16_t commandLen, uint16_t time _ack_waiting_msg = sb->message.header.msg_id; _ack_state = UBX_ACK_WAITING; - UNUSED(timeout); - //if (timeout > 0) { - // ptWait(_ack_state == UBX_ACK_GOT_ACK); - //} - return true; } diff --git a/src/main/msp/msp_protocol_v2_inav.h b/src/main/msp/msp_protocol_v2_inav.h index 2d9663041e3..8b4a09e87af 100755 --- a/src/main/msp/msp_protocol_v2_inav.h +++ b/src/main/msp/msp_protocol_v2_inav.h @@ -97,7 +97,6 @@ #define MSP2_INAV_SET_FW_APPROACH 0x204B #define MSP2_INAV_GPS_UBLOX_COMMAND 0x2050 -#define MSP2_INAV_GPS_UBLOX_COMMAND_RESULT 0x2051 #define MSP2_INAV_RATE_DYNAMICS 0x2060 #define MSP2_INAV_SET_RATE_DYNAMICS 0x2061 From 9f9b867e9de449df7c2b3566826dc5e65d944c21 Mon Sep 17 00:00:00 2001 From: Hubert <1701213518@sz.pku.edu.cn> Date: Sun, 23 Jun 2024 17:16:04 +0800 Subject: [PATCH 277/429] Update accgyro_bmi088.c: get BMI088 acc aligned --- src/main/drivers/accgyro/accgyro_bmi088.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/drivers/accgyro/accgyro_bmi088.c b/src/main/drivers/accgyro/accgyro_bmi088.c index 8988685c835..7f219f212bd 100644 --- a/src/main/drivers/accgyro/accgyro_bmi088.c +++ b/src/main/drivers/accgyro/accgyro_bmi088.c @@ -214,6 +214,7 @@ bool bmi088AccDetect(accDev_t *acc) acc->initFn = bmi088AccInit; acc->readFn = bmi088AccRead; + acc->accAlign = acc->busDev->param; return true; } From b3425abb5f9d80dc093e999c19618f2f53b8e869 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 24 Jun 2024 11:15:17 +0200 Subject: [PATCH 278/429] Revert to previous defaults --- src/main/fc/settings.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 289b4eae84a..f1d729ae35c 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -259,7 +259,7 @@ groups: max: 10 - name: dynamic_gyro_notch_enabled description: "Enable/disable dynamic gyro notch also known as Matrix Filter" - default_value: OFF + default_value: ON field: dynamicGyroNotchEnabled condition: USE_DYNAMIC_FILTERS type: bool @@ -298,7 +298,7 @@ groups: default_value: 0 - name: setpoint_kalman_enabled description: "Enable Kalman filter on the gyro data" - default_value: OFF + default_value: ON condition: USE_GYRO_KALMAN field: kalmanEnabled type: bool From 1e5d2b93d07f810e93fb9cb934498c4658d5ff4b Mon Sep 17 00:00:00 2001 From: jamming Date: Mon, 24 Jun 2024 17:15:29 +0800 Subject: [PATCH 279/429] Add ICM-42688P to KakuteF4 --- src/main/target/KAKUTEF4/target.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/target/KAKUTEF4/target.h b/src/main/target/KAKUTEF4/target.h index bc921c9f3f8..c1ce47b9e80 100644 --- a/src/main/target/KAKUTEF4/target.h +++ b/src/main/target/KAKUTEF4/target.h @@ -57,6 +57,11 @@ #define MPU6000_CS_PIN PC4 #define MPU6000_SPI_BUS BUS_SPI1 +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW270_DEG +#define ICM42605_CS_PIN PC4 +#define ICM42605_SPI_BUS BUS_SPI1 + #if defined(KAKUTEF4V2) || defined(KAKUTEF4V23) || defined(KAKUTEF4V24) # define USE_I2C # define USE_I2C_DEVICE_1 From 116c9e274f4c52ca705db0ea9b964c8af8356d0d Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 24 Jun 2024 11:23:37 +0200 Subject: [PATCH 280/429] Fix defaults initialization --- src/main/fc/settings.yaml | 2 +- src/main/sensors/gyro.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index f1d729ae35c..7c9a416e38b 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -236,7 +236,7 @@ groups: max: 500 - name: gyro_filter_mode description: "Specifies the type of the software LPF of the gyro signals." - default_value: "LULU" + default_value: "STATIC" field: gyroFilterMode table: gyro_filter_mode - name: gyro_dyn_lpf_min_hz diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 7a90215be5c..b4723f0da74 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -96,7 +96,7 @@ EXTENDED_FASTRAM secondaryDynamicGyroNotchState_t secondaryDynamicGyroNotchState #endif -PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 10); +PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 11); PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_anti_aliasing_lpf_hz = SETTING_GYRO_ANTI_ALIASING_LPF_HZ_DEFAULT, @@ -132,6 +132,7 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .adaptiveFilterIntegratorThresholdLow = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW_DEFAULT, #endif .gyroFilterMode = SETTING_GYRO_FILTER_MODE_DEFAULT, + .gyroLuluSampleCount = SETTING_GYRO_LULU_SAMPLE_COUNT_DEFAULT ); STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHardware) From df29310c3a62a7cbeeaf81b2892e3b4874153f30 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:54:27 +0200 Subject: [PATCH 281/429] USE_MAG_ALL --- src/main/target/ATOMRCF405V2/target.h | 7 +------ src/main/target/FLYWOOF405S_AIO/target.h | 8 +------- src/main/target/GEPRCF745_BT_HD/target.h | 7 +------ src/main/target/JHEMCUF405/target.h | 8 +------- src/main/target/JHEMCUF722/target.h | 7 +------ src/main/target/SDMODELH7V1/target.h | 8 +------- src/main/target/TAKERF722SE/target.h | 5 +---- src/main/target/ZEEZF7/target.h | 4 ---- 8 files changed, 7 insertions(+), 47 deletions(-) diff --git a/src/main/target/ATOMRCF405V2/target.h b/src/main/target/ATOMRCF405V2/target.h index b8315653899..232ac47d953 100644 --- a/src/main/target/ATOMRCF405V2/target.h +++ b/src/main/target/ATOMRCF405V2/target.h @@ -81,12 +81,7 @@ */ #define USE_MAG #define MAG_I2C_BUS DEFAULT_I2C_BUS - -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL +#defiine USE_MAG_ALL /* * Barometer diff --git a/src/main/target/FLYWOOF405S_AIO/target.h b/src/main/target/FLYWOOF405S_AIO/target.h index c25dedfeb9b..4250943633e 100644 --- a/src/main/target/FLYWOOF405S_AIO/target.h +++ b/src/main/target/FLYWOOF405S_AIO/target.h @@ -68,13 +68,7 @@ #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_AK8963 -#define USE_MAG_AK8975 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL +#define USE_MAG_ALL #define USE_RANGEFINDER #define USE_RANGEFINDER_HCSR04_I2C diff --git a/src/main/target/GEPRCF745_BT_HD/target.h b/src/main/target/GEPRCF745_BT_HD/target.h index 3d61f663dd8..c6c84a32ad3 100644 --- a/src/main/target/GEPRCF745_BT_HD/target.h +++ b/src/main/target/GEPRCF745_BT_HD/target.h @@ -89,12 +89,7 @@ #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_IST8308 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL +#define USE_MAG_ALL #define TEMPERATURE_I2C_BUS BUS_I2C1 diff --git a/src/main/target/JHEMCUF405/target.h b/src/main/target/JHEMCUF405/target.h index 6a5b2f52ab4..3cd6fd1e3ea 100644 --- a/src/main/target/JHEMCUF405/target.h +++ b/src/main/target/JHEMCUF405/target.h @@ -68,13 +68,7 @@ #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_AK8963 -#define USE_MAG_AK8975 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL +#define USE_MAG_ALL #define USE_RANGEFINDER #define USE_RANGEFINDER_HCSR04_I2C diff --git a/src/main/target/JHEMCUF722/target.h b/src/main/target/JHEMCUF722/target.h index 9d34e5c8201..2777df365e3 100644 --- a/src/main/target/JHEMCUF722/target.h +++ b/src/main/target/JHEMCUF722/target.h @@ -107,12 +107,7 @@ // Mag #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_IST8308 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL +#define USE_MAG_ALL // Onboard Flash #define USE_SPI_DEVICE_3 diff --git a/src/main/target/SDMODELH7V1/target.h b/src/main/target/SDMODELH7V1/target.h index cc4d39cf6c8..1d3f90b8f9d 100644 --- a/src/main/target/SDMODELH7V1/target.h +++ b/src/main/target/SDMODELH7V1/target.h @@ -93,13 +93,7 @@ #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_IST8308 -#define USE_MAG_MAG3110 -#define USE_MAG_LIS3MDL -#define USE_MAG_VCM5883 +#define USE_MAG_ALL #define TEMPERATURE_I2C_BUS BUS_I2C1 #define PITOT_I2C_BUS BUS_I2C1 diff --git a/src/main/target/TAKERF722SE/target.h b/src/main/target/TAKERF722SE/target.h index 817dc535f03..599d5610ad4 100644 --- a/src/main/target/TAKERF722SE/target.h +++ b/src/main/target/TAKERF722SE/target.h @@ -121,11 +121,8 @@ #define USE_BARO_MS5611 #define USE_MAG +#define USE_MAG_ALL #define MAG_I2C_BUS BUS_I2C1 -#define USE_MAG_HMC5883 -#define USE_MAG_QMC5883 -#define USE_MAG_IST8310 -#define USE_MAG_IST8308 #define TEMPERATURE_I2C_BUS BUS_I2C1 diff --git a/src/main/target/ZEEZF7/target.h b/src/main/target/ZEEZF7/target.h index 28395b274fb..563a5814891 100755 --- a/src/main/target/ZEEZF7/target.h +++ b/src/main/target/ZEEZF7/target.h @@ -107,10 +107,6 @@ #define USE_BARO #define USE_BARO_DPS310 -#define USE_MAG -#define USE_MAG_QMC5883 -#endif - #if defined ZEEZF7V2 || defined ZEEZF7V3 #define USE_I2C #define USE_BARO From b07caf31906cb3cf6b8d9611d69ca5107c01cfac Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:57:44 +0200 Subject: [PATCH 282/429] fix typo --- src/main/target/ATOMRCF405V2/target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/ATOMRCF405V2/target.h b/src/main/target/ATOMRCF405V2/target.h index 232ac47d953..32c064f4f21 100644 --- a/src/main/target/ATOMRCF405V2/target.h +++ b/src/main/target/ATOMRCF405V2/target.h @@ -81,7 +81,7 @@ */ #define USE_MAG #define MAG_I2C_BUS DEFAULT_I2C_BUS -#defiine USE_MAG_ALL +#define USE_MAG_ALL /* * Barometer From ea658710f8b07956057d9a86474cb17e6afd8007 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:01:00 +0200 Subject: [PATCH 283/429] Another fix --- src/main/target/ZEEZF7/target.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/target/ZEEZF7/target.h b/src/main/target/ZEEZF7/target.h index 563a5814891..2ab83104d3a 100755 --- a/src/main/target/ZEEZF7/target.h +++ b/src/main/target/ZEEZF7/target.h @@ -107,6 +107,11 @@ #define USE_BARO #define USE_BARO_DPS310 +#define USE_MAG +#define USE_MAG_ALL + +#endif + #if defined ZEEZF7V2 || defined ZEEZF7V3 #define USE_I2C #define USE_BARO From b1b787d40a133659e261fae2218b5c6928dba7e9 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 24 Jun 2024 17:33:25 +0200 Subject: [PATCH 284/429] docs update --- docs/Settings.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index 5b762084ab8..4cdf101c587 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -808,7 +808,7 @@ Enable/disable dynamic gyro notch also known as Matrix Filter | Default | Min | Max | | --- | --- | --- | -| OFF | OFF | ON | +| ON | OFF | ON | --- @@ -1778,7 +1778,7 @@ Specifies the type of the software LPF of the gyro signals. | Default | Min | Max | | --- | --- | --- | -| LULU | | | +| STATIC | | | --- @@ -5868,7 +5868,7 @@ Enable Kalman filter on the gyro data | Default | Min | Max | | --- | --- | --- | -| OFF | OFF | ON | +| ON | OFF | ON | --- From bd7f488e952129c4079b3a421c1e350ddf5970f4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:18:20 +0200 Subject: [PATCH 285/429] More plumbing. Add SBUS2 option to rx type. Add method to query active telemetry frame --- src/main/fc/settings.yaml | 2 +- src/main/rx/rx.c | 1 + src/main/rx/rx.h | 1 + src/main/rx/sbus.h | 4 ++++ src/main/target/common.h | 5 +++++ src/main/telemetry/sbus2.c | 13 +++++++++++++ src/main/telemetry/sbus2.h | 39 ++++++++++++++++++++++---------------- 7 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index a27e9599db7..865d7fc90a1 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -23,7 +23,7 @@ tables: values: ["NONE", "SERIAL", "MSP", "SIM (SITL)"] enum: rxReceiverType_e - name: serial_rx - values: ["SPEK1024", "SPEK2048", "SBUS", "SUMD", "IBUS", "JETIEXBUS", "CRSF", "FPORT", "SBUS_FAST", "FPORT2", "SRXL2", "GHST", "MAVLINK", "FBUS"] + values: ["SPEK1024", "SPEK2048", "SBUS", "SUMD", "IBUS", "JETIEXBUS", "CRSF", "FPORT", "SBUS_FAST", "FPORT2", "SRXL2", "GHST", "MAVLINK", "FBUS", "SBUS2"] - name: blackbox_device values: ["SERIAL", "SPIFLASH", "SDCARD"] - name: motor_pwm_protocol diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index 881b1128c47..f941eaebe20 100755 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -196,6 +196,7 @@ bool serialRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig break; #endif #ifdef USE_SERIALRX_SBUS + case SERIALRX_SBUS2: case SERIALRX_SBUS: enabled = sbusInit(rxConfig, rxRuntimeConfig); break; diff --git a/src/main/rx/rx.h b/src/main/rx/rx.h index 1aee04ec083..9e4816ec64c 100644 --- a/src/main/rx/rx.h +++ b/src/main/rx/rx.h @@ -81,6 +81,7 @@ typedef enum { SERIALRX_GHST, SERIALRX_MAVLINK, SERIALRX_FBUS, + SERIALRX_SBUS2, } rxSerialReceiverType_e; #ifdef USE_24CHANNELS diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index 1fcd3680d0e..07f4b900e1d 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -21,3 +21,7 @@ bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); + +#ifdef USE_SBUS2_TELEMETRY +uint8_t sbusGetCurrentTelemetryFrame(); +#endif diff --git a/src/main/target/common.h b/src/main/target/common.h index 8bb735fc437..3238abea018 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -195,6 +195,11 @@ #define USE_HEADTRACKER_SERIAL #define USE_HEADTRACKER_MSP +#ifndef STM32F4 +// needs bi-direction inverter, no available on F4 hardware. +#define USE_SBUS2_TELEMETRY +#endif + //Designed to free space of F722 and F411 MCUs #if (MCU_FLASH_SIZE > 512) #define USE_VTX_FFPV diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index f192160f8a2..206d7fdd732 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -15,8 +15,16 @@ * along with INAV. If not, see . */ +#include + +#include "platform.h" + +#include "build/debug.h" + #include "sbus2.h" +#ifdef USE_SBUS2_TELEMETRY + const uint8_t Slot_ID[SBUS2_SLOT_COUNT] = { 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, @@ -25,3 +33,8 @@ const uint8_t Slot_ID[SBUS2_SLOT_COUNT] = { }; +sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; +uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; + + +#endif \ No newline at end of file diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index c5b13e12fc7..8fad140c895 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -20,23 +20,25 @@ #include -#define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 - -#define SBUS2_SLOT_COUNT 32 +#include "platform.h" -// Information on SBUS2 sensors from: https://github.com/BrushlessPower/SBUS2-Telemetry/tree/master +#define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 -extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; +#define SBUS2_SLOT_COUNT 32 +#define SBUS2_TELEMETRY_ITEM_SIZE 3 +#define SBUS2_TELEMETRY_SLOTS 8 +#define SBUS2_TELEMETRY_PAGES 4 +#ifdef USE_SBUS2_TELEMETRY +// Information on SBUS2 sensors from: https://github.com/BrushlessPower/SBUS2-Telemetry/tree/master // Temperature: // Max 125C // value | 0x4000 typedef struct sbus2_telemetry_temp_payload_s { uint8_t tempHigh; // temp | 0x4000; // 125c uint8_t tempLow; -} sbsu2_telemetry_temp_payload_t; - +} __attribute__((packed)) sbsu2_telemetry_temp_payload_t; // Temperature: // Max 200C @@ -44,14 +46,14 @@ typedef struct sbus2_telemetry_temp_payload_s { typedef struct sbus2_telemetry_temp200_payload_s { uint8_t tempLow; // temp | 0x8000; // 200c uint8_t tempHigh; -} sbsu2_telemetry_temp200_payload_t; +} __attribute__((packed)) sbsu2_telemetry_temp200_payload_t; // RPM: // (RPM / 6) max: 0xFFFF typedef struct sbus2_telemetry_rpm_payload_s { uint8_t rpmHigh; // RPM / 6, capped at 0xFFFF uint8_t rpmLow; -} sbsu2_telemetry_rpm_payload_t; +} __attribute__((packed)) sbsu2_telemetry_rpm_payload_t; // Voltage: 1 or 2 slots // 0x8000 = rx voltage? @@ -59,7 +61,7 @@ typedef struct sbus2_telemetry_rpm_payload_s { typedef struct sbus2_telemetry_voltage_payload_s { uint8_t voltageHigh; // 2 slots // Voltage 1: value | 0x8000 uint8_t voltageLow; // max input value: 0x1FFF -} sbsu2_telemetry_voltage_payload_t; +} __attribute__((packed)) sbsu2_telemetry_voltage_payload_t; // Current // 3 frames @@ -73,13 +75,12 @@ typedef struct sbus2_telemetry_voltage_payload_s { typedef struct sbus2_telemetry_current_payload_s { uint8_t currentHigh; uint8_t currentLow; -} sbsu2_telemetry_current_payload_t; +} __attribute__((packed)) sbsu2_telemetry_current_payload_t; typedef struct sbus2_telemetry_capacity_payload_s { uint8_t capacityHigh; uint8_t capacityLow; -} sbsu2_telemetry_capacity_payload_t; - +} __attribute__((packed)) sbsu2_telemetry_capacity_payload_t; // GPS // frames: @@ -89,10 +90,10 @@ typedef struct sbus2_telemetry_capacity_payload_s { // 4,5: LAT // 5,6: LON - typedef struct sbus2_telemetry_frame_s { uint8_t slotId; - union { + union + { uint8_t data[2]; sbsu2_telemetry_temp_payload_t temp125; sbsu2_telemetry_temp200_payload_t temp200; @@ -101,4 +102,10 @@ typedef struct sbus2_telemetry_frame_s { sbsu2_telemetry_current_payload_t current; sbsu2_telemetry_capacity_payload_t capacity; } payload; -} sbus2_telemetry_frame_t; +} __attribute__((packed)) sbus2_telemetry_frame_t; + +extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; +extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; +extern uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; + +#endif \ No newline at end of file From 4c56952e15848d3c6811e0751d69d9934967d91d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:46:16 +0200 Subject: [PATCH 286/429] Setup serial port for bi direction, half duplex operation --- src/main/rx/sbus.c | 29 +++++++++++++++++++++++++++-- src/main/rx/sbus.h | 3 ++- src/main/telemetry/sbus2.h | 4 ++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 98570387654..8984be2abbe 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -66,6 +66,9 @@ typedef struct sbusFrameData_s { timeUs_t lastActivityTimeUs; } sbusFrameData_t; +static uint8_t sbus2ActiveTelemetryFrame = 0; +timeUs_t frameTime = 0; + // Receive ISR callback static void sbusDataReceive(uint16_t c, void *data) { @@ -99,9 +102,19 @@ static void sbusDataReceive(uint16_t c, void *data) switch (frame->endByte) { case 0x00: // This is S.BUS 1 case 0x04: // S.BUS 2 receiver voltage + sbus2ActiveTelemetryFrame = 0; + goto process_end_frame; case 0x14: // S.BUS 2 GPS/baro + sbus2ActiveTelemetryFrame = 1; + goto process_end_frame; case 0x24: // Unknown SBUS2 data + sbus2ActiveTelemetryFrame = 2; + goto process_end_frame; case 0x34: // Unknown SBUS2 data + sbus2ActiveTelemetryFrame = 3; + process_end_frame: + frameTime = currentTimeUs; + frameValid = true; sbusFrameData->state = STATE_SBUS_WAIT_SYNC; break; @@ -179,9 +192,10 @@ static bool sbusInitEx(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeC sbusDataReceive, &sbusFrameData, sbusBaudRate, - portShared ? MODE_RXTX : MODE_RX, + (portShared || rxConfig->serialrx_provider == SERIALRX_SBUS2) ? MODE_RXTX : MODE_RX, SBUS_PORT_OPTIONS | (rxConfig->serialrx_inverted ? 0 : SERIAL_INVERTED) | + ((rxConfig->serialrx_provider == SERIALRX_SBUS2) ? SERIAL_BIDIR : 0) | (tristateWithDefaultOffIsActive(rxConfig->halfDuplex) ? SERIAL_BIDIR : 0) ); @@ -203,4 +217,15 @@ bool sbusInitFast(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig { return sbusInitEx(rxConfig, rxRuntimeConfig, SBUS_BAUDRATE_FAST); } -#endif + +#if defined(USE_TELEMETRY) && defined(USE_SBUS2_TELEMETRY) +uint8_t sbusGetLastFrameTime(void) { + return frameTime; +} + +uint8_t sbusGetCurrentTelemetryFrame(void) { + return sbus2ActiveTelemetryFrame; +} +#endif // USE_TELEMETRY && USE_SBUS2_TELEMETRY + +#endif // USE_SERIAL_RX diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index 07f4b900e1d..f698eecb8eb 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -23,5 +23,6 @@ bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeCon bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); #ifdef USE_SBUS2_TELEMETRY -uint8_t sbusGetCurrentTelemetryFrame(); +uint8_t sbusGetCurrentTelemetryFrame(void); +uint8_t sbusGetLastFrameTime(void); #endif diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 8fad140c895..a40bc1f3983 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -24,12 +24,12 @@ #define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 -#define SBUS2_SLOT_COUNT 32 #define SBUS2_TELEMETRY_ITEM_SIZE 3 #define SBUS2_TELEMETRY_SLOTS 8 #define SBUS2_TELEMETRY_PAGES 4 +#define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) -#ifdef USE_SBUS2_TELEMETRY +#if defined(USE_TELEMETRY) && defined(USE_SBUS2_TELEMETRY) // Information on SBUS2 sensors from: https://github.com/BrushlessPower/SBUS2-Telemetry/tree/master // Temperature: From 459fec940f520d71edfb62436b138e3500cbc0a5 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:58:13 +0200 Subject: [PATCH 287/429] Update frame check --- src/main/rx/sbus.c | 31 +++++++++++++++---------------- src/main/rx/sbus.h | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 8984be2abbe..8a5c3f926a1 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -66,7 +66,7 @@ typedef struct sbusFrameData_s { timeUs_t lastActivityTimeUs; } sbusFrameData_t; -static uint8_t sbus2ActiveTelemetryFrame = 0; +static uint8_t sbus2ActiveTelemetryPage = 0; timeUs_t frameTime = 0; // Receive ISR callback @@ -101,19 +101,18 @@ static void sbusDataReceive(uint16_t c, void *data) // Do some sanity check switch (frame->endByte) { case 0x00: // This is S.BUS 1 - case 0x04: // S.BUS 2 receiver voltage - sbus2ActiveTelemetryFrame = 0; - goto process_end_frame; - case 0x14: // S.BUS 2 GPS/baro - sbus2ActiveTelemetryFrame = 1; - goto process_end_frame; - case 0x24: // Unknown SBUS2 data - sbus2ActiveTelemetryFrame = 2; - goto process_end_frame; - case 0x34: // Unknown SBUS2 data - sbus2ActiveTelemetryFrame = 3; - process_end_frame: - frameTime = currentTimeUs; + case 0x04: // S.BUS 2 telemetry page 1 + case 0x14: // S.BUS 2 telemetry page 2 + case 0x24: // S.BUS 2 telemetry page 3 + case 0x34: // S.BUS 2 telemetry page 4 + if(frame->endByte & 0x4) { + sbus2ActiveTelemetryPage = (frame->endByte >> 4) & 0xF; + frameTime = currentTimeUs; + } else { + sbus2ActiveTelemetryPage = 0; + frameTime = -1; + } + frameValid = true; sbusFrameData->state = STATE_SBUS_WAIT_SYNC; @@ -223,8 +222,8 @@ uint8_t sbusGetLastFrameTime(void) { return frameTime; } -uint8_t sbusGetCurrentTelemetryFrame(void) { - return sbus2ActiveTelemetryFrame; +uint8_t sbusGetCurrentTelemetryPage(void) { + return sbus2ActiveTelemetryPage; } #endif // USE_TELEMETRY && USE_SBUS2_TELEMETRY diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index f698eecb8eb..94af636a43f 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -23,6 +23,6 @@ bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeCon bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); #ifdef USE_SBUS2_TELEMETRY -uint8_t sbusGetCurrentTelemetryFrame(void); +uint8_t sbusGetCurrentTelemetryPage(void); uint8_t sbusGetLastFrameTime(void); #endif From a3a129e6ee1c34b022cc7f70366a85b7306a9821 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 00:52:55 +0200 Subject: [PATCH 288/429] Plugin some of the telemetry functions. Basic squeleton in place. Need to update telemetry data and avoid sending telemetry slot twice. --- src/main/rx/sbus.h | 2 ++ src/main/telemetry/sbus2.c | 36 ++++++++++++++++++++++++++++------ src/main/telemetry/sbus2.h | 1 + src/main/telemetry/telemetry.c | 4 ++++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index 94af636a43f..b3356ace83e 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -19,6 +19,8 @@ #define SBUS_DEFAULT_INTERFRAME_DELAY_US 3000 // According to FrSky interframe is 6.67ms, we go smaller just in case +#include "rx/rx.h" + bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 206d7fdd732..309ca045016 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -21,20 +21,44 @@ #include "build/debug.h" -#include "sbus2.h" +#include "common/time.h" + +#include "telemetry/sbus2.h" + +#include "rx/sbus.h" #ifdef USE_SBUS2_TELEMETRY -const uint8_t Slot_ID[SBUS2_SLOT_COUNT] = { - 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, - 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, - 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, - 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB +const uint8_t sbus2SlotIds[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = { + {0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3}, + {0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3}, + {0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB}, + {0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB} }; sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; +void handleSbus2Telemetry(timeUs_t currentTimeUs) +{ + uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); + uint8_t lastFrame = sbusGetLastFrameTime(); + + timeUs_t elapsedTime = currentTimeUs - lastFrame - MS2US(2); + + // 2ms after sbus2 frame = slot 0 + // +660us for next slot + if(elapsedTime > 0) { + uint8_t slot = elapsedTime % 660; + if(slot < SBUS2_TELEMETRY_SLOTS) { + if(sbusTelemetryDataStatus[telemetryPage][slot] != 0) { + sbusTelemetryData[telemetryPage][slot].slotId = sbus2SlotIds[telemetryPage][slot]; + // send + sbusTelemetryDataStatus[telemetryPage][slot] = 0; + } + } + } +} #endif \ No newline at end of file diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index a40bc1f3983..dce16c48441 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -108,4 +108,5 @@ extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; extern uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; +void handleSbus2Telemetry(timeUs_t currentTimeUs); #endif \ No newline at end of file diff --git a/src/main/telemetry/telemetry.c b/src/main/telemetry/telemetry.c index d6c8e355d86..dd6e08961e0 100644 --- a/src/main/telemetry/telemetry.c +++ b/src/main/telemetry/telemetry.c @@ -245,6 +245,10 @@ void telemetryProcess(timeUs_t currentTimeUs) #ifdef USE_TELEMETRY_GHST handleGhstTelemetry(currentTimeUs); #endif + +#ifdef USE_TELMETRY_SBUS2 + handleSbus2Telemetry(currentTimeUs); +#endif } #endif From 596c025ef1a629aa8738ae2faaa55b9b5362062b Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 25 Jun 2024 14:36:59 +0200 Subject: [PATCH 289/429] Remove of register optimization in favor or relying on GCC optimization. --- src/main/common/lulu.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/main/common/lulu.c b/src/main/common/lulu.c index c44d6724ec1..8ab7803ed1b 100644 --- a/src/main/common/lulu.c +++ b/src/main/common/lulu.c @@ -28,16 +28,17 @@ void luluFilterInit(luluFilter_t *filter, int N) FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, int windowSize) { - register float curVal = 0; - register float curValB = 0; + float curVal = 0; + float curValB = 0; for (int N = 1; N <= filterN; N++) { int indexNeg = (index + windowSize - 2 * N) % windowSize; - register int curIndex = (indexNeg + 1) % windowSize; - register float prevVal = series[indexNeg]; - register float prevValB = seriesB[indexNeg]; - register int indexPos = (curIndex + N) % windowSize; - for (int i = windowSize - 2 * N; i < windowSize - N; i++) + int curIndex = (indexNeg + 1) % windowSize; + float prevVal = series[indexNeg]; + float prevValB = seriesB[indexNeg]; + int indexPos = (curIndex + N) % windowSize; + + for (int i = windowSize - 2 * N; i < windowSize - N; i++) { if (indexPos >= windowSize) { @@ -50,8 +51,8 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i // curIndex = (2 - 1) % 3 = 1 curVal = series[curIndex]; curValB = seriesB[curIndex]; - register float nextVal = series[indexPos]; - register float nextValB = seriesB[indexPos]; + float nextVal = series[indexPos]; + float nextValB = seriesB[indexPos]; // onbump (s, 1, 1, 3) // if(onBump(series, curIndex, N, windowSize)) if (prevVal < curVal && curVal > nextVal) @@ -59,7 +60,7 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i float maxValue = MAX(prevVal, nextVal); series[curIndex] = maxValue; - register int k = curIndex; + int k = curIndex; for (int j = 1; j < N; j++) { if (++k >= windowSize) @@ -76,7 +77,7 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i curVal = maxValue; seriesB[curIndex] = maxValue; - register int k = curIndex; + int k = curIndex; for (int j = 1; j < N; j++) { if (++k >= windowSize) @@ -109,8 +110,8 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i // curIndex = (2 - 1) % 3 = 1 curVal = series[curIndex]; curValB = seriesB[curIndex]; - register float nextVal = series[indexPos]; - register float nextValB = seriesB[indexPos]; + float nextVal = series[indexPos]; + float nextValB = seriesB[indexPos]; if (prevVal > curVal && curVal < nextVal) { @@ -118,7 +119,7 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i curVal = minValue; series[curIndex] = minValue; - register int k = curIndex; + int k = curIndex; for (int j = 1; j < N; j++) { if (++k >= windowSize) @@ -134,7 +135,7 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i float minValue = MIN(prevValB, nextValB); curValB = minValue; seriesB[curIndex] = minValue; - register int k = curIndex; + int k = curIndex; for (int j = 1; j < N; j++) { if (++k >= windowSize) @@ -156,13 +157,13 @@ FAST_CODE float fixRoad(float *series, float *seriesB, int index, int filterN, i FAST_CODE float luluFilterPartialApply(luluFilter_t *filter, float input) { // This is the value N of the LULU filter. - register int filterN = filter->N; + int filterN = filter->N; // This is the total window size for the rolling buffer - register int filterWindow = filter->windowSize; + int filterWindow = filter->windowSize; - register int windowIndex = filter->windowBufIndex; - register float inputVal = input; - register int newIndex = (windowIndex + 1) % filterWindow; + int windowIndex = filter->windowBufIndex; + float inputVal = input; + int newIndex = (windowIndex + 1) % filterWindow; filter->windowBufIndex = newIndex; filter->luluInterim[windowIndex] = inputVal; filter->luluInterimB[windowIndex] = -inputVal; From 1a274336a6e29d7b840a9cea9897aeaa530f546e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:43:53 +0200 Subject: [PATCH 290/429] Add task to send telemtery info --- src/main/fc/fc_tasks.c | 13 +++++++++++++ src/main/scheduler/scheduler.h | 4 ++++ src/main/telemetry/sbus2.c | 10 ++++++++-- src/main/telemetry/sbus2.h | 6 +++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 6918b9a6dab..5728b9752cd 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -437,6 +437,10 @@ void fcTasksInit(void) setTaskEnabled(TASK_HEADTRACKER, true); #endif +#if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) + setTaskEnabled(TASK_TELEMETRY_SBUS2, rxConfig->serialrx_provider == SERIALRX_SBUS2); +#endif + #ifdef USE_ADAPTIVE_FILTER setTaskEnabled(TASK_ADAPTIVE_FILTER, ( gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_ADAPTIVE && @@ -726,4 +730,13 @@ cfTask_t cfTasks[TASK_COUNT] = { }, #endif +#if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) + [TASK_TELEMETRY_SBUS2] = { + .taskName = "SBUS2_TELEMETRY", + .taskFunc = taskSendSbus2Telemetry, + .desiredPeriod = TASK_PERIOD_US(300), + .staticPriority = TASK_PRIORITY_IDLE, + }, +#endif + }; diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index a43206840fe..176812d8f3f 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -133,6 +133,10 @@ typedef enum { TASK_HEADTRACKER, #endif +#if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) + TASK_TELEMETRY_SBUS2, +#endif + /* Count of real tasks */ TASK_COUNT, diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 309ca045016..fdd6295718e 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -41,10 +41,16 @@ sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; void handleSbus2Telemetry(timeUs_t currentTimeUs) +{ + UNUSED(currentTimeUs); + + // update telemetry info +} + +void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); uint8_t lastFrame = sbusGetLastFrameTime(); - timeUs_t elapsedTime = currentTimeUs - lastFrame - MS2US(2); // 2ms after sbus2 frame = slot 0 @@ -61,4 +67,4 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) } } -#endif \ No newline at end of file +#endif diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index dce16c48441..7e59782a1d1 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -108,5 +108,9 @@ extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; extern uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; +// refresh telemetry buffers void handleSbus2Telemetry(timeUs_t currentTimeUs); -#endif \ No newline at end of file + +// time critical, send sbus2 data +void taskSendSbus2Telemetry(timeUs_t currentTimeUs); +#endif From 6da4f35a354e4034584914f50080acb917157668 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:00:05 +0200 Subject: [PATCH 291/429] fix sitl --- src/main/telemetry/sbus2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index fdd6295718e..ed258ee15f4 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -21,6 +21,7 @@ #include "build/debug.h" +#include "common/utils.h" #include "common/time.h" #include "telemetry/sbus2.h" From ce5156ba18cc1a12f1830a91cf0d8073be3929af Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:08:05 +0200 Subject: [PATCH 292/429] Use correct method to set message rate for newer ublox devices. As a bonus: Add gpssats and showdebug cli commmands. --- src/main/build/debug.h | 3 +- src/main/common/printf.c | 1 + src/main/fc/cli.c | 161 +++++++++++++++++++++++++++++++++++++- src/main/fc/settings.yaml | 3 +- src/main/io/gps_ublox.c | 77 +++++++++++++----- src/main/io/gps_ublox.h | 44 ++++++++++- 6 files changed, 263 insertions(+), 26 deletions(-) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index fea424b9005..7ee74471544 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -76,7 +76,8 @@ typedef enum { DEBUG_POS_EST, DEBUG_ADAPTIVE_FILTER, DEBUG_HEADTRACKING, - DEBUG_COUNT + DEBUG_GPS, + DEBUG_COUNT // also update debugModeNames in cli.c } debugType_e; #ifdef SITL_BUILD diff --git a/src/main/common/printf.c b/src/main/common/printf.c index 5e72f726b04..39dc01ed4b5 100644 --- a/src/main/common/printf.c +++ b/src/main/common/printf.c @@ -162,6 +162,7 @@ int tfp_nformat(void *putp, int size, void (*putf) (void *, char), const char *f written += putchw(putp, end, putf, w, lz, bf); break; } + case 'i': case 'd':{ #ifdef REQUIRE_PRINTF_LONG_SUPPORT if (lng) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 0d54cab4398..83d3ac51e64 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -187,9 +187,39 @@ static const char * const blackboxIncludeFlagNames[] = { }; #endif -/* Sensor names (used in lookup tables for *_hardware settings and in status command output) */ +static const char *debugModeNames[DEBUG_COUNT] = { + "NONE", + "AGL", + "FLOW_RAW", + "FLOW", + "ALWAYS", + "SAG_COMP_VOLTAGE", + "VIBE", + "CRUISE", + "REM_FLIGHT_TIME", + "SMARTAUDIO", + "ACC", + "NAV_YAW", + "PCF8574", + "DYN_GYRO_LPF", + "AUTOLEVEL", + "ALTITUDE", + "AUTOTRIM", + "AUTOTUNE", + "RATE_DYNAMICS", + "LANDING", + "POS_EST", + "ADAPTIVE_FILTER", + "HEADTRACKER", + "GPS" +}; + +/* Sensor names (used in lookup tables for *_hardware settings and in status + command output) */ // sync with gyroSensor_e -static const char * const gyroNames[] = { "NONE", "AUTO", "MPU6000", "MPU6500", "MPU9250", "BMI160", "ICM20689", "BMI088", "ICM42605", "BMI270","LSM6DXX", "FAKE"}; +static const char *const gyroNames[] = { + "NONE", "AUTO", "MPU6000", "MPU6500", "MPU9250", "BMI160", + "ICM20689", "BMI088", "ICM42605", "BMI270", "LSM6DXX", "FAKE"}; // sync this with sensors_e static const char * const sensorTypeNames[] = { @@ -253,6 +283,7 @@ static void cliPrintLine(const char *str) cliPrintLinefeed(); } + static void cliPrintError(const char *str) { cliPrint("### ERROR: "); @@ -4259,6 +4290,130 @@ typedef struct { } #endif +static void cliCmdDebug(char *arg) +{ + UNUSED(arg); + if (debugMode != DEBUG_NONE) { + cliPrintLinef("Debug fields: [%s (%i)]", debugMode < DEBUG_COUNT ? debugModeNames[debugMode] : "unknown", debugMode); + for (int i = 0; i < DEBUG32_VALUE_COUNT; i++) { + cliPrintLinef("debug[%d] = %d", i, debug[i]); + } + } else { + cliPrintLine("Debug mode is disabled"); + } +} + + +#if defined(USE_GPS) && defined(USE_GPS_PROTO_UBLOX) + +static const char* _ubloxGetSigId(uint8_t gnssId, uint8_t sigId) +{ + if(gnssId == 0) { + switch(sigId) { + case 0: return "GPS L1C/A"; + case 3: return "GPS L2 CL"; + case 4: return "GPS L2 CM"; + case 6: return "GPS L5 I"; + case 7: return "GPS L5 Q"; + default: return "GPS Unknown"; + } + } else if(gnssId == 1) { + switch(sigId) { + case 0: return "SBAS L1C/A"; + default: return "SBAS Unknown"; + } + } else if(gnssId == 2) { + switch(sigId) { + case 0: return "Galileo E1 C"; + case 1: return "Galileo E1 B"; + case 3: return "Galileo E5 al"; + case 4: return "Galileo E5 aQ"; + case 5: return "Galileo E5 bl"; + case 6: return "Galileo E5 bQ"; + default: return "Galileo Unknown"; + } + } else if(gnssId == 3) { + switch(sigId) { + case 0: return "BeiDou B1I D1"; + case 1: return "BeiDou B1I D2"; + case 2: return "BeiDou B2I D1"; + case 3: return "BeiDou B2I D2"; + case 5: return "BeiDou B1C"; + case 7: return "BeiDou B2a"; + default: return "BeiDou Unknown"; + } + } else if(gnssId == 5) { + switch(sigId) { + case 0: return "QZSS L1C/A"; + case 1: return "QZSS L1S"; + case 4: return "QZSS L2 CM"; + case 5: return "QZSS L2 CL"; + case 8: return "QZSS L5 I"; + case 9: return "QZSS L5 Q"; + default: return "QZSS Unknown"; + } + } else if(gnssId == 6) { + switch(sigId) { + case 0: return "GLONASS L1 OF"; + case 2: return "GLONASS L2 OF"; + default: return "GLONASS Unknown"; + } + } + + return "Unknown GNSS/SigId"; +} + +static const char *_ubloxGetQuality(uint8_t quality) +{ + switch(quality) { + case 0: return "No signal"; + case 1: return "Searching signal..."; + case 2: return "Signal acquired"; + case 3: return "Signal detected but unusable"; + case 4: return "Code locked and time synch"; + case 5: + case 6: + case 7: + return "Code and carrier locked and time synch"; + default: return "Unknown"; + } +} + +static void cliUbloxPrintSatelites(char *arg) +{ + UNUSED(arg); + if(!isGpsUblox()) { + cliPrint("GPS is not UBLOX"); + return; + } + + cliPrintLine("UBLOX Satelites"); + + for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) + { + const ubx_nav_sig_info *sat = gpsGetUbloxSatelite(i); + if(sat == NULL || sat->svId == 0) { + continue; + } + + cliPrintLinef("satelite: %d:%d", sat->gnssId, sat->svId); + cliPrintLinef("sigId: %d (%s)", sat->sigId, _ubloxGetSigId(sat->gnssId, sat->sigId)); + cliPrintLinef("signal strength: %i dbHz", sat->cno); + cliPrintLinef("quality: %i (%s)", sat->quality, _ubloxGetQuality(sat->quality)); + //cliPrintLinef("Correlation: %i", sat->corrSource); + //cliPrintLinef("Iono model: %i", sat->ionoModel); + cliPrintLinef("signal flags: 0x%02X", sat->sigFlags); + if(sat->sigFlags & 0x01) { + cliPrintLine("signal: Healthy"); + } else if (sat->sigFlags & 0x02) { + cliPrintLine("signal: Unhealthy"); + } else { + cliPrintLine("signal: Unknown"); + } + } +} +#endif + static void cliHelp(char *cmdline); // should be sorted a..z for bsearch() @@ -4318,6 +4473,7 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("get", "get variable value", "[name]", cliGet), #ifdef USE_GPS CLI_COMMAND_DEF("gpspassthrough", "passthrough gps to serial", NULL, cliGpsPassthrough), + CLI_COMMAND_DEF("gpssats", "show GPS satellites", NULL, cliUbloxPrintSatelites), #endif CLI_COMMAND_DEF("help", NULL, NULL, cliHelp), #ifdef USE_LED_STRIP @@ -4370,6 +4526,7 @@ const clicmd_t cmdTable[] = { #ifdef USE_SDCARD CLI_COMMAND_DEF("sd_info", "sdcard info", NULL, cliSdInfo), #endif + CLI_COMMAND_DEF("showdebug", "Show debug fields.", NULL, cliCmdDebug), CLI_COMMAND_DEF("status", "show status", NULL, cliStatus), CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks), #ifdef USE_TEMPERATURE_SENSOR diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index a27e9599db7..d8dd7d6fbee 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -83,7 +83,8 @@ tables: values: ["NONE", "AGL", "FLOW_RAW", "FLOW", "ALWAYS", "SAG_COMP_VOLTAGE", "VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC", "NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE", - "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER", "HEADTRACKER" ] + "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", + "ADAPTIVE_FILTER", "HEADTRACKER", "GPS" ] - name: aux_operator values: ["OR", "AND"] enum: modeActivationOperator_e diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 52b6329d9f2..b6ea20e854f 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -43,6 +43,7 @@ #include "fc/config.h" #include "fc/runtime_config.h" #include "fc/settings.h" +#include "fc/cli.h" #include "io/serial.h" #include "io/gps.h" @@ -84,6 +85,8 @@ static const char * baudInitDataNMEA[GPS_BAUDRATE_COUNT] = { "$PUBX,41,1,0003,0001,921600,0*15\r\n" // GPS_BAUDRATE_921600 }; +static ubx_nav_sig_info satelites[UBLOX_MAX_SIGNALS] = {}; + // Packet checksum accumulators static uint8_t _ck_a; static uint8_t _ck_b; @@ -145,6 +148,7 @@ static union { ubx_nav_timeutc timeutc; ubx_ack_ack ack; ubx_mon_gnss gnss; + ubx_nav_sig navsig; uint8_t bytes[UBLOX_BUFFER_SIZE]; } _buffer; @@ -551,6 +555,7 @@ static uint32_t gpsDecodeHardwareVersion(const char * szBuf, unsigned nBufSize) static bool gpsParseFrameUBLOX(void) { + DEBUG_SET(DEBUG_GPS, 7, 42); switch (_msg_id) { case MSG_POSLLH: gpsSolDRV.llh.lon = _buffer.posllh.longitude; @@ -601,6 +606,10 @@ static bool gpsParseFrameUBLOX(void) } break; case MSG_PVT: + { + static int pvtCount = 0; + DEBUG_SET(DEBUG_GPS, 1, pvtCount++); + } next_fix_type = gpsMapFixType(_buffer.pvt.fix_status & NAV_STATUS_FIX_VALID, _buffer.pvt.fix_type); gpsSolDRV.fixType = next_fix_type; gpsSolDRV.llh.lon = _buffer.pvt.longitude; @@ -684,6 +693,30 @@ static bool gpsParseFrameUBLOX(void) } } break; + case MSG_NAV_SAT: + if (_class == CLASS_NAV) { + static int satInfoCount = 0; + DEBUG_SET(DEBUG_GPS, 2, satInfoCount++); + gpsSolDRV.numSat = _buffer.svinfo.numCh; + } + break; + case MSG_SIG_INFO: + if (_class == CLASS_NAV && _buffer.navsig.version == 0) { + if(_buffer.navsig.numSigs < UBLOX_MAX_SIGNALS) + { + for(int i=0; i < UBLOX_MAX_SIGNALS && i < _buffer.navsig.numSigs; ++i) + { + memcpy(&satelites[i], &_buffer.navsig.sig[i], sizeof(ubx_nav_sig_info)); + } + for(int i = _buffer.navsig.numSigs; i < UBLOX_MAX_SIGNALS; ++i) + { + satelites[i].svId = 0; // no used + } + } + static int sigInfoCount = 0; + DEBUG_SET(DEBUG_GPS, 0, sigInfoCount++); + } + break; case MSG_ACK_ACK: if ((_ack_state == UBX_ACK_WAITING) && (_buffer.ack.msg == _ack_waiting_msg)) { _ack_state = UBX_ACK_GOT_ACK; @@ -856,27 +889,20 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence - if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9) { - configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9 || gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >=1)) { // > 23.01, don't use configureMSG + ubx_config_data8_payload_t rateValues[] = { + {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, + {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, + }; - configureMSG(MSG_CLASS_UBX, MSG_NAV_SIG, 0); + ubloxSendSetCfgBytes(rateValues, 7); ptWait(_ack_state == UBX_ACK_GOT_ACK); + //ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz @@ -1134,11 +1160,22 @@ void gpsHandleUBLOX(void) bool isGpsUblox(void) { - if(gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) { + if(gpsState.gpsPort != NULL && (gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) { return true; } return false; } + +const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index) +{ + if(index < UBLOX_MAX_SIGNALS) { + return &satelites[index]; + } + + return NULL; +} + + #endif diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 87cffa9c50b..041f98653b5 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -28,7 +28,8 @@ extern "C" { #define GPS_CFG_CMD_TIMEOUT_MS 500 #define GPS_VERSION_RETRY_TIMES 3 -#define MAX_UBLOX_PAYLOAD_SIZE 256 +#define UBLOX_MAX_SIGNALS 32 +#define MAX_UBLOX_PAYLOAD_SIZE 640 // enough for anyone? // UBX-NAV-SIG info would be UBLOX_MAX_SIGNALS + 8 for (32 * 16) + 8 = 520 bytes #define UBLOX_BUFFER_SIZE MAX_UBLOX_PAYLOAD_SIZE #define UBLOX_SBAS_MESSAGE_LENGTH 16 #define GPS_CAPA_INTERVAL 5000 @@ -55,6 +56,13 @@ extern "C" { #define UBX_HW_VERSION_UBLOX9 900 #define UBX_HW_VERSION_UBLOX10 1000 +#define UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1 0x2091002a // U1 +#define UBLOX_CFG_MSGOUT_NAV_SAT_UART1 0x20910016 // U1 +#define UBLOX_CFG_MSGOUT_NAV_SIG_UART1 0x20910346 // U1 +#define UBLOX_CFG_MSGOUT_NAV_STATUS_UART1 0x2091001b // U1 +#define UBLOX_CFG_MSGOUT_NAV_VELNED_UART1 0x20910043 // U1 +#define UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1 0x2091005c // U1 +#define UBLOX_CFG_MSGOUT_NAV_PVT_UART1 0x20910007 // U1 #define UBLOX_CFG_SIGNAL_SBAS_ENA 0x10310020 // U1 #define UBLOX_CFG_SIGNAL_SBAS_L1CA_ENA 0x10310005 // U1 @@ -169,6 +177,34 @@ typedef struct { uint8_t reserved; } __attribute__((packed)) ubx_config_data_header_v1_t; +typedef struct { + uint8_t gnssId; // gnssid 0 = GPS, 1 = SBAS, 2 = GALILEO, 3 = BEIDOU, 4 = IMES, 5 = QZSS, 6 = GLONASS + uint8_t svId; // space vehicle ID + uint8_t sigId; // new style signal ID (gnssId:sigId) + uint8_t freqId; // 0-13 slot +, 0-13, glonass only + int16_t prRes; // pseudo range residual (0.1m) + uint8_t cno; // carrier to noise density ratio (dbHz) + uint8_t quality; // 0 = no signal, 1 = search, 2 = acq, 3 = detected, 4 = code lock + time, 5,6,7 = code/carrier lock + time + uint8_t corrSource; // Correction source: 0 = no correction, 1 = SBAS, 2 = BeiDou, 3 = RTCM2, 4 = RTCM3 OSR, 5 = RTCM3 SSR, 6 = QZSS SLAS, 7 = SPARTN + uint8_t ionoModel; // 0 = no mode, 1 = Klobuchar GPS, 2 = SBAS, 3 = Klobuchar BeiDou, 8 = Iono derived from dual frequency observations + uint16_t sigFlags; // bit:0-1, 0 = unknown, 1 = healthy, 2 = unhealthy + // bit2: pseudorange smoothed, + // bit3: pseudorange used, + // bit4: carrioer range used; + // bit5: doppler used + // bit6: pseudorange corrections used + // bit7: carrier correction used + // bit8: doper corrections used + uint8_t reserved; +} __attribute__((packed)) ubx_nav_sig_info; + +typedef struct { + uint32_t time; // GPS iToW + uint8_t version; // We support version 0 + uint8_t numSigs; // number of signals + uint16_t reserved; + ubx_nav_sig_info sig[UBLOX_MAX_SIGNALS]; // 32 signals +} __attribute__((packed)) ubx_nav_sig; #define MAX_GNSS 7 #define MAX_GNSS_SIZE_BYTES (sizeof(ubx_gnss_msg_t) + sizeof(ubx_gnss_element_t)*MAX_GNSS) @@ -350,6 +386,8 @@ typedef struct { uint8_t reserverd3; } ubx_mon_gnss; + + typedef struct { uint8_t msg_class; uint8_t msg; @@ -394,7 +432,8 @@ typedef enum { MSG_CFG_NAV_SETTINGS = 0x24, MSG_CFG_SBAS = 0x16, MSG_CFG_GNSS = 0x3e, - MSG_MON_GNSS = 0x28 + MSG_MON_GNSS = 0x28, + MSG_SIG_INFO = 0x43 } ubx_protocol_bytes_t; typedef enum { @@ -428,6 +467,7 @@ bool gpsUbloxSendCommand(uint8_t *rawCommand, uint16_t commandLen, uint16_t time bool isGpsUblox(void); +const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index); #ifdef __cplusplus } From eca4674af44edd2a2237d8d233d77973afde82c7 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:24:10 +0200 Subject: [PATCH 293/429] Add some extra gps status info to status command --- src/main/fc/cli.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 83d3ac51e64..be7858fadda 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3889,10 +3889,14 @@ static void cliStatus(char *cmdline) cliPrintLinefeed(); #endif - if (featureConfigured(FEATURE_GPS) && (gpsConfig()->provider == GPS_UBLOX || gpsConfig()->provider == GPS_UBLOX7PLUS)) { + if (featureConfigured(FEATURE_GPS) && isGpsUblox()) { cliPrint("GPS: "); cliPrintf("HW Version: %s Proto: %d.%02d Baud: %d", getGpsHwVersion(), getGpsProtoMajorVersion(), getGpsProtoMinorVersion(), getGpsBaudrate()); cliPrintLinefeed(); + cliPrintLinef("SATS: %i", gpsSol.numSat); + cliPrintLinef("HDOP: %f", (double)(gpsSol.hdop / (float)HDOP_SCALE)); + cliPrintLinef("EPH: %f m", (double)(gpsSol.eph / 100.0f)); + cliPrintLinef("EPV: %f m", (double)(gpsSol.epv / 100.0f)); //cliPrintLinef(" GNSS Capabilities: %d", gpsUbloxCapLastUpdate()); cliPrintLinef(" GNSS Capabilities:"); cliPrintLine(" GNSS Provider active/default"); From 5451413cc3d6671a1a87522af2dd40d8ecceff00 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:25:06 +0200 Subject: [PATCH 294/429] Status formatting --- src/main/fc/cli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index be7858fadda..8df40e20066 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3893,10 +3893,10 @@ static void cliStatus(char *cmdline) cliPrint("GPS: "); cliPrintf("HW Version: %s Proto: %d.%02d Baud: %d", getGpsHwVersion(), getGpsProtoMajorVersion(), getGpsProtoMinorVersion(), getGpsBaudrate()); cliPrintLinefeed(); - cliPrintLinef("SATS: %i", gpsSol.numSat); - cliPrintLinef("HDOP: %f", (double)(gpsSol.hdop / (float)HDOP_SCALE)); - cliPrintLinef("EPH: %f m", (double)(gpsSol.eph / 100.0f)); - cliPrintLinef("EPV: %f m", (double)(gpsSol.epv / 100.0f)); + cliPrintLinef(" SATS: %i", gpsSol.numSat); + cliPrintLinef(" HDOP: %f", (double)(gpsSol.hdop / (float)HDOP_SCALE)); + cliPrintLinef(" EPH : %f m", (double)(gpsSol.eph / 100.0f)); + cliPrintLinef(" EPV : %f m", (double)(gpsSol.epv / 100.0f)); //cliPrintLinef(" GNSS Capabilities: %d", gpsUbloxCapLastUpdate()); cliPrintLinef(" GNSS Capabilities:"); cliPrintLine(" GNSS Provider active/default"); From 615402a9f672831b32846d36759d69fba2992a25 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 00:45:12 +0200 Subject: [PATCH 295/429] Add line feed to sparete satelites --- src/main/fc/cli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 8df40e20066..872d9cbc933 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -4414,6 +4414,7 @@ static void cliUbloxPrintSatelites(char *arg) } else { cliPrintLine("signal: Unknown"); } + cliPrintLinefeed(); } } #endif From 19a4fc3cdc97f2d74b4e653b5d64c0fc3801674d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:08:31 +0200 Subject: [PATCH 296/429] Cleanup --- src/main/io/gps_ublox.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index b6ea20e854f..a22858ef8fc 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -555,7 +555,6 @@ static uint32_t gpsDecodeHardwareVersion(const char * szBuf, unsigned nBufSize) static bool gpsParseFrameUBLOX(void) { - DEBUG_SET(DEBUG_GPS, 7, 42); switch (_msg_id) { case MSG_POSLLH: gpsSolDRV.llh.lon = _buffer.posllh.longitude; @@ -702,6 +701,8 @@ static bool gpsParseFrameUBLOX(void) break; case MSG_SIG_INFO: if (_class == CLASS_NAV && _buffer.navsig.version == 0) { + static int sigInfoCount = 0; + DEBUG_SET(DEBUG_GPS, 0, sigInfoCount++); if(_buffer.navsig.numSigs < UBLOX_MAX_SIGNALS) { for(int i=0; i < UBLOX_MAX_SIGNALS && i < _buffer.navsig.numSigs; ++i) @@ -713,8 +714,6 @@ static bool gpsParseFrameUBLOX(void) satelites[i].svId = 0; // no used } } - static int sigInfoCount = 0; - DEBUG_SET(DEBUG_GPS, 0, sigInfoCount++); } break; case MSG_ACK_ACK: @@ -902,7 +901,6 @@ STATIC_PROTOTHREAD(gpsConfigure) ubloxSendSetCfgBytes(rateValues, 7); ptWait(_ack_state == UBX_ACK_GOT_ACK); - //ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz From bab841c83dcf9a6445ac385cfa14007d2e934f6f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:46:36 +0200 Subject: [PATCH 297/429] UBLOX8 did not support new message and used old configuratoin interface. Provide alternative way of setting message rates in case firmware is too old. Try to enable NAV_SIG but fallback to NAV_SAT. TODO: fill nav sat info into satelites Current status of GPS debug counters 0: NAV_SIG count 1: MSG_PVT count 2: MSG_SAT count 3: 4: 5: flags.pvt 6: flags.sat 7: flags.sig --- src/main/fc/cli.c | 4 +- src/main/io/gps_private.h | 6 +++ src/main/io/gps_ublox.c | 84 +++++++++++++++++++++++++++++++++------ 3 files changed, 79 insertions(+), 15 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 872d9cbc933..fa8ec75b615 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -4386,8 +4386,8 @@ static const char *_ubloxGetQuality(uint8_t quality) static void cliUbloxPrintSatelites(char *arg) { UNUSED(arg); - if(!isGpsUblox()) { - cliPrint("GPS is not UBLOX"); + if(!isGpsUblox() /*|| !(gpsState.flags.sig || gpsState.flags.sat)*/) { + cliPrint("GPS is not UBLOX or does not report satelites."); return; } diff --git a/src/main/io/gps_private.h b/src/main/io/gps_private.h index ee2a0b1e215..e5234e70248 100755 --- a/src/main/io/gps_private.h +++ b/src/main/io/gps_private.h @@ -50,6 +50,12 @@ typedef struct { gpsBaudRate_e baudrateIndex; gpsBaudRate_e autoBaudrateIndex; // Driver internal use (for autoBaud) uint8_t autoConfigStep; // Driver internal use (for autoConfig) + struct + { + uint8_t pvt : 1; + uint8_t sig : 1; + uint8_t sat : 1; + } flags; timeMs_t lastStateSwitchMs; timeMs_t lastLastMessageMs; diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index a22858ef8fc..35b0de92ae6 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -696,7 +696,10 @@ static bool gpsParseFrameUBLOX(void) if (_class == CLASS_NAV) { static int satInfoCount = 0; DEBUG_SET(DEBUG_GPS, 2, satInfoCount++); - gpsSolDRV.numSat = _buffer.svinfo.numCh; + if (!gpsState.flags.pvt) { // PVT is the prefered source + gpsSolDRV.numSat = _buffer.svinfo.numCh; + } + // TODO: populate satelites[] with sat info } break; case MSG_SIG_INFO: @@ -888,19 +891,59 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence - if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9 || gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >=1)) { // > 23.01, don't use configureMSG - ubx_config_data8_payload_t rateValues[] = { - {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, - {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, - }; + if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9) { + // > 23.01, don't use configureMSG + if (gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >= 1)) { + ubx_config_data8_payload_t rateValues[] = { + {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, + {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, + {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0}, + }; + + ubloxSendSetCfgBytes(rateValues, 5); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; + + // Try to enable SIG + ubloxSendSetCfgBytes(rateValues+5, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); + gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK; + + // Try to enable SAT if SIG fails + rateValues[6].value = gpsState.flags.sig ? 0 : 1; + ubloxSendSetCfgBytes(rateValues+6, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); + gpsState.flags.sat = _ack_state == UBX_ACK_GOT_ACK ? rateValues[6].value : 0; + + } else { + configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + + configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + + configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + + configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - ubloxSendSetCfgBytes(rateValues, 7); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; + + configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + gpsState.flags.sat = 0; + + configureMSG(MSG_CLASS_UBX, MSG_SIG_INFO, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); + gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK; + } if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz @@ -936,10 +979,21 @@ STATIC_PROTOTHREAD(gpsConfigure) configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK); + gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); ptWait(_ack_state == UBX_ACK_GOT_ACK); + // Needed for satelite information on older devices + configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || + _ack_state == UBX_ACK_GOT_NAK); + if (_ack_state == UBX_ACK_GOT_ACK) { + gpsState.flags.sat = 1; + } else { + gpsState.flags.sat = 0; + } + if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz } @@ -984,6 +1038,10 @@ STATIC_PROTOTHREAD(gpsConfigure) } } + DEBUG_SET(DEBUG_GPS, 5, gpsState.flags.pvt); + DEBUG_SET(DEBUG_GPS, 6, gpsState.flags.sat); + DEBUG_SET(DEBUG_GPS, 7, gpsState.flags.sig); + // Configure SBAS // If particular SBAS setting is not supported by the hardware we'll get a NAK, // however GPS would be functional. We are waiting for any response - ACK/NACK From d7e8525ac972513707bb73a72e6d02f4d7d45be8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:31:32 +0200 Subject: [PATCH 298/429] use version checks to pick NAV-SAT or NAV-SIG --- src/main/io/gps_ublox.c | 40 ++++++++++++++++++++++++++++++++-------- src/main/io/gps_ublox.h | 6 ++++++ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 35b0de92ae6..a3bcb9379a4 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -893,7 +893,7 @@ STATIC_PROTOTHREAD(gpsConfigure) // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9) { // > 23.01, don't use configureMSG - if (gpsState.swVersionMajor > 23 || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor >= 1)) { + if (ubloxVersionGTE(23, 1)) { ubx_config_data8_payload_t rateValues[] = { {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, @@ -936,13 +936,12 @@ STATIC_PROTOTHREAD(gpsConfigure) ptWait(_ack_state == UBX_ACK_GOT_ACK); gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; - configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 0); + // NAV-SIG is available from 23.1 onwards, NAV-SAT from 15.0 to 23.1 + configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, ubloxVersionGTE(15,0)); ptWait(_ack_state == UBX_ACK_GOT_ACK); - gpsState.flags.sat = 0; + gpsState.flags.sat = ubloxVersionGTE(15, 0); - configureMSG(MSG_CLASS_UBX, MSG_SIG_INFO, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK; + gpsState.flags.sig = 0; } if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { @@ -984,6 +983,7 @@ STATIC_PROTOTHREAD(gpsConfigure) configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); ptWait(_ack_state == UBX_ACK_GOT_ACK); + //if(ubloxVersionGTE(15,0) && ubloxVersionLTE(23, 1)) // Needed for satelite information on older devices configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK || @@ -1053,7 +1053,7 @@ STATIC_PROTOTHREAD(gpsConfigure) if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX8) { gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); bool use_VALSET = 0; - if ( (gpsState.swVersionMajor > 23) || (gpsState.swVersionMajor == 23 && gpsState.swVersionMinor > 1) ) { + if (ubloxVersionGTE(23,1)) { use_VALSET = 1; } @@ -1063,7 +1063,7 @@ STATIC_PROTOTHREAD(gpsConfigure) configureGNSS(); } - ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); + ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); if(_ack_state == UBX_ACK_GOT_NAK) { gpsConfigMutable()->ubloxUseGalileo = SETTING_GPS_UBLOX_USE_GALILEO_DEFAULT; @@ -1233,5 +1233,29 @@ const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index) return NULL; } +bool ubloxVersionLT(uint8_t mj2, uint8_t mn2) +{ + return gpsState.swVersionMajor < mj2 || (gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor < mn2); +} + +bool ubloxVersionGT(uint8_t mj2, uint8_t mn2) +{ + return gpsState.swVersionMajor > mj2 || (gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor > mn2); +} + +bool ubloxVersionGTE(uint8_t mj2, uint8_t mn2) +{ + return ubloxVersionGT(mj2, mn2) || ubloxVersionE(mj2, mn2); +} + +bool ubloxVersionLTE(uint8_t mj2, uint8_t mn2) +{ + return ubloxVersionLT(mj2, mn2) || ubloxVersionE(mj2, mn2); +} + +bool ubloxVersionE(uint8_t mj1, uint8_t mn1, uint8_t mj2, uint8_t mn2) +{ + return gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor == mn2; +} #endif diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 041f98653b5..959399ac600 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -469,6 +469,12 @@ bool isGpsUblox(void); const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index); +bool ubloxVersionLTE(uint8_t mj2, uint8_t mn2); +bool ubloxVersionLT(uint8_t mj2, uint8_t mn2); +bool ubloxVersionGT(uint8_t mj2, uint8_t mn2); +bool ubloxVersionGTE(uint8_t mj2, uint8_t mn2); +bool ubloxVersionE(uint8_t mj2, uint8_t mn2); + #ifdef __cplusplus } #endif From 8f7fe5bdff3851eae0c48b4aec210013f7551a23 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:44:00 +0200 Subject: [PATCH 299/429] missed on of the functions when remove parameters --- src/main/io/gps_ublox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index a3bcb9379a4..7a8a5d198dd 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1253,7 +1253,7 @@ bool ubloxVersionLTE(uint8_t mj2, uint8_t mn2) return ubloxVersionLT(mj2, mn2) || ubloxVersionE(mj2, mn2); } -bool ubloxVersionE(uint8_t mj1, uint8_t mn1, uint8_t mj2, uint8_t mn2) +bool ubloxVersionE(uint8_t mj2, uint8_t mn2) { return gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor == mn2; } From 6de09006418cbb4cf75014bbb25cd7b4a3945bdd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:54:02 +0200 Subject: [PATCH 300/429] rename args --- src/main/io/gps_ublox.c | 20 ++++++++++---------- src/main/io/gps_ublox.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 7a8a5d198dd..0c582338020 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1233,29 +1233,29 @@ const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index) return NULL; } -bool ubloxVersionLT(uint8_t mj2, uint8_t mn2) +bool ubloxVersionLT(uint8_t mj, uint8_t mn) { - return gpsState.swVersionMajor < mj2 || (gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor < mn2); + return gpsState.swVersionMajor < mj || (gpsState.swVersionMajor == mj && gpsState.swVersionMinor < mn); } -bool ubloxVersionGT(uint8_t mj2, uint8_t mn2) +bool ubloxVersionGT(uint8_t mj, uint8_t mn) { - return gpsState.swVersionMajor > mj2 || (gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor > mn2); + return gpsState.swVersionMajor > mj || (gpsState.swVersionMajor == mj && gpsState.swVersionMinor > mn); } -bool ubloxVersionGTE(uint8_t mj2, uint8_t mn2) +bool ubloxVersionGTE(uint8_t mj, uint8_t mn) { - return ubloxVersionGT(mj2, mn2) || ubloxVersionE(mj2, mn2); + return ubloxVersionGT(mj, mn) || ubloxVersionE(mj, mn); } -bool ubloxVersionLTE(uint8_t mj2, uint8_t mn2) +bool ubloxVersionLTE(uint8_t mj, uint8_t mn) { - return ubloxVersionLT(mj2, mn2) || ubloxVersionE(mj2, mn2); + return ubloxVersionLT(mj, mn) || ubloxVersionE(mj, mn); } -bool ubloxVersionE(uint8_t mj2, uint8_t mn2) +bool ubloxVersionE(uint8_t mj, uint8_t mn) { - return gpsState.swVersionMajor == mj2 && gpsState.swVersionMinor == mn2; + return gpsState.swVersionMajor == mj && gpsState.swVersionMinor == mn; } #endif diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 959399ac600..b6e56845dac 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -469,11 +469,11 @@ bool isGpsUblox(void); const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index); -bool ubloxVersionLTE(uint8_t mj2, uint8_t mn2); -bool ubloxVersionLT(uint8_t mj2, uint8_t mn2); -bool ubloxVersionGT(uint8_t mj2, uint8_t mn2); -bool ubloxVersionGTE(uint8_t mj2, uint8_t mn2); -bool ubloxVersionE(uint8_t mj2, uint8_t mn2); +bool ubloxVersionLTE(uint8_t mj, uint8_t mn); +bool ubloxVersionLT(uint8_t mj, uint8_t mn); +bool ubloxVersionGT(uint8_t mj, uint8_t mn); +bool ubloxVersionGTE(uint8_t mj, uint8_t mn); +bool ubloxVersionE(uint8_t mj, uint8_t mn); #ifdef __cplusplus } From bd0a9b69423d5815d5436ade6c68bc6a78070740 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 26 Jun 2024 14:22:07 +0200 Subject: [PATCH 301/429] Separate gyro PT1 filter from LULU filter --- src/main/fc/settings.yaml | 2 +- src/main/sensors/gyro.c | 29 +++++++++++++++-------------- src/main/sensors/gyro.h | 8 ++++---- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index a27e9599db7..ff42fb18fa7 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -192,7 +192,7 @@ tables: values: ["SHARED_LOW", "SHARED_HIGH", "LOW", "HIGH"] enum: led_pin_pwm_mode_e - name: gyro_filter_mode - values: ["STATIC", "DYNAMIC", "ADAPTIVE", "LULU"] + values: ["OFF", "STATIC", "DYNAMIC", "ADAPTIVE"] enum: gyroFilterType_e - name: headtracker_dev_type values: ["NONE", "SERIAL", "MSP"] diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index b4723f0da74..2f69b4d4657 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -96,7 +96,7 @@ EXTENDED_FASTRAM secondaryDynamicGyroNotchState_t secondaryDynamicGyroNotchState #endif -PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 11); +PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 12); PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .gyro_anti_aliasing_lpf_hz = SETTING_GYRO_ANTI_ALIASING_LPF_HZ_DEFAULT, @@ -241,18 +241,13 @@ STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHard return gyroHardware; } -static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t cutoff, uint32_t looptime, filterType_e filterType) +static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t cutoff, uint32_t looptime) { *applyFn = nullFilterApply; if (cutoff > 0) { for (int axis = 0; axis < 3; axis++) { - if(filterType == FILTER_LULU) { - luluFilterInit(&state[axis].lulu, cutoff); - *applyFn = (filterApplyFnPtr)luluFilterApply; - } else { - pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); - *applyFn = (filterApplyFnPtr)pt1FilterApply; - } + pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); + *applyFn = (filterApplyFnPtr)pt1FilterApply; } } } @@ -260,13 +255,19 @@ static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t static void gyroInitFilters(void) { //First gyro LPF running at full gyro frequency 8kHz - initGyroFilter(&gyroLpfApplyFn, gyroLpfState, gyroConfig()->gyro_anti_aliasing_lpf_hz, getGyroLooptime(), FILTER_PT1); + initGyroFilter(&gyroLpfApplyFn, gyroLpfState, gyroConfig()->gyro_anti_aliasing_lpf_hz, getGyroLooptime()); - if(gyroConfig()->gyroFilterMode == GYRO_FILTER_MODE_LULU) { - initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyroLuluSampleCount, getLooptime(), FILTER_LULU); + /* + luluFilterInit(&state[axis].lulu, cutoff); + *applyFn = (filterApplyFnPtr)luluFilterApply; + + initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyroLuluSampleCount, getLooptime(), FILTER_LULU); + */ + + if(gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_OFF) { + initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime()); } else { - //Second gyro LPF runnig and PID frequency - this filter is dynamic when gyro_use_dyn_lpf = ON - initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime(), FILTER_PT1); + gyroLpf2ApplyFn = nullFilterApply; } #ifdef USE_ADAPTIVE_FILTER diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 4b67081a5ae..c6f60b45bbb 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -53,10 +53,10 @@ typedef enum { } dynamicGyroNotchMode_e; typedef enum { - GYRO_FILTER_MODE_STATIC = 0, - GYRO_FILTER_MODE_DYNAMIC = 1, - GYRO_FILTER_MODE_ADAPTIVE = 2, - GYRO_FILTER_MODE_LULU = 3 + GYRO_FILTER_MODE_OFF = 0, + GYRO_FILTER_MODE_STATIC = 1, + GYRO_FILTER_MODE_DYNAMIC = 2, + GYRO_FILTER_MODE_ADAPTIVE = 3 } gyroFilterMode_e; typedef struct gyro_s { From b612e659a2a28e89b38e840d296052523f981518 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:24:03 +0200 Subject: [PATCH 302/429] First attempt at parsing signal info --- src/main/io/gps_ublox.c | 26 +++++++++++++++++++++----- src/main/io/gps_ublox.h | 23 +++++++++++------------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 0c582338020..e28dc6494f3 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -696,19 +696,35 @@ static bool gpsParseFrameUBLOX(void) if (_class == CLASS_NAV) { static int satInfoCount = 0; DEBUG_SET(DEBUG_GPS, 2, satInfoCount++); + DEBUG_SET(DEBUG_GPS, 3, _buffer.svinfo.numSvs); if (!gpsState.flags.pvt) { // PVT is the prefered source - gpsSolDRV.numSat = _buffer.svinfo.numCh; + gpsSolDRV.numSat = _buffer.svinfo.numSvs; } - // TODO: populate satelites[] with sat info + + for(int i =0; i < MIN(_buffer.svinfo.numSvs, UBLOX_MAX_SIGNALS); ++i) { + satelites[i].svId = _buffer.svinfo.channel[i].svId; + satelites[i].gnssId = _buffer.svinfo.channel[i].gnssId; + satelites[i].sigId = 0; + satelites[i].cno = _buffer.svinfo.channel[i].cno; + satelites[i].cno = _buffer.svinfo.channel[i].flags; + satelites[i].quality = _buffer.svinfo.channel[i].flags & 0x3; + satelites[i].sigFlags = (_buffer.svinfo.channel[i].flags >> 4 & 0x3); // Healthy, not healthy + //satelites[i].cno = _buffer.svinfo.channel[i].quality; + } + for(int i =_buffer.svinfo.numSvs; i < UBLOX_MAX_SIGNALS; ++i) { + satelites->svId = 0; + } + } break; case MSG_SIG_INFO: if (_class == CLASS_NAV && _buffer.navsig.version == 0) { static int sigInfoCount = 0; DEBUG_SET(DEBUG_GPS, 0, sigInfoCount++); + DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); if(_buffer.navsig.numSigs < UBLOX_MAX_SIGNALS) { - for(int i=0; i < UBLOX_MAX_SIGNALS && i < _buffer.navsig.numSigs; ++i) + for(int i=0; i < MIN(UBLOX_MAX_SIGNALS, _buffer.navsig.numSigs); ++i) { memcpy(&satelites[i], &_buffer.navsig.sig[i], sizeof(ubx_nav_sig_info)); } @@ -1245,12 +1261,12 @@ bool ubloxVersionGT(uint8_t mj, uint8_t mn) bool ubloxVersionGTE(uint8_t mj, uint8_t mn) { - return ubloxVersionGT(mj, mn) || ubloxVersionE(mj, mn); + return ubloxVersionE(mj, mn) || ubloxVersionGT(mj, mn); } bool ubloxVersionLTE(uint8_t mj, uint8_t mn) { - return ubloxVersionLT(mj, mn) || ubloxVersionE(mj, mn); + return ubloxVersionE(mj, mn) || ubloxVersionLT(mj, mn); } bool ubloxVersionE(uint8_t mj, uint8_t mn) diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index b6e56845dac..d887fe0d986 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -180,7 +180,7 @@ typedef struct { typedef struct { uint8_t gnssId; // gnssid 0 = GPS, 1 = SBAS, 2 = GALILEO, 3 = BEIDOU, 4 = IMES, 5 = QZSS, 6 = GLONASS uint8_t svId; // space vehicle ID - uint8_t sigId; // new style signal ID (gnssId:sigId) + uint8_t sigId; // signal ID uint8_t freqId; // 0-13 slot +, 0-13, glonass only int16_t prRes; // pseudo range residual (0.1m) uint8_t cno; // carrier to noise density ratio (dbHz) @@ -306,22 +306,21 @@ typedef struct { } ubx_nav_velned; typedef struct { - uint8_t chn; // Channel number, 255 for SVx not assigned to channel - uint8_t svid; // Satellite ID - uint8_t flags; // Bitmask - uint8_t quality; // Bitfield + uint8_t gnssId; // Channel number, 255 for SVx not assigned to channel + uint8_t svId; // Satellite ID uint8_t cno; // Carrier to Noise Ratio (Signal Strength) // dbHz, 0-55. - uint8_t elev; // Elevation in integer degrees - int16_t azim; // Azimuth in integer degrees - int32_t prRes; // Pseudo range residual in centimetres + int8_t elev; // Elevation in integer degrees +/-90 + int16_t azim; // Azimuth in integer degrees 0-360 + int16_t prRes; // Pseudo range residual in .1m + uint32_t flags; // Bitmask } ubx_nav_svinfo_channel; typedef struct { - uint32_t time; // GPS Millisecond time of week - uint8_t numCh; // Number of channels - uint8_t globalFlags; // Bitmask, Chip hardware generation 0:Antaris, 1:u-blox 5, 2:u-blox 6 + uint32_t itow; // GPS Millisecond time of week + uint8_t version; // Version = 0 + uint8_t numSvs; // (Space vehicle) Satelite count uint16_t reserved2; // Reserved - ubx_nav_svinfo_channel channel[16]; // 16 satellites * 12 byte + ubx_nav_svinfo_channel channel[UBLOX_MAX_SIGNALS]; // UBLOX_MAX_SIGNALS satellites * 12 byte } ubx_nav_svinfo; typedef struct { From e59a635117c4f04da971a3851b268c2574bcdc31 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:29:39 +0200 Subject: [PATCH 303/429] Simplify message rate setup. 2 cases: Firmware newer than 23.01 => has pvt and new setting message Everything else = legacy. (Including M8) --- src/main/io/gps_ublox.c | 175 +++++++++++----------------------------- 1 file changed, 49 insertions(+), 126 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index e28dc6494f3..9f312c1ec8f 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -607,8 +607,10 @@ static bool gpsParseFrameUBLOX(void) case MSG_PVT: { static int pvtCount = 0; - DEBUG_SET(DEBUG_GPS, 1, pvtCount++); + DEBUG_SET(DEBUG_GPS, 0, pvtCount++); } + + gpsState.flags.pvt = 1; next_fix_type = gpsMapFixType(_buffer.pvt.fix_status & NAV_STATUS_FIX_VALID, _buffer.pvt.fix_type); gpsSolDRV.fixType = next_fix_type; gpsSolDRV.llh.lon = _buffer.pvt.longitude; @@ -695,7 +697,8 @@ static bool gpsParseFrameUBLOX(void) case MSG_NAV_SAT: if (_class == CLASS_NAV) { static int satInfoCount = 0; - DEBUG_SET(DEBUG_GPS, 2, satInfoCount++); + gpsState.flags.sat = 1; + DEBUG_SET(DEBUG_GPS, 1, satInfoCount++); DEBUG_SET(DEBUG_GPS, 3, _buffer.svinfo.numSvs); if (!gpsState.flags.pvt) { // PVT is the prefered source gpsSolDRV.numSat = _buffer.svinfo.numSvs; @@ -720,8 +723,9 @@ static bool gpsParseFrameUBLOX(void) case MSG_SIG_INFO: if (_class == CLASS_NAV && _buffer.navsig.version == 0) { static int sigInfoCount = 0; - DEBUG_SET(DEBUG_GPS, 0, sigInfoCount++); + DEBUG_SET(DEBUG_GPS, 2, sigInfoCount++); DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); + gpsState.flags.sig = 1; if(_buffer.navsig.numSigs < UBLOX_MAX_SIGNALS) { for(int i=0; i < MIN(UBLOX_MAX_SIGNALS, _buffer.navsig.numSigs); ++i) @@ -749,6 +753,10 @@ static bool gpsParseFrameUBLOX(void) return false; } + DEBUG_SET(DEBUG_GPS, 5, gpsState.flags.pvt); + DEBUG_SET(DEBUG_GPS, 6, gpsState.flags.sat); + DEBUG_SET(DEBUG_GPS, 7, gpsState.flags.sig); + // we only return true when we get new position and speed data // this ensures we don't use stale data if (_new_position && _new_speed) { @@ -907,58 +915,23 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence - if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX9) { - // > 23.01, don't use configureMSG - if (ubloxVersionGTE(23, 1)) { + // > 23.01, don't use configureMSG, and have PVT + + if (ubloxVersionGTE(23, 1)) { ubx_config_data8_payload_t rateValues[] = { - {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, - {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, - {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, - {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0}, + {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, // 0 + {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, // 1 + {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, // 2 + {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, // 3 + {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, // 4 + {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, // 5 + {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0} // 6 }; - ubloxSendSetCfgBytes(rateValues, 5); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; - // Try to enable SIG - ubloxSendSetCfgBytes(rateValues+5, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - gpsState.flags.sig = _ack_state == UBX_ACK_GOT_ACK; + ubloxSendSetCfgBytes(rateValues, 7); + ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); - // Try to enable SAT if SIG fails - rateValues[6].value = gpsState.flags.sig ? 0 : 1; - ubloxSendSetCfgBytes(rateValues+6, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - gpsState.flags.sat = _ack_state == UBX_ACK_GOT_ACK ? rateValues[6].value : 0; - - } else { - configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; - - // NAV-SIG is available from 23.1 onwards, NAV-SAT from 15.0 to 23.1 - configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, ubloxVersionGTE(15,0)); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - gpsState.flags.sat = ubloxVersionGTE(15, 0); - - gpsState.flags.sig = 0; - } if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz @@ -972,91 +945,41 @@ STATIC_PROTOTHREAD(gpsConfigure) configureRATE(hz2rate(5)); // 5Hz ptWait(_ack_state == UBX_ACK_GOT_ACK); } - } - else { - // u-Blox 5/6/7/8 or unknown - // u-Blox 7-8 support PVT - if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7) { - configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_SOL, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + } else { + configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_STATUS, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - gpsState.flags.pvt = _ack_state == UBX_ACK_GOT_ACK; + configureMSG(MSG_CLASS_UBX, MSG_SOL, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_VELNED, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - //if(ubloxVersionGTE(15,0) && ubloxVersionLTE(23, 1)) - // Needed for satelite information on older devices - configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK || - _ack_state == UBX_ACK_GOT_NAK); - if (_ack_state == UBX_ACK_GOT_ACK) { - gpsState.flags.sat = 1; - } else { - gpsState.flags.sat = 0; - } + configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 10); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { - configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz - } - else { - configureRATE(hz2rate(5)); // 5Hz - } - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - - if(_ack_state == UBX_ACK_GOT_NAK) { // Fallback to safe 5Hz in case of error - configureRATE(hz2rate(5)); // 5Hz - ptWait(_ack_state == UBX_ACK_GOT_ACK); - } - } - // u-Blox 5/6 doesn't support PVT, use legacy config - // UNKNOWN also falls here, use as a last resort - else { - configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_STATUS, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + // Protocol < 23.01 does not have MSG_PVT + //configureMSG(MSG_CLASS_UBX, MSG_PVT, 0); + //ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - configureMSG(MSG_CLASS_UBX, MSG_SOL, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_VELNED, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 10); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - - // This may fail on old UBLOX units, advance forward on both ACK and NAK - configureMSG(MSG_CLASS_UBX, MSG_PVT, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); + // This may fail on old UBLOX units, advance forward on both ACK and NAK + configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - // Configure data rate to 5HZ - configureRATE(200); - ptWait(_ack_state == UBX_ACK_GOT_ACK); - } - } + // Configure data rate to 5HZ + configureRATE(hz2rate(5)); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + }// end message config - DEBUG_SET(DEBUG_GPS, 5, gpsState.flags.pvt); - DEBUG_SET(DEBUG_GPS, 6, gpsState.flags.sat); - DEBUG_SET(DEBUG_GPS, 7, gpsState.flags.sig); + gpsState.flags.pvt = 0; + gpsState.flags.sat = 0; + gpsState.flags.sig = 0; // Configure SBAS // If particular SBAS setting is not supported by the hardware we'll get a NAK, From d0781576ad08bbf912e7051c38d24f3a985c03ac Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:43:42 +0200 Subject: [PATCH 304/429] Still simpler, but 3 cases. 1) New api, nav_pvt and nav_sig (m9+) 2) Old api, nav_pvt and nav_sat (m7?/m8) 3) Old api, no nav_pvt or nav_sat (time to upgrade) --- src/main/io/gps_ublox.c | 79 +++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 9f312c1ec8f..f3fd3506c90 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -915,37 +915,44 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence - // > 23.01, don't use configureMSG, and have PVT + if (ubloxVersionGTE(23, 1)) { // M9+, new setting API, PVT and NAV_SIG + ubx_config_data8_payload_t rateValues[] = { + {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, // 0 + {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, // 1 + {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, // 2 + {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, // 3 + {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, // 4 + {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, // 5 + {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0} // 6 + }; - if (ubloxVersionGTE(23, 1)) { - ubx_config_data8_payload_t rateValues[] = { - {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, // 0 - {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, // 1 - {UBLOX_CFG_MSGOUT_NAV_VELNED_UART1, 0}, // 2 - {UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1, 0}, // 3 - {UBLOX_CFG_MSGOUT_NAV_PVT_UART1, 1}, // 4 - {UBLOX_CFG_MSGOUT_NAV_SIG_UART1, 1}, // 5 - {UBLOX_CFG_MSGOUT_NAV_SAT_UART1, 0} // 6 - }; + ubloxSendSetCfgBytes(rateValues, 7); + ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); + } else if(ubloxVersionGTE(15,0)) { // M8 and potentially M7, PVT, NAV_SAT, old setting API + configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_STATUS, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - ubloxSendSetCfgBytes(rateValues, 7); - ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); + configureMSG(MSG_CLASS_UBX, MSG_SOL, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_UBX, MSG_VELNED, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { - configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz - } else { - configureRATE(hz2rate(5)); // 5Hz - gpsConfigMutable()->ubloxNavHz = SETTING_GPS_UBLOX_NAV_HZ_DEFAULT; - } + configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + + configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + + configureMSG(MSG_CLASS_UBX, MSG_PVT, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - if(_ack_state == UBX_ACK_GOT_NAK) { // Fallback to safe 5Hz in case of error - configureRATE(hz2rate(5)); // 5Hz - ptWait(_ack_state == UBX_ACK_GOT_ACK); - } - } else { + configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); + } else { // Really old stuff, consider upgrading :), ols setting API, no PVT or NAV_SAT or NAV_SIG configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK); @@ -961,21 +968,23 @@ STATIC_PROTOTHREAD(gpsConfigure) configureMSG(MSG_CLASS_UBX, MSG_TIMEUTC, 10); ptWait(_ack_state == UBX_ACK_GOT_ACK); - // Protocol < 23.01 does not have MSG_PVT - //configureMSG(MSG_CLASS_UBX, MSG_PVT, 0); - //ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - - // This may fail on old UBLOX units, advance forward on both ACK and NAK - configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); - ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - configureMSG(MSG_CLASS_UBX, MSG_SVINFO, 0); ptWait(_ack_state == UBX_ACK_GOT_ACK); + }// end message config + + if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { + configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz + } else { + configureRATE(hz2rate(5)); // 5Hz + gpsConfigMutable()->ubloxNavHz = SETTING_GPS_UBLOX_NAV_HZ_DEFAULT; + } + ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); - // Configure data rate to 5HZ - configureRATE(hz2rate(5)); + if(_ack_state == UBX_ACK_GOT_NAK) { // Fallback to safe 5Hz in case of error + configureRATE(hz2rate(5)); // 5Hz ptWait(_ack_state == UBX_ACK_GOT_ACK); - }// end message config + } + gpsState.flags.pvt = 0; gpsState.flags.sat = 0; From 9ad5252bc9523690c7949f927e33de0abf135ef2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 27 Jun 2024 01:02:10 +0200 Subject: [PATCH 305/429] Disable nmed with new api for swversion >23.1 --- src/main/io/gps_ublox.c | 39 ++++++++++++++++++++++++++------------- src/main/io/gps_ublox.h | 5 +++++ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index f3fd3506c90..a3065f73daa 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -890,26 +890,38 @@ STATIC_PROTOTHREAD(gpsConfigure) } ptWait(_ack_state == UBX_ACK_GOT_ACK); - // Disable NMEA messages gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); + // Disable NMEA messages + if (ubloxVersionGTE(23, 1)) { + ubx_config_data8_payload_t nmeaValues[] = { + { UBLOX_CFG_MSGOUT_NMEA_ID_GGA_UART1, 0 }, + { UBLOX_CFG_MSGOUT_NMEA_ID_GLL_UART1, 0 }, + { UBLOX_CFG_MSGOUT_NMEA_ID_GSA_UART1, 0 }, + { UBLOX_CFG_MSGOUT_NMEA_ID_RMC_UART1, 0 }, + { UBLOX_CFG_MSGOUT_NMEA_ID_VTG_UART1, 0 }, + }; - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GGA, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + ubloxSendSetCfgBytes(nmeaValues, 5); + ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK), GPS_CFG_CMD_TIMEOUT_MS); + } else { + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GGA, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GLL, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GLL, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GSA, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GSA, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GSV, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_GSV, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_RMC, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_RMC, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); - configureMSG(MSG_CLASS_NMEA, MSG_NMEA_VGS, 0); - ptWait(_ack_state == UBX_ACK_GOT_ACK); + configureMSG(MSG_CLASS_NMEA, MSG_NMEA_VGS, 0); + ptWait(_ack_state == UBX_ACK_GOT_ACK); + } // Configure UBX binary messages gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); @@ -972,6 +984,7 @@ STATIC_PROTOTHREAD(gpsConfigure) ptWait(_ack_state == UBX_ACK_GOT_ACK); }// end message config + ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_SHORT_TIMEOUT); if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz } else { diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index d887fe0d986..c79c4654292 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -63,6 +63,11 @@ extern "C" { #define UBLOX_CFG_MSGOUT_NAV_VELNED_UART1 0x20910043 // U1 #define UBLOX_CFG_MSGOUT_NAV_TIMEUTC_UART1 0x2091005c // U1 #define UBLOX_CFG_MSGOUT_NAV_PVT_UART1 0x20910007 // U1 +#define UBLOX_CFG_MSGOUT_NMEA_ID_GGA_UART1 0x209100bb // U1 +#define UBLOX_CFG_MSGOUT_NMEA_ID_GLL_UART1 0x209100ca // U1 +#define UBLOX_CFG_MSGOUT_NMEA_ID_GSA_UART1 0x209100c0 // U1 +#define UBLOX_CFG_MSGOUT_NMEA_ID_RMC_UART1 0x209100ac // U1 +#define UBLOX_CFG_MSGOUT_NMEA_ID_VTG_UART1 0x209100b1 // U1 #define UBLOX_CFG_SIGNAL_SBAS_ENA 0x10310020 // U1 #define UBLOX_CFG_SIGNAL_SBAS_L1CA_ENA 0x10310005 // U1 From c9fc18f8e9eaf9d77d836c6411515cb9cf3add75 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 27 Jun 2024 01:42:59 +0200 Subject: [PATCH 306/429] use 0xff as no sat. --- src/main/fc/cli.c | 4 ++-- src/main/io/gps_ublox.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index fa8ec75b615..fe54e175b27 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -4396,11 +4396,11 @@ static void cliUbloxPrintSatelites(char *arg) for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) { const ubx_nav_sig_info *sat = gpsGetUbloxSatelite(i); - if(sat == NULL || sat->svId == 0) { + if(sat == NULL) { continue; } - cliPrintLinef("satelite: %d:%d", sat->gnssId, sat->svId); + cliPrintLinef("satelite[%d]: %d:%d", i+1, sat->gnssId, sat->svId); cliPrintLinef("sigId: %d (%s)", sat->sigId, _ubloxGetSigId(sat->gnssId, sat->sigId)); cliPrintLinef("signal strength: %i dbHz", sat->cno); cliPrintLinef("quality: %i (%s)", sat->quality, _ubloxGetQuality(sat->quality)); diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index a3065f73daa..93395e7d1d4 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -726,7 +726,7 @@ static bool gpsParseFrameUBLOX(void) DEBUG_SET(DEBUG_GPS, 2, sigInfoCount++); DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); gpsState.flags.sig = 1; - if(_buffer.navsig.numSigs < UBLOX_MAX_SIGNALS) + if(_buffer.navsig.numSigs > 0) { for(int i=0; i < MIN(UBLOX_MAX_SIGNALS, _buffer.navsig.numSigs); ++i) { @@ -734,7 +734,7 @@ static bool gpsParseFrameUBLOX(void) } for(int i = _buffer.navsig.numSigs; i < UBLOX_MAX_SIGNALS; ++i) { - satelites[i].svId = 0; // no used + satelites[i].svId = 0xFF; // no used } } } @@ -1187,7 +1187,7 @@ bool isGpsUblox(void) const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index) { - if(index < UBLOX_MAX_SIGNALS) { + if(index < UBLOX_MAX_SIGNALS && satelites[index].svId != 0xFF) { return &satelites[index]; } From 2bca68bdca1f59fb5ae117c85528b3f3813166fd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 27 Jun 2024 21:45:37 +0200 Subject: [PATCH 307/429] make sure to init satelites as not used --- src/main/io/gps_ublox.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 93395e7d1d4..679bcf91e33 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1033,6 +1033,11 @@ STATIC_PROTOTHREAD(gpsConfigure) } } + for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) + { + satelites[i].svId = 0xFF; + } + ptEnd(0); } From f8cc253b4c37bc5ca7ca8fe2f44a71991fe4b1b2 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Fri, 28 Jun 2024 12:50:02 +0200 Subject: [PATCH 308/429] LuLu filter as separate entity --- src/main/sensors/gyro.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 2f69b4d4657..780bada378d 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -88,6 +88,9 @@ STATIC_FASTRAM filter_t gyroLpfState[XYZ_AXIS_COUNT]; STATIC_FASTRAM filterApplyFnPtr gyroLpf2ApplyFn; STATIC_FASTRAM filter_t gyroLpf2State[XYZ_AXIS_COUNT]; +STATIC_FASTRAM filterApplyFnPtr gyroLuluApplyFn; +STATIC_FASTRAM filter_t gyroLuluState[XYZ_AXIS_COUNT]; + #ifdef USE_DYNAMIC_FILTERS EXTENDED_FASTRAM gyroAnalyseState_t gyroAnalyseState; From e05c38fbcbf30b0708c93b835d712b05992ff663 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 29 Jun 2024 12:12:19 +0200 Subject: [PATCH 309/429] Add some docs on Serial Gimbal --- docs/Serial Gimbal.mb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docs/Serial Gimbal.mb diff --git a/docs/Serial Gimbal.mb b/docs/Serial Gimbal.mb new file mode 100644 index 00000000000..795cb5490a4 --- /dev/null +++ b/docs/Serial Gimbal.mb @@ -0,0 +1,33 @@ +# Serial Gimbal +INAV 8.0 introduces support for serial Gimbals. Currently, it is compatible with the protocol used by the Walksnail GM series gimbals. + +While these gimbals also support PWM as input, using the Serial protocol gives it more flexibility and saves up to 4 PWM channels. The downside of the Serial protocol vs PWM input is that you don't have access to the full power of INAV's mixers. The main advantage is that you gain easy control of gimbal functions using INAV's modes. + +# Axis Input +The Serial Gimbal supports 2 differents inputs. + +## PWM Channels +This is the simplest way to control the Gimbal, and just lets the Gimbal use the value of a given RC PWM Channel. You can control all 3 gimbal axis, plust the Gimbal sensitivity. Unlike the raw PWM input, modes are controlled by INAV modes, instead of a PWM channels. If an rc channel is set to 0, that input will be ignore. So, if you setup the serial gimbal and don't assign any rc channels, it will stay centered, with default sensitivity and will obey the Gimbal MODES setup in the Modes tab. +Since it is using rc channels as inputs, you can have a mixer in your radio and setup a head tracker in the traditional way, like you would with home made servo gimbal. + +## Headtracker Input +Headtracker input is only used when you have a Headtracker device configured and the ```Gimbal Headtracker``` mode is active. +A Headtracker device is a device that transmits headtracker information by a side channel, instead of relying on your rc link. + +In head tracker mode, the Serial Gimbal will ignore the axis rc channel inputs and replace it with the inputs coming from the Headtracker device. + +# Gimbal Modes +## No Gimbal mode selected +Like ACRO is the default mode for flight modes, the Gimbal will default to ```FPV Mode``` or ```Follow Mode``` when no mode is selected. The gimbal will try to stablized the footag and will follow the aircraft pitch, roll and yaw movements and use user inputs to point the camera where the user wants. + +## Gimbal Center +This locks the gimbal camera to the center position and ignores any user input. Useful to reset the camera if you loose orientation. + +## Gimbal Headtracker +Switches inputs to the configured Headtracker device. If no device is configured it will behave like Gimbal Center. + +## Gimbal Level Tilt +This mode locks the camera tilt (pitch axis) and keeps it level with the horizon. Pitching the aircraft up and down, will move the camera so it stays pointing at the horizon. It can be combined with ```Gimbal Level Roll```. + +## Gimbal Level Roll +This mode locks the camera roll and keeps it level with the horizon. Rolling the aircraft will move the camera so it stays level with the horizon. It can be combined with ```Gimbal Level Tilt```. From 17729ed230477c81bc920bc3a79a031fc959de62 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 29 Jun 2024 12:17:43 +0200 Subject: [PATCH 310/429] Oops... --- docs/{Serial Gimbal.mb => Serial Gimbal.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{Serial Gimbal.mb => Serial Gimbal.md} (100%) diff --git a/docs/Serial Gimbal.mb b/docs/Serial Gimbal.md similarity index 100% rename from docs/Serial Gimbal.mb rename to docs/Serial Gimbal.md From a9cdb7456008b22d40c88d11545c691df16a580c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 29 Jun 2024 12:26:37 +0200 Subject: [PATCH 311/429] More changes --- docs/Serial Gimbal.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/Serial Gimbal.md b/docs/Serial Gimbal.md index 795cb5490a4..7b1b20a1bb4 100644 --- a/docs/Serial Gimbal.md +++ b/docs/Serial Gimbal.md @@ -7,8 +7,7 @@ While these gimbals also support PWM as input, using the Serial protocol gives i The Serial Gimbal supports 2 differents inputs. ## PWM Channels -This is the simplest way to control the Gimbal, and just lets the Gimbal use the value of a given RC PWM Channel. You can control all 3 gimbal axis, plust the Gimbal sensitivity. Unlike the raw PWM input, modes are controlled by INAV modes, instead of a PWM channels. If an rc channel is set to 0, that input will be ignore. So, if you setup the serial gimbal and don't assign any rc channels, it will stay centered, with default sensitivity and will obey the Gimbal MODES setup in the Modes tab. -Since it is using rc channels as inputs, you can have a mixer in your radio and setup a head tracker in the traditional way, like you would with home made servo gimbal. +This is the simplest way to control the Gimbal, as you can use your radio mixer and sliders to Control the gimbal by assigning RC channels to functions in the ```Configuration``` tab. You can control all 3 gimbal axis, plust the Gimbal sensitivity. Unlike the raw PWM input, gimbal modes are controlled by INAV modes and you can control roll channel as well, instead of wiring 4 servo outputs. If an rc channel is set to 0, that input will be ignore and will be equivalent to a centered RC channel. So, if you setup the serial gimbal and don't assign any rc channels, it will stay centered, with default sensitivity and will obey the Gimbal MODES setup in the Modes tab. ## Headtracker Input Headtracker input is only used when you have a Headtracker device configured and the ```Gimbal Headtracker``` mode is active. From dc3e723ccdf0d93f213a3a8c2ad17f40f67a48ec Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 29 Jun 2024 06:45:14 -0400 Subject: [PATCH 312/429] Update Serial Gimbal.md --- docs/Serial Gimbal.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/Serial Gimbal.md b/docs/Serial Gimbal.md index 7b1b20a1bb4..984e00f29d1 100644 --- a/docs/Serial Gimbal.md +++ b/docs/Serial Gimbal.md @@ -7,7 +7,7 @@ While these gimbals also support PWM as input, using the Serial protocol gives i The Serial Gimbal supports 2 differents inputs. ## PWM Channels -This is the simplest way to control the Gimbal, as you can use your radio mixer and sliders to Control the gimbal by assigning RC channels to functions in the ```Configuration``` tab. You can control all 3 gimbal axis, plust the Gimbal sensitivity. Unlike the raw PWM input, gimbal modes are controlled by INAV modes and you can control roll channel as well, instead of wiring 4 servo outputs. If an rc channel is set to 0, that input will be ignore and will be equivalent to a centered RC channel. So, if you setup the serial gimbal and don't assign any rc channels, it will stay centered, with default sensitivity and will obey the Gimbal MODES setup in the Modes tab. +This is the simplest way to control the Gimbal, as you can use your radio mixer and sliders to Control the gimbal by assigning RC channels to functions in the ```Configuration``` tab. You can control all 3 gimbal axis and unlike the raw PWM input, gimbal modes are controlled by INAV modes and you can control roll channel as well, instead of wiring 4 servo outputs. If an rc channel is set to 0, that input will be ignore and will be equivalent to a centered RC channel. So, if you setup the serial gimbal and don't assign any rc channels, it will stay centered, with default sensitivity and will obey the Gimbal MODES setup in the Modes tab. ## Headtracker Input Headtracker input is only used when you have a Headtracker device configured and the ```Gimbal Headtracker``` mode is active. @@ -30,3 +30,27 @@ This mode locks the camera tilt (pitch axis) and keeps it level with the horizon ## Gimbal Level Roll This mode locks the camera roll and keeps it level with the horizon. Rolling the aircraft will move the camera so it stays level with the horizon. It can be combined with ```Gimbal Level Tilt```. + +# Advanced settings +The gimbal also supports some advanced settings not exposed in the configurator. + +## Gimbal Trim +You can set a trim setting for the gimbal, the idea is that it will shift the notion of center of the gimbal, like a trim and let you setup a fixed camera up tilt, like you would have in a traditional fpv quad setup. + +``` +gimbal_pan_trim = 0 +Allowed range: -500 - 500 + +gimbal_tilt_trim = 0 +Allowed range: -500 - 500 + +gimbal_roll_trim = 0 +Allowed range: -500 - 500 +``` + +## Gimbal and Headtracker on a single uart +As INAV does not process any inputs from the Walksnail Gimbal, it is possible to share the uard with the Walksnail Headtracking output by connect the fc TX to the gimbal and RX to receive the headtracker input. +``` +gimbal_serial_single_uart = OFF +Allowed values: OFF, ON +``` From 817981fa4b4c3d9ba6bb4a6975b799057dba9b9c Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:43:10 +0100 Subject: [PATCH 313/429] add flown loiter radius for fixed wing --- src/main/navigation/navigation.c | 9 ++- src/main/navigation/navigation.h | 1 + src/main/programming/logic_condition.c | 105 +++++++++++++------------ src/main/programming/logic_condition.h | 1 + 4 files changed, 65 insertions(+), 51 deletions(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 6eed742e804..f7c7303d138 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -5074,5 +5074,12 @@ bool canFwLandingBeCancelled(void) { return FLIGHT_MODE(NAV_FW_AUTOLAND) && posControl.navState != NAV_STATE_FW_LANDING_FLARE; } - #endif +uint16_t getFlownLoiterRadius(void) +{ + if (STATE(AIRPLANE) && navGetCurrentStateFlags() & NAV_CTL_HOLD) { + return CENTIMETERS_TO_METERS(calculateDistanceToDestination(&posControl.desiredState.pos)); + } + + return 0; +} diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index 101b41cd637..1b7734c8b13 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -694,6 +694,7 @@ bool rthAltControlStickOverrideCheck(uint8_t axis); int8_t navCheckActiveAngleHoldAxis(void); uint8_t getActiveWpNumber(void); +uint16_t getFlownLoiterRadius(void); /* Returns the heading recorded when home position was acquired. * Note that the navigation system uses deg*100 as unit and angles diff --git a/src/main/programming/logic_condition.c b/src/main/programming/logic_condition.c index f927ac18d1b..6e43d2394cd 100644 --- a/src/main/programming/logic_condition.c +++ b/src/main/programming/logic_condition.c @@ -97,7 +97,7 @@ static int logicConditionCompute( int temporaryValue; #if defined(USE_VTX_CONTROL) vtxDeviceCapability_t vtxDeviceCapability; -#endif +#endif switch (operation) { @@ -154,7 +154,7 @@ static int logicConditionCompute( case LOGIC_CONDITION_NOR: return !(operandA || operandB); - break; + break; case LOGIC_CONDITION_NOT: return !operandA; @@ -170,7 +170,7 @@ static int logicConditionCompute( return false; } - //When both operands are not met, keep current value + //When both operands are not met, keep current value return currentValue; break; @@ -238,7 +238,7 @@ static int logicConditionCompute( gvSet(operandA, operandB); return operandB; break; - + case LOGIC_CONDITION_GVAR_INC: temporaryValue = gvGet(operandA) + operandB; gvSet(operandA, temporaryValue); @@ -270,7 +270,7 @@ static int logicConditionCompute( return operandA; } break; - + case LOGIC_CONDITION_OVERRIDE_ARMING_SAFETY: LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_ARMING_SAFETY); return true; @@ -293,12 +293,12 @@ static int logicConditionCompute( ENABLE_STATE(CALIBRATE_MAG); return true; break; -#endif +#endif case LOGIC_CONDITION_SET_VTX_POWER_LEVEL: -#if defined(USE_VTX_CONTROL) +#if defined(USE_VTX_CONTROL) #if(defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP)) if ( - logicConditionValuesByType[LOGIC_CONDITION_SET_VTX_POWER_LEVEL] != operandA && + logicConditionValuesByType[LOGIC_CONDITION_SET_VTX_POWER_LEVEL] != operandA && vtxCommonGetDeviceCapability(vtxCommonDevice(), &vtxDeviceCapability) ) { logicConditionValuesByType[LOGIC_CONDITION_SET_VTX_POWER_LEVEL] = constrain(operandA, VTX_SETTINGS_MIN_POWER, vtxDeviceCapability.powerCount); @@ -346,18 +346,18 @@ static int logicConditionCompute( LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_INVERT_PITCH); return true; break; - + case LOGIC_CONDITION_INVERT_YAW: LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_INVERT_YAW); return true; break; - + case LOGIC_CONDITION_OVERRIDE_THROTTLE: logicConditionValuesByType[LOGIC_CONDITION_OVERRIDE_THROTTLE] = operandA; LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_THROTTLE); return operandA; break; - + case LOGIC_CONDITION_SET_OSD_LAYOUT: logicConditionValuesByType[LOGIC_CONDITION_SET_OSD_LAYOUT] = operandA; LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_OSD_LAYOUT); @@ -373,18 +373,18 @@ static int logicConditionCompute( case LOGIC_CONDITION_SIN: temporaryValue = (operandB == 0) ? 500 : operandB; - return sin_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; + return sin_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; break; - + case LOGIC_CONDITION_COS: temporaryValue = (operandB == 0) ? 500 : operandB; - return cos_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; + return cos_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; break; break; - + case LOGIC_CONDITION_TAN: temporaryValue = (operandB == 0) ? 500 : operandB; - return tan_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; + return tan_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue; break; case LOGIC_CONDITION_MIN: @@ -394,11 +394,11 @@ static int logicConditionCompute( case LOGIC_CONDITION_MAX: return (operandA > operandB) ? operandA : operandB; break; - + case LOGIC_CONDITION_MAP_INPUT: return scaleRange(constrain(operandA, 0, operandB), 0, operandB, 0, 1000); break; - + case LOGIC_CONDITION_MAP_OUTPUT: return scaleRange(constrain(operandA, 0, 1000), 0, 1000, 0, operandB); break; @@ -507,7 +507,7 @@ static int logicConditionCompute( default: return false; - break; + break; } } @@ -516,7 +516,7 @@ void logicConditionProcess(uint8_t i) { const int activatorValue = logicConditionGetValue(logicConditions(i)->activatorId); if (logicConditions(i)->enabled && activatorValue && !cliMode) { - + /* * Process condition only when latch flag is not set * Latched LCs can only go from OFF to ON, not the other way @@ -525,13 +525,13 @@ void logicConditionProcess(uint8_t i) { const int operandAValue = logicConditionGetOperandValue(logicConditions(i)->operandA.type, logicConditions(i)->operandA.value); const int operandBValue = logicConditionGetOperandValue(logicConditions(i)->operandB.type, logicConditions(i)->operandB.value); const int newValue = logicConditionCompute( - logicConditionStates[i].value, - logicConditions(i)->operation, - operandAValue, + logicConditionStates[i].value, + logicConditions(i)->operation, + operandAValue, operandBValue, i ); - + logicConditionStates[i].value = newValue; /* @@ -606,7 +606,7 @@ static int logicConditionGetWaypointOperandValue(int operand) { return distance; } break; - + case LOGIC_CONDITION_OPERAND_WAYPOINTS_USER1_ACTION: return (NAV_Status.activeWpIndex > 0) ? ((posControl.waypointList[NAV_Status.activeWpIndex-1].p3 & NAV_WP_USER1) == NAV_WP_USER1) : 0; break; @@ -652,11 +652,11 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_ARM_TIMER: // in s return constrain((uint32_t)getFlightTime(), 0, INT16_MAX); break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_HOME_DISTANCE: //in m return constrain(GPS_distanceToHome, 0, INT16_MAX); break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_TRIP_DISTANCE: //in m return constrain(getTotalTravelDistance() / 100, 0, INT16_MAX); break; @@ -664,7 +664,7 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_RSSI: return constrain(getRSSI() * 100 / RSSI_MAX_VALUE, 0, 99); break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_VBAT: // V / 100 return getBatteryVoltage(); break; @@ -680,7 +680,7 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_CURRENT: // Amp / 100 return getAmperage(); break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_MAH_DRAWN: // mAh return getMAhDrawn(); break; @@ -697,7 +697,7 @@ static int logicConditionGetFlightOperandValue(int operand) { return gpsSol.numSat; } break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_GPS_VALID: // 0/1 return STATE(GPS_FIX) ? 1 : 0; break; @@ -749,15 +749,15 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_IS_AUTOLAUNCH: // 0/1 return (navGetCurrentStateFlags() & NAV_CTL_LAUNCH) ? 1 : 0; - break; - + break; + case LOGIC_CONDITION_OPERAND_FLIGHT_IS_ALTITUDE_CONTROL: // 0/1 return (navGetCurrentStateFlags() & NAV_CTL_ALT) ? 1 : 0; - break; + break; case LOGIC_CONDITION_OPERAND_FLIGHT_IS_POSITION_CONTROL: // 0/1 return (navGetCurrentStateFlags() & NAV_CTL_POS) ? 1 : 0; - break; + break; case LOGIC_CONDITION_OPERAND_FLIGHT_IS_EMERGENCY_LANDING: // 0/1 return (navGetCurrentStateFlags() & NAV_CTL_EMERG) ? 1 : 0; @@ -765,7 +765,7 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_IS_RTH: // 0/1 return (navGetCurrentStateFlags() & NAV_AUTO_RTH) ? 1 : 0; - break; + break; case LOGIC_CONDITION_OPERAND_FLIGHT_IS_LANDING: // 0/1 #ifdef USE_FW_AUTOLAND @@ -773,22 +773,22 @@ static int logicConditionGetFlightOperandValue(int operand) { #else return ((navGetCurrentStateFlags() & NAV_CTL_LAND)) ? 1 : 0; #endif - + break; case LOGIC_CONDITION_OPERAND_FLIGHT_IS_FAILSAFE: // 0/1 return (failsafePhase() != FAILSAFE_IDLE) ? 1 : 0; break; - - case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_YAW: // + + case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_YAW: // return axisPID[YAW]; break; - - case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_ROLL: // + + case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_ROLL: // return axisPID[ROLL]; break; - - case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_PITCH: // + + case LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_PITCH: // return axisPID[PITCH]; break; @@ -819,7 +819,7 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE: //int return getConfigBatteryProfile() + 1; break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_ACTIVE_MIXER_PROFILE: // int return currentMixerProfileIndex + 1; break; @@ -830,15 +830,20 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_LOITER_RADIUS: return getLoiterRadius(navConfig()->fw.loiter_radius); + break; + + case LOGIC_CONDITION_OPERAND_FLIGHT_FLOWN_LOITER_RADIUS: + return getFlownLoiterRadius(); + break; case LOGIC_CONDITION_OPERAND_FLIGHT_AGL_STATUS: return isEstimatedAglTrusted(); break; - + case LOGIC_CONDITION_OPERAND_FLIGHT_AGL: return getEstimatedAglPosition(); - break; - + break; + case LOGIC_CONDITION_OPERAND_FLIGHT_RANGEFINDER_RAW: return rangefinderGetLatestRawAltitude(); break; @@ -946,7 +951,7 @@ int logicConditionGetOperandValue(logicOperandType_e type, int operand) { //Extract RC channel raw value if (operand >= 1 && operand <= MAX_SUPPORTED_RC_CHANNEL_COUNT) { retVal = rxGetChannelValue(operand - 1); - } + } break; case LOGIC_CONDITION_OPERAND_TYPE_FLIGHT: @@ -974,7 +979,7 @@ int logicConditionGetOperandValue(logicOperandType_e type, int operand) { retVal = programmingPidGetOutput(operand); } break; - + case LOGIC_CONDITION_OPERAND_TYPE_WAYPOINTS: retVal = logicConditionGetWaypointOperandValue(operand); break; @@ -988,7 +993,7 @@ int logicConditionGetOperandValue(logicOperandType_e type, int operand) { /* * conditionId == -1 is always evaluated as true - */ + */ int logicConditionGetValue(int8_t conditionId) { if (conditionId >= 0) { return logicConditionStates[conditionId].value; @@ -1070,7 +1075,7 @@ int16_t getRcChannelOverride(uint8_t channel, int16_t originalValue) { uint32_t getLoiterRadius(uint32_t loiterRadius) { #ifdef USE_PROGRAMMING_FRAMEWORK - if (LOGIC_CONDITION_GLOBAL_FLAG(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_LOITER_RADIUS) && + if (LOGIC_CONDITION_GLOBAL_FLAG(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_LOITER_RADIUS) && !(FLIGHT_MODE(FAILSAFE_MODE) || FLIGHT_MODE(NAV_RTH_MODE) || FLIGHT_MODE(NAV_WP_MODE) || navigationIsExecutingAnEmergencyLanding())) { return constrain(logicConditionValuesByType[LOGIC_CONDITION_LOITER_OVERRIDE], loiterRadius, 100000); } else { diff --git a/src/main/programming/logic_condition.h b/src/main/programming/logic_condition.h index 5defafaee67..25d6a5a9e1f 100644 --- a/src/main/programming/logic_condition.h +++ b/src/main/programming/logic_condition.h @@ -143,6 +143,7 @@ typedef enum { LOGIC_CONDITION_OPERAND_FLIGHT_ATTITUDE_YAW, // deg // 40 LOGIC_CONDITION_OPERAND_FLIGHT_FW_LAND_STATE, // 41 LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE, // int // 42 + LOGIC_CONDITION_OPERAND_FLIGHT_FLOWN_LOITER_RADIUS, // 43 } logicFlightOperands_e; typedef enum { From 698ecad29b6695ad3404b9b5cc20035eead12787 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sat, 29 Jun 2024 17:17:51 +0100 Subject: [PATCH 314/429] Update Programming Framework.md --- docs/Programming Framework.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/Programming Framework.md b/docs/Programming Framework.md index 4eb7744e54e..b2ce6fe3b93 100644 --- a/docs/Programming Framework.md +++ b/docs/Programming Framework.md @@ -1,10 +1,10 @@ # INAV Programming Framework -INAV Programming Framework (IPF) is a mechanism that allows you to to create +INAV Programming Framework (IPF) is a mechanism that allows you to to create custom functionality in INAV. You can choose for certain actions to be done, based on custom conditions you select. -Logic conditions can be based on things such as RC channel values, switches, altitude, +Logic conditions can be based on things such as RC channel values, switches, altitude, distance, timers, etc. The conditions you create can also make use of other conditions you've entered previously. The results can be used in: @@ -56,8 +56,8 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | 9 | XOR | `true` if `Operand A` or `Operand B` is `true`, but not both | | 10 | NAND | `false` if `Operand A` and `Operand B` are both `true`| | 11 | NOR | `true` if `Operand A` and `Operand B` are both `false` | -| 12 | NOT | The boolean opposite to `Operand A` | -| 13 | Sticky | `Operand A` is the activation operator, `Operand B` is the deactivation operator. After the activation is `true`, the operator will return `true` until Operand B is evaluated as `true`| +| 12 | NOT | The boolean opposite to `Operand A` | +| 13 | Sticky | `Operand A` is the activation operator, `Operand B` is the deactivation operator. After the activation is `true`, the operator will return `true` until Operand B is evaluated as `true`| | 14 | Basic: Add | Add `Operand A` to `Operand B` and returns the result | | 15 | Basic: Subtract | Substract `Operand B` from `Operand A` and returns the result | | 16 | Basic: Multiply | Multiply `Operand A` by `Operand B` and returns the result | @@ -147,7 +147,7 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | 26 | Stabilized Pitch | Pitch PID controller output `[-500:500]` | | 27 | Stabilized Yaw | Yaw PID controller output `[-500:500]` | | 28 | 3D home distance [m] | 3D distance to home in `meters`. Calculated from Home distance and Altitude using Pythagorean theorem | -| 29 | CRSF LQ | Link quality as returned by the CRSF protocol | +| 29 | CRSF LQ | Link quality as returned by the CRSF protocol | | 30 | CRSF SNR | SNR as returned by the CRSF protocol | | 31 | GPS Valid Fix | Boolean `0`/`1`. True when the GPS has a valid 3D Fix | | 32 | Loiter Radius [cm] | The current loiter radius in cm. | @@ -161,6 +161,7 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn | 40 | Yaw [deg] | Current heading (yaw) in `degrees` | | 41 | FW Land Sate | Integer `1` - `5`, indicates the status of the FW landing, 0 Idle, 1 Downwind, 2 Base Leg, 3 Final Approach, 4 Glide, 5 Flare | | 42 | Current battery profile | The active battery profile. Integer `[1..MAX_PROFILE_COUNT]` | +| 43 | Flown Loiter Radius [m] | The actual loiter radius flown by a fixed wing during hold modes, in `meters` | #### FLIGHT_MODE @@ -183,7 +184,7 @@ The flight mode operands return `true` when the mode is active. These are modes | 12 | USER 3 | `true` when the **USER 3** mode is active. | | 13 | USER 4 | `true` when the **USER 4** mode is active. | | 14 | Acro | `true` when you are in the **Acro** flight mode. | -| 15 | Waypoint Mission | `true` when you are in the **WP Mission** flight mode. | +| 15 | Waypoint Mission | `true` when you are in the **WP Mission** flight mode. | #### WAYPOINTS @@ -216,7 +217,7 @@ The flight mode operands return `true` when the mode is active. These are modes | JUMP | 6 | | SET_HEAD | 7 | | LAND | 8 | - + ### Flags All flags are reseted on ARM and DISARM event. @@ -333,7 +334,7 @@ Steps: ## Common issues / questions about IPF -One common mistake involves setting RC channel values. To override (set) the +One common mistake involves setting RC channel values. To override (set) the value of a specific RC channel, choose "Override RC value", then for operand A choose *value* and enter the channel number. Choosing "get RC value" is a common mistake, which does something other than what you probably want. From 6f40120a24ec9d7192c40d59f64a91cefef166d0 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 29 Jun 2024 21:16:26 +0200 Subject: [PATCH 315/429] Make gyro LULU independent from the gyro LPF --- src/main/build/debug.h | 1 + src/main/fc/settings.yaml | 8 +++++++- src/main/sensors/gyro.c | 33 ++++++++++++++++++++++++--------- src/main/sensors/gyro.h | 1 + 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index fea424b9005..ef32bf88734 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -76,6 +76,7 @@ typedef enum { DEBUG_POS_EST, DEBUG_ADAPTIVE_FILTER, DEBUG_HEADTRACKING, + DEBUG_LULU, DEBUG_COUNT } debugType_e; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index ff42fb18fa7..1631d44b437 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -83,7 +83,7 @@ tables: values: ["NONE", "AGL", "FLOW_RAW", "FLOW", "ALWAYS", "SAG_COMP_VOLTAGE", "VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC", "NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE", - "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER", "HEADTRACKER" ] + "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", "ADAPTIVE_FILTER", "HEADTRACKER", "LULU" ] - name: aux_operator values: ["OR", "AND"] enum: modeActivationOperator_e @@ -226,10 +226,16 @@ groups: default_value: 250 field: gyro_anti_aliasing_lpf_hz max: 1000 + - name: gyro_lulu_enabled + description: "Enable/disable gyro LULU filter" + default_value: OFF + field: gyroLuluEnabled + type: bool - name: gyro_lulu_sample_count description: "Gyro lulu sample count, in number of samples." default_value: 3 field: gyroLuluSampleCount + min: 1 max: 15 - name: gyro_main_lpf_hz description: "Software based gyro main lowpass filter. Value is cutoff frequency (Hz)" diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 780bada378d..9fa0a7c0e4d 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -135,7 +135,8 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig, .adaptiveFilterIntegratorThresholdLow = SETTING_GYRO_ADAPTIVE_FILTER_INTEGRATOR_THRESHOLD_LOW_DEFAULT, #endif .gyroFilterMode = SETTING_GYRO_FILTER_MODE_DEFAULT, - .gyroLuluSampleCount = SETTING_GYRO_LULU_SAMPLE_COUNT_DEFAULT + .gyroLuluSampleCount = SETTING_GYRO_LULU_SAMPLE_COUNT_DEFAULT, + .gyroLuluEnabled = SETTING_GYRO_LULU_ENABLED_DEFAULT ); STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHardware) @@ -248,9 +249,9 @@ static void initGyroFilter(filterApplyFnPtr *applyFn, filter_t state[], uint16_t { *applyFn = nullFilterApply; if (cutoff > 0) { + *applyFn = (filterApplyFnPtr)pt1FilterApply; for (int axis = 0; axis < 3; axis++) { pt1FilterInit(&state[axis].pt1, cutoff, US2S(looptime)); - *applyFn = (filterApplyFnPtr)pt1FilterApply; } } } @@ -260,14 +261,17 @@ static void gyroInitFilters(void) //First gyro LPF running at full gyro frequency 8kHz initGyroFilter(&gyroLpfApplyFn, gyroLpfState, gyroConfig()->gyro_anti_aliasing_lpf_hz, getGyroLooptime()); - /* - luluFilterInit(&state[axis].lulu, cutoff); - *applyFn = (filterApplyFnPtr)luluFilterApply; - - initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyroLuluSampleCount, getLooptime(), FILTER_LULU); - */ + if (gyroConfig()->gyroLuluEnabled && gyroConfig()->gyroLuluSampleCount > 0) { + gyroLuluApplyFn = (filterApplyFnPtr)luluFilterApply; - if(gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_OFF) { + for (int axis = 0; axis < 3; axis++) { + luluFilterInit(&gyroLuluState[axis].lulu, gyroConfig()->gyroLuluSampleCount); + } + } else { + gyroLuluApplyFn = nullFilterApply; + } + + if (gyroConfig()->gyroFilterMode != GYRO_FILTER_MODE_OFF) { initGyroFilter(&gyroLpf2ApplyFn, gyroLpf2State, gyroConfig()->gyro_main_lpf_hz, getLooptime()); } else { gyroLpf2ApplyFn = nullFilterApply; @@ -467,6 +471,17 @@ void FAST_CODE NOINLINE gyroFilter(void) gyroADCf = rpmFilterGyroApply(axis, gyroADCf); #endif + // LULU gyro filter + DEBUG_SET(DEBUG_LULU, axis, gyroADCf); //Pre LULU debug + float preLulu = gyroADCf; + gyroADCf = gyroLuluApplyFn((filter_t *) &gyroLuluState[axis], gyroADCf); + DEBUG_SET(DEBUG_LULU, axis + 3, gyroADCf); //Post LULU debug + + if (axis == ROLL) { + DEBUG_SET(DEBUG_LULU, 6, gyroADCf - preLulu); //LULU delta debug + } + + // Gyro Main LPF gyroADCf = gyroLpf2ApplyFn((filter_t *) &gyroLpf2State[axis], gyroADCf); #ifdef USE_ADAPTIVE_FILTER diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index c6f60b45bbb..de78b2f81c2 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -105,6 +105,7 @@ typedef struct gyroConfig_s { uint8_t gyroFilterMode; uint8_t gyroLuluSampleCount; + bool gyroLuluEnabled; } gyroConfig_t; PG_DECLARE(gyroConfig_t, gyroConfig); From 449fb373f56680644b6f2dbb671810c2507d7592 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 29 Jun 2024 21:17:30 +0200 Subject: [PATCH 316/429] Docs update --- docs/Settings.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/Settings.md b/docs/Settings.md index 872c63bc423..a217a26a981 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1782,13 +1782,23 @@ Specifies the type of the software LPF of the gyro signals. --- +### gyro_lulu_enabled + +Enable/disable gyro LULU filter + +| Default | Min | Max | +| --- | --- | --- | +| OFF | OFF | ON | + +--- + ### gyro_lulu_sample_count Gyro lulu sample count, in number of samples. | Default | Min | Max | | --- | --- | --- | -| 3 | | 15 | +| 3 | 1 | 15 | --- From 0b237d1f06048fa03a24d1a9f4288f5a6b99cf8b Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:50:31 +0100 Subject: [PATCH 317/429] nav course hold yaw stick improvement --- src/main/navigation/navigation.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 6eed742e804..5c0d7ec3431 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -1339,6 +1339,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_COURSE_HOLD_IN_PROGRESS } const bool mcRollStickHeadingAdjustmentActive = STATE(MULTIROTOR) && ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband; + static bool adjustmentWasActive = false; // User demanding yaw -> yaw stick on FW, yaw or roll sticks on MR // We record the desired course and change the desired target in the meanwhile @@ -1353,9 +1354,19 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_COURSE_HOLD_IN_PROGRESS if (timeDifference > 100) timeDifference = 0; // if adjustment was called long time ago, reset the time difference. float rateTarget = scaleRangef((float)headingAdjustCommand, -500.0f, 500.0f, -cruiseYawRate, cruiseYawRate); float centidegsPerIteration = rateTarget * MS2S(timeDifference); - posControl.cruise.course = wrap_36000(posControl.cruise.course - centidegsPerIteration); - DEBUG_SET(DEBUG_CRUISE, 1, CENTIDEGREES_TO_DEGREES(posControl.cruise.course)); + + if (ABS(wrap_18000(posControl.cruise.course - posControl.actualState.cog)) < fabsf(rateTarget)) { + posControl.cruise.course = wrap_36000(posControl.cruise.course - centidegsPerIteration); + } + posControl.cruise.lastCourseAdjustmentTime = currentTimeMs; + adjustmentWasActive = true; + + DEBUG_SET(DEBUG_CRUISE, 1, CENTIDEGREES_TO_DEGREES(posControl.cruise.course)); + } else if (STATE(AIRPLANE) && adjustmentWasActive) { + posControl.cruise.course = posControl.actualState.cog - DEGREES_TO_CENTIDEGREES(gyroRateDps(YAW)); + resetPositionController(); + adjustmentWasActive = false; } else if (currentTimeMs - posControl.cruise.lastCourseAdjustmentTime > 4000) { posControl.cruise.previousCourse = posControl.cruise.course; } From 1c427dab0114ce53e0d63aa0c1d203875e6ea52f Mon Sep 17 00:00:00 2001 From: p-i-engineer Date: Tue, 2 Jul 2024 06:32:47 -0700 Subject: [PATCH 318/429] Fixed position for formation flight / inav radar --- src/main/cms/cms_menu_osd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/cms/cms_menu_osd.c b/src/main/cms/cms_menu_osd.c index 4bde1291d5e..e99e0cc52f2 100644 --- a/src/main/cms/cms_menu_osd.c +++ b/src/main/cms/cms_menu_osd.c @@ -237,6 +237,7 @@ static const OSD_Entry menuOsdElemsEntries[] = OSD_ELEMENT_ENTRY("RADAR", OSD_RADAR), OSD_ELEMENT_ENTRY("MAP SCALE", OSD_MAP_SCALE), OSD_ELEMENT_ENTRY("MAP REFERENCE", OSD_MAP_REFERENCE), + OSD_ELEMENT_ENTRY("FORMATION FLIGHT", OSD_FORMATION_FLIGHT), #endif OSD_ELEMENT_ENTRY("EXPO", OSD_RC_EXPO), OSD_ELEMENT_ENTRY("YAW EXPO", OSD_RC_YAW_EXPO), From 6e3bf5198dcdc3f52887d0a596431fcecb7bf3fa Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:52:16 +0200 Subject: [PATCH 319/429] Fix signal info struct size for NAV_SIG devices --- src/main/fc/cli.c | 35 +++++++++++++++----------- src/main/io/gps_ublox.c | 13 ++++++++-- src/main/io/gps_ublox.h | 39 ++++++++++++++++++++++++----- src/test/unit/gps_ublox_unittest.cc | 6 +++++ 4 files changed, 70 insertions(+), 23 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index fe54e175b27..7320ef060d6 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -4370,15 +4370,15 @@ static const char* _ubloxGetSigId(uint8_t gnssId, uint8_t sigId) static const char *_ubloxGetQuality(uint8_t quality) { switch(quality) { - case 0: return "No signal"; - case 1: return "Searching signal..."; - case 2: return "Signal acquired"; - case 3: return "Signal detected but unusable"; - case 4: return "Code locked and time synch"; - case 5: - case 6: - case 7: - return "Code and carrier locked and time synch"; + case UBLOX_SIG_QUALITY_NOSIGNAL: return "No signal"; + case UBLOX_SIG_QUALITY_SEARCHING: return "Searching signal..."; + case UBLOX_SIG_QUALITY_ACQUIRED: return "Signal acquired"; + case UBLOX_SIG_QUALITY_UNUSABLE: return "Signal detected but unusable"; + case UBLOX_SIG_QUALITY_CODE_LOCK_TIME_SYNC: return "Code locked and time sync"; + case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC: + case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC2: + case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC3: + return "Code and carrier locked and time sync"; default: return "Unknown"; } } @@ -4407,12 +4407,17 @@ static void cliUbloxPrintSatelites(char *arg) //cliPrintLinef("Correlation: %i", sat->corrSource); //cliPrintLinef("Iono model: %i", sat->ionoModel); cliPrintLinef("signal flags: 0x%02X", sat->sigFlags); - if(sat->sigFlags & 0x01) { - cliPrintLine("signal: Healthy"); - } else if (sat->sigFlags & 0x02) { - cliPrintLine("signal: Unhealthy"); - } else { - cliPrintLine("signal: Unknown"); + switch(sat->sigFlags & UBLOX_SIG_HEALTH_MASK) { + case UBLOX_SIG_HEALTH_HEALTHY: + cliPrintLine("signal: Healthy"); + break; + case UBLOX_SIG_HEALTH_UNHEALTHY: + cliPrintLine("signal: Unhealthy"); + break; + case UBLOX_SIG_HEALTH_UNKNOWN: + default: + cliPrintLinef("signal: Unknown (0x%X)", sat->sigFlags & UBLOX_SIG_HEALTH_MASK); + break; } cliPrintLinefeed(); } diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 679bcf91e33..80bee7db441 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -720,23 +720,32 @@ static bool gpsParseFrameUBLOX(void) } break; - case MSG_SIG_INFO: + case MSG_NAV_SIG: if (_class == CLASS_NAV && _buffer.navsig.version == 0) { static int sigInfoCount = 0; DEBUG_SET(DEBUG_GPS, 2, sigInfoCount++); - DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); gpsState.flags.sig = 1; + // + //gpsSolDRV.numSat = _buffer.navSig.numSigs; // if good + int okSats = 0; if(_buffer.navsig.numSigs > 0) { for(int i=0; i < MIN(UBLOX_MAX_SIGNALS, _buffer.navsig.numSigs); ++i) { memcpy(&satelites[i], &_buffer.navsig.sig[i], sizeof(ubx_nav_sig_info)); + if ((_buffer.navsig.sig[i].sigFlags & UBLOX_SIG_HEALTH_MASK) == UBLOX_SIG_HEALTH_HEALTHY && + _buffer.navsig.sig[i].quality >= UBLOX_SIG_QUALITY_CODE_LOCK_TIME_SYNC) + { + okSats++; + } } for(int i = _buffer.navsig.numSigs; i < UBLOX_MAX_SIGNALS; ++i) { satelites[i].svId = 0xFF; // no used } } + //DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); + DEBUG_SET(DEBUG_GPS, 4, okSats); } break; case MSG_ACK_ACK: diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index c79c4654292..3a1c145b1b0 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -21,6 +21,7 @@ #include #include "common/time.h" +#include "build/debug.h" #ifdef __cplusplus extern "C" { @@ -28,8 +29,8 @@ extern "C" { #define GPS_CFG_CMD_TIMEOUT_MS 500 #define GPS_VERSION_RETRY_TIMES 3 -#define UBLOX_MAX_SIGNALS 32 -#define MAX_UBLOX_PAYLOAD_SIZE 640 // enough for anyone? // UBX-NAV-SIG info would be UBLOX_MAX_SIGNALS + 8 for (32 * 16) + 8 = 520 bytes +#define UBLOX_MAX_SIGNALS 64 +#define MAX_UBLOX_PAYLOAD_SIZE 1048 // enough for anyone? // UBX-NAV-SIG info would be UBLOX_MAX_SIGNALS * 16 + 8 for (64 * 16) + 8 = 1032 bytes #define UBLOX_BUFFER_SIZE MAX_UBLOX_PAYLOAD_SIZE #define UBLOX_SBAS_MESSAGE_LENGTH 16 #define GPS_CAPA_INTERVAL 5000 @@ -182,6 +183,33 @@ typedef struct { uint8_t reserved; } __attribute__((packed)) ubx_config_data_header_v1_t; +#define UBLOX_SIG_HEALTH_MASK (BIT(0) | BIT(1)) +#define UBLOX_SIG_PRSMOOTHED (BIT(2)) +#define UBLOX_SIG_PRUSED (BIT(3)) +#define UBLOX_SIG_CRUSED (BIT(4)) +#define UBLOX_SIG_DOUSED (BIT(5)) +#define UBLOX_SIG_PRCORRUSED (BIT(6)) +#define UBLOX_SIG_CRCORRUSED (BIT(7)) +#define UBLOX_SIG_DOCORRUSED (BIT(8)) +#define UBLOX_SIG_AUTHSTATUS (BIT(9)) + +typedef enum { + UBLOX_SIG_HEALTH_UNKNOWN = 0, + UBLOX_SIG_HEALTH_HEALTHY = 1, + UBLOX_SIG_HEALTH_UNHEALTHY = 2 +} ublox_nav_sig_health_e; + +typedef enum { + UBLOX_SIG_QUALITY_NOSIGNAL = 0, + UBLOX_SIG_QUALITY_SEARCHING = 1, + UBLOX_SIG_QUALITY_ACQUIRED = 2, + UBLOX_SIG_QUALITY_UNUSABLE = 3, + UBLOX_SIG_QUALITY_CODE_LOCK_TIME_SYNC = 4, + UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC = 5, + UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC2 = 6, + UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC3 = 7, +} ublox_nav_sig_quality; + typedef struct { uint8_t gnssId; // gnssid 0 = GPS, 1 = SBAS, 2 = GALILEO, 3 = BEIDOU, 4 = IMES, 5 = QZSS, 6 = GLONASS uint8_t svId; // space vehicle ID @@ -192,7 +220,7 @@ typedef struct { uint8_t quality; // 0 = no signal, 1 = search, 2 = acq, 3 = detected, 4 = code lock + time, 5,6,7 = code/carrier lock + time uint8_t corrSource; // Correction source: 0 = no correction, 1 = SBAS, 2 = BeiDou, 3 = RTCM2, 4 = RTCM3 OSR, 5 = RTCM3 SSR, 6 = QZSS SLAS, 7 = SPARTN uint8_t ionoModel; // 0 = no mode, 1 = Klobuchar GPS, 2 = SBAS, 3 = Klobuchar BeiDou, 8 = Iono derived from dual frequency observations - uint16_t sigFlags; // bit:0-1, 0 = unknown, 1 = healthy, 2 = unhealthy + uint16_t sigFlags; // bit:0-1 UBLOX_SIG_HEALTH_MASK // bit2: pseudorange smoothed, // bit3: pseudorange used, // bit4: carrioer range used; @@ -200,7 +228,7 @@ typedef struct { // bit6: pseudorange corrections used // bit7: carrier correction used // bit8: doper corrections used - uint8_t reserved; + uint8_t reserved[4]; } __attribute__((packed)) ubx_nav_sig_info; typedef struct { @@ -429,7 +457,6 @@ typedef enum { MSG_TIMEUTC = 0x21, MSG_SVINFO = 0x30, MSG_NAV_SAT = 0x35, - MSG_NAV_SIG = 0x35, MSG_CFG_PRT = 0x00, MSG_CFG_RATE = 0x08, MSG_CFG_SET_RATE = 0x01, @@ -437,7 +464,7 @@ typedef enum { MSG_CFG_SBAS = 0x16, MSG_CFG_GNSS = 0x3e, MSG_MON_GNSS = 0x28, - MSG_SIG_INFO = 0x43 + MSG_NAV_SIG = 0x43 } ubx_protocol_bytes_t; typedef enum { diff --git a/src/test/unit/gps_ublox_unittest.cc b/src/test/unit/gps_ublox_unittest.cc index bc20b340251..04de34e283b 100644 --- a/src/test/unit/gps_ublox_unittest.cc +++ b/src/test/unit/gps_ublox_unittest.cc @@ -87,4 +87,10 @@ TEST(GPSUbloxTest, TestUbloxCfgFillBytes) // osdFormatCentiNumber(buf, 12345, 1, 2, 3, 7); // std::cout << "'" << buf << "'" << std::endl; //EXPECT_FALSE(strcmp(buf, " 123.45")); +} + +TEST(GPSUbloxTest, navSigStructureSizes) { + EXPECT_TRUE(sizeof(ubx_nav_sig_info) == 16); + + EXPECT_TRUE(sizeof(ubx_nav_sig) == (8 + (16 * UBLOX_MAX_SIGNALS))); } \ No newline at end of file From cdcbd3f7ff7b27554612f0cc8c4ff94906e8ef2b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:53:56 +0200 Subject: [PATCH 320/429] Remove some debugging info --- src/main/io/gps_ublox.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 80bee7db441..d674ea2d9de 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -724,28 +724,20 @@ static bool gpsParseFrameUBLOX(void) if (_class == CLASS_NAV && _buffer.navsig.version == 0) { static int sigInfoCount = 0; DEBUG_SET(DEBUG_GPS, 2, sigInfoCount++); + DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); gpsState.flags.sig = 1; - // - //gpsSolDRV.numSat = _buffer.navSig.numSigs; // if good - int okSats = 0; + if(_buffer.navsig.numSigs > 0) { for(int i=0; i < MIN(UBLOX_MAX_SIGNALS, _buffer.navsig.numSigs); ++i) { memcpy(&satelites[i], &_buffer.navsig.sig[i], sizeof(ubx_nav_sig_info)); - if ((_buffer.navsig.sig[i].sigFlags & UBLOX_SIG_HEALTH_MASK) == UBLOX_SIG_HEALTH_HEALTHY && - _buffer.navsig.sig[i].quality >= UBLOX_SIG_QUALITY_CODE_LOCK_TIME_SYNC) - { - okSats++; - } } for(int i = _buffer.navsig.numSigs; i < UBLOX_MAX_SIGNALS; ++i) { satelites[i].svId = 0xFF; // no used } } - //DEBUG_SET(DEBUG_GPS, 4, _buffer.navsig.numSigs); - DEBUG_SET(DEBUG_GPS, 4, okSats); } break; case MSG_ACK_ACK: From db459e5a4971bb78d2a99296197d9ffc7d9bed49 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:18:09 +0200 Subject: [PATCH 321/429] NAV_SAT parsing --- src/main/io/gps_ublox.c | 12 ++---------- src/main/io/gps_ublox.h | 3 ++- src/main/io/gps_ublox_utils.c | 25 +++++++++++++++++++++++++ src/main/io/gps_ublox_utils.h | 2 ++ src/test/unit/gps_ublox_unittest.cc | 4 ++++ 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index d674ea2d9de..ae81326dd62 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -705,19 +705,11 @@ static bool gpsParseFrameUBLOX(void) } for(int i =0; i < MIN(_buffer.svinfo.numSvs, UBLOX_MAX_SIGNALS); ++i) { - satelites[i].svId = _buffer.svinfo.channel[i].svId; - satelites[i].gnssId = _buffer.svinfo.channel[i].gnssId; - satelites[i].sigId = 0; - satelites[i].cno = _buffer.svinfo.channel[i].cno; - satelites[i].cno = _buffer.svinfo.channel[i].flags; - satelites[i].quality = _buffer.svinfo.channel[i].flags & 0x3; - satelites[i].sigFlags = (_buffer.svinfo.channel[i].flags >> 4 & 0x3); // Healthy, not healthy - //satelites[i].cno = _buffer.svinfo.channel[i].quality; + ubloxNavSat2NavSig(&_buffer.svinfo.channel[i], &satelites[i]); } for(int i =_buffer.svinfo.numSvs; i < UBLOX_MAX_SIGNALS; ++i) { - satelites->svId = 0; + satelites->svId = 0xFF; } - } break; case MSG_NAV_SIG: diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 3a1c145b1b0..d1e9b148a65 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -21,6 +21,7 @@ #include #include "common/time.h" +#include "common/utils.h" #include "build/debug.h" #ifdef __cplusplus @@ -350,7 +351,7 @@ typedef struct { typedef struct { uint32_t itow; // GPS Millisecond time of week - uint8_t version; // Version = 0 + uint8_t version; // Version = 0-1 uint8_t numSvs; // (Space vehicle) Satelite count uint16_t reserved2; // Reserved ubx_nav_svinfo_channel channel[UBLOX_MAX_SIGNALS]; // UBLOX_MAX_SIGNALS satellites * 12 byte diff --git a/src/main/io/gps_ublox_utils.c b/src/main/io/gps_ublox_utils.c index 97c5bf5cd9a..bf0d0f264c0 100644 --- a/src/main/io/gps_ublox_utils.c +++ b/src/main/io/gps_ublox_utils.c @@ -17,6 +17,7 @@ #include +#include #include "gps_ublox_utils.h" @@ -60,3 +61,27 @@ int ubloxCfgFillBytes(ubx_config_data8_t *cfg, ubx_config_data8_payload_t *kvPai return count; } +void ubloxNavSat2NavSig(const ubx_nav_svinfo_channel *navSat, ubx_nav_sig_info *navSig) +{ + memset(navSig, 0, sizeof(ubx_nav_sig_info)); + navSig->svId = navSat->svId; + navSig->gnssId = navSat->gnssId; + navSig->cno = navSat->cno; + navSig->prRes = navSat->prRes; + navSig->quality = navSat->flags & (BIT(0)|BIT(1)|BIT(3)); + navSig->sigFlags = (navSat->flags >> 4) & (BIT(0)|BIT(1)); // Healthy, not healthy + // non-converted items: + //uint8_t sigId; // signal ID + //uint8_t freqId; // 0-13 slot +, 0-13, glonass only + //uint8_t corrSource; // Correction source: 0 = no correction, 1 = SBAS, 2 = BeiDou, 3 = RTCM2, 4 = RTCM3 OSR, 5 = RTCM3 SSR, 6 = QZSS SLAS, 7 = SPARTN + //uint8_t ionoModel; // 0 = no mode, 1 = Klobuchar GPS, 2 = SBAS, 3 = Klobuchar BeiDou, 8 = Iono derived from dual frequency observations + //uint16_t sigFlags; + // bit2: pseudorange smoothed, + // bit3: pseudorange used, + // bit4: carrioer range used; + // bit5: doppler used + // bit6: pseudorange corrections used + // bit7: carrier correction used + // bit8: doper corrections used + //uint8_t reserved[4]; +} \ No newline at end of file diff --git a/src/main/io/gps_ublox_utils.h b/src/main/io/gps_ublox_utils.h index e7ae0caac90..502bbaf31a6 100644 --- a/src/main/io/gps_ublox_utils.h +++ b/src/main/io/gps_ublox_utils.h @@ -29,6 +29,8 @@ int ubloxCfgFillBytes(ubx_config_data8_t *cfg, ubx_config_data8_payload_t *kvPai void ublox_update_checksum(uint8_t *data, uint8_t len, uint8_t *ck_a, uint8_t *ck_b); +void ubloxNavSat2NavSig(const ubx_nav_svinfo_channel *navSat, ubx_nav_sig_info *navSig); + #ifdef __cplusplus } #endif diff --git a/src/test/unit/gps_ublox_unittest.cc b/src/test/unit/gps_ublox_unittest.cc index 04de34e283b..0628f8a1bdd 100644 --- a/src/test/unit/gps_ublox_unittest.cc +++ b/src/test/unit/gps_ublox_unittest.cc @@ -93,4 +93,8 @@ TEST(GPSUbloxTest, navSigStructureSizes) { EXPECT_TRUE(sizeof(ubx_nav_sig_info) == 16); EXPECT_TRUE(sizeof(ubx_nav_sig) == (8 + (16 * UBLOX_MAX_SIGNALS))); + + EXPECT_TRUE(sizeof(ubx_nav_svinfo_channel) == 12); + + EXPECT_TRUE(sizeof(ubx_nav_svinfo) == (8 + (12 * UBLOX_MAX_SIGNALS); } \ No newline at end of file From 78a6a2a858d62e0ff2cda3a3cb8183a9fbe6411b Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:24:39 +0200 Subject: [PATCH 322/429] Fix test --- src/test/unit/gps_ublox_unittest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/unit/gps_ublox_unittest.cc b/src/test/unit/gps_ublox_unittest.cc index 0628f8a1bdd..ea5164b32a0 100644 --- a/src/test/unit/gps_ublox_unittest.cc +++ b/src/test/unit/gps_ublox_unittest.cc @@ -96,5 +96,5 @@ TEST(GPSUbloxTest, navSigStructureSizes) { EXPECT_TRUE(sizeof(ubx_nav_svinfo_channel) == 12); - EXPECT_TRUE(sizeof(ubx_nav_svinfo) == (8 + (12 * UBLOX_MAX_SIGNALS); + EXPECT_TRUE(sizeof(ubx_nav_svinfo) == (8 + (12 * UBLOX_MAX_SIGNALS))); } \ No newline at end of file From 7677abeb0c19bf50c9844f22ccb0a9b438a9bf0d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 3 Jul 2024 23:03:17 +0200 Subject: [PATCH 323/429] cleanup and static asserts --- src/main/io/gps_ublox.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index d1e9b148a65..287124581d4 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -21,6 +21,7 @@ #include #include "common/time.h" +#include "common/maths.h" #include "common/utils.h" #include "build/debug.h" @@ -30,12 +31,16 @@ extern "C" { #define GPS_CFG_CMD_TIMEOUT_MS 500 #define GPS_VERSION_RETRY_TIMES 3 +#ifndef UBLOX_MAX_SIGNALS #define UBLOX_MAX_SIGNALS 64 -#define MAX_UBLOX_PAYLOAD_SIZE 1048 // enough for anyone? // UBX-NAV-SIG info would be UBLOX_MAX_SIGNALS * 16 + 8 for (64 * 16) + 8 = 1032 bytes +#endif +#define MAX_UBLOX_PAYLOAD_SIZE ((UBLOX_MAX_SIGNALS * 16) + 8) // UBX-NAV-SIG info would be UBLOX_MAX_SIGNALS * 16 + 8 #define UBLOX_BUFFER_SIZE MAX_UBLOX_PAYLOAD_SIZE #define UBLOX_SBAS_MESSAGE_LENGTH 16 #define GPS_CAPA_INTERVAL 5000 +STATIC_ASSERT(MAX_UBLOX_PAYLOAD_SIZE >= 256, ubx_size_too_small); + #define UBX_DYNMODEL_PEDESTRIAN 3 #define UBX_DYNMODEL_AUTOMOVITE 4 #define UBX_DYNMODEL_AIR_1G 6 @@ -232,6 +237,8 @@ typedef struct { uint8_t reserved[4]; } __attribute__((packed)) ubx_nav_sig_info; +STATIC_ASSERT(sizeof(ubx_nav_sig_info) == 16, wrong_ubx_nav_sig_info_size); + typedef struct { uint32_t time; // GPS iToW uint8_t version; // We support version 0 @@ -349,6 +356,8 @@ typedef struct { uint32_t flags; // Bitmask } ubx_nav_svinfo_channel; +STATIC_ASSERT(sizeof(ubx_nav_svinfo_channel) == 12, wrong_ubx_nav_svinfo_channel_size); + typedef struct { uint32_t itow; // GPS Millisecond time of week uint8_t version; // Version = 0-1 From 341bb4f15f77c9c8001c68a8bd333531aac4ea36 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:38:05 +0200 Subject: [PATCH 324/429] Add warning about old ublox versions --- src/main/fc/cli.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 7320ef060d6..c99e9111f5a 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3892,6 +3892,9 @@ static void cliStatus(char *cmdline) if (featureConfigured(FEATURE_GPS) && isGpsUblox()) { cliPrint("GPS: "); cliPrintf("HW Version: %s Proto: %d.%02d Baud: %d", getGpsHwVersion(), getGpsProtoMajorVersion(), getGpsProtoMinorVersion(), getGpsBaudrate()); + if(ubloxVersionLT(15, 0)) { + cliPrintf(" (UBLOX SW >= 15.0 required)"); + } cliPrintLinefeed(); cliPrintLinef(" SATS: %i", gpsSol.numSat); cliPrintLinef(" HDOP: %f", (double)(gpsSol.hdop / (float)HDOP_SCALE)); From 29ee096e336de7d20c5c35a516258f2866326fc1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:38:19 +0200 Subject: [PATCH 325/429] Make UBLOX functionally equal to UBLOX7 --- src/main/io/gps_ublox.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index ae81326dd62..175d283ddd4 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -704,7 +704,7 @@ static bool gpsParseFrameUBLOX(void) gpsSolDRV.numSat = _buffer.svinfo.numSvs; } - for(int i =0; i < MIN(_buffer.svinfo.numSvs, UBLOX_MAX_SIGNALS); ++i) { + for(int i = 0; i < MIN(_buffer.svinfo.numSvs, UBLOX_MAX_SIGNALS); ++i) { ubloxNavSat2NavSig(&_buffer.svinfo.channel[i], &satelites[i]); } for(int i =_buffer.svinfo.numSvs; i < UBLOX_MAX_SIGNALS; ++i) { @@ -978,7 +978,7 @@ STATIC_PROTOTHREAD(gpsConfigure) }// end message config ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_SHORT_TIMEOUT); - if ((gpsState.gpsConfig->provider == GPS_UBLOX7PLUS) && (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { + if ((gpsState.hwVersion >= UBX_HW_VERSION_UBLOX7)) { configureRATE(hz2rate(gpsState.gpsConfig->ubloxNavHz)); // default 10Hz } else { configureRATE(hz2rate(5)); // 5Hz @@ -1156,6 +1156,12 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) void gpsRestartUBLOX(void) { + for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) + { + memset(&satelites[i], 0, sizeof(ubx_nav_sig_info)); + satelites[i].svId = 0xFF; + } + ptSemaphoreInit(semNewDataReady); ptRestart(ptGetHandle(gpsProtocolReceiverThread)); ptRestart(ptGetHandle(gpsProtocolStateThread)); From 017cb30bef73de8c8036e7cb9aa47aba08dbe629 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 4 Jul 2024 20:15:55 +0200 Subject: [PATCH 326/429] Small fixes. Add warning about ublox protocol version < 15.00 --- src/main/fc/cli.c | 2 +- src/main/io/gps_ublox.c | 20 ++++++++++++-------- src/main/io/gps_ublox_utils.c | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index c99e9111f5a..580859fec0c 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3893,7 +3893,7 @@ static void cliStatus(char *cmdline) cliPrint("GPS: "); cliPrintf("HW Version: %s Proto: %d.%02d Baud: %d", getGpsHwVersion(), getGpsProtoMajorVersion(), getGpsProtoMinorVersion(), getGpsBaudrate()); if(ubloxVersionLT(15, 0)) { - cliPrintf(" (UBLOX SW >= 15.0 required)"); + cliPrintf(" (UBLOX Proto >= 15.0 required)"); } cliPrintLinefeed(); cliPrintLinef(" SATS: %i", gpsSol.numSat); diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 175d283ddd4..fbe4a7f74ff 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -431,10 +431,10 @@ static void configureGNSS(void) { int blocksUsed = 0; send_buffer.message.header.msg_class = CLASS_CFG; - send_buffer.message.header.msg_id = MSG_CFG_GNSS; // message deprecated in protocol > 23.01, should use UBX-CFG-VALSET/UBX-CFG-VALGET + send_buffer.message.header.msg_id = MSG_CFG_GNSS; // message deprecated in protocol > 23.01, should use UBX-CFG-VALSET/UBX-CFG-VALGET send_buffer.message.payload.gnss.msgVer = 0; send_buffer.message.payload.gnss.numTrkChHw = 0; // read only, so unset - send_buffer.message.payload.gnss.numTrkChUse = 0xFF; // If set to 0xFF will use hardware max + send_buffer.message.payload.gnss.numTrkChUse = 0xFF; // If set to 0xFF will use hardware max /* SBAS, always generated */ blocksUsed += configureGNSS_SBAS(&send_buffer.message.payload.gnss.config[blocksUsed]); @@ -442,11 +442,11 @@ static void configureGNSS(void) /* Galileo */ blocksUsed += configureGNSS_GALILEO(&send_buffer.message.payload.gnss.config[blocksUsed]); - /* BeiDou */ - blocksUsed += configureGNSS_BEIDOU(&send_buffer.message.payload.gnss.config[blocksUsed]); + /* BeiDou */ + blocksUsed += configureGNSS_BEIDOU(&send_buffer.message.payload.gnss.config[blocksUsed]); - /* GLONASS */ - blocksUsed += configureGNSS_GLONASS(&send_buffer.message.payload.gnss.config[blocksUsed]); + /* GLONASS */ + blocksUsed += configureGNSS_GLONASS(&send_buffer.message.payload.gnss.config[blocksUsed]); send_buffer.message.payload.gnss.numConfigBlocks = blocksUsed; send_buffer.message.header.length = (sizeof(ubx_gnss_msg_t) + sizeof(ubx_gnss_element_t)* blocksUsed); @@ -708,6 +708,7 @@ static bool gpsParseFrameUBLOX(void) ubloxNavSat2NavSig(&_buffer.svinfo.channel[i], &satelites[i]); } for(int i =_buffer.svinfo.numSvs; i < UBLOX_MAX_SIGNALS; ++i) { + satelites->gnssId = 0xFF; satelites->svId = 0xFF; } } @@ -728,6 +729,7 @@ static bool gpsParseFrameUBLOX(void) for(int i = _buffer.navsig.numSigs; i < UBLOX_MAX_SIGNALS; ++i) { satelites[i].svId = 0xFF; // no used + satelites[i].gnssId = 0xFF; } } } @@ -1028,7 +1030,8 @@ STATIC_PROTOTHREAD(gpsConfigure) for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) { - satelites[i].svId = 0xFF; + satelites[i].svId = 0xFF; // no used + satelites[i].gnssId = 0xFF; } ptEnd(0); @@ -1160,6 +1163,7 @@ void gpsRestartUBLOX(void) { memset(&satelites[i], 0, sizeof(ubx_nav_sig_info)); satelites[i].svId = 0xFF; + satelites[i].gnssId = 0xFF; } ptSemaphoreInit(semNewDataReady); @@ -1191,7 +1195,7 @@ bool isGpsUblox(void) const ubx_nav_sig_info *gpsGetUbloxSatelite(uint8_t index) { - if(index < UBLOX_MAX_SIGNALS && satelites[index].svId != 0xFF) { + if(index < UBLOX_MAX_SIGNALS && satelites[index].svId != 0xFF && satelites[index].gnssId != 0xFF) { return &satelites[index]; } diff --git a/src/main/io/gps_ublox_utils.c b/src/main/io/gps_ublox_utils.c index bf0d0f264c0..a2adf1df18b 100644 --- a/src/main/io/gps_ublox_utils.c +++ b/src/main/io/gps_ublox_utils.c @@ -68,7 +68,7 @@ void ubloxNavSat2NavSig(const ubx_nav_svinfo_channel *navSat, ubx_nav_sig_info * navSig->gnssId = navSat->gnssId; navSig->cno = navSat->cno; navSig->prRes = navSat->prRes; - navSig->quality = navSat->flags & (BIT(0)|BIT(1)|BIT(3)); + navSig->quality = navSat->flags & (BIT(0)|BIT(1)|BIT(2)); navSig->sigFlags = (navSat->flags >> 4) & (BIT(0)|BIT(1)); // Healthy, not healthy // non-converted items: //uint8_t sigId; // signal ID From db54a7c56a9085a41cf9ae4cda1f3153cd93666c Mon Sep 17 00:00:00 2001 From: Hubert <1701213518@sz.pku.edu.cn> Date: Fri, 5 Jul 2024 22:08:41 +0800 Subject: [PATCH 327/429] Add new targets: MicoAir405Mini, 405v2 and 743 --- src/main/target/MICOAIR405MINI/CMakeLists.txt | 1 + src/main/target/MICOAIR405MINI/config.c | 34 +++++ src/main/target/MICOAIR405MINI/target.c | 36 +++++ src/main/target/MICOAIR405MINI/target.h | 142 +++++++++++++++++ src/main/target/MICOAIR405V2/CMakeLists.txt | 1 + src/main/target/MICOAIR405V2/config.c | 34 +++++ src/main/target/MICOAIR405V2/target.c | 37 +++++ src/main/target/MICOAIR405V2/target.h | 143 ++++++++++++++++++ src/main/target/MICOAIR743/CMakeLists.txt | 1 + src/main/target/MICOAIR743/config.c | 34 +++++ src/main/target/MICOAIR743/target.c | 42 +++++ src/main/target/MICOAIR743/target.h | 141 +++++++++++++++++ 12 files changed, 646 insertions(+) create mode 100644 src/main/target/MICOAIR405MINI/CMakeLists.txt create mode 100644 src/main/target/MICOAIR405MINI/config.c create mode 100644 src/main/target/MICOAIR405MINI/target.c create mode 100644 src/main/target/MICOAIR405MINI/target.h create mode 100644 src/main/target/MICOAIR405V2/CMakeLists.txt create mode 100644 src/main/target/MICOAIR405V2/config.c create mode 100644 src/main/target/MICOAIR405V2/target.c create mode 100644 src/main/target/MICOAIR405V2/target.h create mode 100644 src/main/target/MICOAIR743/CMakeLists.txt create mode 100644 src/main/target/MICOAIR743/config.c create mode 100644 src/main/target/MICOAIR743/target.c create mode 100644 src/main/target/MICOAIR743/target.h diff --git a/src/main/target/MICOAIR405MINI/CMakeLists.txt b/src/main/target/MICOAIR405MINI/CMakeLists.txt new file mode 100644 index 00000000000..27ed5c945f4 --- /dev/null +++ b/src/main/target/MICOAIR405MINI/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f405xg(MICOAIR405MINI) \ No newline at end of file diff --git a/src/main/target/MICOAIR405MINI/config.c b/src/main/target/MICOAIR405MINI/config.c new file mode 100644 index 00000000000..00ee10a378d --- /dev/null +++ b/src/main/target/MICOAIR405MINI/config.c @@ -0,0 +1,34 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include "platform.h" +#include "config/config_master.h" +#include "config/feature.h" +#include "io/serial.h" +#include "fc/config.h" +#include "sensors/gyro.h" + + +void targetConfiguration(void) +{ + serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[1].msp_baudrateIndex = BAUD_57600; + serialConfigMutable()->portConfigs[2].functionMask = FUNCTION_MSP_OSD; + serialConfigMutable()->portConfigs[3].functionMask = FUNCTION_GPS; + serialConfigMutable()->portConfigs[5].functionMask = FUNCTION_ESCSERIAL; +} diff --git a/src/main/target/MICOAIR405MINI/target.c b/src/main/target/MICOAIR405MINI/target.c new file mode 100644 index 00000000000..6903cb1cc49 --- /dev/null +++ b/src/main/target/MICOAIR405MINI/target.c @@ -0,0 +1,36 @@ +/* +* This file is part of Cleanflight. +* +* Cleanflight is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Cleanflight is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Cleanflight. If not, see . +*/ + +#include +#include +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 + DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 + DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 + DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 + DEF_TIM(TIM4, CH3, PB8, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 + DEF_TIM(TIM4, CH4, PB9, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 + DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/MICOAIR405MINI/target.h b/src/main/target/MICOAIR405MINI/target.h new file mode 100644 index 00000000000..4b7e0b811da --- /dev/null +++ b/src/main/target/MICOAIR405MINI/target.h @@ -0,0 +1,142 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "MINI" + +#define USBD_PRODUCT_STRING "MICOAIR405MINI" + +// *************** LED ********************** +#define LED0 PC5 +#define LED1 PC4 +#define LED2 PA8 + +// *************** SPI: Gyro & ACC & BARO & OSD & SDCARD ********************** +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define USE_SPI_DEVICE_2 +#define USE_SPI_DEVICE_3 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PC2 +#define SPI2_MOSI_PIN PC3 + +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW0_DEG +#define BMI270_SPI_BUS BUS_SPI2 +#define BMI270_CS_PIN PC14 + +#define USE_BARO +#define USE_BARO_DPS310 +#define DPS310_SPI_BUS BUS_SPI2 +#define DPS310_CS_PIN PC13 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI1 +#define MAX7456_CS_PIN PB12 + +#define USE_BLACKBOX +#define USE_SDCARD +#define USE_SDCARD_SPI +#define SDCARD_SPI_BUS BUS_SPI3 +#define SDCARD_CS_PIN PC9 +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART5 +#define UART5_RX_PIN PD2 +#define UART5_TX_PIN NONE + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 +#define INVERTER_PIN_UART6_RX PC15 + +#define SERIAL_PORT_COUNT 7 //VCP, UART1, UART2, UART3, UART4, UART5, UART6 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART6 +#define USE_UART_INVERTER + +// *************** I2C **************************** +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 +#define DEFAULT_I2C_BUS BUS_I2C1 + +#define USE_MAG +#define MAG_I2C_BUS DEFAULT_I2C_BUS +#define USE_MAG_ALL + +// *************** ENABLE OPTICAL FLOW & RANGEFINDER ***************************** +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_STREAM DMA2_Stream0 +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define VBAT_SCALE_DEFAULT 2121 +#define CURRENT_METER_SCALE 402 + +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) + +#define USE_DSHOT +#define USE_ESC_SENSOR +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) + +#define MAX_PWM_OUTPUT_PORTS 9 diff --git a/src/main/target/MICOAIR405V2/CMakeLists.txt b/src/main/target/MICOAIR405V2/CMakeLists.txt new file mode 100644 index 00000000000..1cd8dfbe968 --- /dev/null +++ b/src/main/target/MICOAIR405V2/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32f405xg(MICOAIR405V2) diff --git a/src/main/target/MICOAIR405V2/config.c b/src/main/target/MICOAIR405V2/config.c new file mode 100644 index 00000000000..00ee10a378d --- /dev/null +++ b/src/main/target/MICOAIR405V2/config.c @@ -0,0 +1,34 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include "platform.h" +#include "config/config_master.h" +#include "config/feature.h" +#include "io/serial.h" +#include "fc/config.h" +#include "sensors/gyro.h" + + +void targetConfiguration(void) +{ + serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[1].msp_baudrateIndex = BAUD_57600; + serialConfigMutable()->portConfigs[2].functionMask = FUNCTION_MSP_OSD; + serialConfigMutable()->portConfigs[3].functionMask = FUNCTION_GPS; + serialConfigMutable()->portConfigs[5].functionMask = FUNCTION_ESCSERIAL; +} diff --git a/src/main/target/MICOAIR405V2/target.c b/src/main/target/MICOAIR405V2/target.c new file mode 100644 index 00000000000..8c93f5394af --- /dev/null +++ b/src/main/target/MICOAIR405V2/target.c @@ -0,0 +1,37 @@ +/* +* This file is part of Cleanflight. +* +* Cleanflight is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Cleanflight is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Cleanflight. If not, see . +*/ + +#include +#include +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 D(1,7) + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 D(1,2) + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 -D(1,5) + DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S4 D(1,6) + DEF_TIM(TIM3, CH1, PB4, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 D(1,4) + DEF_TIM(TIM3, CH2, PB5, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 -D(1,5) + DEF_TIM(TIM4, CH3, PB8, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 + DEF_TIM(TIM4, CH4, PB9, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 + DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 + DEF_TIM(TIM12, CH2, PB15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/MICOAIR405V2/target.h b/src/main/target/MICOAIR405V2/target.h new file mode 100644 index 00000000000..c4a54f003b6 --- /dev/null +++ b/src/main/target/MICOAIR405V2/target.h @@ -0,0 +1,143 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "M405" + +#define USBD_PRODUCT_STRING "MICOAIR405V2" + +// *************** LED ********************** +#define LED0 PC5 +#define LED1 PC4 +#define LED2 PA8 + +// *************** SPI: Gyro & ACC & BARO & OSD & SDCARD ********************** +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define USE_SPI_DEVICE_2 +#define USE_SPI_DEVICE_3 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PC2 +#define SPI2_MOSI_PIN PC3 + +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +#define USE_IMU_BMI088 +#define IMU_BMI088_ALIGN CW270_DEG +#define BMI088_SPI_BUS BUS_SPI2 +#define BMI088_GYRO_CS_PIN PC14 +#define BMI088_ACC_CS_PIN PC13 + +#define USE_BARO +#define USE_BARO_SPL06 +#define SPL06_SPI_BUS BUS_SPI2 +#define SPL06_CS_PIN PA4 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI1 +#define MAX7456_CS_PIN PB12 + +#define USE_BLACKBOX +#define USE_SDCARD +#define USE_SDCARD_SPI +#define SDCARD_SPI_BUS BUS_SPI3 +#define SDCARD_CS_PIN PC9 +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART5 +#define UART5_RX_PIN PD2 +#define UART5_TX_PIN NONE + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 +#define INVERTER_PIN_UART6_RX PC15 + +#define SERIAL_PORT_COUNT 7 //VCP, UART1, UART2, UART3, UART4, UART5, UART6 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART6 +#define USE_UART_INVERTER + +// *************** I2C **************************** +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 +#define DEFAULT_I2C_BUS BUS_I2C1 + +#define USE_MAG +#define MAG_I2C_BUS DEFAULT_I2C_BUS +#define USE_MAG_ALL + +// *************** ENABLE OPTICAL FLOW & RANGEFINDER ***************************** +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_STREAM DMA2_Stream0 +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define VBAT_SCALE_DEFAULT 2121 +#define CURRENT_METER_SCALE 402 + +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) + +#define USE_DSHOT +#define USE_ESC_SENSOR +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) + +#define MAX_PWM_OUTPUT_PORTS 10 diff --git a/src/main/target/MICOAIR743/CMakeLists.txt b/src/main/target/MICOAIR743/CMakeLists.txt new file mode 100644 index 00000000000..1d381638780 --- /dev/null +++ b/src/main/target/MICOAIR743/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(MICOAIR743) \ No newline at end of file diff --git a/src/main/target/MICOAIR743/config.c b/src/main/target/MICOAIR743/config.c new file mode 100644 index 00000000000..6f5be655693 --- /dev/null +++ b/src/main/target/MICOAIR743/config.c @@ -0,0 +1,34 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include +#include "platform.h" +#include "config/config_master.h" +#include "config/feature.h" +#include "io/serial.h" +#include "fc/config.h" +#include "sensors/gyro.h" + + +void targetConfiguration(void) +{ + serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[1].msp_baudrateIndex = BAUD_57600; + serialConfigMutable()->portConfigs[2].functionMask = FUNCTION_MSP_OSD; + serialConfigMutable()->portConfigs[3].functionMask = FUNCTION_GPS; + serialConfigMutable()->portConfigs[6].functionMask = FUNCTION_ESCSERIAL; +} diff --git a/src/main/target/MICOAIR743/target.c b/src/main/target/MICOAIR743/target.c new file mode 100644 index 00000000000..139fad35772 --- /dev/null +++ b/src/main/target/MICOAIR743/target.c @@ -0,0 +1,42 @@ +/* +* This file is part of Cleanflight. +* +* Cleanflight is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Cleanflight is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Cleanflight. If not, see . +*/ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM1, CH4, PE14, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 + DEF_TIM(TIM1, CH3, PE13, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 + DEF_TIM(TIM1, CH2, PE11, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 + DEF_TIM(TIM1, CH1, PE9, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 4), // S5 + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 5), // S6 + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 6), // S7 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 7), // S8 + DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 + DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/MICOAIR743/target.h b/src/main/target/MICOAIR743/target.h new file mode 100644 index 00000000000..4ba27f3447e --- /dev/null +++ b/src/main/target/MICOAIR743/target.h @@ -0,0 +1,141 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "M743" + +#define USBD_PRODUCT_STRING "MICOAIR743" + +// *************** LED ********************** +#define LED0 PE5 +#define LED1 PE6 +#define LED2 PE4 + +// *************** SPI: Gyro & ACC & OSD ********************** +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define USE_SPI_DEVICE_2 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define SPI2_SCK_PIN PD3 +#define SPI2_MISO_PIN PC2 +#define SPI2_MOSI_PIN PC3 + +#define USE_IMU_BMI088 +#define IMU_BMI088_ALIGN CW270_DEG +#define BMI088_SPI_BUS BUS_SPI2 +#define BMI088_GYRO_CS_PIN PD5 +#define BMI088_ACC_CS_PIN PD4 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI1 +#define MAX7456_CS_PIN PB12 + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART2 +#define UART2_RX_PIN PA3 +#define UART2_TX_PIN PA2 + +#define USE_UART3 +#define UART3_RX_PIN PD9 +#define UART3_TX_PIN PD8 + +#define USE_UART4 +#define UART4_RX_PIN PA1 +#define UART4_TX_PIN PA0 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 +#define INVERTER_PIN_UART6_RX PD0 + +#define USE_UART7 +#define UART7_RX_PIN PE7 + +#define USE_UART8 +#define UART8_RX_PIN PE0 +#define UART8_TX_PIN PE1 + +#define SERIAL_PORT_COUNT 8 //VCP, UART1, UART2, UART3, UART4, UART6, UART7, UART8 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART6 + +// *************** I2C: BARO & MAG **************************** +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define USE_I2C_DEVICE_2 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +#define USE_BARO +#define USE_BARO_DPS310 +#define BARO_I2C_BUS BUS_I2C2 + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +// *************** ENABLE OPTICAL FLOW & RANGEFINDER ***************************** +#define USE_RANGEFINDER +#define USE_RANGEFINDER_MSP +#define USE_OPFLOW +#define USE_OPFLOW_MSP + +// *************** SDIO SD BLACKBOX******************* +#define USE_SDCARD +#define USE_SDCARD_SDIO +#define SDCARD_SDIO_DEVICE SDIODEV_1 +#define SDCARD_SDIO_4BIT +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 +#define ADC_CHANNEL_1_PIN PC0 +#define ADC_CHANNEL_2_PIN PC1 +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define VBAT_SCALE_DEFAULT 2121 +#define CURRENT_METER_SCALE 402 + +#define DEFAULT_FEATURES (FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_OSD | FEATURE_TELEMETRY) + +#define USE_DSHOT +#define USE_ESC_SENSOR +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + +#define MAX_PWM_OUTPUT_PORTS 10 From 980784d941bfefe564cf28dec320fe0ca400b8a9 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:52:34 +0200 Subject: [PATCH 328/429] Fix GPS dynamic model setup for M10 GPS units --- src/main/io/gps_ublox.c | 74 ++++++++++++++++++++++++++++++----------- src/main/io/gps_ublox.h | 10 ++++++ 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index fbe4a7f74ff..623f2f5ae2e 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -865,25 +865,57 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // Set dynamic model - switch (gpsState.gpsConfig->dynModel) { - case GPS_DYNMODEL_PEDESTRIAN: - configureNAV5(UBX_DYNMODEL_PEDESTRIAN, UBX_FIXMODE_AUTO); - break; - case GPS_DYNMODEL_AUTOMOTIVE: - configureNAV5(UBX_DYNMODEL_AUTOMOVITE, UBX_FIXMODE_AUTO); - break; - case GPS_DYNMODEL_AIR_1G: - configureNAV5(UBX_DYNMODEL_AIR_1G, UBX_FIXMODE_AUTO); - break; - case GPS_DYNMODEL_AIR_2G: // Default to this - default: - configureNAV5(UBX_DYNMODEL_AIR_2G, UBX_FIXMODE_AUTO); - break; - case GPS_DYNMODEL_AIR_4G: - configureNAV5(UBX_DYNMODEL_AIR_4G, UBX_FIXMODE_AUTO); - break; + if (ubloxVersionGTE(23, 1)) { + ubx_config_data8_payload_t dynmodelCfg[] = { + {UBLOX_CFG_NAVPSG_DYNMODEL, UBX_DYNMODEL_AIR_2G}, + {UBLOX_CFG_NAVPSG_FIXMODE, UBX_FIXMODE_AUTO} + }; + + switch (gpsState.gpsConfig->dynModel) { + case GPS_DYNMODEL_PEDESTRIAN: + dynmodelCfg[0].value = UBX_DYNMODEL_PEDESTRIAN; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + case GPS_DYNMODEL_AUTOMOTIVE: + dynmodelCfg[0].value = UBX_DYNMODEL_AUTOMOVITE; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + case GPS_DYNMODEL_AIR_1G: + dynmodelCfg[0].value = UBX_DYNMODEL_AIR_1G; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + case GPS_DYNMODEL_AIR_2G: // Default to this + default: + dynmodelCfg[0].value = UBX_DYNMODEL_AIR_2G; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + case GPS_DYNMODEL_AIR_4G: + dynmodelCfg[0].value = UBX_DYNMODEL_AIR_4G; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + } + ptWait(_ack_state == UBX_ACK_GOT_ACK); + } else { + switch (gpsState.gpsConfig->dynModel) { + case GPS_DYNMODEL_PEDESTRIAN: + configureNAV5(UBX_DYNMODEL_PEDESTRIAN, UBX_FIXMODE_AUTO); + break; + case GPS_DYNMODEL_AUTOMOTIVE: + configureNAV5(UBX_DYNMODEL_AUTOMOVITE, UBX_FIXMODE_AUTO); + break; + case GPS_DYNMODEL_AIR_1G: + configureNAV5(UBX_DYNMODEL_AIR_1G, UBX_FIXMODE_AUTO); + break; + case GPS_DYNMODEL_AIR_2G: // Default to this + default: + configureNAV5(UBX_DYNMODEL_AIR_2G, UBX_FIXMODE_AUTO); + break; + case GPS_DYNMODEL_AIR_4G: + configureNAV5(UBX_DYNMODEL_AIR_4G, UBX_FIXMODE_AUTO); + break; + } + ptWait(_ack_state == UBX_ACK_GOT_ACK); } - ptWait(_ack_state == UBX_ACK_GOT_ACK); gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // Disable NMEA messages @@ -960,6 +992,7 @@ STATIC_PROTOTHREAD(gpsConfigure) configureMSG(MSG_CLASS_UBX, MSG_NAV_SAT, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK); } else { // Really old stuff, consider upgrading :), ols setting API, no PVT or NAV_SAT or NAV_SIG + // TODO: remove in INAV 9.0.0 configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 1); ptWait(_ack_state == UBX_ACK_GOT_ACK); @@ -1006,7 +1039,7 @@ STATIC_PROTOTHREAD(gpsConfigure) ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); // Configure GNSS for M8N and later - if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX8) { + if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX8) { // TODO: This check can be remove in INAV 9.0.0 gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); bool use_VALSET = 0; if (ubloxVersionGTE(23,1)) { @@ -1030,7 +1063,8 @@ STATIC_PROTOTHREAD(gpsConfigure) for(int i = 0; i < UBLOX_MAX_SIGNALS; ++i) { - satelites[i].svId = 0xFF; // no used + // Mark satelites as unused + satelites[i].svId = 0xFF; satelites[i].gnssId = 0xFF; } diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 287124581d4..89142b51a9b 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -41,11 +41,18 @@ extern "C" { STATIC_ASSERT(MAX_UBLOX_PAYLOAD_SIZE >= 256, ubx_size_too_small); +#define UBX_DYNMODEL_PORTABLE 0 +#define UBX_DYNMODEL_STATIONARY 2 #define UBX_DYNMODEL_PEDESTRIAN 3 #define UBX_DYNMODEL_AUTOMOVITE 4 +#define UBX_DYNMODEL_SEA 5 #define UBX_DYNMODEL_AIR_1G 6 #define UBX_DYNMODEL_AIR_2G 7 #define UBX_DYNMODEL_AIR_4G 8 +#define UBX_DYNMODEL_WRIST 9 +#define UBX_DYNMODEL_BIKE 10 +#define UBX_DYNMODEL_MOWER 11 +#define UBX_DYNMODEL_ESCOOTER 12 #define UBX_FIXMODE_2D_ONLY 1 #define UBX_FIXMODE_3D_ONLY 2 @@ -75,6 +82,9 @@ STATIC_ASSERT(MAX_UBLOX_PAYLOAD_SIZE >= 256, ubx_size_too_small); #define UBLOX_CFG_MSGOUT_NMEA_ID_GSA_UART1 0x209100c0 // U1 #define UBLOX_CFG_MSGOUT_NMEA_ID_RMC_UART1 0x209100ac // U1 #define UBLOX_CFG_MSGOUT_NMEA_ID_VTG_UART1 0x209100b1 // U1 +#define UBLOX_CFG_NAVSPG_FIXMODE 0x20110011 // E1 +#define UBLOX_CFG_NAVSPG_DYNMODEL 0x20110021 // E1 + #define UBLOX_CFG_SIGNAL_SBAS_ENA 0x10310020 // U1 #define UBLOX_CFG_SIGNAL_SBAS_L1CA_ENA 0x10310005 // U1 From 938f392ccc59795ef95a52114d87fecbcc6edb0f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:05:10 +0200 Subject: [PATCH 329/429] fix typo --- src/main/io/gps_ublox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 623f2f5ae2e..40ea17fe2cb 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -867,8 +867,8 @@ STATIC_PROTOTHREAD(gpsConfigure) // Set dynamic model if (ubloxVersionGTE(23, 1)) { ubx_config_data8_payload_t dynmodelCfg[] = { - {UBLOX_CFG_NAVPSG_DYNMODEL, UBX_DYNMODEL_AIR_2G}, - {UBLOX_CFG_NAVPSG_FIXMODE, UBX_FIXMODE_AUTO} + {UBLOX_CFG_NAVSPG_DYNMODEL, UBX_DYNMODEL_AIR_2G}, + {UBLOX_CFG_NAVSPG_FIXMODE, UBX_FIXMODE_AUTO} }; switch (gpsState.gpsConfig->dynModel) { From 798f1ac2544010804442312dabda0ae2eb9220dc Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Sat, 6 Jul 2024 18:18:20 -0500 Subject: [PATCH 330/429] mixer.h: PLATFORM_OTHER isn't valid, remove --- src/main/flight/mixer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index 8af82173069..12688bd2c09 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -40,8 +40,7 @@ typedef enum { PLATFORM_HELICOPTER = 2, PLATFORM_TRICOPTER = 3, PLATFORM_ROVER = 4, - PLATFORM_BOAT = 5, - PLATFORM_OTHER = 6 + PLATFORM_BOAT = 5 } flyingPlatformType_e; @@ -132,4 +131,4 @@ void stopPwmAllMotors(void); void loadPrimaryMotorMixer(void); bool areMotorsRunning(void); -uint16_t getMaxThrottle(void); \ No newline at end of file +uint16_t getMaxThrottle(void); From 463fe1a877f58d4291201360179274029f998fe3 Mon Sep 17 00:00:00 2001 From: Roberto Date: Sun, 7 Jul 2024 14:43:36 +0200 Subject: [PATCH 331/429] Fix typo Rx.md --- docs/Rx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Rx.md b/docs/Rx.md index ec34f4e6f9e..c52fe151571 100644 --- a/docs/Rx.md +++ b/docs/Rx.md @@ -205,7 +205,7 @@ Note: ## SIM (SITL) Joystick -Enables the use of a joystick in the INAV SITL with a flight simulator. See the [SITL documentation](SITL/SITL). +Enables the use of a joystick in the INAV SITL with a flight simulator. See the [SITL documentation](SITL/SITL.md). ## Configuration From 32203d81edff2db9847c9952e7a9e137672dc950 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:21:39 +0200 Subject: [PATCH 332/429] Set gps rate with current api. The old message probably works on M10 by accident, as it is not even mentioned in the manual anymore. --- src/main/io/gps_ublox.c | 52 ++++++++++++++++++++++++++++++----- src/main/io/gps_ublox.h | 22 +++++++++++++++ src/main/io/gps_ublox_utils.c | 31 ++++++++++++++++++++- src/main/io/gps_ublox_utils.h | 1 + 4 files changed, 98 insertions(+), 8 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 40ea17fe2cb..30e653782c2 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -288,6 +288,19 @@ static void ubloxSendSetCfgBytes(ubx_config_data8_payload_t *kvPairs, uint8_t co _ack_state = UBX_ACK_WAITING; } +// M10 ublox protocol info: +// https://content.u-blox.com/sites/default/files/u-blox-M10-SPG-5.10_InterfaceDescription_UBX-21035062.pdf +static void ubloxSendSetCfgU2(ubx_config_data16_payload_t *kvPairs, uint8_t count) +{ + ubx_config_data16_t cfg = {}; + + ubloxCfgFillU2(&cfg, kvPairs, count); + + serialWriteBuf(gpsState.gpsPort, (uint8_t *)&cfg, cfg.header.length+8); + _ack_waiting_msg = cfg.header.msg_id; + _ack_state = UBX_ACK_WAITING; +} + // Info on protocol used by M8-M9, check UBX-CFG-GNSS for gnss configuration // https://content.u-blox.com/sites/default/files/products/documents/u-blox8-M8_ReceiverDescrProtSpec_UBX-13003221.pdf // https://content.u-blox.com/sites/default/files/documents/u-blox-F9-HPG-1.32_InterfaceDescription_UBX-22008968.pdf @@ -482,13 +495,38 @@ static void configureMSG(uint8_t msg_class, uint8_t id, uint8_t rate) */ static void configureRATE(uint16_t measRate) { - send_buffer.message.header.msg_class = CLASS_CFG; - send_buffer.message.header.msg_id = MSG_CFG_RATE; - send_buffer.message.header.length = 6; - send_buffer.message.payload.rate.meas=measRate; - send_buffer.message.payload.rate.nav=1; - send_buffer.message.payload.rate.time=1; - sendConfigMessageUBLOX(); + if(ubloxVersionLT(24, 0)) { + measRate = MAX(50, measRate); + } else { + measRate = MAX(25, measRate); + } + + if (ubloxVersionLT(23, 1)) { + send_buffer.message.header.msg_class = CLASS_CFG; + send_buffer.message.header.msg_id = MSG_CFG_RATE; + send_buffer.message.header.length = 6; + send_buffer.message.payload.rate.meas = measRate; + send_buffer.message.payload.rate.nav = 1; + send_buffer.message.payload.rate.time = 1; + sendConfigMessageUBLOX(); + } else { // M10+ + // 1 is already default, for TIMEREF. + // The wait the configuration happens, + // it is tricky to wait for multiple commands. + // SendSetCfg could be refactored to support U1, U2, U3 and U4 messages + // at the same time. For now, leave it out. + // + //ubx_config_data8_payload_t rateValues[] = { + // {UBLOX_CFG_RATE_TIMEREF, 1}, // 0 + //}; + //ubloxSendSetCfgBytes(rateValues, 1); + + ubx_config_data16_payload_t rate16Values[] = { + {UBLOX_CFG_RATE_MEAS, measRate}, + {UBLOX_CFG_RATE_NAV, 1} + }; + ubloxSendSetCfgU2(rate16Values, 2); + } } /* diff --git a/src/main/io/gps_ublox.h b/src/main/io/gps_ublox.h index 89142b51a9b..ab0ab930275 100644 --- a/src/main/io/gps_ublox.h +++ b/src/main/io/gps_ublox.h @@ -84,6 +84,10 @@ STATIC_ASSERT(MAX_UBLOX_PAYLOAD_SIZE >= 256, ubx_size_too_small); #define UBLOX_CFG_MSGOUT_NMEA_ID_VTG_UART1 0x209100b1 // U1 #define UBLOX_CFG_NAVSPG_FIXMODE 0x20110011 // E1 #define UBLOX_CFG_NAVSPG_DYNMODEL 0x20110021 // E1 +#define UBLOX_CFG_RATE_MEAS 0x30210001 // U2 +#define UBLOX_CFG_RATE_NAV 0x30210002 // U2 +#define UBLOX_CFG_RATE_TIMEREF 0x30210002 // E1 + #define UBLOX_CFG_SIGNAL_SBAS_ENA 0x10310020 // U1 @@ -282,6 +286,13 @@ typedef struct { uint8_t value; } __attribute__((packed)) ubx_config_data8_payload_t; +typedef struct { + uint32_t key; + uint16_t value; +} __attribute__((packed)) ubx_config_data16_payload_t; + + + #define MAX_CONFIG_SET_VAL_VALUES 32 @@ -294,6 +305,17 @@ typedef struct { } data; } __attribute__((packed)) ubx_config_data8_t; +typedef struct { + ubx_header header; + ubx_config_data_header_v1_t configHeader; + union { + ubx_config_data16_payload_t payload[0]; + uint8_t buffer[(MAX_CONFIG_SET_VAL_VALUES * sizeof(ubx_config_data16_payload_t)) + 2]; // 12 key/value pairs + 2 checksum bytes + } data; +} __attribute__((packed)) ubx_config_data16_t; + + + typedef struct { ubx_header header; ubx_payload payload; diff --git a/src/main/io/gps_ublox_utils.c b/src/main/io/gps_ublox_utils.c index a2adf1df18b..b2daef21bfa 100644 --- a/src/main/io/gps_ublox_utils.c +++ b/src/main/io/gps_ublox_utils.c @@ -48,7 +48,36 @@ int ubloxCfgFillBytes(ubx_config_data8_t *cfg, ubx_config_data8_payload_t *kvPai for (int i = 0; i < count; ++i) { - cfg->data.payload[i].key = kvPairs[i].key; //htonl(kvPairs[i].key); + cfg->data.payload[i].key = kvPairs[i].key; + cfg->data.payload[i].value = kvPairs[i].value; + } + + uint8_t *buf = (uint8_t *)cfg; + uint8_t ck_a, ck_b; + ublox_update_checksum(buf + 2, cfg->header.length + 4, &ck_a, &ck_b); + buf[cfg->header.length + 6] = ck_a; + buf[cfg->header.length + 7] = ck_b; + + return count; +} + +int ubloxCfgFillU2(ubx_config_data16_t *cfg, ubx_config_data16_payload_t *kvPairs, uint8_t count) +{ + if (count > MAX_CONFIG_SET_VAL_VALUES) + count = MAX_CONFIG_SET_VAL_VALUES; + + cfg->header.preamble1 = 0xb5; + cfg->header.preamble2 = 0x62; + cfg->header.msg_class = 0x06; + cfg->header.msg_id = 0x16A; + cfg->header.length = sizeof(ubx_config_data_header_v1_t) + ((sizeof(ubx_config_data16_payload_t) * count)); + cfg->configHeader.layers = 0x1; + cfg->configHeader.transaction = 0; + cfg->configHeader.reserved = 0; + cfg->configHeader.version = 1; + + for (int i = 0; i < count; ++i) { + cfg->data.payload[i].key = kvPairs[i].key; cfg->data.payload[i].value = kvPairs[i].value; } diff --git a/src/main/io/gps_ublox_utils.h b/src/main/io/gps_ublox_utils.h index 502bbaf31a6..996cbe2a68c 100644 --- a/src/main/io/gps_ublox_utils.h +++ b/src/main/io/gps_ublox_utils.h @@ -26,6 +26,7 @@ extern "C" { #endif int ubloxCfgFillBytes(ubx_config_data8_t *cfg, ubx_config_data8_payload_t *kvPairs, uint8_t count); +int ubloxCfgFillU2(ubx_config_data16_t *cfg, ubx_config_data16_payload_t *kvPairs, uint8_t count); void ublox_update_checksum(uint8_t *data, uint8_t len, uint8_t *ck_a, uint8_t *ck_b); From 64d8293f3677ac20b76e1bb2b04600d8c80282eb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:29:14 +0200 Subject: [PATCH 333/429] Fix msg_id --- src/main/io/gps_ublox_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox_utils.c b/src/main/io/gps_ublox_utils.c index b2daef21bfa..c9c1682a5f7 100644 --- a/src/main/io/gps_ublox_utils.c +++ b/src/main/io/gps_ublox_utils.c @@ -69,7 +69,7 @@ int ubloxCfgFillU2(ubx_config_data16_t *cfg, ubx_config_data16_payload_t *kvPair cfg->header.preamble1 = 0xb5; cfg->header.preamble2 = 0x62; cfg->header.msg_class = 0x06; - cfg->header.msg_id = 0x16A; + cfg->header.msg_id = 0x8A; cfg->header.length = sizeof(ubx_config_data_header_v1_t) + ((sizeof(ubx_config_data16_payload_t) * count)); cfg->configHeader.layers = 0x1; cfg->configHeader.transaction = 0; From 90bba03870fcfecadec6de5b010214f6f0faa7b6 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:38:21 +0200 Subject: [PATCH 334/429] less than vs less than or equal on CFG-RATE check --- src/main/io/gps_ublox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 30e653782c2..8f7a96098dd 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -501,7 +501,7 @@ static void configureRATE(uint16_t measRate) measRate = MAX(25, measRate); } - if (ubloxVersionLT(23, 1)) { + if (ubloxVersionLTE(23, 1)) { send_buffer.message.header.msg_class = CLASS_CFG; send_buffer.message.header.msg_id = MSG_CFG_RATE; send_buffer.message.header.length = 6; From 1c0fb3feca38a7896fa9c52fb8db17d5e69c664c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 15:50:21 +0200 Subject: [PATCH 335/429] Update comments --- src/main/io/gps_ublox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 8f7a96098dd..9cc4aa76954 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1005,7 +1005,7 @@ STATIC_PROTOTHREAD(gpsConfigure) ubloxSendSetCfgBytes(rateValues, 7); ptWaitTimeout((_ack_state == UBX_ACK_GOT_ACK || _ack_state == UBX_ACK_GOT_NAK), GPS_CFG_CMD_TIMEOUT_MS); - } else if(ubloxVersionGTE(15,0)) { // M8 and potentially M7, PVT, NAV_SAT, old setting API + } else if(ubloxVersionGTE(15,0)) { // M8, PVT, NAV_SAT, old setting API configureMSG(MSG_CLASS_UBX, MSG_POSLLH, 0); ptWait(_ack_state == UBX_ACK_GOT_ACK); From 6e1a76148d248c2439fddaa180e760f70c2f01bb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 09:50:44 -0400 Subject: [PATCH 336/429] Add UBLOX PSA Add PSA about M7, M6 and older GPS units. From INAV 9.0.0, you will need a UBLOX unit with Protocol version > 15.0 --- readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.md b/readme.md index 53710d519aa..ac5445aff5f 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,15 @@ > The filtering settings for the ICM426xx has changed to match what is used by Ardupilot and Betaflight in INAV 7.1. When upgrading from older versions you may need to recalibrate the Accelerometer and if you are not using INAV's default tune you may also want to check if the tune is still good. +# M7, M6 and older UBLOX GPS units PSA + +> INAV 8.0 will mark those GPS as deprecated and INAV 9.0.0 will require UBLOX units with Protocol version 15.00 or newer. This means that you need a GPS unit based on UBLOX M8 or newer. + +> If you want to check the protocol version of your unit, it is displayed in INAV's 7.0.0+ status cli command. + +> M8, M9 and M10 GPS are the most common units in use today, are readly available and have similar capabilities. +>Mantaining and testing GPS changes across this many UBLOX versions is a challenge and takes a lot of time. Removing the support for older devices will simplify code. + ![INAV](http://static.rcgroups.net/forums/attachments/6/1/0/3/7/6/a9088858-102-inav.png) # PosHold, Navigation and RTH without compass PSA From 575416547f11edea055e794cf054b31579206451 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 10:46:23 -0400 Subject: [PATCH 337/429] Update readme.md --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index ac5445aff5f..1c313de3569 100644 --- a/readme.md +++ b/readme.md @@ -15,6 +15,9 @@ > INAV 8.0 will mark those GPS as deprecated and INAV 9.0.0 will require UBLOX units with Protocol version 15.00 or newer. This means that you need a GPS unit based on UBLOX M8 or newer. > If you want to check the protocol version of your unit, it is displayed in INAV's 7.0.0+ status cli command. +> INAV 8.0.0 will warn you if your GPS is too old. +> ```GPS: HW Version: Unknown Proto: 0.00 Baud: 115200 (UBLOX Proto >= 15.0 required)``` + > M8, M9 and M10 GPS are the most common units in use today, are readly available and have similar capabilities. >Mantaining and testing GPS changes across this many UBLOX versions is a challenge and takes a lot of time. Removing the support for older devices will simplify code. From 2bab471451a7bb8ee20f351b36cd0511b052fc13 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:18:37 +0200 Subject: [PATCH 338/429] LTE/GT for 23.1 protocol --- src/main/io/gps_ublox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 9cc4aa76954..9b5a65647cb 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -903,7 +903,7 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // Set dynamic model - if (ubloxVersionGTE(23, 1)) { + if (ubloxVersionGT(23, 1)) { ubx_config_data8_payload_t dynmodelCfg[] = { {UBLOX_CFG_NAVSPG_DYNMODEL, UBX_DYNMODEL_AIR_2G}, {UBLOX_CFG_NAVSPG_FIXMODE, UBX_FIXMODE_AUTO} @@ -957,7 +957,7 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // Disable NMEA messages - if (ubloxVersionGTE(23, 1)) { + if (ubloxVersionGT(23, 1)) { ubx_config_data8_payload_t nmeaValues[] = { { UBLOX_CFG_MSGOUT_NMEA_ID_GGA_UART1, 0 }, { UBLOX_CFG_MSGOUT_NMEA_ID_GLL_UART1, 0 }, @@ -992,7 +992,7 @@ STATIC_PROTOTHREAD(gpsConfigure) gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); // M9N & M10 does not support some of the UBX 6/7/8 messages, so we have to configure it using special sequence - if (ubloxVersionGTE(23, 1)) { // M9+, new setting API, PVT and NAV_SIG + if (ubloxVersionGT(23, 1)) { // M9+, new setting API, PVT and NAV_SIG ubx_config_data8_payload_t rateValues[] = { {UBLOX_CFG_MSGOUT_NAV_POSLLH_UART1, 0}, // 0 {UBLOX_CFG_MSGOUT_NAV_STATUS_UART1, 0}, // 1 @@ -1080,7 +1080,7 @@ STATIC_PROTOTHREAD(gpsConfigure) if (gpsState.hwVersion >= UBX_HW_VERSION_UBLOX8) { // TODO: This check can be remove in INAV 9.0.0 gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); bool use_VALSET = 0; - if (ubloxVersionGTE(23,1)) { + if (ubloxVersionGT(23,1)) { use_VALSET = 1; } From c02444e0480ec4107e80ad1f00964c89f9d2e9cf Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Sun, 7 Jul 2024 11:50:20 -0500 Subject: [PATCH 339/429] IFLIGHT_BLITZ_ATF435 MAX_PWM_OUTPUT_PORTS should 8 --- src/main/target/IFLIGHT_BLITZ_ATF435/target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/target/IFLIGHT_BLITZ_ATF435/target.h b/src/main/target/IFLIGHT_BLITZ_ATF435/target.h index b29112d5256..19f1483dfeb 100644 --- a/src/main/target/IFLIGHT_BLITZ_ATF435/target.h +++ b/src/main/target/IFLIGHT_BLITZ_ATF435/target.h @@ -159,6 +159,6 @@ #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE BIT(2) -#define MAX_PWM_OUTPUT_PORTS 4 +#define MAX_PWM_OUTPUT_PORTS 8 #define USE_DSHOT #define USE_ESC_SENSOR From 9d5b40bcb512710cd90e03c3e02fda670d53031c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 8 Jul 2024 22:49:38 +0200 Subject: [PATCH 340/429] Add SEA and MOWER dynamic models. Potentially better models for hovers --- src/main/fc/settings.yaml | 4 ++-- src/main/io/gps.h | 2 ++ src/main/io/gps_ublox.c | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index d8dd7d6fbee..278be344339 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -48,7 +48,7 @@ tables: values: ["AUTO", "EGNOS", "WAAS", "MSAS", "GAGAN", "SPAN", "NONE"] enum: sbasMode_e - name: gps_dyn_model - values: ["PEDESTRIAN","AUTOMOTIVE", "AIR_1G", "AIR_2G", "AIR_4G"] + values: ["PEDESTRIAN","AUTOMOTIVE", "AIR_1G", "AIR_2G", "AIR_4G", "SEA", "MOWER"] enum: gpsDynModel_e - name: reset_type values: ["NEVER", "FIRST_ARM", "EACH_ARM"] @@ -4307,4 +4307,4 @@ groups: default_value: 1 field: roll_ratio min: 0 - max: 5 \ No newline at end of file + max: 5 diff --git a/src/main/io/gps.h b/src/main/io/gps.h index cd8f909d344..7b78fe5e799 100755 --- a/src/main/io/gps.h +++ b/src/main/io/gps.h @@ -80,6 +80,8 @@ typedef enum { GPS_DYNMODEL_AIR_1G, GPS_DYNMODEL_AIR_2G, GPS_DYNMODEL_AIR_4G, + GPS_DYNMODEL_SEA, + GPS_DYNMODEL_MOWER, } gpsDynModel_e; typedef enum { diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 9b5a65647cb..725ecfd862d 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -931,6 +931,14 @@ STATIC_PROTOTHREAD(gpsConfigure) dynmodelCfg[0].value = UBX_DYNMODEL_AIR_4G; ubloxSendSetCfgBytes(dynmodelCfg, 2); break; + case GPS_DYNMODEL_SEA: + dynmodelCfg[0].value = UBX_DYNMODEL_SEA; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; + case GPS_DYNMODEL_MOWER: + dynmodelCfg[0].value = UBX_DYNMODEL_MOWER; + ubloxSendSetCfgBytes(dynmodelCfg, 2); + break; } ptWait(_ack_state == UBX_ACK_GOT_ACK); } else { @@ -951,6 +959,12 @@ STATIC_PROTOTHREAD(gpsConfigure) case GPS_DYNMODEL_AIR_4G: configureNAV5(UBX_DYNMODEL_AIR_4G, UBX_FIXMODE_AUTO); break; + case GPS_DYNMODEL_SEA: + configureNAV5(UBX_DYNMODEL_SEA, UBX_FIXMODE_AUTO); + break; + case GPS_DYNMODEL_MOWER: + configureNAV5(UBX_DYNMODEL_MOWER, UBX_FIXMODE_AUTO); + break; } ptWait(_ack_state == UBX_ACK_GOT_ACK); } From 3eafbe6acbaed83a13dcbb1df94ff78a0a5f544d Mon Sep 17 00:00:00 2001 From: jamming Date: Tue, 9 Jul 2024 10:14:59 +0800 Subject: [PATCH 341/429] Fix DMA conflict of TIM1 and ADC1 --- src/main/target/KAKUTEF4WING/target.c | 4 ++-- src/main/target/KAKUTEF4WING/target.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/target/KAKUTEF4WING/target.c b/src/main/target/KAKUTEF4WING/target.c index 8c2240a9c3b..f6956dae169 100755 --- a/src/main/target/KAKUTEF4WING/target.c +++ b/src/main/target/KAKUTEF4WING/target.c @@ -30,10 +30,10 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S1_OUT - DMA2_ST1_CH6 - DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT - DMA2_ST6_CH0 + DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 1), // S2_OUT - DMA2_ST2_CH6 DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3_OUT - DMA1_ST7_CH5 DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4_OUT - DMA1_ST2_CH5 - DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT - DMA2_ST2_CH0 + DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 1), // S5_OUT - DMA2_ST4_CH7 DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT - DMA2_ST7_CH7 DEF_TIM(TIM2, CH2, PA1, TIM_USE_LED, 0, 0), // LED_STRIP-DMA1_ST6_CH3 diff --git a/src/main/target/KAKUTEF4WING/target.h b/src/main/target/KAKUTEF4WING/target.h index cb29473d06a..70eb125646a 100644 --- a/src/main/target/KAKUTEF4WING/target.h +++ b/src/main/target/KAKUTEF4WING/target.h @@ -140,7 +140,7 @@ // *************** Battery Voltage Sense*********** #define USE_ADC #define ADC_INSTANCE ADC1 -#define ADC1_DMA_STREAM DMA2_Stream4 +#define ADC1_DMA_STREAM DMA2_Stream0 #define ADC_CHANNEL_1_PIN PC0 #define ADC_CHANNEL_2_PIN PC1 #define VBAT_ADC_CHANNEL ADC_CHN_1 From c1227fa858090013be6b52de8bc26677b8c706b7 Mon Sep 17 00:00:00 2001 From: Sensei Date: Mon, 8 Jul 2024 22:48:11 -0500 Subject: [PATCH 342/429] Update OSD.md - List all of the OSD-related docs --- docs/OSD.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/OSD.md b/docs/OSD.md index d57da7e25f3..5787496687a 100644 --- a/docs/OSD.md +++ b/docs/OSD.md @@ -2,6 +2,15 @@ The On Screen Display, or OSD, is a feature that overlays flight data over the video image. This can be done on the flight controller, using the analogue MAX7456 chip. Digital systems take the OSD data, via MSP DisplayPort, send it to the video receiver; which combines the data with the image. You can specify what elements are displayed, and their locations on the image. Most systems are character based, and use the MAX7456 analogue setup, or MSP DisplayPort. However, there are some different systems which are also supported. Such as the canvas based FrSKY PixelOSD on analogue. Canvas OSDs draw shapes on the image. Whereas character based OSDs use font characters to display the data. + +General OSD information is in this document. Other documents cover specific OSD-related topics: +* [Custom OSD Messages](https://github.com/iNavFlight/inav/wiki/OSD-custom-messages) +* [OSD Hud and ESP32 radars](https://github.com/iNavFlight/inav/wiki/OSD-Hud-and-ESP32-radars) +* [OSD Joystick](https://github.com/iNavFlight/inav/blob/master/docs/OSD%20Joystick.md) +* [DJI compatible OSD.md](https://github.com/iNavFlight/inav/blob/master/docs/DJI%20compatible%20OSD.md) +* [Pixel OSD FAQ](https://github.com/iNavFlight/inav/wiki/Pixel-OSD-FAQs) + + ## Features and Limitations Not all OSDs are created equally. This table shows the differences between the different systems available. From 72327a6812502fc3a89d926fbdcb055cd2251575 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:43:52 +0200 Subject: [PATCH 343/429] UBLOX and UBLOX7 have been merged into UBLOX Any difference between UBLOX and UBLOX7 is now handled based on GPS protocol version, and not INAV GPS Provider type. --- src/main/fc/settings.yaml | 2 +- src/main/io/gps.h | 1 - src/main/io/gps_ublox.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 6670148d0bd..b8ab782ee96 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -42,7 +42,7 @@ tables: values: ["VELNED", "TURNRATE","ADAPTIVE"] enum: imu_inertia_comp_method_e - name: gps_provider - values: ["UBLOX", "UBLOX7", "MSP", "FAKE"] + values: ["UBLOX", "MSP", "FAKE"] enum: gpsProvider_e - name: gps_sbas_mode values: ["AUTO", "EGNOS", "WAAS", "MSAS", "GAGAN", "SPAN", "NONE"] diff --git a/src/main/io/gps.h b/src/main/io/gps.h index 7b78fe5e799..c14db4a7630 100755 --- a/src/main/io/gps.h +++ b/src/main/io/gps.h @@ -34,7 +34,6 @@ typedef enum { GPS_UBLOX = 0, - GPS_UBLOX7PLUS, GPS_MSP, GPS_FAKE, GPS_PROVIDER_COUNT diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 725ecfd862d..acc894996ba 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1224,7 +1224,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) ptSemaphoreWait(semNewDataReady); gpsProcessNewSolutionData(false); - if ((gpsState.gpsConfig->autoConfig) && (gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) { + if ((gpsState.gpsConfig->autoConfig) && (gpsState.gpsConfig->provider == GPS_UBLOX)) { if ((millis() - gpsState.lastCapaPoolMs) > GPS_CAPA_INTERVAL) { gpsState.lastCapaPoolMs = millis(); From e8fd649a6f9f639cdc0ebe64d8c044d68b484078 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:59:27 +0200 Subject: [PATCH 344/429] Missed commit --- src/main/io/gps.c | 7 ------- src/main/io/gps_ublox.c | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/io/gps.c b/src/main/io/gps.c index 294b9414297..e7aecd3e0d6 100755 --- a/src/main/io/gps.c +++ b/src/main/io/gps.c @@ -102,13 +102,6 @@ static gpsProviderDescriptor_t gpsProviders[GPS_PROVIDER_COUNT] = { { false, 0, NULL, NULL }, #endif - /* UBLOX7PLUS binary */ -#ifdef USE_GPS_PROTO_UBLOX - { false, MODE_RXTX, &gpsRestartUBLOX, &gpsHandleUBLOX }, -#else - { false, 0, NULL, NULL }, -#endif - /* MSP GPS */ #ifdef USE_GPS_PROTO_MSP { true, 0, &gpsRestartMSP, &gpsHandleMSP }, diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index acc894996ba..4e32628a017 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1271,7 +1271,7 @@ void gpsHandleUBLOX(void) bool isGpsUblox(void) { - if(gpsState.gpsPort != NULL && (gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) { + if(gpsState.gpsPort != NULL && (gpsState.gpsConfig->provider == GPS_UBLOX)) { return true; } From e6e903a076fbbc4f46e0ad84a35ad69b4c20e293 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:12:25 +0200 Subject: [PATCH 345/429] No need to check provider. --- src/main/io/gps_ublox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index 4e32628a017..89549768edb 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -1224,7 +1224,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) ptSemaphoreWait(semNewDataReady); gpsProcessNewSolutionData(false); - if ((gpsState.gpsConfig->autoConfig) && (gpsState.gpsConfig->provider == GPS_UBLOX)) { + if (gpsState.gpsConfig->autoConfig) { if ((millis() - gpsState.lastCapaPoolMs) > GPS_CAPA_INTERVAL) { gpsState.lastCapaPoolMs = millis(); From 442aaad0a06d2f98dd18520cfb93db22bf02f7ec Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:17:51 +0200 Subject: [PATCH 346/429] Quick and dirty attemp at making things play along --- src/main/telemetry/mavlink.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/telemetry/mavlink.c b/src/main/telemetry/mavlink.c index 6b4c9346ece..59d1ef69463 100644 --- a/src/main/telemetry/mavlink.c +++ b/src/main/telemetry/mavlink.c @@ -162,6 +162,7 @@ static serialPortConfig_t *portConfig; static bool mavlinkTelemetryEnabled = false; static portSharing_e mavlinkPortSharing; +static uint8_t txbuff_free = 100; /* MAVLink datastream rates in Hz */ static uint8_t mavRates[] = { @@ -1111,6 +1112,13 @@ static bool handleIncoming_RC_CHANNELS_OVERRIDE(void) { return true; } +static bool handleIncoming_RADIO_STATUS(void) { + mavlink_radio_status_t msg; + mavlink_msg_radio_status_decode(&mavRecvMsg, &msg); + txbuff_free = msg.txbuf; + return true; +} + #ifdef USE_ADSB static bool handleIncoming_ADSB_VEHICLE(void) { mavlink_adsb_vehicle_t msg; @@ -1181,6 +1189,8 @@ static bool processMAVLinkIncomingTelemetry(void) case MAVLINK_MSG_ID_ADSB_VEHICLE: return handleIncoming_ADSB_VEHICLE(); #endif + case MAVLINK_MSG_ID_RADIO_STATUS: + return handleIncoming_RADIO_STATUS(); default: return false; } @@ -1207,7 +1217,7 @@ void handleMAVLinkTelemetry(timeUs_t currentTimeUs) incomingRequestServed = true; } - if ((currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY) { + if ((currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY && txbuff_free >= 90) { // Only process scheduled data if we didn't serve any incoming request this cycle if (!incomingRequestServed || ( From 26af58c3609d2eb91ae1b69ec268833ab1fd8368 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 10 Jul 2024 11:46:38 +0200 Subject: [PATCH 347/429] All all baro to IFLIGHTF4_SUCCEXD --- src/main/target/IFLIGHTF4_SUCCEXD/target.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/target/IFLIGHTF4_SUCCEXD/target.h b/src/main/target/IFLIGHTF4_SUCCEXD/target.h index 6ba059bb63c..6db93702c42 100644 --- a/src/main/target/IFLIGHTF4_SUCCEXD/target.h +++ b/src/main/target/IFLIGHTF4_SUCCEXD/target.h @@ -39,6 +39,11 @@ #define MPU6000_CS_PIN PA4 #define MPU6000_SPI_BUS BUS_SPI1 +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW180_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 + // *************** SPI2 OSD ***************************** #define USE_SPI_DEVICE_2 #define SPI2_SCK_PIN PB13 @@ -91,9 +96,7 @@ #define USE_BARO #define BARO_I2C_BUS BUS_I2C1 -#define USE_BARO_BMP280 -#define USE_BARO_MS5611 -#define USE_BARO_BMP085 +#define USE_BARO_ALL #define USE_MAG #define MAG_I2C_BUS BUS_I2C1 From 0c6d79ed266c42ef73ad7e9ae7190032395f63bc Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:42:42 +0200 Subject: [PATCH 348/429] Remove mention of UBLOX7. --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index a217a26a981..b599a739776 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1594,7 +1594,7 @@ Minimum number of GPS satellites in view to acquire GPS_FIX and consider GPS pos ### gps_provider -Which GPS protocol to be used, note that UBLOX is 5Hz and UBLOX7 is 10Hz (M8N). +Which GPS protocol to be used. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index b8ab782ee96..eb0c9806b42 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1666,7 +1666,7 @@ groups: condition: USE_GPS members: - name: gps_provider - description: "Which GPS protocol to be used, note that UBLOX is 5Hz and UBLOX7 is 10Hz (M8N)." + description: "Which GPS protocol to be used." default_value: "UBLOX" field: provider table: gps_provider From 964c9d495e0f0787947f68450104ef6ab01361b1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:49:43 +0200 Subject: [PATCH 349/429] Another mention of UBLOX7 squashed --- docs/Settings.md | 2 +- src/main/fc/settings.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index b599a739776..da0b77f8ce1 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -1614,7 +1614,7 @@ Which SBAS mode to be used ### gps_ublox_nav_hz -Navigation update rate for UBLOX7 receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer. +Navigation update rate for UBLOX receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer. | Default | Min | Max | | --- | --- | --- | diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index eb0c9806b42..52d6d63f66e 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -1721,7 +1721,7 @@ groups: min: 5 max: 10 - name: gps_ublox_nav_hz - description: "Navigation update rate for UBLOX7 receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer." + description: "Navigation update rate for UBLOX receivers. Some receivers may limit the maximum number of satellites tracked when set to a higher rate or even stop sending navigation updates if the value is too high. Some M10 devices can do up to 25Hz. 10 is a safe value for M8 and newer." default_value: 10 field: ubloxNavHz type: uint8_t From 0c54990ca70fdfa89526a7ab2424cd1b21000967 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:58:39 +0200 Subject: [PATCH 350/429] create single zip with all hex files, again. --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92862bb4300..06d0c437809 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,41 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.BUILD_NAME }}.${{ matrix.id }} + name: matrix-${{ env.BUILD_NAME }}.${{ matrix.id }} path: ./build/*.hex + retention-days: 1 + + upload-artifacts: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Setup environment + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: | + # This is the hash of the commit for the PR + # when the action is triggered by PR, empty otherwise + COMMIT_ID=${{ github.event.pull_request.head.sha }} + # This is the hash of the commit when triggered by push + # but the hash of refs/pull//merge, which is different + # from the hash of the latest commit in the PR, that's + # why we try github.event.pull_request.head.sha first + COMMIT_ID=${COMMIT_ID:-${{ github.sha }}} + BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID}) + VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/^[ \t]+|[ \t\)]+$/, "", $2); print $2 }') + echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV + echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: matrix-inav-* + merge-multiple: true + path: binaries + - name: Upload single zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_NAME }} + path: binaries/*.hex build-SITL-Linux: runs-on: ubuntu-latest From 5c42ec792e1c58f28f016cced963625af61f14ba Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:09:33 +0200 Subject: [PATCH 351/429] Another attempt --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06d0c437809..d63e3daf2e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,7 @@ jobs: runs-on: ubuntu-latest needs: [build] steps: + - uses: actions/checkout@v4 - name: Setup environment env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true From a856c84c52c90844b323f1a070d0cec8b68ab2d8 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:21:02 +0200 Subject: [PATCH 352/429] s/name/pattern/ --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d63e3daf2e3..15c0e872f0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: matrix-inav-* + pattern: matrix-inav-* merge-multiple: true path: binaries - name: Upload single zip From a330d2503c973f39a4a375ba5a746cb7b8e5c2b4 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:24:10 +0200 Subject: [PATCH 353/429] Generate targets list --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15c0e872f0f..0c7f795e0bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,11 +80,19 @@ jobs: pattern: matrix-inav-* merge-multiple: true path: binaries - - name: Upload single zip + - name: Build target list + run: | + ls -1 binaries/*.hex > targets.txt + - name: Upload firmware images uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_NAME }} path: binaries/*.hex + - name: Upload firmware images + uses: actions/upload-artifact@v4 + with: + name: targets + path: targets.txt build-SITL-Linux: runs-on: ubuntu-latest From 819591e706045f071f266bf10c431e63256533c1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:43:22 +0200 Subject: [PATCH 354/429] remove binaries/ from path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c7f795e0bc..4663febe50e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: path: binaries - name: Build target list run: | - ls -1 binaries/*.hex > targets.txt + ls -1 binaries/*.hex | cut -d/ -f2 > targets.txt - name: Upload firmware images uses: actions/upload-artifact@v4 with: From 6a3a0d1bf3663d6de7fa880706ea18110c60e6a7 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 11 Jul 2024 00:05:50 +0200 Subject: [PATCH 355/429] First attempt at transmitting telemetry May need to break out the osciloscope/logic analizer soon. --- src/main/build/debug.h | 1 + src/main/fc/cli.c | 4 +++- src/main/fc/settings.yaml | 2 +- src/main/rx/sbus.c | 2 +- src/main/telemetry/sbus2.c | 48 +++++++++++++++++++++++++++----------- src/main/telemetry/sbus2.h | 6 +++-- 6 files changed, 45 insertions(+), 18 deletions(-) diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 0d897f77101..0bb74bac1ac 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -78,6 +78,7 @@ typedef enum { DEBUG_HEADTRACKING, DEBUG_GPS, DEBUG_LULU, + DEBUG_SBUS2, DEBUG_COUNT // also update debugModeNames in cli.c } debugType_e; diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 580859fec0c..0ea43fd0ce7 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -211,7 +211,9 @@ static const char *debugModeNames[DEBUG_COUNT] = { "POS_EST", "ADAPTIVE_FILTER", "HEADTRACKER", - "GPS" + "GPS", + "LULU", + "SBUS2" }; /* Sensor names (used in lookup tables for *_hardware settings and in status diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 9e68ec1778d..b0a0fb70ea7 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -84,7 +84,7 @@ tables: "VIBE", "CRUISE", "REM_FLIGHT_TIME", "SMARTAUDIO", "ACC", "NAV_YAW", "PCF8574", "DYN_GYRO_LPF", "AUTOLEVEL", "ALTITUDE", "AUTOTRIM", "AUTOTUNE", "RATE_DYNAMICS", "LANDING", "POS_EST", - "ADAPTIVE_FILTER", "HEADTRACKER", "GPS", "LULU"] + "ADAPTIVE_FILTER", "HEADTRACKER", "GPS", "LULU", "SBUS2"] - name: aux_operator values: ["OR", "AND"] enum: modeActivationOperator_e diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 8a5c3f926a1..3d08d274333 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -199,7 +199,7 @@ static bool sbusInitEx(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeC ); #ifdef USE_TELEMETRY - if (portShared) { + if (portShared || (rxConfig->serialrx_provider == SERIALRX_SBUS2)) { telemetrySharedPort = sBusPort; } #endif diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index ed258ee15f4..c00a3a1d0da 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -24,45 +24,67 @@ #include "common/utils.h" #include "common/time.h" +#include "telemetry/telemetry.h" #include "telemetry/sbus2.h" #include "rx/sbus.h" #ifdef USE_SBUS2_TELEMETRY -const uint8_t sbus2SlotIds[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = { - {0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3}, - {0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3}, - {0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB}, - {0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB} +const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { + 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, + 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, + 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, + 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB }; -sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; -uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS] = {{}}; +sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT] = {}; +uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT] = {}; +timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT] = {}; void handleSbus2Telemetry(timeUs_t currentTimeUs) { UNUSED(currentTimeUs); + // TODO: placeholder + + int16_t temp = 42 | 0x4000; + sbusTelemetryData[0].payload.temp125.tempHigh = ((temp >> 8) & 0xFF); + sbusTelemetryData[0].payload.temp125.tempLow = (temp & 0xFF); + sbusTelemetryDataUsed[0] = 1; + + int16_t rpm = 9000; + sbusTelemetryData[1].payload.rpm.rpmHigh = (rpm >> 8) & 0xFF; + sbusTelemetryData[1].payload.rpm.rpmLow = rpm & 0xFF; + sbusTelemetryDataUsed[1] = 1; + // P1S0: TEMP + // P1S1: RPM // update telemetry info } void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { + if(!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || rxConfig()->serialrx_provider != SERIALRX_SBUS2) + { + return; + } + uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); uint8_t lastFrame = sbusGetLastFrameTime(); timeUs_t elapsedTime = currentTimeUs - lastFrame - MS2US(2); // 2ms after sbus2 frame = slot 0 // +660us for next slot - if(elapsedTime > 0) { + if(elapsedTime > MS2US(2)) { uint8_t slot = elapsedTime % 660; - if(slot < SBUS2_TELEMETRY_SLOTS) { - if(sbusTelemetryDataStatus[telemetryPage][slot] != 0) { - sbusTelemetryData[telemetryPage][slot].slotId = sbus2SlotIds[telemetryPage][slot]; - // send - sbusTelemetryDataStatus[telemetryPage][slot] = 0; + int slotIndex = (telemetryPage * SBUS2_TELEMETRY_SLOTS) + slot; + if(slot < SBUS2_TELEMETRY_SLOTS && slotIndex < SBUS2_SLOT_COUNT && (currentTimeUs - sbusTelemetryDataLastSent[slotIndex]) > MS2US(2)) { + if(sbusTelemetryDataUsed[slotIndex] != 0) { + sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; + // send + serialWriteBuf(telemetrySharedPort, (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); + sbusTelemetryDataLastSent[slotIndex] = currentTimeUs; } } } diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 7e59782a1d1..9fdbc3fd7db 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -27,6 +27,7 @@ #define SBUS2_TELEMETRY_ITEM_SIZE 3 #define SBUS2_TELEMETRY_SLOTS 8 #define SBUS2_TELEMETRY_PAGES 4 + #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) #if defined(USE_TELEMETRY) && defined(USE_SBUS2_TELEMETRY) @@ -105,8 +106,9 @@ typedef struct sbus2_telemetry_frame_s { } __attribute__((packed)) sbus2_telemetry_frame_t; extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; -extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; -extern uint8_t sbusTelemetryDataStatus[SBUS2_TELEMETRY_PAGES][SBUS2_TELEMETRY_SLOTS]; +extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT]; +extern uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT]; +extern timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT]; // refresh telemetry buffers void handleSbus2Telemetry(timeUs_t currentTimeUs); From ff94b7702e8a8f7ced8b487eb875c346b5c383d0 Mon Sep 17 00:00:00 2001 From: MUSTARDTIGERFPV Date: Thu, 11 Jul 2024 04:17:34 +0000 Subject: [PATCH 356/429] Improve MAVLink behavior when flow control information is available --- src/main/telemetry/mavlink.c | 63 +++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/main/telemetry/mavlink.c b/src/main/telemetry/mavlink.c index 59d1ef69463..be10ad1fd95 100644 --- a/src/main/telemetry/mavlink.c +++ b/src/main/telemetry/mavlink.c @@ -163,14 +163,15 @@ static serialPortConfig_t *portConfig; static bool mavlinkTelemetryEnabled = false; static portSharing_e mavlinkPortSharing; static uint8_t txbuff_free = 100; +static bool txbuff_valid = false; /* MAVLink datastream rates in Hz */ static uint8_t mavRates[] = { [MAV_DATA_STREAM_EXTENDED_STATUS] = 2, // 2Hz - [MAV_DATA_STREAM_RC_CHANNELS] = 5, // 5Hz + [MAV_DATA_STREAM_RC_CHANNELS] = 1, // 1Hz [MAV_DATA_STREAM_POSITION] = 2, // 2Hz - [MAV_DATA_STREAM_EXTRA1] = 10, // 10Hz - [MAV_DATA_STREAM_EXTRA2] = 2, // 2Hz + [MAV_DATA_STREAM_EXTRA1] = 3, // 3Hz + [MAV_DATA_STREAM_EXTRA2] = 2, // 2Hz, HEARTBEATs are important [MAV_DATA_STREAM_EXTRA3] = 1 // 1Hz }; @@ -1112,9 +1113,23 @@ static bool handleIncoming_RC_CHANNELS_OVERRIDE(void) { return true; } +static bool handleIncoming_PARAM_REQUEST_LIST(void) { + mavlink_param_request_list_t msg; + mavlink_msg_param_request_list_decode(&mavRecvMsg, &msg); + + // Respond that we don't have any parameters to force Mission Planner to give up quickly + if (msg.target_system == mavSystemId) { + // mavlink_msg_param_value_pack(system_id, component_id, msg, param_value->param_id, param_value->param_value, param_value->param_type, param_value->param_count, param_value->param_index); + mavlink_msg_param_value_pack(mavSystemId, mavComponentId, &mavSendMsg, 0, 0, 0, 0, 0); + mavlinkSendMessage(); + } + return true; +} + static bool handleIncoming_RADIO_STATUS(void) { mavlink_radio_status_t msg; mavlink_msg_radio_status_decode(&mavRecvMsg, &msg); + txbuff_valid = true; txbuff_free = msg.txbuf; return true; } @@ -1163,6 +1178,7 @@ static bool handleIncoming_ADSB_VEHICLE(void) { } #endif +// Returns whether a message was processed static bool processMAVLinkIncomingTelemetry(void) { while (serialRxBytesWaiting(mavlinkPort) > 0) { @@ -1173,6 +1189,8 @@ static bool processMAVLinkIncomingTelemetry(void) switch (mavRecvMsg.msgid) { case MAVLINK_MSG_ID_HEARTBEAT: break; + case MAVLINK_MSG_ID_PARAM_REQUEST_LIST: + return handleIncoming_PARAM_REQUEST_LIST(); case MAVLINK_MSG_ID_MISSION_CLEAR_ALL: return handleIncoming_MISSION_CLEAR_ALL(); case MAVLINK_MSG_ID_MISSION_COUNT: @@ -1184,13 +1202,17 @@ static bool processMAVLinkIncomingTelemetry(void) case MAVLINK_MSG_ID_MISSION_REQUEST: return handleIncoming_MISSION_REQUEST(); case MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE: - return handleIncoming_RC_CHANNELS_OVERRIDE(); + handleIncoming_RC_CHANNELS_OVERRIDE(); + // Don't set that we handled a message, otherwise RC channel packets will block telemetry messages + return false; #ifdef USE_ADSB case MAVLINK_MSG_ID_ADSB_VEHICLE: return handleIncoming_ADSB_VEHICLE(); #endif case MAVLINK_MSG_ID_RADIO_STATUS: - return handleIncoming_RADIO_STATUS(); + handleIncoming_RADIO_STATUS(); + // Don't set that we handled a message, otherwise radio status packets will block telemetry messages + return false; default: return false; } @@ -1202,8 +1224,6 @@ static bool processMAVLinkIncomingTelemetry(void) void handleMAVLinkTelemetry(timeUs_t currentTimeUs) { - static bool incomingRequestServed; - if (!mavlinkTelemetryEnabled) { return; } @@ -1212,24 +1232,23 @@ void handleMAVLinkTelemetry(timeUs_t currentTimeUs) return; } - // If we did serve data on incoming request - skip next scheduled messages batch to avoid link clogging - if (processMAVLinkIncomingTelemetry()) { - incomingRequestServed = true; + // Process incoming MAVLink - ignore the return indicating whether or not a message was processed + // Very few telemetry links are dynamic uplink/downlink split so uplink telemetry shouldn't reduce downlink bandwidth availability + processMAVLinkIncomingTelemetry(); + + // Determine whether to send telemetry back + bool shouldSendTelemetry = false; + if (txbuff_valid) { + // Use flow control if available + shouldSendTelemetry = txbuff_free >= 33; + } else { + // If not, use blind frame pacing + shouldSendTelemetry = (currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY; } - if ((currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY && txbuff_free >= 90) { - // Only process scheduled data if we didn't serve any incoming request this cycle - if (!incomingRequestServed || - ( - (rxConfig()->receiverType == RX_TYPE_SERIAL) && - (rxConfig()->serialrx_provider == SERIALRX_MAVLINK) && - !tristateWithDefaultOnIsActive(rxConfig()->halfDuplex) - ) - ) { - processMAVLinkTelemetry(currentTimeUs); - } + if (shouldSendTelemetry) { + processMAVLinkTelemetry(currentTimeUs); lastMavlinkMessage = currentTimeUs; - incomingRequestServed = false; } } From 3d1e6832c5f01be1c854ba369a1c7533702d7dbf Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:33:27 +0200 Subject: [PATCH 357/429] "working" need to fill in actual telemetry values now. --- src/main/fc/fc_tasks.c | 5 +- src/main/rx/sbus.c | 17 +- src/main/rx/sbus.h | 5 +- src/main/target/common.h | 6 +- src/main/telemetry/sbus2.c | 794 +++++++++++++++++++++++++++++++-- src/main/telemetry/sbus2.h | 173 ++++--- src/main/telemetry/telemetry.c | 6 +- 7 files changed, 906 insertions(+), 100 deletions(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 5728b9752cd..b269681baa7 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -93,6 +93,7 @@ #include "sensors/opflow.h" #include "telemetry/telemetry.h" +#include "telemetry/sbus2.h" #include "config/feature.h" @@ -438,7 +439,7 @@ void fcTasksInit(void) #endif #if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) - setTaskEnabled(TASK_TELEMETRY_SBUS2, rxConfig->serialrx_provider == SERIALRX_SBUS2); + setTaskEnabled(TASK_TELEMETRY_SBUS2,rxConfig()->receiverType == RX_TYPE_SERIAL && rxConfig()->serialrx_provider == SERIALRX_SBUS2); #endif #ifdef USE_ADAPTIVE_FILTER @@ -734,7 +735,7 @@ cfTask_t cfTasks[TASK_COUNT] = { [TASK_TELEMETRY_SBUS2] = { .taskName = "SBUS2_TELEMETRY", .taskFunc = taskSendSbus2Telemetry, - .desiredPeriod = TASK_PERIOD_US(300), + .desiredPeriod = TASK_PERIOD_HZ(2000), .staticPriority = TASK_PRIORITY_IDLE, }, #endif diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 3d08d274333..e8f67522b77 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -67,6 +67,7 @@ typedef struct sbusFrameData_s { } sbusFrameData_t; static uint8_t sbus2ActiveTelemetryPage = 0; +static uint8_t sbus2ActiveTelemetrySlot = 0; timeUs_t frameTime = 0; // Receive ISR callback @@ -76,6 +77,7 @@ static void sbusDataReceive(uint16_t c, void *data) const timeUs_t currentTimeUs = micros(); const timeDelta_t timeSinceLastByteUs = cmpTimeUs(currentTimeUs, sbusFrameData->lastActivityTimeUs); sbusFrameData->lastActivityTimeUs = currentTimeUs; + bool isSbus2Frame = true; // Handle inter-frame gap. We dwell in STATE_SBUS_WAIT_SYNC state ignoring all incoming bytes until we get long enough quite period on the wire if (sbusFrameData->state == STATE_SBUS_WAIT_SYNC && timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { @@ -108,8 +110,10 @@ static void sbusDataReceive(uint16_t c, void *data) if(frame->endByte & 0x4) { sbus2ActiveTelemetryPage = (frame->endByte >> 4) & 0xF; frameTime = currentTimeUs; + isSbus2Frame = true; } else { sbus2ActiveTelemetryPage = 0; + sbus2ActiveTelemetrySlot = 0; frameTime = -1; } @@ -153,6 +157,8 @@ static uint8_t sbusFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig) // Reset the frameDone flag - tell ISR that we're ready to receive next frame sbusFrameData->frameDone = false; + //taskSendSbus2Telemetry(micros()); + // Calculate "virtual link quality based on packet loss metric" if (retValue & RX_FRAME_COMPLETE) { lqTrackerAccumulate(rxRuntimeConfig->lqTracker, ((retValue & RX_FRAME_DROPPED) || (retValue & RX_FRAME_FAILSAFE)) ? 0 : RSSI_MAX_VALUE); @@ -217,11 +223,18 @@ bool sbusInitFast(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig return sbusInitEx(rxConfig, rxRuntimeConfig, SBUS_BAUDRATE_FAST); } -#if defined(USE_TELEMETRY) && defined(USE_SBUS2_TELEMETRY) -uint8_t sbusGetLastFrameTime(void) { +#if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) +timeUs_t sbusGetLastFrameTime(void) { return frameTime; } +uint8_t sbusGetCurrentTelemetryNextSlot(void) +{ + uint8_t current = sbus2ActiveTelemetrySlot; + sbus2ActiveTelemetrySlot++; + return current; +} + uint8_t sbusGetCurrentTelemetryPage(void) { return sbus2ActiveTelemetryPage; } diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index b3356ace83e..aa550b618e1 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -24,7 +24,8 @@ bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); -#ifdef USE_SBUS2_TELEMETRY +#ifdef USE_TELEMETRY_SBUS2 uint8_t sbusGetCurrentTelemetryPage(void); -uint8_t sbusGetLastFrameTime(void); +uint8_t sbusGetCurrentTelemetryNextSlot(void); +timeUs_t sbusGetLastFrameTime(void); #endif diff --git a/src/main/target/common.h b/src/main/target/common.h index 3238abea018..51f1fbf6ea6 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -195,9 +195,9 @@ #define USE_HEADTRACKER_SERIAL #define USE_HEADTRACKER_MSP -#ifndef STM32F4 -// needs bi-direction inverter, no available on F4 hardware. -#define USE_SBUS2_TELEMETRY +#if defined(STM32F7) || defined(STM32H7) +// needs bi-direction inverter, not available on F4 hardware. +#define USE_TELEMETRY_SBUS2 #endif //Designed to free space of F722 and F411 MCUs diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index c00a3a1d0da..5cb6e40f276 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -29,7 +29,7 @@ #include "rx/sbus.h" -#ifdef USE_SBUS2_TELEMETRY +#ifdef USE_TELEMETRY_SBUS2 const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, @@ -39,9 +39,10 @@ const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { }; + sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT] = {}; uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT] = {}; -timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT] = {}; +timeUs_t sbusTelemetryMinDelay[SBUS2_SLOT_COUNT] = {}; void handleSbus2Telemetry(timeUs_t currentTimeUs) { @@ -49,45 +50,788 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) // TODO: placeholder - int16_t temp = 42 | 0x4000; - sbusTelemetryData[0].payload.temp125.tempHigh = ((temp >> 8) & 0xFF); - sbusTelemetryData[0].payload.temp125.tempLow = (temp & 0xFF); - sbusTelemetryDataUsed[0] = 1; + for (int i = 1; i < SBUS2_SLOT_COUNT; ++i) { + int16_t temp = 41 + i; + send_SBS01T(i, temp); + } - int16_t rpm = 9000; - sbusTelemetryData[1].payload.rpm.rpmHigh = (rpm >> 8) & 0xFF; - sbusTelemetryData[1].payload.rpm.rpmLow = rpm & 0xFF; - sbusTelemetryDataUsed[1] = 1; - // P1S0: TEMP - // P1S1: RPM - // update telemetry info + DEBUG_SET(DEBUG_SBUS2, 5, 42); +} + + +#define SBUS2_DEADTIME MS2US(2) +#define SBUS2_SLOT_TIME 700 +#define SBUS2_SLOT_DELAY_MAX 200 +uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) +{ + if (elapsed < SBUS2_DEADTIME) { + return 0xFF; // skip it + } + + elapsed = elapsed - SBUS2_DEADTIME; + + uint8_t slot = (elapsed % SBUS2_SLOT_TIME) - 1; + + if (elapsed - (slot * SBUS2_SLOT_TIME) > SBUS2_SLOT_DELAY_MAX) { + slot = 0xFF; + } + + return slot; } void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { - if(!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || rxConfig()->serialrx_provider != SERIALRX_SBUS2) - { + if (!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || + rxConfig()->serialrx_provider != SERIALRX_SBUS2) { + DEBUG_SET(DEBUG_SBUS2, 0, -1); return; } + timeUs_t elapsedTime = currentTimeUs - sbusGetLastFrameTime(); + + if(elapsedTime > MS2US(8)) { + DEBUG_SET(DEBUG_SBUS2, 0, -2); + return; + } + + DEBUG_SET(DEBUG_SBUS2, 0, 1); + uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); - uint8_t lastFrame = sbusGetLastFrameTime(); - timeUs_t elapsedTime = currentTimeUs - lastFrame - MS2US(2); - // 2ms after sbus2 frame = slot 0 - // +660us for next slot - if(elapsedTime > MS2US(2)) { - uint8_t slot = elapsedTime % 660; + uint8_t slot = sbus2GetTelemetrySlot(elapsedTime); + + if(slot < SBUS2_TELEMETRY_SLOTS) { + DEBUG_SET(DEBUG_SBUS2, 1, telemetryPage); + DEBUG_SET(DEBUG_SBUS2, 2, slot); + DEBUG_SET(DEBUG_SBUS2, 4, -1); int slotIndex = (telemetryPage * SBUS2_TELEMETRY_SLOTS) + slot; - if(slot < SBUS2_TELEMETRY_SLOTS && slotIndex < SBUS2_SLOT_COUNT && (currentTimeUs - sbusTelemetryDataLastSent[slotIndex]) > MS2US(2)) { - if(sbusTelemetryDataUsed[slotIndex] != 0) { + if (slotIndex < SBUS2_SLOT_COUNT) { + DEBUG_SET(DEBUG_SBUS2, 3, slotIndex); + if (sbusTelemetryDataUsed[slotIndex] != 0 && sbusTelemetryMinDelay[slotIndex] < currentTimeUs) { sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; // send - serialWriteBuf(telemetrySharedPort, (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); - sbusTelemetryDataLastSent[slotIndex] = currentTimeUs; + serialWriteBuf(telemetrySharedPort, + (const uint8_t *)&sbusTelemetryData[slotIndex], + sizeof(sbus2_telemetry_frame_t)); + sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(2); + sbusTelemetryDataUsed[slotIndex] = 0; + + DEBUG_SET(DEBUG_SBUS2, 4, slotIndex); } } } } +// +void send_RPM(uint8_t port, uint32_t RPM) +{ + uint32_t value = 0; + uint8_t bytes[2] = { }; + + value = RPM / 6; + if(value > 0xffff){ + value = 0xffff; + } + bytes[1] = value >> 8; + bytes[0] = value; + SBUS2_transmit_telemetry_data( port , bytes); +} + + +void send_temp125(uint8_t port, int16_t temp) +{ + int16_t value= 0; + uint8_t bytes[2] = { }; + + value = temp | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); +} +void send_SBS01T(uint8_t port, int16_t temp){ + int16_t value= 0; + uint8_t bytes[2] = {}; + + value = temp | 0x8000; + value = value + 100; + bytes[0] = value;// >> 8; + bytes[1] = value >> 8; + SBUS2_transmit_telemetry_data( port , bytes); +} + + +void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2) +{ + uint16_t value = 0; + uint8_t bytes[2] = { }; + + // VOLTAGE1 + value = voltage1 | 0x8000; + if ( value > 0x9FFF ){ + value = 0x9FFF; // max voltage is 819.1 + } + else if(value < 0x8000){ + value = 0x8000; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //VOLTAGE2 + value = voltage2; + if ( value > 0x1FFF ){ + value = 0x1FFF; // max voltage is 819.1 + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+1 , bytes); +} + +void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage) +{ + uint16_t value = 0; + uint32_t local = 0; + uint8_t bytes[2] = { }; + + + // CURRENT + local = ((uint32_t)current) * 1 ; + value = (uint16_t)local; + if ( value > 0x3FFF ) + { + // max current is 163.83 + value = 0x3FFF; + } + bytes[0] = value >> 8; + bytes[0] = bytes[0] | 0x40; + bytes[0] = bytes[0] & 0x7F; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //VOLTAGE + local = ((uint32_t)voltage) * 1; + value = (uint16_t)local; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+1 , bytes); + + // CAPACITY + local = (uint32_t)capacity; + value = (uint16_t)local; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+2 , bytes); +} + +void send_f1675_gps(uint8_t port, uint16_t speed, int16_t altitude, int16_t vario, int32_t latitude, int32_t longitude) +{ + uint16_t value1 = 0; + int16_t value2 = 0; + uint32_t value3 = 0; + bool latitude_pos = false; + bool longitude_pos = false; + uint8_t bytes[2] = {}; + + + // SPEED -> Bit 14(bytes[1] bit7) -> GPS Valid or not + value1 = speed | 0x4000; + if (value1 > 0x43E7 ){ + value1 = 0x43E7; // max Speed is 999 km/h + } + else if( value1 < 0x4000){ + value1 = 0x4000; + } + bytes[0] = value1 >> 8; + bytes[1] = value1; + SBUS2_transmit_telemetry_data( port , bytes); + + //HIGHT + value2 = altitude | 0x4000; + /*if(value2 > 0x7FFF ){ // max = +16383 + value2 = 0x7FFF; + } + else if( value2 < 0xC000){ // min = -16384 + value2 = 0xC000; + }*/ + bytes[0] = value2 >> 8; + bytes[1] = value2; + SBUS2_transmit_telemetry_data( port+1 , bytes); + + //TIME -> 12:34:56 Uhr = 12*60*60 + 34*60 + 56 = 45296 = 0xB0F0 + bytes[0] = 0xB0; + bytes[1] = 0xF0; + SBUS2_transmit_telemetry_data( port+2 , bytes); + + // VARIO + value2 = vario * 10; + bytes[0] = value2 >> 8; + bytes[1] = value2; + SBUS2_transmit_telemetry_data( port+3 , bytes); + + // LATITUDE + if(latitude >= 0){ + latitude_pos = true; + } + else{ + latitude_pos = false; + latitude = latitude * -1; + } + bytes[0] = (uint8_t)(latitude/1000000); + value3 = (uint32_t)(latitude%1000000); + if(latitude_pos){ + bytes[1] = ((value3 >> 16) & 0x0f); // North + } + else{ + bytes[1] = ((value3 >> 16) | 0x1f); // South + } + SBUS2_transmit_telemetry_data( port+4 , bytes); + + bytes[0] = ((value3 >> 8) & 0xff); + bytes[1] = value3 & 0xff; + SBUS2_transmit_telemetry_data( port+5 , bytes); + + // LONGITUDE + if(longitude >= 0){ + longitude_pos = true; + } + else{ + longitude_pos = false; + longitude = longitude * -1; + } + bytes[0] = (uint8_t)(longitude/1000000); + value3 = (uint32_t)(longitude%1000000); + if(longitude_pos){ + bytes[1] = ((value3 >> 16) & 0x0f); // Eath + } + else{ + bytes[1] = ((value3 >> 16) | 0x1f); // West + } + SBUS2_transmit_telemetry_data( port+6 , bytes); + + bytes[0] = ((value3 >> 8) & 0xff); + bytes[1] = value3 & 0xff; + SBUS2_transmit_telemetry_data( port+7 , bytes); +} + +void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario) +{ + int16_t value = 0; + uint8_t bytes[2] = { }; + + // VARIO + value = vario; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port, bytes); + + //HIGHT + value = altitude | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1, bytes); +} + +void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario) +{ + int16_t value = 0; + uint8_t bytes[2] = { }; + + // VARIO + value = vario; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //HIGHT + value = altitude | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + +} + + +void send_SBS01TE(uint8_t port, int16_t temp){ + send_temp125(port, temp); +} +void send_F1713(uint8_t port, int16_t temp){ + send_temp125(port, temp); +} + +void send_SBS01RB(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01RM(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01RO(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01R(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} + +void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ + send_s1678_current(port, current, capacity, voltage); +} +void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} +void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} +void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2){ + send_voltage(port, voltage1, voltage2); +} +void send_SBS01Vf(uint8_t port,float voltage1, float voltage2){ + send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); +} +void send_voltagef(uint8_t port,float voltage1, float voltage2){ + send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); +} +void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ + send_s1678_current(port, current, capacity, voltage); +} +void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} + +void send_f1712_variof(uint8_t port, int16_t altitude, float vario){ + send_f1712_vario(port, altitude, (int16_t)(vario * 10)); +} +void send_f1672_variof(uint8_t port, int16_t altitude, float vario){ + send_f1672_vario(port, altitude, (int16_t)(vario * 100)); +} +void send_F1712(uint8_t port, int16_t altitude, int16_t vario){ + send_f1712_vario(port, altitude, vario); +} +void send_F1712f(uint8_t port, int16_t altitude, float vario){ + send_f1712_vario(port, altitude, (int16_t)(vario * 10)); +} +void send_F1672(uint8_t port, int16_t altitude, int16_t vario){ + send_f1672_vario(port, altitude, vario); +} +void send_F1672f(uint8_t port, int16_t altitude, float vario){ + send_f1672_vario(port, altitude, (int16_t)(vario * 100)); +} + +void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min){ + bool Lat_Negative = false; + bool Lon_Negative = false; + if(lat_deg < 0){ + Lat_Negative = true; + lat_deg = lat_deg * -1; + } + if(lon_deg < 0){ + Lon_Negative = true; + lon_deg = lon_deg * -1; + } + if(lat_min < 0){ + Lat_Negative = true; + lat_min = lat_min * -1; + } + if(lon_min < 0){ + Lon_Negative = true; + lon_min = lon_min * -1; + } + int32_t _latitude_deg = lat_deg; + int32_t _longitude_deg = lon_deg; + int32_t _latitude_min = lat_min * 10000; + int32_t _longitude_min = lon_min * 10000; + int32_t _latitude = _latitude_deg * 1000000; + int32_t _longitude = _longitude_deg * 1000000; + _latitude = _latitude + _latitude_min; + _longitude = _longitude + _longitude_min; + if(Lat_Negative){ + _latitude = _latitude * -1; + } + if(Lon_Negative){ + _longitude = _longitude * -1; + } + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min){ + bool Lat_Negative = false; + bool Lon_Negative = false; + if(lat_deg < 0){ + Lat_Negative = true; + lat_deg = lat_deg * -1; + } + if(lon_deg < 0){ + Lon_Negative = true; + lon_deg = lon_deg * -1; + } + if(lat_min < 0){ + Lat_Negative = true; + lat_min = lat_min * -1; + } + if(lon_min < 0){ + Lon_Negative = true; + lon_min = lon_min * -1; + } + int32_t _latitude_deg = lat_deg; + int32_t _longitude_deg = lon_deg; + int32_t _latitude = _latitude_deg * 1000000; + int32_t _longitude = _longitude_deg * 1000000; + _latitude = _latitude + lat_min; + _longitude = _longitude + lon_min; + if(Lat_Negative){ + _latitude = _latitude * -1; + } + if(Lon_Negative){ + _longitude = _longitude * -1; + } + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude){ + int32_t _latitude = latitude; + int32_t _longitude = longitude; + int32_t _latitude_deg = _latitude/1000000; + int32_t _longitude_deg = _longitude/1000000; + int32_t _latitude_min = _latitude%1000000; + int32_t _longitude_min = _longitude%1000000; + _latitude = _latitude_deg * 1000000; + _longitude = _longitude_deg * 1000000; + _latitude = _latitude + ((_latitude_min * 60)/100); + _longitude = _longitude + ((_longitude_min * 60)/100); + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude){ + int32_t _latitude = latitude * 1000000; + int32_t _longitude = longitude * 1000000; + int32_t _latitude_deg = _latitude/1000000; + int32_t _longitude_deg = _longitude/1000000; + int32_t _latitude_min = _latitude%1000000; + int32_t _longitude_min = _longitude%1000000; + _latitude = _latitude_deg * 1000000; + _longitude = _longitude_deg * 1000000; + _latitude = _latitude + ((_latitude_min * 60)/100); + _longitude = _longitude + ((_longitude_min * 60)/100); + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_SBS10G( + uint8_t port, + uint16_t hours, // 0 to 24 + uint16_t minutes, // 0 to 60 + uint16_t seconds, // 0 to 60 + float latitude, // decimal degrees (i.e. 52.520833; negative value for southern hemisphere) + float longitude, // decimal degrees (i.e. 13.409430; negative value for western hemisphere) + float altitudeMeters, // meters (valid range: -1050 to 4600) + uint16_t speed, // km/h (valid range 0 to 511) + float gpsVario) // m/s (valid range: -150 to 260) +{ + uint32_t utc = (hours*3600) + (minutes*60) + seconds; + uint32_t lat, lon; + // scale latitude/longitude (add 0.5 for correct rounding) + if (latitude > 0) { + lat = (600000.0*latitude) + 0.5; + } + else { + lat = (-600000.0*latitude) + 0.5; + // toggle south bit + lat |= 0x4000000; + } + if (longitude > 0) { + lon = (600000.0*longitude) + 0.5; + } + else { + lon = (-600000.0*longitude) + 0.5; + // toggle west bit + lon |= 0x8000000; + } + // convert altitude (add 0.5 for correct rounding) + uint16_t alt = (altitudeMeters>=-820 && altitudeMeters<=4830) ?(1.25*(altitudeMeters+820)) + 0.5 : 0; + // error check speed + if (speed < 512) { + // set speed enable bit + speed |= 0x200; + } + else { + speed = 0; + } + // initialize buffer + uint8_t bytes[2] = { }; + // slot 0 (utc) + bytes[0] = (utc&0x00ff); + bytes[1] = (utc&0xff00)>>8; + SBUS2_transmit_telemetry_data(port , bytes); + // slot 1 (latitude & utc) + bytes[0] = ((lat&0x007f)<<1) | ((utc&0x10000)>>16); + bytes[1] = (lat&0x7f80)>>7; + SBUS2_transmit_telemetry_data(port+1 , bytes); + // slot 2 (latitude & longitude) + bytes[0] = (lat&0x07f8000)>>15; + bytes[1] = ((lat&0x7800000)>>23) | (lon&0x0f)<<4; + SBUS2_transmit_telemetry_data(port+2 , bytes); + // slot 3 (longitude) + bytes[0] = (lon&0x00ff0)>>4; + bytes[1] = (lon&0xff000)>>12; + SBUS2_transmit_telemetry_data(port+3 , bytes); + // slot 4 (longitude & speed) + bytes[0] = ((lon&0xff00000)>>20); + bytes[1] = (speed&0xff); + SBUS2_transmit_telemetry_data(port+4 , bytes); + // slot 5 (pressure & speed) + bytes[0] = ((speed&0x300)>>8); + bytes[1] = 0x00; + SBUS2_transmit_telemetry_data(port+5 , bytes); + // slot 6 (altitude & pressure) + bytes[0] = ((alt&0x003)<<6); + bytes[1] = (alt&0x3fc)>>2; + SBUS2_transmit_telemetry_data(port+6 , bytes); + // slot (7 (vario & altitude) + uint16_t vario; + // error check vario + if (gpsVario >= -150 && gpsVario <= 260) { + // scale vario (add 0.5 for correct rounding) + vario = (10.0*(gpsVario + 150)) + 0.5; + // set vario enable + vario |= 0x1000; + } + else { + vario = 0; + } + bytes[0] = ((vario&0x001f)<<3) | ((alt&0x1c00)>>10); + bytes[1] = (vario&0x1fe0)>>5; + SBUS2_transmit_telemetry_data(port+7 , bytes); +} +void send_scorpion_kontronik( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + uint32_t value = 0; + uint8_t bytes[2] = { }; + + // voltage 41.1 = 4110 + value = voltage | 0x8000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + // 1330 mah => 1.33 Ah + value = capacity; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + + // 2250 rpm => 2250 + value = rpm / 6; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 2 , bytes); + + // 13310 => 133.1 A + value = current; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 3 , bytes); + + // 41 => 41 Celsius + value = temp; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 4 , bytes); + + // 21 => Bec Celsius + value = becTemp; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 5 , bytes); + + // 650 => 6,5 Bec Current + value = becCurrent; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 6 , bytes); + + // PWM output + value = pwm; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 7 , bytes); +} + +void send_scorpion( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + send_scorpion_kontronik( + port, + voltage, + capacity, + rpm, + current, + temp, + becTemp, + becCurrent, + pwm); +} + +void send_kontronik( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + send_scorpion_kontronik( + port, + voltage, + capacity, + rpm, + current, + temp, + becTemp, + becCurrent, + pwm); +} + +void send_jetcat( + uint8_t port, + uint32_t rpm, + uint16_t egt, + uint16_t pump_volt, + uint32_t setrpm, + uint16_t thrust, + uint16_t fuel, + uint16_t fuelflow, + uint16_t altitude, + uint16_t quality, + uint16_t volt, + uint16_t current, + uint16_t speed, + uint16_t status, + uint32_t secondrpm) +{ + uint32_t value = 0; + uint8_t bytes[2] = {}; + + // Actual RPM with 0x4000 Offset -> why? + value = rpm / 100; + value = value | 0x4000; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + // EGT Abgastemperatur in °C + value = egt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + + // Pump Voltage 12.34V = 1234 + value = pump_volt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 2 , bytes); + + // Setpoint RPM without Offset + value = setrpm / 100; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 3 , bytes); + + // Thrust 123.4N = 1234 + value = thrust; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 4 , bytes); + + // Fuel (remain) in ml + value = fuel; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 5 , bytes); + + // Fuel Flow in ml/min + value = fuelflow; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 6 , bytes); + + // Altitude -> without offset? + value = altitude; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 7 , bytes); + + // Fuel Quality in % + value = quality; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 8 , bytes); + + // Voltage 12.34V = 1234 + value = volt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 9 , bytes); + + // Current 123.4A = 1234 + value = current; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 10 , bytes); + + // Speed in km/h + value = speed; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 11 , bytes); + + // Status and Error Code + value = status; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 12 , bytes); + + // Second RPM without Offset + value = secondrpm / 100; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 13 , bytes); + +} + + +void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes) +{ + if(slotId > 0 && slotId < SBUS2_SLOT_COUNT) { + sbusTelemetryData[slotId].payload.data[0] = bytes[0]; + sbusTelemetryData[slotId].payload.data[1] = bytes[1]; + sbusTelemetryData[slotId].slotId = sbus2SlotIds[slotId]; + //sbusTelemetryData[i].payload.data[0] = 0x81; + //sbusTelemetryData[i].payload.data[1] = 0x80; + sbusTelemetryDataUsed[slotId] = 1; + } + +} + #endif diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 9fdbc3fd7db..62dcd85aecf 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -22,89 +22,35 @@ #include "platform.h" +#include "common/time.h" + #define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 #define SBUS2_TELEMETRY_ITEM_SIZE 3 #define SBUS2_TELEMETRY_SLOTS 8 #define SBUS2_TELEMETRY_PAGES 4 +#define SBUS2_DEADTIME MS2US(2) +#define SBUS2_SLOT_TIME 700 +#define SBUS2_SLOT_DELAY_MAX 200 + #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) -#if defined(USE_TELEMETRY) && defined(USE_SBUS2_TELEMETRY) +#if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) // Information on SBUS2 sensors from: https://github.com/BrushlessPower/SBUS2-Telemetry/tree/master -// Temperature: -// Max 125C -// value | 0x4000 -typedef struct sbus2_telemetry_temp_payload_s { - uint8_t tempHigh; // temp | 0x4000; // 125c - uint8_t tempLow; -} __attribute__((packed)) sbsu2_telemetry_temp_payload_t; - -// Temperature: -// Max 200C -// temp | 0x8000 -typedef struct sbus2_telemetry_temp200_payload_s { - uint8_t tempLow; // temp | 0x8000; // 200c - uint8_t tempHigh; -} __attribute__((packed)) sbsu2_telemetry_temp200_payload_t; - -// RPM: -// (RPM / 6) max: 0xFFFF -typedef struct sbus2_telemetry_rpm_payload_s { - uint8_t rpmHigh; // RPM / 6, capped at 0xFFFF - uint8_t rpmLow; -} __attribute__((packed)) sbsu2_telemetry_rpm_payload_t; - -// Voltage: 1 or 2 slots -// 0x8000 = rx voltage? -// max input: 0x1FFF -typedef struct sbus2_telemetry_voltage_payload_s { - uint8_t voltageHigh; // 2 slots // Voltage 1: value | 0x8000 - uint8_t voltageLow; // max input value: 0x1FFF -} __attribute__((packed)) sbsu2_telemetry_voltage_payload_t; - -// Current -// 3 frames -// 1: current -// Max input: 0x3FFF -// input |= 0x4000 -// input &= 0x7FFF -// 2: voltage -// same as voltage frame. may not need ot be capped. -// 3: Capacity -typedef struct sbus2_telemetry_current_payload_s { - uint8_t currentHigh; - uint8_t currentLow; -} __attribute__((packed)) sbsu2_telemetry_current_payload_t; - -typedef struct sbus2_telemetry_capacity_payload_s { - uint8_t capacityHigh; - uint8_t capacityLow; -} __attribute__((packed)) sbsu2_telemetry_capacity_payload_t; - -// GPS -// frames: -// 1: Speed -// 2: Altitude -// 3: Vario -// 4,5: LAT -// 5,6: LON - typedef struct sbus2_telemetry_frame_s { uint8_t slotId; union { uint8_t data[2]; - sbsu2_telemetry_temp_payload_t temp125; - sbsu2_telemetry_temp200_payload_t temp200; - sbsu2_telemetry_rpm_payload_t rpm; - sbsu2_telemetry_voltage_payload_t voltage; - sbsu2_telemetry_current_payload_t current; - sbsu2_telemetry_capacity_payload_t capacity; + uint16_t u16; } payload; } __attribute__((packed)) sbus2_telemetry_frame_t; + +STATIC_ASSERT(sizeof(sbus2_telemetry_frame_t) == 3, sbus2_telemetry_size); + extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT]; extern uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT]; @@ -115,4 +61,101 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs); // time critical, send sbus2 data void taskSendSbus2Telemetry(timeUs_t currentTimeUs); + +uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed); + +// Sensor code from https://github.com/BrushlessPower/SBUS2-Telemetry +// SBUS2 telemetry: 2ms deadtime after rc package +// One new slot every 700us + +/* + * ++++++++++++++++++++++++++++++++ + * Temperature Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_temp125(uint8_t port, int16_t temp); +void send_alarm_as_temp125(uint8_t port, int16_t alarm); +void send_SBS01TE(uint8_t port, int16_t temp); +void send_SBS01T(uint8_t port, int16_t temp); +void send_F1713(uint8_t port, int16_t temp); + +/* + * ++++++++++++++++++++++++++++++++ + * RPM Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_RPM(uint8_t port, uint32_t RPM); +void send_SBS01RB(uint8_t port, uint32_t RPM); +void send_SBS01RM(uint8_t port, uint32_t RPM); +void send_SBS01RO(uint8_t port, uint32_t RPM); +void send_SBS01R(uint8_t port, uint32_t RPM); + +/* + * ++++++++++++++++++++++++++++++++ + * Voltage/Current Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2); +void send_voltagef(uint8_t port,float voltage1, float voltage2); +void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage); +void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage); +void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage); +void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2); +void send_SBS01Vf(uint8_t port,float voltage1, float voltage2); + + +/* + * ++++++++++++++++++++++++++++++++ + * Vario Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario); +void send_f1712_variof(uint8_t port, int16_t altitude, float vario); +void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario); +void send_f1672_variof(uint8_t port, int16_t altitude, float vario); +void send_F1712(uint8_t port, int16_t altitude, int16_t vario); +void send_F1712f(uint8_t port, int16_t altitude, float vario); +void send_F1672(uint8_t port, int16_t altitude, int16_t vario); +void send_F1672f(uint8_t port, int16_t altitude, float vario); + +/* + * ++++++++++++++++++++++++++++++++ + * GPS Sensors + * Note the different Input Types! + * Example: + * Position Berlin Fernsehturm + * https://www.koordinaten-umrechner.de/decimal/52.520832,13.409430?karte=OpenStreetMap&zoom=19 + * Degree Minutes 52° 31.2499 and 13° 24.5658 + * Decimal Degree 52.520832 and 13.409430 + * ++++++++++++++++++++++++++++++++ + */ +// Degree Minutes as Integer -> 52312499 +void send_f1675_gps(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); +// Degree Minutes as Integer -> 52 and 312499 +void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min); +// Degree Minutes as Float -> 52 and 31.2499 +void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min); +// Decimal Degrees as Float -> 52.520832 +void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude); +// Decimal Degrees as Integer -> 52520832 +void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); +void send_SBS10G(uint8_t port, uint16_t hours, uint16_t minutes, uint16_t seconds, float latitude, float longitude, float altitudeMeters, uint16_t speed, float gpsVario); + +/* + * ++++++++++++++++++++++++++++++++ + * ESC Sensors + * Note These sensors only exists on the newer Futaba Radios 18SZ, 16IZ, etc + * ++++++++++++++++++++++++++++++++ + */ + +void send_kontronik(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); +void send_scorpion(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); + +void send_jetcat(uint8_t port, uint32_t rpm, uint16_t egt, uint16_t pump_volt, uint32_t setrpm, uint16_t thrust, uint16_t fuel, uint16_t fuelflow, uint16_t altitude, uint16_t quality, uint16_t volt, uint16_t current, uint16_t speed, uint16_t status, uint32_t secondrpm); + +void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes); + #endif diff --git a/src/main/telemetry/telemetry.c b/src/main/telemetry/telemetry.c index dd6e08961e0..f6ba7f85437 100644 --- a/src/main/telemetry/telemetry.c +++ b/src/main/telemetry/telemetry.c @@ -23,6 +23,8 @@ #ifdef USE_TELEMETRY +#include "build/debug.h" + #include "common/utils.h" #include "config/parameter_group.h" @@ -49,6 +51,7 @@ #include "telemetry/ibus.h" #include "telemetry/crsf.h" #include "telemetry/srxl.h" +#include "telemetry/sbus2.h" #include "telemetry/sim.h" #include "telemetry/ghst.h" @@ -246,8 +249,9 @@ void telemetryProcess(timeUs_t currentTimeUs) handleGhstTelemetry(currentTimeUs); #endif -#ifdef USE_TELMETRY_SBUS2 +#ifdef USE_TELEMETRY_SBUS2 handleSbus2Telemetry(currentTimeUs); + DEBUG_SET(DEBUG_SBUS2, 7, 1); #endif } From 92d6315e59446cda53422ea9c08d06fe6f19a0dd Mon Sep 17 00:00:00 2001 From: MUSTARDTIGERFPV Date: Thu, 11 Jul 2024 20:19:47 +0000 Subject: [PATCH 358/429] Improve MAVLink behavior with half-duplex links, update default SRs --- docs/Settings.md | 4 ++-- src/main/fc/settings.yaml | 4 ++-- src/main/telemetry/mavlink.c | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/docs/Settings.md b/docs/Settings.md index a217a26a981..393960c2622 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -2518,7 +2518,7 @@ Rate of the extra1 message for MAVLink telemetry | Default | Min | Max | | --- | --- | --- | -| 10 | 0 | 255 | +| 2 | 0 | 255 | --- @@ -2558,7 +2558,7 @@ Rate of the RC channels message for MAVLink telemetry | Default | Min | Max | | --- | --- | --- | -| 5 | 0 | 255 | +| 1 | 0 | 255 | --- diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 6670148d0bd..5caf1dd8215 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -3155,7 +3155,7 @@ groups: type: uint8_t min: 0 max: 255 - default_value: 5 + default_value: 1 - name: mavlink_pos_rate description: "Rate of the position message for MAVLink telemetry" field: mavlink.position_rate @@ -3169,7 +3169,7 @@ groups: type: uint8_t min: 0 max: 255 - default_value: 10 + default_value: 2 - name: mavlink_extra2_rate description: "Rate of the extra2 message for MAVLink telemetry" field: mavlink.extra2_rate diff --git a/src/main/telemetry/mavlink.c b/src/main/telemetry/mavlink.c index be10ad1fd95..8931ed83c83 100644 --- a/src/main/telemetry/mavlink.c +++ b/src/main/telemetry/mavlink.c @@ -1222,6 +1222,11 @@ static bool processMAVLinkIncomingTelemetry(void) return false; } +static bool isMAVLinkTelemetryHalfDuplex(void) { + return telemetryConfig()->halfDuplex || + (rxConfig()->receiverType == RX_TYPE_SERIAL && rxConfig()->serialrx_provider == SERIALRX_MAVLINK && tristateWithDefaultOffIsActive(rxConfig()->halfDuplex)); +} + void handleMAVLinkTelemetry(timeUs_t currentTimeUs) { if (!mavlinkTelemetryEnabled) { @@ -1232,18 +1237,18 @@ void handleMAVLinkTelemetry(timeUs_t currentTimeUs) return; } - // Process incoming MAVLink - ignore the return indicating whether or not a message was processed - // Very few telemetry links are dynamic uplink/downlink split so uplink telemetry shouldn't reduce downlink bandwidth availability - processMAVLinkIncomingTelemetry(); - - // Determine whether to send telemetry back + // Process incoming MAVLink + bool receivedMessage = processMAVLinkIncomingTelemetry(); bool shouldSendTelemetry = false; + + // Determine whether to send telemetry back based on flow control / pacing if (txbuff_valid) { // Use flow control if available shouldSendTelemetry = txbuff_free >= 33; } else { - // If not, use blind frame pacing - shouldSendTelemetry = (currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY; + // If not, use blind frame pacing - and back off for collision avoidance if half-duplex + bool halfDuplexBackoff = (isMAVLinkTelemetryHalfDuplex() && receivedMessage); + shouldSendTelemetry = ((currentTimeUs - lastMavlinkMessage) >= TELEMETRY_MAVLINK_DELAY) && !halfDuplexBackoff; } if (shouldSendTelemetry) { From e8ba7a43ac7ceeffe28d48945e7e35655821f113 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:36:50 +0200 Subject: [PATCH 359/429] somewhat works. slow inconsisten updates --- src/main/telemetry/sbus2.c | 73 ++++++++++++++++++++++++++++---------- src/main/telemetry/sbus2.h | 2 +- 2 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 5cb6e40f276..716e850c521 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -23,12 +23,23 @@ #include "common/utils.h" #include "common/time.h" +#include "common/axis.h" #include "telemetry/telemetry.h" #include "telemetry/sbus2.h" #include "rx/sbus.h" +#include "sensors/battery.h" +#include "sensors/sensors.h" + +#include "navigation/navigation.h" + +#ifdef USE_ESC_SENSOR +#include "sensors/esc_sensor.h" +#include "flight/mixer.h" +#endif + #ifdef USE_TELEMETRY_SBUS2 const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { @@ -48,16 +59,50 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) { UNUSED(currentTimeUs); - // TODO: placeholder - - for (int i = 1; i < SBUS2_SLOT_COUNT; ++i) { - int16_t temp = 41 + i; - send_SBS01T(i, temp); + float voltage = getBatteryVoltage() * 0.01f; + float cellVoltage = getBatteryAverageCellVoltage() * 0.01f; + float current = getAmperage() * 0.01f; + float capacity = getMAhDrawn(); + float altitude = getEstimatedActualPosition(Z) * 0.01f; + float vario = getEstimatedActualVelocity(Z); + float temperature = 0; + uint32_t rpm = 0; + +#ifdef USE_ESC_SENSOR + escSensorData_t * escSensor = escSensorGetData(); + if (escSensor && escSensor->dataAge <= ESC_DATA_MAX_AGE) { + rpm = escSensor->rpm; + temperature = escSensor->temperature; + } else { + rpm = 0; + temperature = 0; } +#endif - DEBUG_SET(DEBUG_SBUS2, 5, 42); -} + temperature = 42.16f; + + DEBUG_SET(DEBUG_SBUS2, 0, voltage); + DEBUG_SET(DEBUG_SBUS2, 1, cellVoltage); + DEBUG_SET(DEBUG_SBUS2, 2, current); + DEBUG_SET(DEBUG_SBUS2, 3, capacity); + DEBUG_SET(DEBUG_SBUS2, 4, altitude); + DEBUG_SET(DEBUG_SBUS2, 5, vario); + DEBUG_SET(DEBUG_SBUS2, 6, rpm); + DEBUG_SET(DEBUG_SBUS2, 7, temperature); + + // 2 slots + send_voltagef(1, voltage, cellVoltage); + // 3 slots + send_s1678_currentf(3, current, capacity, voltage); + // 1 slot + send_RPM(6, rpm); + // 1 slot - esc temp + //send_temp125(7, temperature); + send_SBS01T(7, temperature); + // 8 slots - gps + // +} #define SBUS2_DEADTIME MS2US(2) #define SBUS2_SLOT_TIME 700 @@ -83,40 +128,31 @@ void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { if (!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || rxConfig()->serialrx_provider != SERIALRX_SBUS2) { - DEBUG_SET(DEBUG_SBUS2, 0, -1); return; } timeUs_t elapsedTime = currentTimeUs - sbusGetLastFrameTime(); if(elapsedTime > MS2US(8)) { - DEBUG_SET(DEBUG_SBUS2, 0, -2); return; } - DEBUG_SET(DEBUG_SBUS2, 0, 1); uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); uint8_t slot = sbus2GetTelemetrySlot(elapsedTime); if(slot < SBUS2_TELEMETRY_SLOTS) { - DEBUG_SET(DEBUG_SBUS2, 1, telemetryPage); - DEBUG_SET(DEBUG_SBUS2, 2, slot); - DEBUG_SET(DEBUG_SBUS2, 4, -1); int slotIndex = (telemetryPage * SBUS2_TELEMETRY_SLOTS) + slot; if (slotIndex < SBUS2_SLOT_COUNT) { - DEBUG_SET(DEBUG_SBUS2, 3, slotIndex); if (sbusTelemetryDataUsed[slotIndex] != 0 && sbusTelemetryMinDelay[slotIndex] < currentTimeUs) { sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; // send serialWriteBuf(telemetrySharedPort, (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); - sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(2); + sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(1); sbusTelemetryDataUsed[slotIndex] = 0; - - DEBUG_SET(DEBUG_SBUS2, 4, slotIndex); } } } @@ -156,10 +192,9 @@ void send_SBS01T(uint8_t port, int16_t temp){ value = value + 100; bytes[0] = value;// >> 8; bytes[1] = value >> 8; - SBUS2_transmit_telemetry_data( port , bytes); + SBUS2_transmit_telemetry_data(port , bytes); } - void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2) { uint16_t value = 0; diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 62dcd85aecf..d6683a4dc53 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -32,7 +32,7 @@ #define SBUS2_DEADTIME MS2US(2) #define SBUS2_SLOT_TIME 700 -#define SBUS2_SLOT_DELAY_MAX 200 +#define SBUS2_SLOT_DELAY_MAX 300 #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) From 935d309e1363c3c6a64f80fa1c280ebeac107bf2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:12:54 +0200 Subject: [PATCH 360/429] Fix build --- src/main/rx/sbus.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index e8f67522b77..9c0fa30bd11 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -77,7 +77,6 @@ static void sbusDataReceive(uint16_t c, void *data) const timeUs_t currentTimeUs = micros(); const timeDelta_t timeSinceLastByteUs = cmpTimeUs(currentTimeUs, sbusFrameData->lastActivityTimeUs); sbusFrameData->lastActivityTimeUs = currentTimeUs; - bool isSbus2Frame = true; // Handle inter-frame gap. We dwell in STATE_SBUS_WAIT_SYNC state ignoring all incoming bytes until we get long enough quite period on the wire if (sbusFrameData->state == STATE_SBUS_WAIT_SYNC && timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { @@ -110,7 +109,6 @@ static void sbusDataReceive(uint16_t c, void *data) if(frame->endByte & 0x4) { sbus2ActiveTelemetryPage = (frame->endByte >> 4) & 0xF; frameTime = currentTimeUs; - isSbus2Frame = true; } else { sbus2ActiveTelemetryPage = 0; sbus2ActiveTelemetrySlot = 0; From 248144d17f05f88868cdd95c04245277d0a0774c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:15:44 +0200 Subject: [PATCH 361/429] more fixes --- src/main/telemetry/sbus2.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 716e850c521..64a6bd46c49 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -104,9 +104,6 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) // } -#define SBUS2_DEADTIME MS2US(2) -#define SBUS2_SLOT_TIME 700 -#define SBUS2_SLOT_DELAY_MAX 200 uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) { if (elapsed < SBUS2_DEADTIME) { From 04f065a180964bb18cee6a1b9c3fbe77112db5bb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:54:58 +0200 Subject: [PATCH 362/429] resend stale data --- src/main/telemetry/sbus2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 64a6bd46c49..a8c0c7e83a8 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -149,7 +149,7 @@ void taskSendSbus2Telemetry(timeUs_t currentTimeUs) (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(1); - sbusTelemetryDataUsed[slotIndex] = 0; + //sbusTelemetryDataUsed[slotIndex] = 0; } } } From 49f81af5275f36f209f2299447e3a167bca11cc9 Mon Sep 17 00:00:00 2001 From: Bart Slinger Date: Fri, 12 Jul 2024 21:35:45 +0800 Subject: [PATCH 363/429] Add blackbox device FILE for SITL build --- src/main/blackbox/blackbox.c | 3 ++ src/main/blackbox/blackbox_io.c | 70 +++++++++++++++++++++++++++++++++ src/main/blackbox/blackbox_io.h | 3 ++ src/main/fc/settings.yaml | 2 +- 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 419b7b4add4..324b41a1095 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -1442,6 +1442,9 @@ static void blackboxValidateConfig(void) #endif #ifdef USE_SDCARD case BLACKBOX_DEVICE_SDCARD: +#endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: #endif case BLACKBOX_DEVICE_SERIAL: // Device supported, leave the setting alone diff --git a/src/main/blackbox/blackbox_io.c b/src/main/blackbox/blackbox_io.c index 3e6adb719b7..dfa79b16eda 100644 --- a/src/main/blackbox/blackbox_io.c +++ b/src/main/blackbox/blackbox_io.c @@ -19,6 +19,11 @@ #include #include +#if defined(SITL_BUILD) +#include +#include +#endif + #include "platform.h" #ifdef USE_BLACKBOX @@ -81,6 +86,12 @@ static struct { #endif +#if defined(SITL_BUILD) +static struct { + FILE *file_handler; +} blackboxFile; +#endif + #ifndef UNIT_TEST void blackboxOpen(void) { @@ -103,6 +114,11 @@ void blackboxWrite(uint8_t value) case BLACKBOX_DEVICE_SDCARD: afatfs_fputc(blackboxSDCard.logFile, value); break; +#endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + fputc(value, blackboxFile.file_handler); + break; #endif case BLACKBOX_DEVICE_SERIAL: default: @@ -133,6 +149,13 @@ int blackboxPrint(const char *s) break; #endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + length = strlen(s); + fputs(s, blackboxFile.file_handler); + break; +#endif + case BLACKBOX_DEVICE_SERIAL: default: pos = (uint8_t*) s; @@ -196,6 +219,12 @@ bool blackboxDeviceFlushForce(void) return afatfs_flush(); #endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + fflush(blackboxFile.file_handler); + return true; +#endif + default: return false; } @@ -271,6 +300,26 @@ bool blackboxDeviceOpen(void) return true; break; #endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + { + const time_t now = time(NULL); + const struct tm *t = localtime(&now); + char filename[32]; + strftime(filename, sizeof(filename), "%Y_%m_%d_%H%M%S.TXT", t); + + blackboxFile.file_handler = fopen(filename, "wb"); + if (blackboxFile.file_handler == NULL) { + fprintf(stderr, "[BlackBox] Failed to create log file\n"); + return false; + } + fprintf(stderr, "[BlackBox] Created %s\n", filename); + } + + blackboxMaxHeaderBytesPerIteration = BLACKBOX_TARGET_HEADER_BUDGET_PER_ITERATION; + return true; + break; +#endif default: return false; } @@ -302,6 +351,11 @@ void blackboxDeviceClose(void) // Some flash device, e.g., NAND devices, require explicit close to flush internally buffered data. flashfsClose(); break; +#endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + fclose(blackboxFile.file_handler); + break; #endif default: ; @@ -506,6 +560,11 @@ bool isBlackboxDeviceFull(void) return afatfs_isFull(); #endif +#if defined (SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + return false; +#endif + default: return false; } @@ -562,6 +621,11 @@ void blackboxReplenishHeaderBudget(void) case BLACKBOX_DEVICE_SDCARD: freeSpace = afatfs_getFreeBufferSpace(); break; +#endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + freeSpace = BLACKBOX_MAX_ACCUMULATED_HEADER_BUDGET; + break; #endif default: freeSpace = 0; @@ -631,6 +695,12 @@ blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes) return BLACKBOX_RESERVE_TEMPORARY_FAILURE; #endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + // Assume that all writes will fit in the file's buffers + return BLACKBOX_RESERVE_TEMPORARY_FAILURE; +#endif + default: return BLACKBOX_RESERVE_PERMANENT_FAILURE; } diff --git a/src/main/blackbox/blackbox_io.h b/src/main/blackbox/blackbox_io.h index d143b72098d..76b03b5cd6a 100644 --- a/src/main/blackbox/blackbox_io.h +++ b/src/main/blackbox/blackbox_io.h @@ -31,6 +31,9 @@ typedef enum BlackboxDevice { #ifdef USE_SDCARD BLACKBOX_DEVICE_SDCARD = 2, #endif +#if defined(SITL_BUILD) + BLACKBOX_DEVICE_FILE = 3, +#endif BLACKBOX_DEVICE_END } BlackboxDevice; diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 52d6d63f66e..341fe95bddd 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -25,7 +25,7 @@ tables: - name: serial_rx values: ["SPEK1024", "SPEK2048", "SBUS", "SUMD", "IBUS", "JETIEXBUS", "CRSF", "FPORT", "SBUS_FAST", "FPORT2", "SRXL2", "GHST", "MAVLINK", "FBUS"] - name: blackbox_device - values: ["SERIAL", "SPIFLASH", "SDCARD"] + values: ["SERIAL", "SPIFLASH", "SDCARD", "FILE"] - name: motor_pwm_protocol values: ["STANDARD", "ONESHOT125", "MULTISHOT", "BRUSHED", "DSHOT150", "DSHOT300", "DSHOT600"] - name: servo_protocol From ed4aac11222a3da2ee6c92a36d9faf34d8495ed3 Mon Sep 17 00:00:00 2001 From: Bart Slinger Date: Fri, 12 Jul 2024 22:29:36 +0800 Subject: [PATCH 364/429] Set blackbox file handler to NULL after closing file --- src/main/blackbox/blackbox_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/blackbox/blackbox_io.c b/src/main/blackbox/blackbox_io.c index dfa79b16eda..36a9750be84 100644 --- a/src/main/blackbox/blackbox_io.c +++ b/src/main/blackbox/blackbox_io.c @@ -355,6 +355,7 @@ void blackboxDeviceClose(void) #if defined(SITL_BUILD) case BLACKBOX_DEVICE_FILE: fclose(blackboxFile.file_handler); + blackboxFile.file_handler = NULL; break; #endif default: From 972dd9f4463dd2196878b9ec70d2d6b833c7e36e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 21:56:11 +0200 Subject: [PATCH 365/429] Add some documentation --- docs/SBUS2_Telemetry.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/SBUS2_Telemetry.md diff --git a/docs/SBUS2_Telemetry.md b/docs/SBUS2_Telemetry.md new file mode 100644 index 00000000000..6a24ea37a88 --- /dev/null +++ b/docs/SBUS2_Telemetry.md @@ -0,0 +1,19 @@ +# Futaba SBUS2 Telemetry + +Basic support for SBUS2 telemetry has been added to INAV 8.0.0. Currently it is somewhat unreliable and slow to update. + +The basic sensors have been tested with a Futaba T16IZ running software version 6.0E. + +# Sensor mapping + +The follow fixed sensor mapping is used: +| Slot | Sensort Type | Info | +| --- | --- | --- | +| 1 | Voltage | Pack voltage and cell voltage | +| 3 | Current | Capacity = used mAh | +| 6 | rpm sensor | motor rpm. Need to set geat ratio to 1.0 | +| 7 | Temperature | ESC Temperature | +| 8 | GPS | | +| 16 | Temperature | IMU Temperature | +| 17 | Temperature | Baro Temperature | +| 18-25 | Temperature | Temperature sensor 0-7 | From 0548e6b8aa4bf1e4d18c74f240d40c0948e46078 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:34:16 +0200 Subject: [PATCH 366/429] Working a bit more reliably. I am concerned about the realtime priority. Will need to test fly it a bit more to be sure. --- src/main/common/maths.h | 4 ++++ src/main/fc/fc_tasks.c | 4 ++-- src/main/telemetry/sbus2.c | 48 +++++++++++++++++++++++++++++++++++--- src/main/telemetry/sbus2.h | 4 ++-- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/src/main/common/maths.h b/src/main/common/maths.h index b8d3803613f..2dbb53c0a1d 100644 --- a/src/main/common/maths.h +++ b/src/main/common/maths.h @@ -73,6 +73,10 @@ #define CMSEC_TO_CENTIKPH(cms) (cms * 3.6f) #define CMSEC_TO_CENTIKNOTS(cms) (cms * 1.943845f) +#define CMSEC_TO_MPH(cms) (CMSEC_TO_CENTIMPH(cms) / 100.0f) +#define CMSEC_TO_KPH(cms) (CMSEC_TO_CENTIKPH(cms) / 100.0f) +#define CMSEC_TO_KNOTS(cms) (CMSEC_TO_CENTIKNOTS(cms) / 100.0f) + #define C_TO_KELVIN(temp) (temp + 273.15f) // Standard Sea Level values diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index b269681baa7..7a456699fa9 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -735,8 +735,8 @@ cfTask_t cfTasks[TASK_COUNT] = { [TASK_TELEMETRY_SBUS2] = { .taskName = "SBUS2_TELEMETRY", .taskFunc = taskSendSbus2Telemetry, - .desiredPeriod = TASK_PERIOD_HZ(2000), - .staticPriority = TASK_PRIORITY_IDLE, + .desiredPeriod = TASK_PERIOD_US(125), // 8kHz 2ms dead time + 650us window / sensor. + .staticPriority = TASK_PRIORITY_REALTIME, // timing is critical. Ideally, should be a timer interrupt triggered by sbus packet }, #endif diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index a8c0c7e83a8..79678df0be9 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -32,6 +32,10 @@ #include "sensors/battery.h" #include "sensors/sensors.h" +#include "sensors/temperature.h" +#include "sensors/diagnostics.h" + +#include "io/gps.h" #include "navigation/navigation.h" @@ -79,7 +83,7 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) } #endif - temperature = 42.16f; + //temperature = 42.16f; DEBUG_SET(DEBUG_SBUS2, 0, voltage); DEBUG_SET(DEBUG_SBUS2, 1, cellVoltage); @@ -97,9 +101,47 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) // 1 slot send_RPM(6, rpm); // 1 slot - esc temp - //send_temp125(7, temperature); + static int change = 0; + change++; + int delta = change / 10; + delta = delta % 20; send_SBS01T(7, temperature); + // 8 slots, gps + uint16_t speed = 0; + float latitude = 0; + float longitude = 0; + +#ifdef USE_GPS + if (gpsSol.fixType >= GPS_FIX_2D) { + speed = (CMSEC_TO_KPH(gpsSol.groundSpeed) + 0.5f); + latitude = gpsSol.llh.lat * 1e-7; + longitude = gpsSol.llh.lon * 1e-7; + } +#endif + + send_F1675f(8, speed, altitude, vario, latitude, longitude); + // imu 1 slot + int16_t temp16; + bool valid = getIMUTemperature(&temp16); + send_SBS01T(16, valid ? temp16 / 10 : 0); + // baro + valid = 0; + valid = getBaroTemperature(&temp16); + send_SBS01T(17, valid ? temp16 / 10 : 0); + // temp sensors 18-25 +#ifdef USE_TEMPERATURE_SENSOR + for(int i = 0; i < 8; i++) { + temp16 = 0; + valid = getSensorTemperature(0, &temp16); + send_SBS01T(18 + i, valid ? temp16 / 10 : 0); + } +#else + for(int i = 0; i < 8; i++) { + send_SBS01T(18 + i, 0); + } +#endif + // 8 slots - gps // } @@ -121,7 +163,7 @@ uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) return slot; } -void taskSendSbus2Telemetry(timeUs_t currentTimeUs) +FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { if (!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || rxConfig()->serialrx_provider != SERIALRX_SBUS2) { diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index d6683a4dc53..675ab8d729d 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -31,8 +31,8 @@ #define SBUS2_TELEMETRY_PAGES 4 #define SBUS2_DEADTIME MS2US(2) -#define SBUS2_SLOT_TIME 700 -#define SBUS2_SLOT_DELAY_MAX 300 +#define SBUS2_SLOT_TIME 650 +#define SBUS2_SLOT_DELAY_MAX 350 #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) From bc008ef72753efafa1e8e618a8e04989621217fb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:38:57 +0200 Subject: [PATCH 367/429] Update docs --- docs/SBUS2_Telemetry.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/SBUS2_Telemetry.md b/docs/SBUS2_Telemetry.md index 6a24ea37a88..9fb0c43e4f4 100644 --- a/docs/SBUS2_Telemetry.md +++ b/docs/SBUS2_Telemetry.md @@ -1,9 +1,14 @@ # Futaba SBUS2 Telemetry -Basic support for SBUS2 telemetry has been added to INAV 8.0.0. Currently it is somewhat unreliable and slow to update. +Basic experimental support for SBUS2 telemetry has been added to INAV 8.0.0. Currently it is limited to F7 and H7 mcus only. The main reason it is limited to those MCUs is due to it requiring an inverted UART signal, and the SBUS pads in F405 usually are not bi-directional. The basic sensors have been tested with a Futaba T16IZ running software version 6.0E. +An alternative to using INAV's SBUS2 support is to use SBS-01ML MAVlink Telemetry Drone Sensor instead. (not tested) + +# Wiring +The SBUS2 signal should be connected to the TX PIN, not the RX PIN, like on a traditional SBUS setup. + # Sensor mapping The follow fixed sensor mapping is used: From cf33eb72ffcae3ba6ff9fcfcc41066ec2658dbf1 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 12 Jul 2024 23:06:26 +0200 Subject: [PATCH 368/429] Small changes --- src/main/telemetry/sbus2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 675ab8d729d..5787b5c10fd 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -31,8 +31,8 @@ #define SBUS2_TELEMETRY_PAGES 4 #define SBUS2_DEADTIME MS2US(2) -#define SBUS2_SLOT_TIME 650 -#define SBUS2_SLOT_DELAY_MAX 350 +#define SBUS2_SLOT_TIME 650u +#define SBUS2_SLOT_DELAY_MAX (MIN(350u, (SBUS2_SLOT_TIME / 2u))) #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) From 42ae58841f794f5d15e62292f1f2d3423e2745b0 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:02:59 +0200 Subject: [PATCH 369/429] Update docs --- docs/SBUS2_Telemetry.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/SBUS2_Telemetry.md b/docs/SBUS2_Telemetry.md index 9fb0c43e4f4..d8a1cd8f1e1 100644 --- a/docs/SBUS2_Telemetry.md +++ b/docs/SBUS2_Telemetry.md @@ -11,7 +11,8 @@ The SBUS2 signal should be connected to the TX PIN, not the RX PIN, like on a tr # Sensor mapping -The follow fixed sensor mapping is used: +The following fixed sensor mapping is used: + | Slot | Sensort Type | Info | | --- | --- | --- | | 1 | Voltage | Pack voltage and cell voltage | From 87356e94fc9cdd98fb2ea7599971418ee87649ed Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Sat, 13 Jul 2024 21:38:08 -0500 Subject: [PATCH 370/429] GEPRC_F722_AIO include UART3 --- src/main/target/GEPRC_F722_AIO/target.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/target/GEPRC_F722_AIO/target.h b/src/main/target/GEPRC_F722_AIO/target.h index f7ed46bd466..5dede599778 100644 --- a/src/main/target/GEPRC_F722_AIO/target.h +++ b/src/main/target/GEPRC_F722_AIO/target.h @@ -108,6 +108,10 @@ #define UART2_RX_PIN PA3 #define UART2_TX_PIN PA2 +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + #define USE_UART4 #define UART4_RX_PIN PC11 #define UART4_TX_PIN PC10 @@ -116,7 +120,7 @@ #define UART5_RX_PIN PD2 #define UART5_TX_PIN PC12 -#define SERIAL_PORT_COUNT 5 +#define SERIAL_PORT_COUNT 6 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL #define SERIALRX_PROVIDER SERIALRX_SBUS From 934fb4c777f89f752793135f8ffb8c7b3c11f93b Mon Sep 17 00:00:00 2001 From: Bart Slinger Date: Sun, 14 Jul 2024 10:55:36 +0800 Subject: [PATCH 371/429] Blackbox device type 'file' (SITL) considered working when file handler is available --- src/main/blackbox/blackbox_io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/blackbox/blackbox_io.c b/src/main/blackbox/blackbox_io.c index 36a9750be84..b344b0dfff6 100644 --- a/src/main/blackbox/blackbox_io.c +++ b/src/main/blackbox/blackbox_io.c @@ -583,6 +583,10 @@ bool isBlackboxDeviceWorking(void) #ifdef USE_FLASHFS case BLACKBOX_DEVICE_FLASH: return flashfsIsReady(); +#endif +#if defined(SITL_BUILD) + case BLACKBOX_DEVICE_FILE: + return blackboxFile.file_handler != NULL; #endif default: return false; From 6337989e34803198314f5355a5e6c13a625c2b0d Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 17 Jul 2024 08:54:52 +0200 Subject: [PATCH 372/429] Add gyros to DakeFPV targets --- src/main/target/DAKEFPVF405/target.h | 5 +++++ src/main/target/DAKEFPVF722/target.h | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/target/DAKEFPVF405/target.h b/src/main/target/DAKEFPVF405/target.h index 41c128668ef..9b1aef0721a 100644 --- a/src/main/target/DAKEFPVF405/target.h +++ b/src/main/target/DAKEFPVF405/target.h @@ -67,6 +67,11 @@ #define ICM42605_SPI_BUS BUS_SPI1 #define ICM42605_CS_PIN PA4 +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW90_DEG +#define BMI270_SPI_BUS BUS_SPI1 +#define BMI270_CS_PIN PA4 + //Baro #define USE_BARO #define USE_BARO_BMP280 diff --git a/src/main/target/DAKEFPVF722/target.h b/src/main/target/DAKEFPVF722/target.h index 92cc65783b8..f0f4584e801 100644 --- a/src/main/target/DAKEFPVF722/target.h +++ b/src/main/target/DAKEFPVF722/target.h @@ -57,6 +57,21 @@ #define MPU6500_CS_PIN PA4 #define MPU6500_SPI_BUS BUS_SPI1 +#define USE_IMU_MPU6000 +#define IMU_MPU6000_ALIGN CW90_DEG +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_BUS BUS_SPI1 + +#define USE_IMU_ICM42605 +#define IMU_ICM42605_ALIGN CW90_DEG +#define ICM42605_SPI_BUS BUS_SPI1 +#define ICM42605_CS_PIN PA4 + +#define USE_IMU_BMI270 +#define IMU_BMI270_ALIGN CW90_DEG +#define BMI270_SPI_BUS BUS_SPI1 +#define BMI270_CS_PIN PA4 + //Baro #define USE_BARO #define USE_BARO_BMP280 From 0b019a0739df3aa5bbd31f22731df9e702585177 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 18 Jul 2024 12:41:12 +0100 Subject: [PATCH 373/429] Updated Logic Condition constraints to INT32 from INT16 --- src/main/programming/logic_condition.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/programming/logic_condition.c b/src/main/programming/logic_condition.c index 6e43d2394cd..24eb93d77c6 100644 --- a/src/main/programming/logic_condition.c +++ b/src/main/programming/logic_condition.c @@ -650,15 +650,15 @@ static int logicConditionGetFlightOperandValue(int operand) { switch (operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_ARM_TIMER: // in s - return constrain((uint32_t)getFlightTime(), 0, INT16_MAX); + return constrain((uint32_t)getFlightTime(), 0, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_HOME_DISTANCE: //in m - return constrain(GPS_distanceToHome, 0, INT16_MAX); + return constrain(GPS_distanceToHome, 0, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_TRIP_DISTANCE: //in m - return constrain(getTotalTravelDistance() / 100, 0, INT16_MAX); + return constrain(getTotalTravelDistance() / 100, 0, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_RSSI: @@ -713,18 +713,18 @@ static int logicConditionGetFlightOperandValue(int operand) { case LOGIC_CONDITION_OPERAND_FLIGHT_AIR_SPEED: // cm/s #ifdef USE_PITOT - return constrain(getAirspeedEstimate(), 0, INT16_MAX); + return constrain(getAirspeedEstimate(), 0, INT32_MAX); #else return false; #endif break; case LOGIC_CONDITION_OPERAND_FLIGHT_ALTITUDE: // cm - return constrain(getEstimatedActualPosition(Z), INT16_MIN, INT16_MAX); + return constrain(getEstimatedActualPosition(Z), INT32_MIN, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_VERTICAL_SPEED: // cm/s - return constrain(getEstimatedActualVelocity(Z), INT16_MIN, INT16_MAX); + return constrain(getEstimatedActualVelocity(Z), INT32_MIN, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_TROTTLE_POS: // % @@ -793,7 +793,7 @@ static int logicConditionGetFlightOperandValue(int operand) { break; case LOGIC_CONDITION_OPERAND_FLIGHT_3D_HOME_DISTANCE: //in m - return constrain(calc_length_pythagorean_2D(GPS_distanceToHome, getEstimatedActualPosition(Z) / 100.0f), 0, INT16_MAX); + return constrain(calc_length_pythagorean_2D(GPS_distanceToHome, getEstimatedActualPosition(Z) / 100.0f), 0, INT32_MAX); break; case LOGIC_CONDITION_OPERAND_FLIGHT_CRSF_LQ: From 59f5737e926d19fc7918ac8ea510056287c66b9f Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 18 Jul 2024 12:48:18 +0100 Subject: [PATCH 374/429] Use int32_t explicitly, rather than int --- src/main/programming/logic_condition.c | 14 +++++++------- src/main/programming/logic_condition.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/programming/logic_condition.c b/src/main/programming/logic_condition.c index 24eb93d77c6..594db21417c 100644 --- a/src/main/programming/logic_condition.c +++ b/src/main/programming/logic_condition.c @@ -513,7 +513,7 @@ static int logicConditionCompute( void logicConditionProcess(uint8_t i) { - const int activatorValue = logicConditionGetValue(logicConditions(i)->activatorId); + const int32_t activatorValue = logicConditionGetValue(logicConditions(i)->activatorId); if (logicConditions(i)->enabled && activatorValue && !cliMode) { @@ -522,9 +522,9 @@ void logicConditionProcess(uint8_t i) { * Latched LCs can only go from OFF to ON, not the other way */ if (!(logicConditionStates[i].flags & LOGIC_CONDITION_FLAG_LATCH)) { - const int operandAValue = logicConditionGetOperandValue(logicConditions(i)->operandA.type, logicConditions(i)->operandA.value); - const int operandBValue = logicConditionGetOperandValue(logicConditions(i)->operandB.type, logicConditions(i)->operandB.value); - const int newValue = logicConditionCompute( + const int32_t operandAValue = logicConditionGetOperandValue(logicConditions(i)->operandA.type, logicConditions(i)->operandA.value); + const int32_t operandBValue = logicConditionGetOperandValue(logicConditions(i)->operandB.type, logicConditions(i)->operandB.value); + const int32_t newValue = logicConditionCompute( logicConditionStates[i].value, logicConditions(i)->operation, operandAValue, @@ -938,8 +938,8 @@ static int logicConditionGetFlightModeOperandValue(int operand) { } } -int logicConditionGetOperandValue(logicOperandType_e type, int operand) { - int retVal = 0; +int32_t logicConditionGetOperandValue(logicOperandType_e type, int operand) { + int32_t retVal = 0; switch (type) { @@ -994,7 +994,7 @@ int logicConditionGetOperandValue(logicOperandType_e type, int operand) { /* * conditionId == -1 is always evaluated as true */ -int logicConditionGetValue(int8_t conditionId) { +int32_t logicConditionGetValue(int8_t conditionId) { if (conditionId >= 0) { return logicConditionStates[conditionId].value; } else { diff --git a/src/main/programming/logic_condition.h b/src/main/programming/logic_condition.h index 25d6a5a9e1f..74a7765be40 100644 --- a/src/main/programming/logic_condition.h +++ b/src/main/programming/logic_condition.h @@ -249,9 +249,9 @@ extern uint64_t logicConditionsGlobalFlags; void logicConditionProcess(uint8_t i); -int logicConditionGetOperandValue(logicOperandType_e type, int operand); +int32_t logicConditionGetOperandValue(logicOperandType_e type, int operand); -int logicConditionGetValue(int8_t conditionId); +int32_t logicConditionGetValue(int8_t conditionId); void logicConditionUpdateTask(timeUs_t currentTimeUs); void logicConditionReset(void); From 2379a53b2b3789b19fd74e61b4d0ad040e1b4d85 Mon Sep 17 00:00:00 2001 From: breadoven <56191411+breadoven@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:43:17 +0100 Subject: [PATCH 375/429] Update fc_core.c --- src/main/fc/fc_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index da40f9149f5..f7603eee692 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -880,7 +880,9 @@ void taskMainPidLoop(timeUs_t currentTimeUs) cycleTime = getTaskDeltaTime(TASK_SELF); dT = (float)cycleTime * 0.000001f; - if (ARMING_FLAG(ARMED) && (!STATE(FIXED_WING_LEGACY) || !isNavLaunchEnabled() || (isNavLaunchEnabled() && fixedWingLaunchStatus() >= FW_LAUNCH_DETECTED))) { + bool fwLaunchIsActive = STATE(AIRPLANE) && isNavLaunchEnabled() && armTime == 0; + + if (ARMING_FLAG(ARMED) && (!STATE(AIRPLANE) || !fwLaunchIsActive || fixedWingLaunchStatus() >= FW_LAUNCH_DETECTED)) { flightTime += cycleTime; armTime += cycleTime; updateAccExtremes(); From 4e07f771336ee9d125448cfa18b2a3dfa0b77fa6 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:35:30 +0200 Subject: [PATCH 376/429] Move things around, in the correct branch --- src/main/CMakeLists.txt | 2 + src/main/telemetry/sbus2.c | 709 +--------------------------- src/main/telemetry/sbus2.h | 97 +--- src/main/telemetry/sbus2_sensors.c | 729 +++++++++++++++++++++++++++++ src/main/telemetry/sbus2_sensors.h | 118 +++++ 5 files changed, 852 insertions(+), 803 deletions(-) create mode 100644 src/main/telemetry/sbus2_sensors.c create mode 100644 src/main/telemetry/sbus2_sensors.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 505512357cc..b6ff0e10985 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -614,6 +614,8 @@ main_sources(COMMON_SRC telemetry/msp_shared.h telemetry/sbus2.c telemetry/sbus2.h + telemetry/sbus2_sensors.c + telemetry/sbus2_sensors.h telemetry/smartport.c telemetry/smartport.h telemetry/sim.c diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 79678df0be9..bcdc1368168 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -27,6 +27,7 @@ #include "telemetry/telemetry.h" #include "telemetry/sbus2.h" +#include "telemetry/sbus2_sensors.h" #include "rx/sbus.h" @@ -197,715 +198,7 @@ FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) } } -// -void send_RPM(uint8_t port, uint32_t RPM) -{ - uint32_t value = 0; - uint8_t bytes[2] = { }; - - value = RPM / 6; - if(value > 0xffff){ - value = 0xffff; - } - bytes[1] = value >> 8; - bytes[0] = value; - SBUS2_transmit_telemetry_data( port , bytes); -} - - -void send_temp125(uint8_t port, int16_t temp) -{ - int16_t value= 0; - uint8_t bytes[2] = { }; - - value = temp | 0x4000; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); -} -void send_SBS01T(uint8_t port, int16_t temp){ - int16_t value= 0; - uint8_t bytes[2] = {}; - - value = temp | 0x8000; - value = value + 100; - bytes[0] = value;// >> 8; - bytes[1] = value >> 8; - SBUS2_transmit_telemetry_data(port , bytes); -} - -void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2) -{ - uint16_t value = 0; - uint8_t bytes[2] = { }; - - // VOLTAGE1 - value = voltage1 | 0x8000; - if ( value > 0x9FFF ){ - value = 0x9FFF; // max voltage is 819.1 - } - else if(value < 0x8000){ - value = 0x8000; - } - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); - - //VOLTAGE2 - value = voltage2; - if ( value > 0x1FFF ){ - value = 0x1FFF; // max voltage is 819.1 - } - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port+1 , bytes); -} - -void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage) -{ - uint16_t value = 0; - uint32_t local = 0; - uint8_t bytes[2] = { }; - - - // CURRENT - local = ((uint32_t)current) * 1 ; - value = (uint16_t)local; - if ( value > 0x3FFF ) - { - // max current is 163.83 - value = 0x3FFF; - } - bytes[0] = value >> 8; - bytes[0] = bytes[0] | 0x40; - bytes[0] = bytes[0] & 0x7F; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); - - //VOLTAGE - local = ((uint32_t)voltage) * 1; - value = (uint16_t)local; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port+1 , bytes); - - // CAPACITY - local = (uint32_t)capacity; - value = (uint16_t)local; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port+2 , bytes); -} - -void send_f1675_gps(uint8_t port, uint16_t speed, int16_t altitude, int16_t vario, int32_t latitude, int32_t longitude) -{ - uint16_t value1 = 0; - int16_t value2 = 0; - uint32_t value3 = 0; - bool latitude_pos = false; - bool longitude_pos = false; - uint8_t bytes[2] = {}; - - - // SPEED -> Bit 14(bytes[1] bit7) -> GPS Valid or not - value1 = speed | 0x4000; - if (value1 > 0x43E7 ){ - value1 = 0x43E7; // max Speed is 999 km/h - } - else if( value1 < 0x4000){ - value1 = 0x4000; - } - bytes[0] = value1 >> 8; - bytes[1] = value1; - SBUS2_transmit_telemetry_data( port , bytes); - - //HIGHT - value2 = altitude | 0x4000; - /*if(value2 > 0x7FFF ){ // max = +16383 - value2 = 0x7FFF; - } - else if( value2 < 0xC000){ // min = -16384 - value2 = 0xC000; - }*/ - bytes[0] = value2 >> 8; - bytes[1] = value2; - SBUS2_transmit_telemetry_data( port+1 , bytes); - - //TIME -> 12:34:56 Uhr = 12*60*60 + 34*60 + 56 = 45296 = 0xB0F0 - bytes[0] = 0xB0; - bytes[1] = 0xF0; - SBUS2_transmit_telemetry_data( port+2 , bytes); - - // VARIO - value2 = vario * 10; - bytes[0] = value2 >> 8; - bytes[1] = value2; - SBUS2_transmit_telemetry_data( port+3 , bytes); - - // LATITUDE - if(latitude >= 0){ - latitude_pos = true; - } - else{ - latitude_pos = false; - latitude = latitude * -1; - } - bytes[0] = (uint8_t)(latitude/1000000); - value3 = (uint32_t)(latitude%1000000); - if(latitude_pos){ - bytes[1] = ((value3 >> 16) & 0x0f); // North - } - else{ - bytes[1] = ((value3 >> 16) | 0x1f); // South - } - SBUS2_transmit_telemetry_data( port+4 , bytes); - - bytes[0] = ((value3 >> 8) & 0xff); - bytes[1] = value3 & 0xff; - SBUS2_transmit_telemetry_data( port+5 , bytes); - - // LONGITUDE - if(longitude >= 0){ - longitude_pos = true; - } - else{ - longitude_pos = false; - longitude = longitude * -1; - } - bytes[0] = (uint8_t)(longitude/1000000); - value3 = (uint32_t)(longitude%1000000); - if(longitude_pos){ - bytes[1] = ((value3 >> 16) & 0x0f); // Eath - } - else{ - bytes[1] = ((value3 >> 16) | 0x1f); // West - } - SBUS2_transmit_telemetry_data( port+6 , bytes); - - bytes[0] = ((value3 >> 8) & 0xff); - bytes[1] = value3 & 0xff; - SBUS2_transmit_telemetry_data( port+7 , bytes); -} - -void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario) -{ - int16_t value = 0; - uint8_t bytes[2] = { }; - - // VARIO - value = vario; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port, bytes); - - //HIGHT - value = altitude | 0x4000; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 1, bytes); -} - -void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario) -{ - int16_t value = 0; - uint8_t bytes[2] = { }; - - // VARIO - value = vario; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); - - //HIGHT - value = altitude | 0x4000; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 1 , bytes); - -} - - -void send_SBS01TE(uint8_t port, int16_t temp){ - send_temp125(port, temp); -} -void send_F1713(uint8_t port, int16_t temp){ - send_temp125(port, temp); -} - -void send_SBS01RB(uint8_t port, uint32_t RPM){ - send_RPM(port, RPM); -} -void send_SBS01RM(uint8_t port, uint32_t RPM){ - send_RPM(port, RPM); -} -void send_SBS01RO(uint8_t port, uint32_t RPM){ - send_RPM(port, RPM); -} -void send_SBS01R(uint8_t port, uint32_t RPM){ - send_RPM(port, RPM); -} - -void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ - send_s1678_current(port, current, capacity, voltage); -} -void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage){ - send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); -} -void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage){ - send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); -} -void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2){ - send_voltage(port, voltage1, voltage2); -} -void send_SBS01Vf(uint8_t port,float voltage1, float voltage2){ - send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); -} -void send_voltagef(uint8_t port,float voltage1, float voltage2){ - send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); -} -void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ - send_s1678_current(port, current, capacity, voltage); -} -void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage){ - send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); -} -void send_f1712_variof(uint8_t port, int16_t altitude, float vario){ - send_f1712_vario(port, altitude, (int16_t)(vario * 10)); -} -void send_f1672_variof(uint8_t port, int16_t altitude, float vario){ - send_f1672_vario(port, altitude, (int16_t)(vario * 100)); -} -void send_F1712(uint8_t port, int16_t altitude, int16_t vario){ - send_f1712_vario(port, altitude, vario); -} -void send_F1712f(uint8_t port, int16_t altitude, float vario){ - send_f1712_vario(port, altitude, (int16_t)(vario * 10)); -} -void send_F1672(uint8_t port, int16_t altitude, int16_t vario){ - send_f1672_vario(port, altitude, vario); -} -void send_F1672f(uint8_t port, int16_t altitude, float vario){ - send_f1672_vario(port, altitude, (int16_t)(vario * 100)); -} -void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min){ - bool Lat_Negative = false; - bool Lon_Negative = false; - if(lat_deg < 0){ - Lat_Negative = true; - lat_deg = lat_deg * -1; - } - if(lon_deg < 0){ - Lon_Negative = true; - lon_deg = lon_deg * -1; - } - if(lat_min < 0){ - Lat_Negative = true; - lat_min = lat_min * -1; - } - if(lon_min < 0){ - Lon_Negative = true; - lon_min = lon_min * -1; - } - int32_t _latitude_deg = lat_deg; - int32_t _longitude_deg = lon_deg; - int32_t _latitude_min = lat_min * 10000; - int32_t _longitude_min = lon_min * 10000; - int32_t _latitude = _latitude_deg * 1000000; - int32_t _longitude = _longitude_deg * 1000000; - _latitude = _latitude + _latitude_min; - _longitude = _longitude + _longitude_min; - if(Lat_Negative){ - _latitude = _latitude * -1; - } - if(Lon_Negative){ - _longitude = _longitude * -1; - } - send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); -} -void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min){ - bool Lat_Negative = false; - bool Lon_Negative = false; - if(lat_deg < 0){ - Lat_Negative = true; - lat_deg = lat_deg * -1; - } - if(lon_deg < 0){ - Lon_Negative = true; - lon_deg = lon_deg * -1; - } - if(lat_min < 0){ - Lat_Negative = true; - lat_min = lat_min * -1; - } - if(lon_min < 0){ - Lon_Negative = true; - lon_min = lon_min * -1; - } - int32_t _latitude_deg = lat_deg; - int32_t _longitude_deg = lon_deg; - int32_t _latitude = _latitude_deg * 1000000; - int32_t _longitude = _longitude_deg * 1000000; - _latitude = _latitude + lat_min; - _longitude = _longitude + lon_min; - if(Lat_Negative){ - _latitude = _latitude * -1; - } - if(Lon_Negative){ - _longitude = _longitude * -1; - } - send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); -} -void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude){ - int32_t _latitude = latitude; - int32_t _longitude = longitude; - int32_t _latitude_deg = _latitude/1000000; - int32_t _longitude_deg = _longitude/1000000; - int32_t _latitude_min = _latitude%1000000; - int32_t _longitude_min = _longitude%1000000; - _latitude = _latitude_deg * 1000000; - _longitude = _longitude_deg * 1000000; - _latitude = _latitude + ((_latitude_min * 60)/100); - _longitude = _longitude + ((_longitude_min * 60)/100); - send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); -} -void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude){ - int32_t _latitude = latitude * 1000000; - int32_t _longitude = longitude * 1000000; - int32_t _latitude_deg = _latitude/1000000; - int32_t _longitude_deg = _longitude/1000000; - int32_t _latitude_min = _latitude%1000000; - int32_t _longitude_min = _longitude%1000000; - _latitude = _latitude_deg * 1000000; - _longitude = _longitude_deg * 1000000; - _latitude = _latitude + ((_latitude_min * 60)/100); - _longitude = _longitude + ((_longitude_min * 60)/100); - send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); -} -void send_SBS10G( - uint8_t port, - uint16_t hours, // 0 to 24 - uint16_t minutes, // 0 to 60 - uint16_t seconds, // 0 to 60 - float latitude, // decimal degrees (i.e. 52.520833; negative value for southern hemisphere) - float longitude, // decimal degrees (i.e. 13.409430; negative value for western hemisphere) - float altitudeMeters, // meters (valid range: -1050 to 4600) - uint16_t speed, // km/h (valid range 0 to 511) - float gpsVario) // m/s (valid range: -150 to 260) -{ - uint32_t utc = (hours*3600) + (minutes*60) + seconds; - uint32_t lat, lon; - // scale latitude/longitude (add 0.5 for correct rounding) - if (latitude > 0) { - lat = (600000.0*latitude) + 0.5; - } - else { - lat = (-600000.0*latitude) + 0.5; - // toggle south bit - lat |= 0x4000000; - } - if (longitude > 0) { - lon = (600000.0*longitude) + 0.5; - } - else { - lon = (-600000.0*longitude) + 0.5; - // toggle west bit - lon |= 0x8000000; - } - // convert altitude (add 0.5 for correct rounding) - uint16_t alt = (altitudeMeters>=-820 && altitudeMeters<=4830) ?(1.25*(altitudeMeters+820)) + 0.5 : 0; - // error check speed - if (speed < 512) { - // set speed enable bit - speed |= 0x200; - } - else { - speed = 0; - } - // initialize buffer - uint8_t bytes[2] = { }; - // slot 0 (utc) - bytes[0] = (utc&0x00ff); - bytes[1] = (utc&0xff00)>>8; - SBUS2_transmit_telemetry_data(port , bytes); - // slot 1 (latitude & utc) - bytes[0] = ((lat&0x007f)<<1) | ((utc&0x10000)>>16); - bytes[1] = (lat&0x7f80)>>7; - SBUS2_transmit_telemetry_data(port+1 , bytes); - // slot 2 (latitude & longitude) - bytes[0] = (lat&0x07f8000)>>15; - bytes[1] = ((lat&0x7800000)>>23) | (lon&0x0f)<<4; - SBUS2_transmit_telemetry_data(port+2 , bytes); - // slot 3 (longitude) - bytes[0] = (lon&0x00ff0)>>4; - bytes[1] = (lon&0xff000)>>12; - SBUS2_transmit_telemetry_data(port+3 , bytes); - // slot 4 (longitude & speed) - bytes[0] = ((lon&0xff00000)>>20); - bytes[1] = (speed&0xff); - SBUS2_transmit_telemetry_data(port+4 , bytes); - // slot 5 (pressure & speed) - bytes[0] = ((speed&0x300)>>8); - bytes[1] = 0x00; - SBUS2_transmit_telemetry_data(port+5 , bytes); - // slot 6 (altitude & pressure) - bytes[0] = ((alt&0x003)<<6); - bytes[1] = (alt&0x3fc)>>2; - SBUS2_transmit_telemetry_data(port+6 , bytes); - // slot (7 (vario & altitude) - uint16_t vario; - // error check vario - if (gpsVario >= -150 && gpsVario <= 260) { - // scale vario (add 0.5 for correct rounding) - vario = (10.0*(gpsVario + 150)) + 0.5; - // set vario enable - vario |= 0x1000; - } - else { - vario = 0; - } - bytes[0] = ((vario&0x001f)<<3) | ((alt&0x1c00)>>10); - bytes[1] = (vario&0x1fe0)>>5; - SBUS2_transmit_telemetry_data(port+7 , bytes); -} -void send_scorpion_kontronik( - uint8_t port, - uint16_t voltage, - uint16_t capacity, - uint32_t rpm, - uint16_t current, - uint16_t temp, - uint16_t becTemp, - uint16_t becCurrent, - uint16_t pwm) -{ - uint32_t value = 0; - uint8_t bytes[2] = { }; - - // voltage 41.1 = 4110 - value = voltage | 0x8000; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); - - // 1330 mah => 1.33 Ah - value = capacity; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 1 , bytes); - - // 2250 rpm => 2250 - value = rpm / 6; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 2 , bytes); - - // 13310 => 133.1 A - value = current; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 3 , bytes); - - // 41 => 41 Celsius - value = temp; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 4 , bytes); - - // 21 => Bec Celsius - value = becTemp; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 5 , bytes); - - // 650 => 6,5 Bec Current - value = becCurrent; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 6 , bytes); - - // PWM output - value = pwm; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 7 , bytes); -} - -void send_scorpion( - uint8_t port, - uint16_t voltage, - uint16_t capacity, - uint32_t rpm, - uint16_t current, - uint16_t temp, - uint16_t becTemp, - uint16_t becCurrent, - uint16_t pwm) -{ - send_scorpion_kontronik( - port, - voltage, - capacity, - rpm, - current, - temp, - becTemp, - becCurrent, - pwm); -} - -void send_kontronik( - uint8_t port, - uint16_t voltage, - uint16_t capacity, - uint32_t rpm, - uint16_t current, - uint16_t temp, - uint16_t becTemp, - uint16_t becCurrent, - uint16_t pwm) -{ - send_scorpion_kontronik( - port, - voltage, - capacity, - rpm, - current, - temp, - becTemp, - becCurrent, - pwm); -} - -void send_jetcat( - uint8_t port, - uint32_t rpm, - uint16_t egt, - uint16_t pump_volt, - uint32_t setrpm, - uint16_t thrust, - uint16_t fuel, - uint16_t fuelflow, - uint16_t altitude, - uint16_t quality, - uint16_t volt, - uint16_t current, - uint16_t speed, - uint16_t status, - uint32_t secondrpm) -{ - uint32_t value = 0; - uint8_t bytes[2] = {}; - - // Actual RPM with 0x4000 Offset -> why? - value = rpm / 100; - value = value | 0x4000; - if(value > 0xffff){ - value = 0xffff; - } - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port , bytes); - - // EGT Abgastemperatur in °C - value = egt; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 1 , bytes); - - // Pump Voltage 12.34V = 1234 - value = pump_volt; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 2 , bytes); - - // Setpoint RPM without Offset - value = setrpm / 100; - if(value > 0xffff){ - value = 0xffff; - } - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 3 , bytes); - - // Thrust 123.4N = 1234 - value = thrust; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 4 , bytes); - - // Fuel (remain) in ml - value = fuel; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 5 , bytes); - - // Fuel Flow in ml/min - value = fuelflow; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 6 , bytes); - - // Altitude -> without offset? - value = altitude; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 7 , bytes); - - // Fuel Quality in % - value = quality; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 8 , bytes); - - // Voltage 12.34V = 1234 - value = volt; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 9 , bytes); - - // Current 123.4A = 1234 - value = current; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 10 , bytes); - - // Speed in km/h - value = speed; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 11 , bytes); - - // Status and Error Code - value = status; - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 12 , bytes); - - // Second RPM without Offset - value = secondrpm / 100; - if(value > 0xffff){ - value = 0xffff; - } - bytes[0] = value >> 8; - bytes[1] = value; - SBUS2_transmit_telemetry_data( port + 13 , bytes); - -} - - -void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes) -{ - if(slotId > 0 && slotId < SBUS2_SLOT_COUNT) { - sbusTelemetryData[slotId].payload.data[0] = bytes[0]; - sbusTelemetryData[slotId].payload.data[1] = bytes[1]; - sbusTelemetryData[slotId].slotId = sbus2SlotIds[slotId]; - //sbusTelemetryData[i].payload.data[0] = 0x81; - //sbusTelemetryData[i].payload.data[1] = 0x80; - sbusTelemetryDataUsed[slotId] = 1; - } - -} #endif diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 5787b5c10fd..9c2c39ba73e 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -23,6 +23,7 @@ #include "platform.h" #include "common/time.h" +#include "common/utils.h" #define SBUS2_TELEMETRY_PAYLOAD_SIZE 3 @@ -51,7 +52,7 @@ typedef struct sbus2_telemetry_frame_s { STATIC_ASSERT(sizeof(sbus2_telemetry_frame_t) == 3, sbus2_telemetry_size); -extern const uint8_t Slot_ID[SBUS2_SLOT_COUNT]; +extern const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT]; extern uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT]; extern timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT]; @@ -64,98 +65,4 @@ void taskSendSbus2Telemetry(timeUs_t currentTimeUs); uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed); -// Sensor code from https://github.com/BrushlessPower/SBUS2-Telemetry -// SBUS2 telemetry: 2ms deadtime after rc package -// One new slot every 700us - -/* - * ++++++++++++++++++++++++++++++++ - * Temperature Sensors - * ++++++++++++++++++++++++++++++++ - */ -void send_temp125(uint8_t port, int16_t temp); -void send_alarm_as_temp125(uint8_t port, int16_t alarm); -void send_SBS01TE(uint8_t port, int16_t temp); -void send_SBS01T(uint8_t port, int16_t temp); -void send_F1713(uint8_t port, int16_t temp); - -/* - * ++++++++++++++++++++++++++++++++ - * RPM Sensors - * ++++++++++++++++++++++++++++++++ - */ -void send_RPM(uint8_t port, uint32_t RPM); -void send_SBS01RB(uint8_t port, uint32_t RPM); -void send_SBS01RM(uint8_t port, uint32_t RPM); -void send_SBS01RO(uint8_t port, uint32_t RPM); -void send_SBS01R(uint8_t port, uint32_t RPM); - -/* - * ++++++++++++++++++++++++++++++++ - * Voltage/Current Sensors - * ++++++++++++++++++++++++++++++++ - */ -void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2); -void send_voltagef(uint8_t port,float voltage1, float voltage2); -void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); -void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage); -void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); -void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage); -void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); -void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage); -void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2); -void send_SBS01Vf(uint8_t port,float voltage1, float voltage2); - - -/* - * ++++++++++++++++++++++++++++++++ - * Vario Sensors - * ++++++++++++++++++++++++++++++++ - */ -void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario); -void send_f1712_variof(uint8_t port, int16_t altitude, float vario); -void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario); -void send_f1672_variof(uint8_t port, int16_t altitude, float vario); -void send_F1712(uint8_t port, int16_t altitude, int16_t vario); -void send_F1712f(uint8_t port, int16_t altitude, float vario); -void send_F1672(uint8_t port, int16_t altitude, int16_t vario); -void send_F1672f(uint8_t port, int16_t altitude, float vario); - -/* - * ++++++++++++++++++++++++++++++++ - * GPS Sensors - * Note the different Input Types! - * Example: - * Position Berlin Fernsehturm - * https://www.koordinaten-umrechner.de/decimal/52.520832,13.409430?karte=OpenStreetMap&zoom=19 - * Degree Minutes 52° 31.2499 and 13° 24.5658 - * Decimal Degree 52.520832 and 13.409430 - * ++++++++++++++++++++++++++++++++ - */ -// Degree Minutes as Integer -> 52312499 -void send_f1675_gps(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); -// Degree Minutes as Integer -> 52 and 312499 -void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min); -// Degree Minutes as Float -> 52 and 31.2499 -void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min); -// Decimal Degrees as Float -> 52.520832 -void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude); -// Decimal Degrees as Integer -> 52520832 -void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); -void send_SBS10G(uint8_t port, uint16_t hours, uint16_t minutes, uint16_t seconds, float latitude, float longitude, float altitudeMeters, uint16_t speed, float gpsVario); - -/* - * ++++++++++++++++++++++++++++++++ - * ESC Sensors - * Note These sensors only exists on the newer Futaba Radios 18SZ, 16IZ, etc - * ++++++++++++++++++++++++++++++++ - */ - -void send_kontronik(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); -void send_scorpion(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); - -void send_jetcat(uint8_t port, uint32_t rpm, uint16_t egt, uint16_t pump_volt, uint32_t setrpm, uint16_t thrust, uint16_t fuel, uint16_t fuelflow, uint16_t altitude, uint16_t quality, uint16_t volt, uint16_t current, uint16_t speed, uint16_t status, uint32_t secondrpm); - -void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes); - #endif diff --git a/src/main/telemetry/sbus2_sensors.c b/src/main/telemetry/sbus2_sensors.c new file mode 100644 index 00000000000..ec3d05a4bd7 --- /dev/null +++ b/src/main/telemetry/sbus2_sensors.c @@ -0,0 +1,729 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include "telemetry/sbus2.h" +#include "telemetry/sbus2_sensors.h" + +void send_RPM(uint8_t port, uint32_t RPM) +{ + uint32_t value = 0; + uint8_t bytes[2] = { }; + + value = RPM / 6; + if(value > 0xffff){ + value = 0xffff; + } + bytes[1] = value >> 8; + bytes[0] = value; + SBUS2_transmit_telemetry_data( port , bytes); +} + + +void send_temp125(uint8_t port, int16_t temp) +{ + int16_t value= 0; + uint8_t bytes[2] = { }; + + value = temp | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); +} +void send_SBS01T(uint8_t port, int16_t temp){ + int16_t value= 0; + uint8_t bytes[2] = {}; + + value = temp | 0x8000; + value = value + 100; + bytes[0] = value;// >> 8; + bytes[1] = value >> 8; + SBUS2_transmit_telemetry_data(port , bytes); +} + +void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2) +{ + uint16_t value = 0; + uint8_t bytes[2] = { }; + + // VOLTAGE1 + value = voltage1 | 0x8000; + if ( value > 0x9FFF ){ + value = 0x9FFF; // max voltage is 819.1 + } + else if(value < 0x8000){ + value = 0x8000; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //VOLTAGE2 + value = voltage2; + if ( value > 0x1FFF ){ + value = 0x1FFF; // max voltage is 819.1 + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+1 , bytes); +} + +void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage) +{ + uint16_t value = 0; + uint32_t local = 0; + uint8_t bytes[2] = { }; + + + // CURRENT + local = ((uint32_t)current) * 1 ; + value = (uint16_t)local; + if ( value > 0x3FFF ) + { + // max current is 163.83 + value = 0x3FFF; + } + bytes[0] = value >> 8; + bytes[0] = bytes[0] | 0x40; + bytes[0] = bytes[0] & 0x7F; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //VOLTAGE + local = ((uint32_t)voltage) * 1; + value = (uint16_t)local; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+1 , bytes); + + // CAPACITY + local = (uint32_t)capacity; + value = (uint16_t)local; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port+2 , bytes); +} + +void send_f1675_gps(uint8_t port, uint16_t speed, int16_t altitude, int16_t vario, int32_t latitude, int32_t longitude) +{ + uint16_t value1 = 0; + int16_t value2 = 0; + uint32_t value3 = 0; + bool latitude_pos = false; + bool longitude_pos = false; + uint8_t bytes[2] = {}; + + + // SPEED -> Bit 14(bytes[1] bit7) -> GPS Valid or not + value1 = speed | 0x4000; + if (value1 > 0x43E7 ){ + value1 = 0x43E7; // max Speed is 999 km/h + } + else if( value1 < 0x4000){ + value1 = 0x4000; + } + bytes[0] = value1 >> 8; + bytes[1] = value1; + SBUS2_transmit_telemetry_data( port , bytes); + + //HIGHT + value2 = altitude | 0x4000; + /*if(value2 > 0x7FFF ){ // max = +16383 + value2 = 0x7FFF; + } + else if( value2 < 0xC000){ // min = -16384 + value2 = 0xC000; + }*/ + bytes[0] = value2 >> 8; + bytes[1] = value2; + SBUS2_transmit_telemetry_data( port+1 , bytes); + + //TIME -> 12:34:56 Uhr = 12*60*60 + 34*60 + 56 = 45296 = 0xB0F0 + bytes[0] = 0xB0; + bytes[1] = 0xF0; + SBUS2_transmit_telemetry_data( port+2 , bytes); + + // VARIO + value2 = vario * 10; + bytes[0] = value2 >> 8; + bytes[1] = value2; + SBUS2_transmit_telemetry_data( port+3 , bytes); + + // LATITUDE + if(latitude >= 0){ + latitude_pos = true; + } + else{ + latitude_pos = false; + latitude = latitude * -1; + } + bytes[0] = (uint8_t)(latitude/1000000); + value3 = (uint32_t)(latitude%1000000); + if(latitude_pos){ + bytes[1] = ((value3 >> 16) & 0x0f); // North + } + else{ + bytes[1] = ((value3 >> 16) | 0x1f); // South + } + SBUS2_transmit_telemetry_data( port+4 , bytes); + + bytes[0] = ((value3 >> 8) & 0xff); + bytes[1] = value3 & 0xff; + SBUS2_transmit_telemetry_data( port+5 , bytes); + + // LONGITUDE + if(longitude >= 0){ + longitude_pos = true; + } + else{ + longitude_pos = false; + longitude = longitude * -1; + } + bytes[0] = (uint8_t)(longitude/1000000); + value3 = (uint32_t)(longitude%1000000); + if(longitude_pos){ + bytes[1] = ((value3 >> 16) & 0x0f); // Eath + } + else{ + bytes[1] = ((value3 >> 16) | 0x1f); // West + } + SBUS2_transmit_telemetry_data( port+6 , bytes); + + bytes[0] = ((value3 >> 8) & 0xff); + bytes[1] = value3 & 0xff; + SBUS2_transmit_telemetry_data( port+7 , bytes); +} + +void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario) +{ + int16_t value = 0; + uint8_t bytes[2] = { }; + + // VARIO + value = vario; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port, bytes); + + //HIGHT + value = altitude | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1, bytes); +} + +void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario) +{ + int16_t value = 0; + uint8_t bytes[2] = { }; + + // VARIO + value = vario; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + //HIGHT + value = altitude | 0x4000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + +} + + +void send_SBS01TE(uint8_t port, int16_t temp){ + send_temp125(port, temp); +} +void send_F1713(uint8_t port, int16_t temp){ + send_temp125(port, temp); +} + +void send_SBS01RB(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01RM(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01RO(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} +void send_SBS01R(uint8_t port, uint32_t RPM){ + send_RPM(port, RPM); +} + +void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ + send_s1678_current(port, current, capacity, voltage); +} +void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} +void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} +void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2){ + send_voltage(port, voltage1, voltage2); +} +void send_SBS01Vf(uint8_t port,float voltage1, float voltage2){ + send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); +} +void send_voltagef(uint8_t port,float voltage1, float voltage2){ + send_voltage(port, (uint16_t)(voltage1 * 10), (uint16_t)(voltage2 * 10)); +} +void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage){ + send_s1678_current(port, current, capacity, voltage); +} +void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage){ + send_s1678_current(port, (uint16_t)(current * 100), capacity, (uint16_t)(voltage * 100)); +} + +void send_f1712_variof(uint8_t port, int16_t altitude, float vario){ + send_f1712_vario(port, altitude, (int16_t)(vario * 10)); +} +void send_f1672_variof(uint8_t port, int16_t altitude, float vario){ + send_f1672_vario(port, altitude, (int16_t)(vario * 100)); +} +void send_F1712(uint8_t port, int16_t altitude, int16_t vario){ + send_f1712_vario(port, altitude, vario); +} +void send_F1712f(uint8_t port, int16_t altitude, float vario){ + send_f1712_vario(port, altitude, (int16_t)(vario * 10)); +} +void send_F1672(uint8_t port, int16_t altitude, int16_t vario){ + send_f1672_vario(port, altitude, vario); +} +void send_F1672f(uint8_t port, int16_t altitude, float vario){ + send_f1672_vario(port, altitude, (int16_t)(vario * 100)); +} + +void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min){ + bool Lat_Negative = false; + bool Lon_Negative = false; + if(lat_deg < 0){ + Lat_Negative = true; + lat_deg = lat_deg * -1; + } + if(lon_deg < 0){ + Lon_Negative = true; + lon_deg = lon_deg * -1; + } + if(lat_min < 0){ + Lat_Negative = true; + lat_min = lat_min * -1; + } + if(lon_min < 0){ + Lon_Negative = true; + lon_min = lon_min * -1; + } + int32_t _latitude_deg = lat_deg; + int32_t _longitude_deg = lon_deg; + int32_t _latitude_min = lat_min * 10000; + int32_t _longitude_min = lon_min * 10000; + int32_t _latitude = _latitude_deg * 1000000; + int32_t _longitude = _longitude_deg * 1000000; + _latitude = _latitude + _latitude_min; + _longitude = _longitude + _longitude_min; + if(Lat_Negative){ + _latitude = _latitude * -1; + } + if(Lon_Negative){ + _longitude = _longitude * -1; + } + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min){ + bool Lat_Negative = false; + bool Lon_Negative = false; + if(lat_deg < 0){ + Lat_Negative = true; + lat_deg = lat_deg * -1; + } + if(lon_deg < 0){ + Lon_Negative = true; + lon_deg = lon_deg * -1; + } + if(lat_min < 0){ + Lat_Negative = true; + lat_min = lat_min * -1; + } + if(lon_min < 0){ + Lon_Negative = true; + lon_min = lon_min * -1; + } + int32_t _latitude_deg = lat_deg; + int32_t _longitude_deg = lon_deg; + int32_t _latitude = _latitude_deg * 1000000; + int32_t _longitude = _longitude_deg * 1000000; + _latitude = _latitude + lat_min; + _longitude = _longitude + lon_min; + if(Lat_Negative){ + _latitude = _latitude * -1; + } + if(Lon_Negative){ + _longitude = _longitude * -1; + } + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude){ + int32_t _latitude = latitude; + int32_t _longitude = longitude; + int32_t _latitude_deg = _latitude/1000000; + int32_t _longitude_deg = _longitude/1000000; + int32_t _latitude_min = _latitude%1000000; + int32_t _longitude_min = _longitude%1000000; + _latitude = _latitude_deg * 1000000; + _longitude = _longitude_deg * 1000000; + _latitude = _latitude + ((_latitude_min * 60)/100); + _longitude = _longitude + ((_longitude_min * 60)/100); + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude){ + int32_t _latitude = latitude * 1000000; + int32_t _longitude = longitude * 1000000; + int32_t _latitude_deg = _latitude/1000000; + int32_t _longitude_deg = _longitude/1000000; + int32_t _latitude_min = _latitude%1000000; + int32_t _longitude_min = _longitude%1000000; + _latitude = _latitude_deg * 1000000; + _longitude = _longitude_deg * 1000000; + _latitude = _latitude + ((_latitude_min * 60)/100); + _longitude = _longitude + ((_longitude_min * 60)/100); + send_f1675_gps(port, speed, hight, vario, _latitude, _longitude); +} +void send_SBS10G( + uint8_t port, + uint16_t hours, // 0 to 24 + uint16_t minutes, // 0 to 60 + uint16_t seconds, // 0 to 60 + float latitude, // decimal degrees (i.e. 52.520833; negative value for southern hemisphere) + float longitude, // decimal degrees (i.e. 13.409430; negative value for western hemisphere) + float altitudeMeters, // meters (valid range: -1050 to 4600) + uint16_t speed, // km/h (valid range 0 to 511) + float gpsVario) // m/s (valid range: -150 to 260) +{ + uint32_t utc = (hours*3600) + (minutes*60) + seconds; + uint32_t lat, lon; + // scale latitude/longitude (add 0.5 for correct rounding) + if (latitude > 0) { + lat = (600000.0*latitude) + 0.5; + } + else { + lat = (-600000.0*latitude) + 0.5; + // toggle south bit + lat |= 0x4000000; + } + if (longitude > 0) { + lon = (600000.0*longitude) + 0.5; + } + else { + lon = (-600000.0*longitude) + 0.5; + // toggle west bit + lon |= 0x8000000; + } + // convert altitude (add 0.5 for correct rounding) + uint16_t alt = (altitudeMeters>=-820 && altitudeMeters<=4830) ?(1.25*(altitudeMeters+820)) + 0.5 : 0; + // error check speed + if (speed < 512) { + // set speed enable bit + speed |= 0x200; + } + else { + speed = 0; + } + // initialize buffer + uint8_t bytes[2] = { }; + // slot 0 (utc) + bytes[0] = (utc&0x00ff); + bytes[1] = (utc&0xff00)>>8; + SBUS2_transmit_telemetry_data(port , bytes); + // slot 1 (latitude & utc) + bytes[0] = ((lat&0x007f)<<1) | ((utc&0x10000)>>16); + bytes[1] = (lat&0x7f80)>>7; + SBUS2_transmit_telemetry_data(port+1 , bytes); + // slot 2 (latitude & longitude) + bytes[0] = (lat&0x07f8000)>>15; + bytes[1] = ((lat&0x7800000)>>23) | (lon&0x0f)<<4; + SBUS2_transmit_telemetry_data(port+2 , bytes); + // slot 3 (longitude) + bytes[0] = (lon&0x00ff0)>>4; + bytes[1] = (lon&0xff000)>>12; + SBUS2_transmit_telemetry_data(port+3 , bytes); + // slot 4 (longitude & speed) + bytes[0] = ((lon&0xff00000)>>20); + bytes[1] = (speed&0xff); + SBUS2_transmit_telemetry_data(port+4 , bytes); + // slot 5 (pressure & speed) + bytes[0] = ((speed&0x300)>>8); + bytes[1] = 0x00; + SBUS2_transmit_telemetry_data(port+5 , bytes); + // slot 6 (altitude & pressure) + bytes[0] = ((alt&0x003)<<6); + bytes[1] = (alt&0x3fc)>>2; + SBUS2_transmit_telemetry_data(port+6 , bytes); + // slot (7 (vario & altitude) + uint16_t vario; + // error check vario + if (gpsVario >= -150 && gpsVario <= 260) { + // scale vario (add 0.5 for correct rounding) + vario = (10.0*(gpsVario + 150)) + 0.5; + // set vario enable + vario |= 0x1000; + } + else { + vario = 0; + } + bytes[0] = ((vario&0x001f)<<3) | ((alt&0x1c00)>>10); + bytes[1] = (vario&0x1fe0)>>5; + SBUS2_transmit_telemetry_data(port+7 , bytes); +} +void send_scorpion_kontronik( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + uint32_t value = 0; + uint8_t bytes[2] = { }; + + // voltage 41.1 = 4110 + value = voltage | 0x8000; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + // 1330 mah => 1.33 Ah + value = capacity; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + + // 2250 rpm => 2250 + value = rpm / 6; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 2 , bytes); + + // 13310 => 133.1 A + value = current; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 3 , bytes); + + // 41 => 41 Celsius + value = temp; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 4 , bytes); + + // 21 => Bec Celsius + value = becTemp; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 5 , bytes); + + // 650 => 6,5 Bec Current + value = becCurrent; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 6 , bytes); + + // PWM output + value = pwm; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 7 , bytes); +} + +void send_scorpion( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + send_scorpion_kontronik( + port, + voltage, + capacity, + rpm, + current, + temp, + becTemp, + becCurrent, + pwm); +} + +void send_kontronik( + uint8_t port, + uint16_t voltage, + uint16_t capacity, + uint32_t rpm, + uint16_t current, + uint16_t temp, + uint16_t becTemp, + uint16_t becCurrent, + uint16_t pwm) +{ + send_scorpion_kontronik( + port, + voltage, + capacity, + rpm, + current, + temp, + becTemp, + becCurrent, + pwm); +} + +void send_jetcat( + uint8_t port, + uint32_t rpm, + uint16_t egt, + uint16_t pump_volt, + uint32_t setrpm, + uint16_t thrust, + uint16_t fuel, + uint16_t fuelflow, + uint16_t altitude, + uint16_t quality, + uint16_t volt, + uint16_t current, + uint16_t speed, + uint16_t status, + uint32_t secondrpm) +{ + uint32_t value = 0; + uint8_t bytes[2] = {}; + + // Actual RPM with 0x4000 Offset -> why? + value = rpm / 100; + value = value | 0x4000; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port , bytes); + + // EGT Abgastemperatur in °C + value = egt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 1 , bytes); + + // Pump Voltage 12.34V = 1234 + value = pump_volt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 2 , bytes); + + // Setpoint RPM without Offset + value = setrpm / 100; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 3 , bytes); + + // Thrust 123.4N = 1234 + value = thrust; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 4 , bytes); + + // Fuel (remain) in ml + value = fuel; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 5 , bytes); + + // Fuel Flow in ml/min + value = fuelflow; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 6 , bytes); + + // Altitude -> without offset? + value = altitude; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 7 , bytes); + + // Fuel Quality in % + value = quality; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 8 , bytes); + + // Voltage 12.34V = 1234 + value = volt; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 9 , bytes); + + // Current 123.4A = 1234 + value = current; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 10 , bytes); + + // Speed in km/h + value = speed; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 11 , bytes); + + // Status and Error Code + value = status; + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 12 , bytes); + + // Second RPM without Offset + value = secondrpm / 100; + if(value > 0xffff){ + value = 0xffff; + } + bytes[0] = value >> 8; + bytes[1] = value; + SBUS2_transmit_telemetry_data( port + 13 , bytes); + +} + + +void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes) +{ + if(slotId > 0 && slotId < SBUS2_SLOT_COUNT) { + sbusTelemetryData[slotId].payload.data[0] = bytes[0]; + sbusTelemetryData[slotId].payload.data[1] = bytes[1]; + sbusTelemetryData[slotId].slotId = sbus2SlotIds[slotId]; + //sbusTelemetryData[i].payload.data[0] = 0x81; + //sbusTelemetryData[i].payload.data[1] = 0x80; + sbusTelemetryDataUsed[slotId] = 1; + } + +} \ No newline at end of file diff --git a/src/main/telemetry/sbus2_sensors.h b/src/main/telemetry/sbus2_sensors.h new file mode 100644 index 00000000000..f349e389cf9 --- /dev/null +++ b/src/main/telemetry/sbus2_sensors.h @@ -0,0 +1,118 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + + +#pragma once + +#include + +#include "platform.h" + +// Sensor code from https://github.com/BrushlessPower/SBUS2-Telemetry +// SBUS2 telemetry: 2ms deadtime after rc package +// One new slot every 700us + +/* + * ++++++++++++++++++++++++++++++++ + * Temperature Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_temp125(uint8_t port, int16_t temp); +void send_alarm_as_temp125(uint8_t port, int16_t alarm); +void send_SBS01TE(uint8_t port, int16_t temp); +void send_SBS01T(uint8_t port, int16_t temp); +void send_F1713(uint8_t port, int16_t temp); + +/* + * ++++++++++++++++++++++++++++++++ + * RPM Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_RPM(uint8_t port, uint32_t RPM); +void send_SBS01RB(uint8_t port, uint32_t RPM); +void send_SBS01RM(uint8_t port, uint32_t RPM); +void send_SBS01RO(uint8_t port, uint32_t RPM); +void send_SBS01R(uint8_t port, uint32_t RPM); + +/* + * ++++++++++++++++++++++++++++++++ + * Voltage/Current Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_voltage(uint8_t port,uint16_t voltage1, uint16_t voltage2); +void send_voltagef(uint8_t port,float voltage1, float voltage2); +void send_s1678_current(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_s1678_currentf(uint8_t port, float current, uint16_t capacity, float voltage); +void send_SBS01C(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_SBS01Cf(uint8_t port, float current, uint16_t capacity, float voltage); +void send_F1678(uint8_t port, uint16_t current, uint16_t capacity, uint16_t voltage); +void send_F1678f(uint8_t port, float current, uint16_t capacity, float voltage); +void send_SBS01V(uint8_t port,uint16_t voltage1, uint16_t voltage2); +void send_SBS01Vf(uint8_t port,float voltage1, float voltage2); + + +/* + * ++++++++++++++++++++++++++++++++ + * Vario Sensors + * ++++++++++++++++++++++++++++++++ + */ +void send_f1712_vario(uint8_t port, int16_t altitude, int16_t vario); +void send_f1712_variof(uint8_t port, int16_t altitude, float vario); +void send_f1672_vario(uint8_t port, int16_t altitude, int16_t vario); +void send_f1672_variof(uint8_t port, int16_t altitude, float vario); +void send_F1712(uint8_t port, int16_t altitude, int16_t vario); +void send_F1712f(uint8_t port, int16_t altitude, float vario); +void send_F1672(uint8_t port, int16_t altitude, int16_t vario); +void send_F1672f(uint8_t port, int16_t altitude, float vario); + +/* + * ++++++++++++++++++++++++++++++++ + * GPS Sensors + * Note the different Input Types! + * Example: + * Position Berlin Fernsehturm + * https://www.koordinaten-umrechner.de/decimal/52.520832,13.409430?karte=OpenStreetMap&zoom=19 + * Degree Minutes 52° 31.2499 and 13° 24.5658 + * Decimal Degree 52.520832 and 13.409430 + * ++++++++++++++++++++++++++++++++ + */ +// Degree Minutes as Integer -> 52312499 +void send_f1675_gps(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); +// Degree Minutes as Integer -> 52 and 312499 +void send_F1675min(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, int32_t lat_min, int8_t lon_deg, int32_t lon_min); +// Degree Minutes as Float -> 52 and 31.2499 +void send_F1675minf(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int8_t lat_deg, float lat_min, int8_t lon_deg, float lon_min); +// Decimal Degrees as Float -> 52.520832 +void send_F1675f(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, float latitude, float longitude); +// Decimal Degrees as Integer -> 52520832 +void send_F1675(uint8_t port, uint16_t speed, int16_t hight, int16_t vario, int32_t latitude, int32_t longitude); +void send_SBS10G(uint8_t port, uint16_t hours, uint16_t minutes, uint16_t seconds, float latitude, float longitude, float altitudeMeters, uint16_t speed, float gpsVario); + +/* + * ++++++++++++++++++++++++++++++++ + * ESC Sensors + * Note These sensors only exists on the newer Futaba Radios 18SZ, 16IZ, etc + * ++++++++++++++++++++++++++++++++ + */ + +void send_kontronik(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); +void send_scorpion(uint8_t port, uint16_t voltage, uint16_t capacity, uint32_t rpm, uint16_t current, uint16_t temp, uint16_t becTemp, uint16_t becCurrent, uint16_t pwm); + +void send_jetcat(uint8_t port, uint32_t rpm, uint16_t egt, uint16_t pump_volt, uint32_t setrpm, uint16_t thrust, uint16_t fuel, uint16_t fuelflow, uint16_t altitude, uint16_t quality, uint16_t volt, uint16_t current, uint16_t speed, uint16_t status, uint32_t secondrpm); + +void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes); + From cf4fab88092f0f27918f66caab149dda51878a8f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:38:19 +0200 Subject: [PATCH 377/429] ifdef USE_TELEMETRY_SBUS2 --- src/main/telemetry/sbus2_sensors.c | 5 ++++- src/main/telemetry/sbus2_sensors.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/telemetry/sbus2_sensors.c b/src/main/telemetry/sbus2_sensors.c index ec3d05a4bd7..f2e94f51ac1 100644 --- a/src/main/telemetry/sbus2_sensors.c +++ b/src/main/telemetry/sbus2_sensors.c @@ -18,6 +18,8 @@ #include "telemetry/sbus2.h" #include "telemetry/sbus2_sensors.h" + +#ifdef USE_TELEMETRY_SBUS2 void send_RPM(uint8_t port, uint32_t RPM) { uint32_t value = 0; @@ -726,4 +728,5 @@ void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes) sbusTelemetryDataUsed[slotId] = 1; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/main/telemetry/sbus2_sensors.h b/src/main/telemetry/sbus2_sensors.h index f349e389cf9..53ffb07aded 100644 --- a/src/main/telemetry/sbus2_sensors.h +++ b/src/main/telemetry/sbus2_sensors.h @@ -22,6 +22,8 @@ #include "platform.h" +#ifdef USE_TELEMETRY_SBUS2 + // Sensor code from https://github.com/BrushlessPower/SBUS2-Telemetry // SBUS2 telemetry: 2ms deadtime after rc package // One new slot every 700us @@ -116,3 +118,4 @@ void send_jetcat(uint8_t port, uint32_t rpm, uint16_t egt, uint16_t pump_volt, u void SBUS2_transmit_telemetry_data(uint8_t slotId , const uint8_t *bytes); +#endif \ No newline at end of file From 711301ef6986cf318ab51ec6d4878b624d0907fb Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:54:21 +0200 Subject: [PATCH 378/429] Fixed update rate --- src/main/telemetry/sbus2.c | 38 +++++++++++++++++++++++++++++++------- src/main/telemetry/sbus2.h | 7 ++++++- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index bcdc1368168..7b2168ca486 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -54,11 +54,11 @@ const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB }; - - sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT] = {}; uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT] = {}; -timeUs_t sbusTelemetryMinDelay[SBUS2_SLOT_COUNT] = {}; +//timeUs_t sbusTelemetryMinDelay[SBUS2_SLOT_COUNT] = {}; +static uint8_t currentSlot = 0; +static timeUs_t nextSlotTime = 0; void handleSbus2Telemetry(timeUs_t currentTimeUs) { @@ -149,10 +149,21 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) { + UNUSED(elapsed); if (elapsed < SBUS2_DEADTIME) { + currentSlot = 0; + nextSlotTime = 0; return 0xFF; // skip it } + if(currentSlot < SBUS2_TELEMETRY_SLOTS) { + return currentSlot; + } + + return 0xFF; + + /* + elapsed = elapsed - SBUS2_DEADTIME; uint8_t slot = (elapsed % SBUS2_SLOT_TIME) - 1; @@ -162,6 +173,13 @@ uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) } return slot; + */ +} + +void sbus2IncrementTelemetrySlot(timeUs_t currentTimeUs) +{ + nextSlotTime = currentTimeUs + (SBUS2_TRANSMIT_TIME + SBUS2_SLOT_DELAY); + currentSlot++; } FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) @@ -173,10 +191,15 @@ FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) timeUs_t elapsedTime = currentTimeUs - sbusGetLastFrameTime(); - if(elapsedTime > MS2US(8)) { + if (elapsedTime > MS2US(8)) { + currentSlot = 0; + nextSlotTime = 0; return; } + if (currentTimeUs < nextSlotTime) { + return; + } uint8_t telemetryPage = sbusGetCurrentTelemetryPage(); @@ -185,16 +208,17 @@ FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) if(slot < SBUS2_TELEMETRY_SLOTS) { int slotIndex = (telemetryPage * SBUS2_TELEMETRY_SLOTS) + slot; if (slotIndex < SBUS2_SLOT_COUNT) { - if (sbusTelemetryDataUsed[slotIndex] != 0 && sbusTelemetryMinDelay[slotIndex] < currentTimeUs) { - sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; + if (sbusTelemetryDataUsed[slotIndex] != 0) { + //sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; // send serialWriteBuf(telemetrySharedPort, (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); - sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(1); + //sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(1); //sbusTelemetryDataUsed[slotIndex] = 0; } } + sbus2IncrementTelemetrySlot(currentTimeUs); } } diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 9c2c39ba73e..ac538b1c193 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -33,6 +33,10 @@ #define SBUS2_DEADTIME MS2US(2) #define SBUS2_SLOT_TIME 650u + +#define SBUS2_TRANSMIT_TIME ((8 + 1 + 2 + 1 + 1) * 3 * 10) // 8e2, 100000 baud + star and stop bits +#define SBUS2_SLOT_DELAY 200 + #define SBUS2_SLOT_DELAY_MAX (MIN(350u, (SBUS2_SLOT_TIME / 2u))) #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) @@ -55,7 +59,7 @@ STATIC_ASSERT(sizeof(sbus2_telemetry_frame_t) == 3, sbus2_telemetry_size); extern const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT]; extern uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT]; -extern timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT]; +//extern timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT]; // refresh telemetry buffers void handleSbus2Telemetry(timeUs_t currentTimeUs); @@ -64,5 +68,6 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs); void taskSendSbus2Telemetry(timeUs_t currentTimeUs); uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed); +void sbus2IncrementTelemetrySlot(timeUs_t now); #endif From 6d393a700c5e09600d75b1b750697feb5a73bf04 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:56:47 +0200 Subject: [PATCH 379/429] Remove dead code --- src/main/telemetry/sbus2.c | 17 ----------------- src/main/telemetry/sbus2.h | 1 - 2 files changed, 18 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 7b2168ca486..fb7ff5dde16 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -56,7 +56,6 @@ const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT] = { sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT] = {}; uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT] = {}; -//timeUs_t sbusTelemetryMinDelay[SBUS2_SLOT_COUNT] = {}; static uint8_t currentSlot = 0; static timeUs_t nextSlotTime = 0; @@ -161,19 +160,6 @@ uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) } return 0xFF; - - /* - - elapsed = elapsed - SBUS2_DEADTIME; - - uint8_t slot = (elapsed % SBUS2_SLOT_TIME) - 1; - - if (elapsed - (slot * SBUS2_SLOT_TIME) > SBUS2_SLOT_DELAY_MAX) { - slot = 0xFF; - } - - return slot; - */ } void sbus2IncrementTelemetrySlot(timeUs_t currentTimeUs) @@ -209,13 +195,10 @@ FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) int slotIndex = (telemetryPage * SBUS2_TELEMETRY_SLOTS) + slot; if (slotIndex < SBUS2_SLOT_COUNT) { if (sbusTelemetryDataUsed[slotIndex] != 0) { - //sbusTelemetryData[slotIndex].slotId = sbus2SlotIds[slotIndex]; // send serialWriteBuf(telemetrySharedPort, (const uint8_t *)&sbusTelemetryData[slotIndex], sizeof(sbus2_telemetry_frame_t)); - //sbusTelemetryMinDelay[slotIndex] = currentTimeUs + MS2US(1); - //sbusTelemetryDataUsed[slotIndex] = 0; } } sbus2IncrementTelemetrySlot(currentTimeUs); diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index ac538b1c193..10e5b35ece0 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -59,7 +59,6 @@ STATIC_ASSERT(sizeof(sbus2_telemetry_frame_t) == 3, sbus2_telemetry_size); extern const uint8_t sbus2SlotIds[SBUS2_SLOT_COUNT]; extern sbus2_telemetry_frame_t sbusTelemetryData[SBUS2_SLOT_COUNT]; extern uint8_t sbusTelemetryDataUsed[SBUS2_SLOT_COUNT]; -//extern timeUs_t sbusTelemetryDataLastSent[SBUS2_SLOT_COUNT]; // refresh telemetry buffers void handleSbus2Telemetry(timeUs_t currentTimeUs); From 062b068bd08f1aa32e1749d3bdbecac36f07d5cd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 17:58:27 +0200 Subject: [PATCH 380/429] Remove old comment --- src/main/telemetry/sbus2.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index fb7ff5dde16..7bedd18c0a9 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -141,9 +141,6 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) send_SBS01T(18 + i, 0); } #endif - - // 8 slots - gps - // } uint8_t sbus2GetTelemetrySlot(timeUs_t elapsed) From 7bba2b931e68a9a6756575c7b9eb8cc1c2d0e9ca Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 12:19:10 -0400 Subject: [PATCH 381/429] Update SBUS2_Telemetry.md --- docs/SBUS2_Telemetry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/SBUS2_Telemetry.md b/docs/SBUS2_Telemetry.md index d8a1cd8f1e1..1a687e99b0b 100644 --- a/docs/SBUS2_Telemetry.md +++ b/docs/SBUS2_Telemetry.md @@ -1,10 +1,10 @@ # Futaba SBUS2 Telemetry -Basic experimental support for SBUS2 telemetry has been added to INAV 8.0.0. Currently it is limited to F7 and H7 mcus only. The main reason it is limited to those MCUs is due to it requiring an inverted UART signal, and the SBUS pads in F405 usually are not bi-directional. +Basic experimental support for SBUS2 telemetry has been added to INAV 8.0.0. Currently it is limited to F7 and H7 mcus only. The main reason it is limited to those MCUs is due to the requirement for an inverted UART signal and the SBUS pads in F405 usually are not bi-directional. The basic sensors have been tested with a Futaba T16IZ running software version 6.0E. -An alternative to using INAV's SBUS2 support is to use SBS-01ML MAVlink Telemetry Drone Sensor instead. (not tested) +An alternative to using INAV's SBUS2 support is to use SBS-01ML MAVlink Telemetry Drone Sensor instead. (not tested and not supported with older futaba radios, including my 16IZ). # Wiring The SBUS2 signal should be connected to the TX PIN, not the RX PIN, like on a traditional SBUS setup. From 7eb45b2457cba260b0cbe14c43ecffd5fcff2373 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 18:29:17 +0200 Subject: [PATCH 382/429] Remove unused define --- src/main/telemetry/sbus2.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/telemetry/sbus2.h b/src/main/telemetry/sbus2.h index 10e5b35ece0..0fc74f3298d 100644 --- a/src/main/telemetry/sbus2.h +++ b/src/main/telemetry/sbus2.h @@ -37,8 +37,6 @@ #define SBUS2_TRANSMIT_TIME ((8 + 1 + 2 + 1 + 1) * 3 * 10) // 8e2, 100000 baud + star and stop bits #define SBUS2_SLOT_DELAY 200 -#define SBUS2_SLOT_DELAY_MAX (MIN(350u, (SBUS2_SLOT_TIME / 2u))) - #define SBUS2_SLOT_COUNT (SBUS2_TELEMETRY_PAGES * SBUS2_TELEMETRY_SLOTS) #if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) From a617d218a0bd827ff5dff6e4557a217be353e20d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 14:06:43 -0400 Subject: [PATCH 383/429] Update telemetry.c --- src/main/telemetry/telemetry.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/telemetry/telemetry.c b/src/main/telemetry/telemetry.c index f6ba7f85437..56c18ca159b 100644 --- a/src/main/telemetry/telemetry.c +++ b/src/main/telemetry/telemetry.c @@ -251,7 +251,6 @@ void telemetryProcess(timeUs_t currentTimeUs) #ifdef USE_TELEMETRY_SBUS2 handleSbus2Telemetry(currentTimeUs); - DEBUG_SET(DEBUG_SBUS2, 7, 1); #endif } From 397a632f0e3bb01bbd7199d684c154a6daa90a79 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 20:33:49 +0200 Subject: [PATCH 384/429] Cleanup --- src/main/telemetry/sbus2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index 7bedd18c0a9..dc5fb81d77d 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -129,6 +129,7 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) valid = 0; valid = getBaroTemperature(&temp16); send_SBS01T(17, valid ? temp16 / 10 : 0); + // temp sensors 18-25 #ifdef USE_TEMPERATURE_SENSOR for(int i = 0; i < 8; i++) { @@ -136,10 +137,6 @@ void handleSbus2Telemetry(timeUs_t currentTimeUs) valid = getSensorTemperature(0, &temp16); send_SBS01T(18 + i, valid ? temp16 / 10 : 0); } -#else - for(int i = 0; i < 8; i++) { - send_SBS01T(18 + i, 0); - } #endif } From cd7e89d8c71e26b171d33e18a513688f40941272 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sat, 20 Jul 2024 21:09:24 +0200 Subject: [PATCH 385/429] Add basic sbus information and link to full docs --- docs/Telemetry.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/Telemetry.md b/docs/Telemetry.md index 996630e66fa..a33aa4ee527 100644 --- a/docs/Telemetry.md +++ b/docs/Telemetry.md @@ -390,3 +390,21 @@ In configurator set IBUS telemetry and RX on this same port, enable telemetry fe Warning: Schematic above work also for connect telemetry only, but not work for connect rx only - will stop FC. + + +## Futaba SBUS2 telemetry + +SBUS2 telemetry requires a single connection from the TX pin of a bidirectional serial port to the SBUS2 pin on a Futaba T-FHSS or FASSTest telemetry receiver. (tested T16IZ radio and R7108SB and R3204SB receivers) + +It shares 1 line for both TX and RX, the rx pin cannot be used for other serial port stuff. +It runs at a fixed baud rate of 100000, so it needs a hardware uart capable of inverted signals. It is not available on F4 mcus. + +``` + _______ + / \ /-------------\ + | STM32 |-->UART TX-->[Bi-directional @ 100000 baud]-->| Futaba RX | + | uC |- UART RX--x[not connected] | SBUS2 port | + \_______/ \-------------/ +``` + +For more information and sensor slot numbering, refer to [SBUS2 Documentation](SBUS2_telemetry.md) \ No newline at end of file From 734050e9383c81d58e88d04f9c3421e01645129c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:07:36 +0200 Subject: [PATCH 386/429] Lower sbus2 telemetry trask priority --- src/main/fc/fc_tasks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 7a456699fa9..107a0e732b6 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -733,10 +733,10 @@ cfTask_t cfTasks[TASK_COUNT] = { #if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) [TASK_TELEMETRY_SBUS2] = { - .taskName = "SBUS2_TELEMETRY", + .taskName = "SBUS2 TLM", .taskFunc = taskSendSbus2Telemetry, .desiredPeriod = TASK_PERIOD_US(125), // 8kHz 2ms dead time + 650us window / sensor. - .staticPriority = TASK_PRIORITY_REALTIME, // timing is critical. Ideally, should be a timer interrupt triggered by sbus packet + .staticPriority = TASK_PRIORITY_LOW, // timing is critical. Ideally, should be a timer interrupt triggered by sbus packet }, #endif From 7d5d8f27997d6a1bc247053b8828acc2d685abd2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:15:58 -0400 Subject: [PATCH 387/429] Update Serial Gimbal.md Fix typos --- docs/Serial Gimbal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Serial Gimbal.md b/docs/Serial Gimbal.md index 984e00f29d1..c2c35b90af1 100644 --- a/docs/Serial Gimbal.md +++ b/docs/Serial Gimbal.md @@ -17,7 +17,7 @@ In head tracker mode, the Serial Gimbal will ignore the axis rc channel inputs a # Gimbal Modes ## No Gimbal mode selected -Like ACRO is the default mode for flight modes, the Gimbal will default to ```FPV Mode``` or ```Follow Mode``` when no mode is selected. The gimbal will try to stablized the footag and will follow the aircraft pitch, roll and yaw movements and use user inputs to point the camera where the user wants. +Like ACRO is the default mode for flight modes, the Gimbal will default to ```FPV Mode``` or ```Follow Mode``` when no mode is selected. The gimbal will try to stablized the footage and will follow the aircraft pitch, roll and yaw movements and use user inputs to point the camera where the user wants. ## Gimbal Center This locks the gimbal camera to the center position and ignores any user input. Useful to reset the camera if you loose orientation. @@ -49,7 +49,7 @@ Allowed range: -500 - 500 ``` ## Gimbal and Headtracker on a single uart -As INAV does not process any inputs from the Walksnail Gimbal, it is possible to share the uard with the Walksnail Headtracking output by connect the fc TX to the gimbal and RX to receive the headtracker input. +As INAV does not process any inputs from the Walksnail Gimbal, it is possible to share the uart with the Walksnail Headtracking output by connect the fc TX to the gimbal and RX to receive the headtracker input. ``` gimbal_serial_single_uart = OFF Allowed values: OFF, ON From b3f060d9ef4d999ef38c0995a325cfc6bc7ba248 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:45:04 +0200 Subject: [PATCH 388/429] Make sure DEFAULT_I2C_DEVICE is always valid --- src/main/target/KAKUTEF4WING/target.h | 2 ++ src/main/target/common_post.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/target/KAKUTEF4WING/target.h b/src/main/target/KAKUTEF4WING/target.h index 70eb125646a..cd8b74ac13d 100644 --- a/src/main/target/KAKUTEF4WING/target.h +++ b/src/main/target/KAKUTEF4WING/target.h @@ -45,6 +45,8 @@ #define I2C2_SCL PB10 #define I2C2_SDA PB11 +#define DEFAULT_I2C_BUS BUS_I2C2 + // ********** External MAG On I2C2****** #define USE_MAG #define MAG_I2C_BUS BUS_I2C2 diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index d3ccf280b17..9a85d14f1ee 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -29,6 +29,22 @@ extern uint8_t __config_end; # undef USE_OLED_UG2864 #endif + +// Make sure DEFAULT_I2C_BUS is valid +#ifndef DEFAULT_I2C_BUS + +#ifdef USE_I2C_DEVICE_1 +#define DEFAULT_I2C_BUS BUS_I2C1 +#elif USE_I2C_DEVICE_2 +#define DEFAULT_I2C_BUS BUS_I2C2 +#elif USE_I2C_DEVICE_3 +#define DEFAULT_I2C_BUS BUS_I2C3 +#elif USE_I2C_DEVICE_4 +#define DEFAULT_I2C_BUS BUS_I2C4 +#endif + +#endif + // Enable MSP_DISPLAYPORT for F3 targets without builtin OSD, // since it's used to display CMS on MWOSD #if !defined(USE_MSP_DISPLAYPORT) && !defined(USE_OSD) From 0b207ac02d66ea667a32f22a27f633ce4b84b745 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:59:35 +0200 Subject: [PATCH 389/429] Use default_i2c_bus when available --- src/main/target/common_post.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index 9a85d14f1ee..fc3859977ed 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -33,18 +33,35 @@ extern uint8_t __config_end; // Make sure DEFAULT_I2C_BUS is valid #ifndef DEFAULT_I2C_BUS -#ifdef USE_I2C_DEVICE_1 +#if defined(USE_I2C_DEVICE_1) #define DEFAULT_I2C_BUS BUS_I2C1 -#elif USE_I2C_DEVICE_2 +#elif defined(USE_I2C_DEVICE_2) #define DEFAULT_I2C_BUS BUS_I2C2 -#elif USE_I2C_DEVICE_3 +#elif defined(USE_I2C_DEVICE_3) #define DEFAULT_I2C_BUS BUS_I2C3 -#elif USE_I2C_DEVICE_4 +#elif defined(USE_I2C_DEVICE_4) #define DEFAULT_I2C_BUS BUS_I2C4 #endif #endif +// Airspeed sensors +#if defined(USE_PITOT) && defined(DEFAULT_I2C_BUS) + +#ifndef PITOT_I2C_BUS +#define PITOT_I2C_BUS DEFAULT_I2C_BUS +#endif + +#endif + +// Temperature sensors +#if !defined(TEMPERATURE_I2C_BUS) && defined(DEFAULT_I2C_BUS) + +#define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS + +#endif + + // Enable MSP_DISPLAYPORT for F3 targets without builtin OSD, // since it's used to display CMS on MWOSD #if !defined(USE_MSP_DISPLAYPORT) && !defined(USE_OSD) From 5d2fb24bc19abb639ac45345e446fa9d09e6709f Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:05:49 +0200 Subject: [PATCH 390/429] Add DEFAULT_I2C_BUS and make sure we default to a valid i2c bus --- src/main/target/common_post.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index fc3859977ed..fddd8b2a906 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -56,11 +56,13 @@ extern uint8_t __config_end; // Temperature sensors #if !defined(TEMPERATURE_I2C_BUS) && defined(DEFAULT_I2C_BUS) - #define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS - #endif +// Rangefinder sensors +#if !defined(RANGEFINDER_I2C_BUS) && defined(DEFAULT_I2C_BUS) +#define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS +#endif // Enable MSP_DISPLAYPORT for F3 targets without builtin OSD, // since it's used to display CMS on MWOSD @@ -100,6 +102,10 @@ extern uint8_t __config_end; #endif // USE_MAG_ALL +#if defined(DEFAULT_I2C_BUS) && !defined(MAG_I2C_BUS) +#define MAG_I2C_BUS DEFAULT_I2C_BUS +#endif + #endif // USE_MAG #if defined(USE_BARO) @@ -117,6 +123,10 @@ extern uint8_t __config_end; #define USE_BARO_SPL06 #endif +#if defined(DEFAULT_I2C_BUS) && !defined(BARO_I2C_BUS) +#define BARO_I2C_BUS DEFAULT_I2C_BUS +#endif + #endif #ifdef USE_ESC_SENSOR From 4c497046747235f09d2e5f6d202b152ac2eb769d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:15:04 +0200 Subject: [PATCH 391/429] Make sure all i2c devices are setup correctly --- src/main/target/KAKUTEF4WING/target.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/target/KAKUTEF4WING/target.h b/src/main/target/KAKUTEF4WING/target.h index cd8b74ac13d..70eb125646a 100644 --- a/src/main/target/KAKUTEF4WING/target.h +++ b/src/main/target/KAKUTEF4WING/target.h @@ -45,8 +45,6 @@ #define I2C2_SCL PB10 #define I2C2_SDA PB11 -#define DEFAULT_I2C_BUS BUS_I2C2 - // ********** External MAG On I2C2****** #define USE_MAG #define MAG_I2C_BUS BUS_I2C2 From db023eccc87b75bc0fb0f64a7b460e36c639b83c Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 26 Jul 2024 11:39:37 -0500 Subject: [PATCH 392/429] AOCODARCF7MINI_V1: DSHOT_DMAR and V1 output order --- src/main/target/AOCODARCF7MINI/target.c | 4 +++- src/main/target/AOCODARCF7MINI/target.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/target/AOCODARCF7MINI/target.c b/src/main/target/AOCODARCF7MINI/target.c index f01d2c73e81..72140f50fac 100644 --- a/src/main/target/AOCODARCF7MINI/target.c +++ b/src/main/target/AOCODARCF7MINI/target.c @@ -47,11 +47,13 @@ timerHardware_t timerHardware[] = { #if defined(AOCODARCF7MINI_V2) DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 D(2, 4, 7) DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 D(2, 7, 7) + DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 D(1, 0, 2) #else + DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 D(1, 6, 3) + DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 #endif - DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 D(1, 0, 2) DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 D(1, 3, 2) DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 0), // LED diff --git a/src/main/target/AOCODARCF7MINI/target.h b/src/main/target/AOCODARCF7MINI/target.h index 9f628963d85..4a5f5068746 100644 --- a/src/main/target/AOCODARCF7MINI/target.h +++ b/src/main/target/AOCODARCF7MINI/target.h @@ -163,3 +163,7 @@ #define USE_DSHOT #define USE_SERIALSHOT #define USE_ESC_SENSOR + +#if defined(AOCODARCF7MINI_V1) +#define USE_DSHOT_DMAR +#endif From 4b47e89d1a13c65d81a35f66d9e64feea9b27c62 Mon Sep 17 00:00:00 2001 From: MUSTARDTIGER FPV <122312693+MUSTARDTIGERFPV@users.noreply.github.com> Date: Sat, 27 Jul 2024 09:09:40 -0700 Subject: [PATCH 393/429] Change MAVLink component ID to be a "proper" autopilot - makes QGC & mLRS work properly. --- src/main/telemetry/mavlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/telemetry/mavlink.c b/src/main/telemetry/mavlink.c index 8931ed83c83..c8f5600d6e6 100644 --- a/src/main/telemetry/mavlink.c +++ b/src/main/telemetry/mavlink.c @@ -184,7 +184,7 @@ static mavlink_message_t mavRecvMsg; static mavlink_status_t mavRecvStatus; static uint8_t mavSystemId = 1; -static uint8_t mavComponentId = MAV_COMP_ID_SYSTEM_CONTROL; +static uint8_t mavComponentId = MAV_COMP_ID_AUTOPILOT1; static APM_COPTER_MODE inavToArduCopterMap(flightModeForTelemetry_e flightMode) { From 13edf9c0569b2b786f1537c0c6f26c4b951c2280 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Tue, 30 Jul 2024 07:19:38 +0200 Subject: [PATCH 394/429] sa: increase MAX_POWER_COUNT to 8 --- src/main/io/vtx_smartaudio.c | 7 +++++-- src/main/io/vtx_smartaudio.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/io/vtx_smartaudio.c b/src/main/io/vtx_smartaudio.c index 9901db409e2..20997c2da2c 100644 --- a/src/main/io/vtx_smartaudio.c +++ b/src/main/io/vtx_smartaudio.c @@ -73,7 +73,7 @@ static vtxDevice_t vtxSmartAudio = { .vTable = &saVTable, .capability.bandCount = VTX_SMARTAUDIO_BAND_COUNT, .capability.channelCount = VTX_SMARTAUDIO_CHANNEL_COUNT, - .capability.powerCount = VTX_SMARTAUDIO_MAX_POWER_COUNT, + .capability.powerCount = VTX_SMARTAUDIO_MAX_POWER_COUNT, // Should this be VTX_SMARTAUDIO_DEFAULT_POWER_COUNT? .capability.bandNames = (char **)vtx58BandNames, .capability.channelNames = (char **)vtx58ChannelNames, .capability.powerNames = (char**)saPowerNames @@ -124,7 +124,10 @@ saPowerTable_t saPowerTable[VTX_SMARTAUDIO_MAX_POWER_COUNT] = { { 200, 16 }, { 500, 25 }, { 800, 40 }, - { 0, 0 } // Placeholder + { 0, 0 }, // Placeholders + { 0, 0 }, + { 0, 0 }, + { 0, 0 } }; // Last received device ('hard') states diff --git a/src/main/io/vtx_smartaudio.h b/src/main/io/vtx_smartaudio.h index c817f05a79f..ba8856b0faf 100644 --- a/src/main/io/vtx_smartaudio.h +++ b/src/main/io/vtx_smartaudio.h @@ -33,7 +33,7 @@ #define VTX_SMARTAUDIO_BAND_COUNT (VTX_SMARTAUDIO_MAX_BAND - VTX_SMARTAUDIO_MIN_BAND + 1) #define VTX_SMARTAUDIO_CHANNEL_COUNT (VTX_SMARTAUDIO_MAX_CHANNEL - VTX_SMARTAUDIO_MIN_CHANNEL + 1) -#define VTX_SMARTAUDIO_MAX_POWER_COUNT 5 +#define VTX_SMARTAUDIO_MAX_POWER_COUNT 8 #define VTX_SMARTAUDIO_DEFAULT_POWER_COUNT 4 #define VTX_SMARTAUDIO_DEFAULT_POWER 1 From 86fe389b0c97bf6e89963c3f872062f7aeb0de1e Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Tue, 30 Jul 2024 18:11:48 +0100 Subject: [PATCH 395/429] add additional BBL headers for MAX SERVO increase (#10263) --- src/main/blackbox/blackbox.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 324b41a1095..5a72d323b09 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -350,6 +350,8 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 13, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"servo", 14, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"servo", 15, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 16, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 17, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"navState", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, {"navFlags", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, @@ -406,7 +408,7 @@ static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = { * but name kept for external compatibility reasons. * "activeFlightModeFlags" logs actual active flight modes rather than rc boxmodes. * 'active' should at least distinguish it from the existing "flightModeFlags" */ - + {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"flightModeFlags", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, {"flightModeFlags2", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, From 6670fe3e71ce5b817e217187fa863e520379aaba Mon Sep 17 00:00:00 2001 From: b14ckyy Date: Tue, 30 Jul 2024 22:50:31 +0200 Subject: [PATCH 396/429] Removed WP uploade blcoker when armed --- src/main/navigation/navigation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index adcecede5fe..82452256a51 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -3703,7 +3703,7 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData) setDesiredPosition(&wpPos.pos, DEGREES_TO_CENTIDEGREES(wpData->p1), waypointUpdateFlags); } // WP #1 - #NAV_MAX_WAYPOINTS - common waypoints - pre-programmed mission - else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS) && !ARMING_FLAG(ARMED)) { + else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS)) { // && !ARMING_FLAG(ARMED) if (wpData->action == NAV_WP_ACTION_WAYPOINT || wpData->action == NAV_WP_ACTION_JUMP || wpData->action == NAV_WP_ACTION_RTH || wpData->action == NAV_WP_ACTION_HOLD_TIME || wpData->action == NAV_WP_ACTION_LAND || wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD ) { // Only allow upload next waypoint (continue upload mission) or first waypoint (new mission) static int8_t nonGeoWaypointCount = 0; From b54a1c9526277a347057ea3b9a5833e220a16d69 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:25:17 +0200 Subject: [PATCH 397/429] Refactor sbus to support futaba's 26 (36 channel version) --- src/main/io/servo_sbus.c | 4 +-- src/main/rx/sbus.c | 57 +++++++++++++++++++++++++++++++++++-- src/main/rx/sbus_channels.c | 52 +++++++++++++++++++++++++++++++-- src/main/rx/sbus_channels.h | 11 ++++--- 4 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/main/io/servo_sbus.c b/src/main/io/servo_sbus.c index bfcd71b1158..121025c71a3 100644 --- a/src/main/io/servo_sbus.c +++ b/src/main/io/servo_sbus.c @@ -109,8 +109,8 @@ void sbusServoUpdate(uint8_t index, uint16_t value) case 13: sbusFrame.channels.chan13 = sbusEncodeChannelValue(value); break; case 14: sbusFrame.channels.chan14 = sbusEncodeChannelValue(value); break; case 15: sbusFrame.channels.chan15 = sbusEncodeChannelValue(value); break; - case 16: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_17) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_17) ; break; - case 17: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_18) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_18) ; break; + case 16: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_DG1) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_DG1) ; break; + case 17: sbusFrame.channels.flags = value > PWM_RANGE_MIDDLE ? (sbusFrame.channels.flags | SBUS_FLAG_CHANNEL_DG2) : (sbusFrame.channels.flags & ~SBUS_FLAG_CHANNEL_DG2) ; break; default: break; } diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 9c0fa30bd11..df22dab3e6b 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -54,6 +54,8 @@ typedef enum { STATE_SBUS_SYNC = 0, STATE_SBUS_PAYLOAD, + STATE_SBUS26_PAYLOAD_LOW, + STATE_SBUS26_PAYLOAD_HIGH, STATE_SBUS_WAIT_SYNC } sbusDecoderState_e; @@ -61,7 +63,8 @@ typedef struct sbusFrameData_s { sbusDecoderState_e state; volatile sbusFrame_t frame; volatile bool frameDone; - uint8_t buffer[SBUS_FRAME_SIZE]; + volatile bool is26channels; + uint8_t buffer[SBUS26_FRAME_SIZE]; uint8_t position; timeUs_t lastActivityTimeUs; } sbusFrameData_t; @@ -89,6 +92,14 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; + } else if (c == SBUS26_FRAME0_BEGIN_BYTE) { + sbusFrameData->position = 0; + sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; + sbusFrameData->state = STATE_SBUS26_PAYLOAD_LOW; + } else if (c == SBUS26_FRAME1_BEGIN_BYTE) { + sbusFrameData->position = 0; + sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; + sbusFrameData->state = STATE_SBUS26_PAYLOAD_HIGH; } break; @@ -130,10 +141,50 @@ static void sbusDataReceive(uint16_t c, void *data) memcpy((void *)&sbusFrameData->frame, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); sbusFrameData->frameDone = true; + sbusFrameData->is26channels = false; + } + } + break; + + case STATE_SBUS26_PAYLOAD_LOW: + case STATE_SBUS26_PAYLOAD_HIGH: + sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; + + if (sbusFrameData->position == SBUS_FRAME_SIZE) { + const sbusFrame_t * frame = (sbusFrame_t *)&sbusFrameData->buffer[0]; + bool frameValid = false; + + // Do some sanity check + switch (frame->endByte) { + case 0x20: // S.BUS 2 telemetry page 1 + case 0x24: // S.BUS 2 telemetry page 2 + case 0x28: // S.BUS 2 telemetry page 3 + case 0x2C: // S.BUS 2 telemetry page 4 + if (frame->syncByte == SBUS26_FRAME1_BEGIN_BYTE) { + sbus2ActiveTelemetryPage = (frame->endByte >> 2) & 0x3; + frameTime = currentTimeUs; + } + + frameValid = true; + sbusFrameData->state = STATE_SBUS_WAIT_SYNC; + break; + + default: // Failed end marker + sbusFrameData->state = STATE_SBUS_WAIT_SYNC; + break; + } + + // Frame seems sane, pass data to decoder + if (!sbusFrameData->frameDone && frameValid) { + memcpy((void *)&sbusFrameData->frame, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); + sbusFrameData->frameDone = true; + sbusFrameData->is26channels = true; } } break; + + case STATE_SBUS_WAIT_SYNC: // Stay at this state and do nothing. Exit will be handled before byte is processed if the // inter-frame gap is long enough @@ -150,7 +201,9 @@ static uint8_t sbusFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig) } // Decode channel data and store return value - const uint8_t retValue = sbusChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels); + const uint8_t retValue = sbusFrameData->is26channels ? + sbus26ChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels, (sbusFrameData->frame.syncByte == SBUS26_FRAME1_BEGIN_BYTE)) : + sbusChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels); // Reset the frameDone flag - tell ISR that we're ready to receive next frame sbusFrameData->frameDone = false; diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 99ca76393d6..8697544a08f 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -34,6 +34,54 @@ STATIC_ASSERT(SBUS_FRAME_SIZE == sizeof(sbusFrame_t), SBUS_FRAME_SIZE_doesnt_match_sbusFrame_t); +uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels, bool highChannels) +{ + uint8_t offset = highChannels ? 16 : 0 + uint16_t *sbusChannelData = rxRuntimeConfig->channelData; + sbusChannelData[0 + offset] = channels->chan0; + sbusChannelData[1 + offset] = channels->chan1; + sbusChannelData[2 + offset] = channels->chan2; + sbusChannelData[3 + offset] = channels->chan3; + sbusChannelData[4 + offset] = channels->chan4; + sbusChannelData[5 + offset] = channels->chan5; + sbusChannelData[6 + offset] = channels->chan6; + sbusChannelData[7 + offset] = channels->chan7; + sbusChannelData[8 + offset] = channels->chan8; + sbusChannelData[9 + offset] = channels->chan9; + sbusChannelData[10 + offset] = channels->chan10; + sbusChannelData[11 + offset] = channels->chan11; + sbusChannelData[12 + offset] = channels->chan12; + sbusChannelData[13 + offset] = channels->chan13; + sbusChannelData[14 + offset] = channels->chan14; + sbusChannelData[15 + offset] = channels->chan15; + + offset = highChannels ? 0 : 2; + if (channels->flags & SBUS_FLAG_CHANNEL_DG1) { + sbusChannelData[32 + offset] = SBUS_DIGITAL_CHANNEL_MAX; + } else { + sbusChannelData[32 + offset] = SBUS_DIGITAL_CHANNEL_MIN; + } + + if (channels->flags & SBUS_FLAG_CHANNEL_DG2) { + sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MAX; + } else { + sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MIN; + } + + if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) { + // internal failsafe enabled and rx failsafe flag set + // RX *should* still be sending valid channel data, so use it. + return RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE; + } + + if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) { + // The received data is a repeat of the last valid data so can be considered complete. + return RX_FRAME_COMPLETE | RX_FRAME_DROPPED; + } + + return RX_FRAME_COMPLETE; +} + uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels) { uint16_t *sbusChannelData = rxRuntimeConfig->channelData; @@ -54,13 +102,13 @@ uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannel sbusChannelData[14] = channels->chan14; sbusChannelData[15] = channels->chan15; - if (channels->flags & SBUS_FLAG_CHANNEL_17) { + if (channels->flags & SBUS_FLAG_CHANNEL_DG1) { sbusChannelData[16] = SBUS_DIGITAL_CHANNEL_MAX; } else { sbusChannelData[16] = SBUS_DIGITAL_CHANNEL_MIN; } - if (channels->flags & SBUS_FLAG_CHANNEL_18) { + if (channels->flags & SBUS_FLAG_CHANNEL_DG2) { sbusChannelData[17] = SBUS_DIGITAL_CHANNEL_MAX; } else { sbusChannelData[17] = SBUS_DIGITAL_CHANNEL_MIN; diff --git a/src/main/rx/sbus_channels.h b/src/main/rx/sbus_channels.h index 467fdda5afc..d8070704052 100644 --- a/src/main/rx/sbus_channels.h +++ b/src/main/rx/sbus_channels.h @@ -20,17 +20,19 @@ #include #include "rx/rx.h" -#define SBUS_MAX_CHANNEL 18 +#define SBUS_MAX_CHANNEL 36 -#define SBUS_FLAG_CHANNEL_17 (1 << 0) -#define SBUS_FLAG_CHANNEL_18 (1 << 1) +#define SBUS_FLAG_CHANNEL_DG1 (1 << 0) +#define SBUS_FLAG_CHANNEL_DG2 (1 << 1) #define SBUS_FLAG_SIGNAL_LOSS (1 << 2) #define SBUS_FLAG_FAILSAFE_ACTIVE (1 << 3) #define SBUS_CHANNEL_DATA_LENGTH sizeof(sbusChannels_t) #define SBUS_FRAME_SIZE (SBUS_CHANNEL_DATA_LENGTH + 2) -#define SBUS_FRAME_BEGIN_BYTE 0x0F +#define SBUS_FRAME_BEGIN_BYTE 0x0F +#define SBUS26_FRAME0_BEGIN_BYTE 0xF4 +#define SBUS26_FRAME1_BEGIN_BYTE 0xF0 #define SBUS_BAUDRATE 100000 #define SBUS_BAUDRATE_FAST 200000 @@ -78,5 +80,6 @@ uint16_t sbusDecodeChannelValue(uint16_t sbusValue, bool safeValuesOnly); uint16_t sbusEncodeChannelValue(uint16_t rcValue); uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels); +uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels, bool highChannels); void sbusChannelsInit(rxRuntimeConfig_t *rxRuntimeConfig); From 73f8b03940192a76bf50bb55b84e7878fad46679 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:30:26 +0200 Subject: [PATCH 398/429] Adding missing commits --- src/main/rx/sbus.c | 2 +- src/main/rx/sbus_channels.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index df22dab3e6b..9b24361a091 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -64,7 +64,7 @@ typedef struct sbusFrameData_s { volatile sbusFrame_t frame; volatile bool frameDone; volatile bool is26channels; - uint8_t buffer[SBUS26_FRAME_SIZE]; + uint8_t buffer[SBUS_FRAME_SIZE]; uint8_t position; timeUs_t lastActivityTimeUs; } sbusFrameData_t; diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 8697544a08f..01c9aab5baa 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -36,7 +36,7 @@ STATIC_ASSERT(SBUS_FRAME_SIZE == sizeof(sbusFrame_t), SBUS_FRAME_SIZE_doesnt_mat uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels, bool highChannels) { - uint8_t offset = highChannels ? 16 : 0 + uint8_t offset = highChannels ? 16 : 0; uint16_t *sbusChannelData = rxRuntimeConfig->channelData; sbusChannelData[0 + offset] = channels->chan0; sbusChannelData[1 + offset] = channels->chan1; From 63c090e7ed246a8b3437100114f5229edef7134d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:05:43 +0200 Subject: [PATCH 399/429] commence breakage --- src/main/drivers/pwm_mapping.h | 2 +- src/main/flight/servos.h | 14 +++++++++++++- src/main/rx/sbus.c | 8 ++++---- src/main/rx/sbus_channels.c | 8 +++++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 08123130f2c..161735a4431 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -28,7 +28,7 @@ #define MAX_MOTORS 12 #endif -#define MAX_SERVOS 18 +#define MAX_SERVOS 36 #define PWM_TIMER_HZ 1000000 diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 4f6e5777967..5a161d6e4aa 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 18 +#define MAX_SUPPORTED_SERVOS 36 // These must be consecutive typedef enum { @@ -75,6 +75,18 @@ typedef enum { INPUT_RC_CH22 = 47, INPUT_RC_CH23 = 48, INPUT_RC_CH24 = 49, + INPUT_RC_CH25 = 50, + INPUT_RC_CH26 = 51, + INPUT_RC_CH27 = 52, + INPUT_RC_CH28 = 53, + INPUT_RC_CH29 = 54, + INPUT_RC_CH30 = 55, + INPUT_RC_CH31 = 56, + INPUT_RC_CH32 = 57, + INPUT_RC_CH33 = 58, + INPUT_RC_CH34 = 59, + INPUT_RC_CH35 = 60, + INPUT_RC_CH36 = 61, #endif INPUT_SOURCE_COUNT } inputSource_e; diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 9b24361a091..27fa927b9b9 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -88,11 +88,12 @@ static void sbusDataReceive(uint16_t c, void *data) switch (sbusFrameData->state) { case STATE_SBUS_SYNC: - if (c == SBUS_FRAME_BEGIN_BYTE) { + // Ignore non 26 channel packets + if (c == SBUS_FRAME_BEGIN_BYTE && !sbusFrameData->is26channels) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if (c == SBUS26_FRAME0_BEGIN_BYTE) { + } else if (c == SBUS26_FRAME0_BEGIN_BYTE && false) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD_LOW; @@ -141,7 +142,6 @@ static void sbusDataReceive(uint16_t c, void *data) memcpy((void *)&sbusFrameData->frame, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); sbusFrameData->frameDone = true; - sbusFrameData->is26channels = false; } } break; @@ -221,7 +221,7 @@ static uint8_t sbusFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig) static bool sbusInitEx(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, uint32_t sbusBaudRate) { static uint16_t sbusChannelData[SBUS_MAX_CHANNEL]; - static sbusFrameData_t sbusFrameData; + static sbusFrameData_t sbusFrameData = { .is26channels = false}; rxRuntimeConfig->channelData = sbusChannelData; rxRuntimeConfig->frameData = &sbusFrameData; diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 01c9aab5baa..60f10737996 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -68,18 +68,20 @@ uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChann sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MIN; } + uint8_t ret = 0; + if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) { // internal failsafe enabled and rx failsafe flag set // RX *should* still be sending valid channel data, so use it. - return RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE; + ret = RX_FRAME_FAILSAFE; } if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) { // The received data is a repeat of the last valid data so can be considered complete. - return RX_FRAME_COMPLETE | RX_FRAME_DROPPED; + ret = RX_FRAME_DROPPED; } - return RX_FRAME_COMPLETE; + return ret | (highChannels ? RX_FRAME_COMPLETE : RX_FRAME_PENDING); } uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels) From bab0c9c5296943f63fb168779088523a02fc7d14 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:10:10 +0200 Subject: [PATCH 400/429] remove test code --- src/main/rx/sbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 27fa927b9b9..70427932493 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -93,7 +93,7 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if (c == SBUS26_FRAME0_BEGIN_BYTE && false) { + } else if (c == SBUS26_FRAME0_BEGIN_BYTE) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD_LOW; From 81bed958d4f3e80e2bcf17365cccb2021febceb6 Mon Sep 17 00:00:00 2001 From: MUSTARDTIGERFPV Date: Thu, 1 Aug 2024 02:35:42 +0000 Subject: [PATCH 401/429] Allow serialpassthrough to set parity & stop bits --- docs/Cli.md | 2 +- src/main/drivers/serial.c | 5 +++ src/main/drivers/serial.h | 3 ++ src/main/drivers/serial_softserial.c | 6 +++ src/main/drivers/serial_tcp.c | 7 +++ src/main/drivers/serial_uart.c | 8 ++++ src/main/drivers/serial_uart_hal.c | 8 ++++ src/main/drivers/serial_uart_hal_at32f43x.c | 8 ++++ src/main/drivers/serial_usb_vcp.c | 9 ++++ src/main/drivers/serial_usb_vcp_at32f43x.c | 7 +++ src/main/fc/cli.c | 49 ++++++++++++++++++++- 11 files changed, 109 insertions(+), 3 deletions(-) diff --git a/docs/Cli.md b/docs/Cli.md index 6a48244a13a..2e45ae138f7 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -107,7 +107,7 @@ While connected to the CLI, all Logical Switches are temporarily disabled (5.1.0 | `save` | Save and reboot | | `sd_info` | Sdcard info | | `serial` | Configure serial ports. [Usage](Serial.md) | -| `serialpassthrough` | Passthrough serial data to port, with ` `, where `id` is the zero based port index, `baud` is a standard baud rate, and mode is `rx`, `tx`, or both (`rxtx`) | +| `serialpassthrough` | Passthrough serial data to port, with ` `, where `id` is the zero based port index, `baud` is a standard baud rate, mode is `rx`, `tx`, or both (`rxtx`), and options is a short string like `8N1` or `8E2` | | `servo` | Configure servos | | `set` | Change setting with name=value or blank or * for list | | `smix` | Custom servo mixer | diff --git a/src/main/drivers/serial.c b/src/main/drivers/serial.c index 165f9c31698..dc625aaa354 100644 --- a/src/main/drivers/serial.c +++ b/src/main/drivers/serial.c @@ -86,6 +86,11 @@ void serialSetMode(serialPort_t *instance, portMode_t mode) instance->vTable->setMode(instance, mode); } +void serialSetOptions(serialPort_t *instance, portOptions_t options) +{ + instance->vTable->setOptions(instance, options); +} + void serialWriteBufShim(void *instance, const uint8_t *data, int count) { serialWriteBuf((serialPort_t *)instance, data, count); diff --git a/src/main/drivers/serial.h b/src/main/drivers/serial.h index fcb787ded99..8e66b5f8445 100644 --- a/src/main/drivers/serial.h +++ b/src/main/drivers/serial.h @@ -95,6 +95,8 @@ struct serialPortVTable { void (*setMode)(serialPort_t *instance, portMode_t mode); + void (*setOptions)(serialPort_t *instance, portOptions_t options); + void (*writeBuf)(serialPort_t *instance, const void *data, int count); bool (*isConnected)(const serialPort_t *instance); @@ -113,6 +115,7 @@ void serialWriteBuf(serialPort_t *instance, const uint8_t *data, int count); uint8_t serialRead(serialPort_t *instance); void serialSetBaudRate(serialPort_t *instance, uint32_t baudRate); void serialSetMode(serialPort_t *instance, portMode_t mode); +void serialSetOptions(serialPort_t *instance, portOptions_t options); bool isSerialTransmitBufferEmpty(const serialPort_t *instance); void serialPrint(serialPort_t *instance, const char *str); uint32_t serialGetBaudRate(serialPort_t *instance); diff --git a/src/main/drivers/serial_softserial.c b/src/main/drivers/serial_softserial.c index 7ce128516f0..09352f4d61b 100644 --- a/src/main/drivers/serial_softserial.c +++ b/src/main/drivers/serial_softserial.c @@ -623,6 +623,11 @@ void softSerialSetMode(serialPort_t *instance, portMode_t mode) instance->mode = mode; } +void softSerialSetOptions(serialPort_t *instance, portOptions_t options) +{ + instance->options = options; +} + bool isSoftSerialTransmitBufferEmpty(const serialPort_t *instance) { return instance->txBufferHead == instance->txBufferTail; @@ -636,6 +641,7 @@ static const struct serialPortVTable softSerialVTable = { .serialSetBaudRate = softSerialSetBaudRate, .isSerialTransmitBufferEmpty = isSoftSerialTransmitBufferEmpty, .setMode = softSerialSetMode, + .setOptions = softSerialSetOptions, .isConnected = NULL, .writeBuf = NULL, .beginWrite = NULL, diff --git a/src/main/drivers/serial_tcp.c b/src/main/drivers/serial_tcp.c index 765f8308cd3..915f2a53605 100644 --- a/src/main/drivers/serial_tcp.c +++ b/src/main/drivers/serial_tcp.c @@ -317,6 +317,12 @@ void tcpSetMode(serialPort_t *instance, portMode_t mode) UNUSED(mode); } +void tcpSetOptions(serialPort_t *instance, portOptions_t options) +{ + UNUSED(instance); + UNUSED(options); +} + static const struct serialPortVTable tcpVTable[] = { { .serialWrite = tcpWrite, @@ -326,6 +332,7 @@ static const struct serialPortVTable tcpVTable[] = { .serialSetBaudRate = tcpSetBaudRate, .isSerialTransmitBufferEmpty = isTcpTransmitBufferEmpty, .setMode = tcpSetMode, + .setOptions = tcpSetOptions, .isConnected = tcpIsConnected, .writeBuf = tcpWritBuf, .beginWrite = NULL, diff --git a/src/main/drivers/serial_uart.c b/src/main/drivers/serial_uart.c index 7b9bbd7128e..9307b0cab8b 100644 --- a/src/main/drivers/serial_uart.c +++ b/src/main/drivers/serial_uart.c @@ -175,6 +175,13 @@ void uartSetMode(serialPort_t *instance, portMode_t mode) uartReconfigure(uartPort); } +void uartSetOptions(serialPort_t *instance, portOptions_t options) +{ + uartPort_t *uartPort = (uartPort_t *)instance; + uartPort->port.options = options; + uartReconfigure(uartPort); +} + uint32_t uartTotalRxBytesWaiting(const serialPort_t *instance) { const uartPort_t *s = (const uartPort_t*)instance; @@ -255,6 +262,7 @@ const struct serialPortVTable uartVTable[] = { .serialSetBaudRate = uartSetBaudRate, .isSerialTransmitBufferEmpty = isUartTransmitBufferEmpty, .setMode = uartSetMode, + .setOptions = uartSetOptions, .isConnected = NULL, .writeBuf = NULL, .beginWrite = NULL, diff --git a/src/main/drivers/serial_uart_hal.c b/src/main/drivers/serial_uart_hal.c index b1df6ed7541..cce38422848 100644 --- a/src/main/drivers/serial_uart_hal.c +++ b/src/main/drivers/serial_uart_hal.c @@ -185,6 +185,13 @@ void uartSetMode(serialPort_t *instance, portMode_t mode) uartReconfigure(uartPort); } +void uartSetOptions(serialPort_t *instance, portOptions_t options) +{ + uartPort_t *uartPort = (uartPort_t *)instance; + uartPort->port.options = options; + uartReconfigure(uartPort); +} + uint32_t uartTotalRxBytesWaiting(const serialPort_t *instance) { uartPort_t *s = (uartPort_t*)instance; @@ -266,6 +273,7 @@ const struct serialPortVTable uartVTable[] = { .serialSetBaudRate = uartSetBaudRate, .isSerialTransmitBufferEmpty = isUartTransmitBufferEmpty, .setMode = uartSetMode, + .setOptions = uartSetOptions, .isConnected = NULL, .writeBuf = NULL, .beginWrite = NULL, diff --git a/src/main/drivers/serial_uart_hal_at32f43x.c b/src/main/drivers/serial_uart_hal_at32f43x.c index 0e0f11b1c13..a06869ba10c 100644 --- a/src/main/drivers/serial_uart_hal_at32f43x.c +++ b/src/main/drivers/serial_uart_hal_at32f43x.c @@ -178,6 +178,13 @@ void uartSetMode(serialPort_t *instance, portMode_t mode) uartReconfigure(uartPort); } +void uartSetOptions(serialPort_t *instance, portOptions_t options) +{ + uartPort_t *uartPort = (uartPort_t *)instance; + uartPort->port.options = options; + uartReconfigure(uartPort); +} + uint32_t uartTotalRxBytesWaiting(const serialPort_t *instance) { const uartPort_t *s = (const uartPort_t*)instance; @@ -260,6 +267,7 @@ const struct serialPortVTable uartVTable[] = { .serialSetBaudRate = uartSetBaudRate, .isSerialTransmitBufferEmpty = isUartTransmitBufferEmpty, .setMode = uartSetMode, + .setOptions = uartSetOptions, .isConnected = NULL, .writeBuf = NULL, .beginWrite = NULL, diff --git a/src/main/drivers/serial_usb_vcp.c b/src/main/drivers/serial_usb_vcp.c index a90633d6cfd..7fdbad2a114 100644 --- a/src/main/drivers/serial_usb_vcp.c +++ b/src/main/drivers/serial_usb_vcp.c @@ -67,6 +67,14 @@ static void usbVcpSetMode(serialPort_t *instance, portMode_t mode) // TODO implement } +static void usbVcpSetOptions(serialPort_t *instance, portOptions_t options) +{ + UNUSED(instance); + UNUSED(options); + + // TODO implement +} + static bool isUsbVcpTransmitBufferEmpty(const serialPort_t *instance) { UNUSED(instance); @@ -184,6 +192,7 @@ static const struct serialPortVTable usbVTable[] = { .serialSetBaudRate = usbVcpSetBaudRate, .isSerialTransmitBufferEmpty = isUsbVcpTransmitBufferEmpty, .setMode = usbVcpSetMode, + .setOptions = usbVcpSetOptions, .isConnected = usbVcpIsConnected, .writeBuf = usbVcpWriteBuf, .beginWrite = usbVcpBeginWrite, diff --git a/src/main/drivers/serial_usb_vcp_at32f43x.c b/src/main/drivers/serial_usb_vcp_at32f43x.c index 29b96d1a2b6..96b283ec363 100644 --- a/src/main/drivers/serial_usb_vcp_at32f43x.c +++ b/src/main/drivers/serial_usb_vcp_at32f43x.c @@ -308,6 +308,12 @@ static void usbVcpSetMode(serialPort_t *instance, portMode_t mode) UNUSED(mode); } +static void usbVcpSetOptions(serialPort_t *instance, portOptions_t options) +{ + UNUSED(instance); + UNUSED(options); +} + static bool isUsbVcpTransmitBufferEmpty(const serialPort_t *instance) { UNUSED(instance); @@ -434,6 +440,7 @@ static const struct serialPortVTable usbVTable[] = { .serialSetBaudRate = usbVcpSetBaudRate, .isSerialTransmitBufferEmpty = isUsbVcpTransmitBufferEmpty, .setMode = usbVcpSetMode, + .setOptions = usbVcpSetOptions, .isConnected = usbVcpIsConnected, .writeBuf = usbVcpWriteBuf, .beginWrite = usbVcpBeginWrite, diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 0ea43fd0ce7..b9cc2a993b9 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -913,6 +913,42 @@ static void cliSerial(char *cmdline) } #ifdef USE_SERIAL_PASSTHROUGH + +portOptions_t constructPortOptions(char *options) { + if (strlen(options) != 3 || options[0] != '8') { + // Invalid format + return -1; + } + + portOptions_t result = 0; + + switch (options[1]) { + case 'N': + result |= SERIAL_PARITY_NO; + break; + case 'E': + result |= SERIAL_PARITY_EVEN; + break; + default: + // Invalid format + return -1; + } + + switch (options[2]) { + case '1': + result |= SERIAL_STOPBITS_1; + break; + case '2': + result |= SERIAL_STOPBITS_2; + break; + default: + // Invalid format + return -1; + } + + return result; +} + static void cliSerialPassthrough(char *cmdline) { char * saveptr; @@ -925,6 +961,7 @@ static void cliSerialPassthrough(char *cmdline) int id = -1; uint32_t baud = 0; unsigned mode = 0; + portOptions_t options = SERIAL_NOT_INVERTED; char* tok = strtok_r(cmdline, " ", &saveptr); int index = 0; @@ -942,6 +979,9 @@ static void cliSerialPassthrough(char *cmdline) if (strstr(tok, "tx") || strstr(tok, "TX")) mode |= MODE_TX; break; + case 3: + options |= constructPortOptions(tok); + break; } index++; tok = strtok_r(NULL, " ", &saveptr); @@ -959,7 +999,7 @@ static void cliSerialPassthrough(char *cmdline) passThroughPort = openSerialPort(id, FUNCTION_NONE, NULL, NULL, baud, mode, - SERIAL_NOT_INVERTED); + options); if (!passThroughPort) { tfp_printf("Port %d could not be opened.\r\n", id); return; @@ -975,6 +1015,11 @@ static void cliSerialPassthrough(char *cmdline) passThroughPort->mode, mode); serialSetMode(passThroughPort, mode); } + if (options && passThroughPort->options != options) { + tfp_printf("Adjusting options from %d to %d.\r\n", + passThroughPort->options, options); + serialSetOptions(passThroughPort, options); + } // If this port has a rx callback associated we need to remove it now. // Otherwise no data will be pushed in the serial port buffer! if (passThroughPort->rxCallback) { @@ -4514,7 +4559,7 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("save", "save and reboot", NULL, cliSave), CLI_COMMAND_DEF("serial", "configure serial ports", NULL, cliSerial), #ifdef USE_SERIAL_PASSTHROUGH - CLI_COMMAND_DEF("serialpassthrough", "passthrough serial data to port", " [baud] [mode] : passthrough to serial", cliSerialPassthrough), + CLI_COMMAND_DEF("serialpassthrough", "passthrough serial data to port", " [baud] [mode] [options]: passthrough to serial", cliSerialPassthrough), #endif CLI_COMMAND_DEF("servo", "configure servos", NULL, cliServo), #ifdef USE_PROGRAMMING_FRAMEWORK From 957f23d5ddf300de7f587b8f4e20d604aa1c0f0a Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Thu, 1 Aug 2024 11:45:42 +0100 Subject: [PATCH 402/429] only BBL log servos defined in the mixer (#10267) * only BBL log servos defined in the mixer * address gcc13/gcc14/arm/intel GCC type mismatch --- src/main/blackbox/blackbox.c | 64 +++++++++++++++++--------- src/main/blackbox/blackbox_fielddefs.h | 19 ++++++++ 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 5a72d323b09..8c37ee3cb29 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -334,24 +334,24 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"motor", 7, UNSIGNED, .Ipredict = PREDICT(MOTOR_0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_MOTORS_8)}, /* servos */ - {"servo", 0, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 1, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 2, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 3, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 4, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 5, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 6, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 7, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 8, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 9, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 10, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 11, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 12, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 13, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 14, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 15, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 16, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, - {"servo", 17, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 0, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_1)}, + {"servo", 1, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_2)}, + {"servo", 2, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_3)}, + {"servo", 3, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_4)}, + {"servo", 4, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_5)}, + {"servo", 5, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_6)}, + {"servo", 6, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_7)}, + {"servo", 7, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_8)}, + {"servo", 8, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_9)}, + {"servo", 9, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_10)}, + {"servo", 10, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_11)}, + {"servo", 11, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_12)}, + {"servo", 12, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_13)}, + {"servo", 13, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_14)}, + {"servo", 14, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_15)}, + {"servo", 15, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_16)}, + {"servo", 16, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_17)}, + {"servo", 17, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_18)}, {"navState", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, {"navFlags", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, @@ -656,6 +656,26 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) case FLIGHT_LOG_FIELD_CONDITION_SERVOS: return isMixerUsingServos(); + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_2: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_3: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_4: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_5: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_6: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_7: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_8: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_9: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_10: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_11: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_12: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_13: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_14: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_15: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18: + return ((FlightLogFieldCondition)getServoCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); + case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0: case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1: case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_2: @@ -955,7 +975,8 @@ static void writeIntraframe(void) } if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SERVOS)) { - for (int x = 0; x < MAX_SUPPORTED_SERVOS; x++) { + const int servoCount = getServoCount(); + for (int x = 0; x < servoCount; x++) { //Assume that servos spends most of its time around the center blackboxWriteSignedVB(blackboxCurrent->servo[x] - 1500); } @@ -1214,7 +1235,7 @@ static void writeInterframe(void) } if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SERVOS)) { - blackboxWriteArrayUsingAveragePredictor16(offsetof(blackboxMainState_t, servo), MAX_SUPPORTED_SERVOS); + blackboxWriteArrayUsingAveragePredictor16(offsetof(blackboxMainState_t, servo), getServoCount()); } blackboxWriteSignedVB(blackboxCurrent->navState - blackboxLast->navState); @@ -1682,7 +1703,8 @@ static void loadMainState(timeUs_t currentTimeUs) blackboxCurrent->rssi = getRSSI(); - for (int i = 0; i < MAX_SUPPORTED_SERVOS; i++) { + const int servoCount = getServoCount(); + for (int i = 0; i < servoCount; i++) { blackboxCurrent->servo[i] = servo[i]; } diff --git a/src/main/blackbox/blackbox_fielddefs.h b/src/main/blackbox/blackbox_fielddefs.h index 1e5615e3ec4..63a951d407c 100644 --- a/src/main/blackbox/blackbox_fielddefs.h +++ b/src/main/blackbox/blackbox_fielddefs.h @@ -33,7 +33,26 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_6, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_7, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_8, + FLIGHT_LOG_FIELD_CONDITION_SERVOS, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_2, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_3, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_4, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_5, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_6, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_7, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_8, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_9, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_10, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_11, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_12, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_13, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_14, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_15, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18, FLIGHT_LOG_FIELD_CONDITION_MAG, FLIGHT_LOG_FIELD_CONDITION_BARO, From b347a48f7157beda78e2d2dfd198e1e0ef32f1db Mon Sep 17 00:00:00 2001 From: b14ckyy Date: Thu, 1 Aug 2024 17:33:10 +0200 Subject: [PATCH 403/429] Reset Mission start if RESUME is used and shorter mission is uploaded --- src/main/navigation/navigation.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 82452256a51..e43eb9d8534 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -3703,7 +3703,8 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData) setDesiredPosition(&wpPos.pos, DEGREES_TO_CENTIDEGREES(wpData->p1), waypointUpdateFlags); } // WP #1 - #NAV_MAX_WAYPOINTS - common waypoints - pre-programmed mission - else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS)) { // && !ARMING_FLAG(ARMED) + else if ((wpNumber >= 1) && (wpNumber <= NAV_MAX_WAYPOINTS) && !FLIGHT_MODE(NAV_WP_MODE)) { + // WP upload is not allowed why WP mode is active if (wpData->action == NAV_WP_ACTION_WAYPOINT || wpData->action == NAV_WP_ACTION_JUMP || wpData->action == NAV_WP_ACTION_RTH || wpData->action == NAV_WP_ACTION_HOLD_TIME || wpData->action == NAV_WP_ACTION_LAND || wpData->action == NAV_WP_ACTION_SET_POI || wpData->action == NAV_WP_ACTION_SET_HEAD ) { // Only allow upload next waypoint (continue upload mission) or first waypoint (new mission) static int8_t nonGeoWaypointCount = 0; @@ -3725,6 +3726,10 @@ void setWaypoint(uint8_t wpNumber, const navWaypoint_t * wpData) posControl.geoWaypointCount = posControl.waypointCount - nonGeoWaypointCount; if (posControl.waypointListValid) { nonGeoWaypointCount = 0; + // If active WP index is bigger than total mission WP number, reset active WP index (Mission Upload mid flight with interrupted mission) if RESUME is enabled + if (posControl.activeWaypointIndex > posControl.waypointCount) { + posControl.activeWaypointIndex = 0; + } } } } From 592ea06d89afeb653d5f12a14b29f58b822bd4ca Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:33:46 +0200 Subject: [PATCH 404/429] Working support for 26(34) channels sbus2 rc (Futaba FASSTest) --- src/main/rx/rx.h | 6 +--- src/main/rx/sbus.c | 66 +++++++++++++++++++------------------ src/main/rx/sbus.h | 1 + src/main/rx/sbus_channels.c | 25 +++++++------- src/main/rx/sbus_channels.h | 7 ++-- 5 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/main/rx/rx.h b/src/main/rx/rx.h index 9e4816ec64c..c841838a5ea 100644 --- a/src/main/rx/rx.h +++ b/src/main/rx/rx.h @@ -84,11 +84,7 @@ typedef enum { SERIALRX_SBUS2, } rxSerialReceiverType_e; -#ifdef USE_24CHANNELS -#define MAX_SUPPORTED_RC_CHANNEL_COUNT 26 -#else -#define MAX_SUPPORTED_RC_CHANNEL_COUNT 18 -#endif +#define MAX_SUPPORTED_RC_CHANNEL_COUNT 34 #define NON_AUX_CHANNEL_COUNT 4 #define MAX_AUX_CHANNEL_COUNT (MAX_SUPPORTED_RC_CHANNEL_COUNT - NON_AUX_CHANNEL_COUNT) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 70427932493..40de5d3bc2e 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -54,14 +54,14 @@ typedef enum { STATE_SBUS_SYNC = 0, STATE_SBUS_PAYLOAD, - STATE_SBUS26_PAYLOAD_LOW, - STATE_SBUS26_PAYLOAD_HIGH, + STATE_SBUS26_PAYLOAD, STATE_SBUS_WAIT_SYNC } sbusDecoderState_e; typedef struct sbusFrameData_s { sbusDecoderState_e state; volatile sbusFrame_t frame; + volatile sbusFrame_t frameHigh; volatile bool frameDone; volatile bool is26channels; uint8_t buffer[SBUS_FRAME_SIZE]; @@ -82,25 +82,23 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->lastActivityTimeUs = currentTimeUs; // Handle inter-frame gap. We dwell in STATE_SBUS_WAIT_SYNC state ignoring all incoming bytes until we get long enough quite period on the wire - if (sbusFrameData->state == STATE_SBUS_WAIT_SYNC && timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { + if (timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { + sbusFrameData->state = STATE_SBUS_SYNC; + } else if ((sbusFrameData->state == STATE_SBUS_PAYLOAD || sbusFrameData->state == STATE_SBUS26_PAYLOAD) && timeSinceLastByteUs >= 300) { + // payload is pausing too long, possible if some telemetry have been sent between frames sbusFrameData->state = STATE_SBUS_SYNC; } switch (sbusFrameData->state) { case STATE_SBUS_SYNC: - // Ignore non 26 channel packets - if (c == SBUS_FRAME_BEGIN_BYTE && !sbusFrameData->is26channels) { + if (c == SBUS_FRAME_BEGIN_BYTE) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if (c == SBUS26_FRAME0_BEGIN_BYTE) { - sbusFrameData->position = 0; - sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; - sbusFrameData->state = STATE_SBUS26_PAYLOAD_LOW; - } else if (c == SBUS26_FRAME1_BEGIN_BYTE) { + } else if ((uint8_t)c == SBUS26_FRAME_BEGIN_BYTE || c == 0xF2 || c == 0x2c) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; - sbusFrameData->state = STATE_SBUS26_PAYLOAD_HIGH; + sbusFrameData->state = STATE_SBUS26_PAYLOAD; } break; @@ -127,7 +125,6 @@ static void sbusDataReceive(uint16_t c, void *data) frameTime = -1; } - frameValid = true; sbusFrameData->state = STATE_SBUS_WAIT_SYNC; break; @@ -146,8 +143,7 @@ static void sbusDataReceive(uint16_t c, void *data) } break; - case STATE_SBUS26_PAYLOAD_LOW: - case STATE_SBUS26_PAYLOAD_HIGH: + case STATE_SBUS26_PAYLOAD: sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; if (sbusFrameData->position == SBUS_FRAME_SIZE) { @@ -156,38 +152,40 @@ static void sbusDataReceive(uint16_t c, void *data) // Do some sanity check switch (frame->endByte) { - case 0x20: // S.BUS 2 telemetry page 1 - case 0x24: // S.BUS 2 telemetry page 2 - case 0x28: // S.BUS 2 telemetry page 3 - case 0x2C: // S.BUS 2 telemetry page 4 - if (frame->syncByte == SBUS26_FRAME1_BEGIN_BYTE) { - sbus2ActiveTelemetryPage = (frame->endByte >> 2) & 0x3; - frameTime = currentTimeUs; - } - + case 0x00: + case 0x04: // S.BUS 2 telemetry page 1 + case 0x14: // S.BUS 2 telemetry page 2 + case 0x24: // S.BUS 2 telemetry page 3 + case 0x34: // S.BUS 2 telemetry page 4 + frameTime = -1; // ignore this one, as you can't fit telemetry between this and the next frame. frameValid = true; - sbusFrameData->state = STATE_SBUS_WAIT_SYNC; + sbusFrameData->state = STATE_SBUS_SYNC; // Next piece of data should be a sync byte break; default: // Failed end marker + frameValid = false; sbusFrameData->state = STATE_SBUS_WAIT_SYNC; break; } // Frame seems sane, pass data to decoder if (!sbusFrameData->frameDone && frameValid) { - memcpy((void *)&sbusFrameData->frame, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); + memcpy((void *)&sbusFrameData->frameHigh, (void *)&sbusFrameData->buffer[0], SBUS_FRAME_SIZE); sbusFrameData->frameDone = true; sbusFrameData->is26channels = true; } } break; - - case STATE_SBUS_WAIT_SYNC: // Stay at this state and do nothing. Exit will be handled before byte is processed if the // inter-frame gap is long enough + if (c == SBUS26_FRAME_BEGIN_BYTE || c == 0xF2 || c == 0x2c) { + sbusFrameData->position = 0; + sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; + sbusFrameData->state = STATE_SBUS26_PAYLOAD; + } + break; } } @@ -200,16 +198,20 @@ static uint8_t sbusFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig) return RX_FRAME_PENDING; } + uint8_t retValue = 0; // Decode channel data and store return value - const uint8_t retValue = sbusFrameData->is26channels ? - sbus26ChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels, (sbusFrameData->frame.syncByte == SBUS26_FRAME1_BEGIN_BYTE)) : - sbusChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels); + if (sbusFrameData->is26channels) + { + retValue = sbus26ChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels, false); + retValue |= sbus26ChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frameHigh.channels, true); + + } else { + retValue = sbusChannelsDecode(rxRuntimeConfig, (void *)&sbusFrameData->frame.channels); + } // Reset the frameDone flag - tell ISR that we're ready to receive next frame sbusFrameData->frameDone = false; - //taskSendSbus2Telemetry(micros()); - // Calculate "virtual link quality based on packet loss metric" if (retValue & RX_FRAME_COMPLETE) { lqTrackerAccumulate(rxRuntimeConfig->lqTracker, ((retValue & RX_FRAME_DROPPED) || (retValue & RX_FRAME_FAILSAFE)) ? 0 : RSSI_MAX_VALUE); diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index aa550b618e1..810b577693e 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -18,6 +18,7 @@ #pragma once #define SBUS_DEFAULT_INTERFRAME_DELAY_US 3000 // According to FrSky interframe is 6.67ms, we go smaller just in case +#define SBUS_MIN_SYNC_DELAY_US MS2US(2) // 2ms #include "rx/rx.h" diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index 60f10737996..ebc5035220f 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -26,6 +26,8 @@ #include "common/utils.h" #include "common/maths.h" +#include "build/debug.h" + #include "rx/sbus_channels.h" @@ -55,17 +57,18 @@ uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChann sbusChannelData[14 + offset] = channels->chan14; sbusChannelData[15 + offset] = channels->chan15; - offset = highChannels ? 0 : 2; - if (channels->flags & SBUS_FLAG_CHANNEL_DG1) { - sbusChannelData[32 + offset] = SBUS_DIGITAL_CHANNEL_MAX; - } else { - sbusChannelData[32 + offset] = SBUS_DIGITAL_CHANNEL_MIN; - } - - if (channels->flags & SBUS_FLAG_CHANNEL_DG2) { - sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MAX; - } else { - sbusChannelData[33 + offset] = SBUS_DIGITAL_CHANNEL_MIN; + if (!highChannels) { + if (channels->flags & SBUS_FLAG_CHANNEL_DG1) { + sbusChannelData[32] = SBUS_DIGITAL_CHANNEL_MAX; + } else { + sbusChannelData[32] = SBUS_DIGITAL_CHANNEL_MIN; + } + + if (channels->flags & SBUS_FLAG_CHANNEL_DG2) { + sbusChannelData[33] = SBUS_DIGITAL_CHANNEL_MAX; + } else { + sbusChannelData[33] = SBUS_DIGITAL_CHANNEL_MIN; + } } uint8_t ret = 0; diff --git a/src/main/rx/sbus_channels.h b/src/main/rx/sbus_channels.h index d8070704052..4ff065f8d25 100644 --- a/src/main/rx/sbus_channels.h +++ b/src/main/rx/sbus_channels.h @@ -20,7 +20,7 @@ #include #include "rx/rx.h" -#define SBUS_MAX_CHANNEL 36 +#define SBUS_MAX_CHANNEL 34 #define SBUS_FLAG_CHANNEL_DG1 (1 << 0) #define SBUS_FLAG_CHANNEL_DG2 (1 << 1) @@ -30,9 +30,8 @@ #define SBUS_CHANNEL_DATA_LENGTH sizeof(sbusChannels_t) #define SBUS_FRAME_SIZE (SBUS_CHANNEL_DATA_LENGTH + 2) -#define SBUS_FRAME_BEGIN_BYTE 0x0F -#define SBUS26_FRAME0_BEGIN_BYTE 0xF4 -#define SBUS26_FRAME1_BEGIN_BYTE 0xF0 +#define SBUS_FRAME_BEGIN_BYTE ((uint8_t)0x0F) +#define SBUS26_FRAME_BEGIN_BYTE ((uint8_t)0x2F) #define SBUS_BAUDRATE 100000 #define SBUS_BAUDRATE_FAST 200000 From e0ea833e2de32baf4be230c3eeee11544db505fe Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:49:28 +0200 Subject: [PATCH 405/429] Adding more servos --- src/main/blackbox/blackbox.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 5a72d323b09..80d0d67a4da 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -352,6 +352,23 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 15, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"servo", 16, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"servo", 17, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 18, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 19, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 20, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 21, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 22, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 23, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 24, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 25, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 26, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 27, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 28, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 29, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 30, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 31, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 32, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 33, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, + {"servo", 34, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(SERVOS)}, {"navState", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, {"navFlags", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, From 2722fb8f9c235f8caedfab9836fe1cf0cccca908 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:53:41 +0200 Subject: [PATCH 406/429] Cleanup and blackbox changes --- src/main/flight/servos.h | 4 +--- src/main/rx/sbus.c | 2 +- src/main/rx/sbus_channels.c | 8 +++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 5a161d6e4aa..79ab18caa36 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 36 +#define MAX_SUPPORTED_SERVOS 34 // These must be consecutive typedef enum { @@ -85,8 +85,6 @@ typedef enum { INPUT_RC_CH32 = 57, INPUT_RC_CH33 = 58, INPUT_RC_CH34 = 59, - INPUT_RC_CH35 = 60, - INPUT_RC_CH36 = 61, #endif INPUT_SOURCE_COUNT } inputSource_e; diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 40de5d3bc2e..1549ba74a8b 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -95,7 +95,7 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if ((uint8_t)c == SBUS26_FRAME_BEGIN_BYTE || c == 0xF2 || c == 0x2c) { + } else if ((uint8_t)c == SBUS26_FRAME_BEGIN_BYTE) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD; diff --git a/src/main/rx/sbus_channels.c b/src/main/rx/sbus_channels.c index ebc5035220f..4794df2f7db 100644 --- a/src/main/rx/sbus_channels.c +++ b/src/main/rx/sbus_channels.c @@ -71,20 +71,18 @@ uint8_t sbus26ChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChann } } - uint8_t ret = 0; - if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) { // internal failsafe enabled and rx failsafe flag set // RX *should* still be sending valid channel data, so use it. - ret = RX_FRAME_FAILSAFE; + return RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE; } if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) { // The received data is a repeat of the last valid data so can be considered complete. - ret = RX_FRAME_DROPPED; + return RX_FRAME_COMPLETE | RX_FRAME_DROPPED; } - return ret | (highChannels ? RX_FRAME_COMPLETE : RX_FRAME_PENDING); + return RX_FRAME_COMPLETE; } uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels) From fc8e4c1247b790eb854cdc33f3ef5b0c3aff9562 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:59:02 +0200 Subject: [PATCH 407/429] More blackbox changes that were missed --- src/main/blackbox/blackbox_fielddefs.h | 16 ++++++++++++++++ src/main/drivers/pwm_mapping.h | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/blackbox/blackbox_fielddefs.h b/src/main/blackbox/blackbox_fielddefs.h index 63a951d407c..43d9542dad5 100644 --- a/src/main/blackbox/blackbox_fielddefs.h +++ b/src/main/blackbox/blackbox_fielddefs.h @@ -53,6 +53,22 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_19, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_20, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_21, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_22, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_23, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_24, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_25, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_26, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_27, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_28, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_29, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_30, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_31, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33, + FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34, FLIGHT_LOG_FIELD_CONDITION_MAG, FLIGHT_LOG_FIELD_CONDITION_BARO, diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 161735a4431..9b774bfac9d 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -28,7 +28,7 @@ #define MAX_MOTORS 12 #endif -#define MAX_SERVOS 36 +#define MAX_SERVOS 34 #define PWM_TIMER_HZ 1000000 From 4b140e476d17fa07c02341e3f50abc2a404ffd3c Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:05:28 +0200 Subject: [PATCH 408/429] Limit servo count in blackbox to 26. I will deal with size 64bit limit on conditions later. --- src/main/blackbox/blackbox.c | 24 +++++++++++++++++++++++- src/main/blackbox/blackbox_fielddefs.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index fc88ac12bd2..ebb4f72a497 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -360,6 +360,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 23, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_23)}, {"servo", 24, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_24)}, {"servo", 25, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_25)}, + /* {"servo", 26, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_26)}, {"servo", 27, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_27)}, {"servo", 27, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_28)}, @@ -369,6 +370,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = { {"servo", 31, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_32)}, {"servo", 32, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_33)}, {"servo", 33, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(AVERAGE_2), .Pencode = ENCODING(SIGNED_VB), CONDITION(AT_LEAST_SERVOS_34)}, + */ {"navState", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, {"navFlags", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(ALWAYS)}, @@ -691,7 +693,27 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18: - return ((FlightLogFieldCondition)getServoCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_19: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_20: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_21: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_22: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_23: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_24: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_25: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_26: + /* + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_27: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_28: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_29: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_30: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_31: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_35: + case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_36: + */ + return ((FlightLogFieldCondition)MIN(getServoCount(), 26) >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0: case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1: diff --git a/src/main/blackbox/blackbox_fielddefs.h b/src/main/blackbox/blackbox_fielddefs.h index 43d9542dad5..17595157dd2 100644 --- a/src/main/blackbox/blackbox_fielddefs.h +++ b/src/main/blackbox/blackbox_fielddefs.h @@ -61,6 +61,7 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_24, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_25, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_26, + /* FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_27, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_28, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_29, @@ -69,6 +70,7 @@ typedef enum FlightLogFieldCondition { FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33, FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34, + */ FLIGHT_LOG_FIELD_CONDITION_MAG, FLIGHT_LOG_FIELD_CONDITION_BARO, From 265cd57c20dc68ed50e9c7fb8e312cdfbf48112b Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Thu, 1 Aug 2024 18:10:50 +0100 Subject: [PATCH 409/429] add SERVOS to blackbox optional fields list (#10272) --- src/main/blackbox/blackbox.c | 9 +++++---- src/main/blackbox/blackbox.h | 3 ++- src/main/fc/cli.c | 17 +++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 8c37ee3cb29..11a23748c4f 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -99,7 +99,7 @@ #define BLACKBOX_INVERTED_CARD_DETECTION 0 #endif -PG_REGISTER_WITH_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 2); +PG_REGISTER_WITH_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 3); PG_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, .device = DEFAULT_BLACKBOX_DEVICE, @@ -108,7 +108,8 @@ PG_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, .invertedCardDetection = BLACKBOX_INVERTED_CARD_DETECTION, .includeFlags = BLACKBOX_FEATURE_NAV_PID | BLACKBOX_FEATURE_NAV_POS | BLACKBOX_FEATURE_MAG | BLACKBOX_FEATURE_ACC | BLACKBOX_FEATURE_ATTITUDE | - BLACKBOX_FEATURE_RC_DATA | BLACKBOX_FEATURE_RC_COMMAND | BLACKBOX_FEATURE_MOTORS, + BLACKBOX_FEATURE_RC_DATA | BLACKBOX_FEATURE_RC_COMMAND | + BLACKBOX_FEATURE_MOTORS | BLACKBOX_FEATURE_SERVOS, ); void blackboxIncludeFlagSet(uint32_t mask) @@ -654,7 +655,7 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) return (getMotorCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_MOTORS_1 + 1) && blackboxIncludeFlag(BLACKBOX_FEATURE_MOTORS); case FLIGHT_LOG_FIELD_CONDITION_SERVOS: - return isMixerUsingServos(); + return blackboxIncludeFlag(BLACKBOX_FEATURE_SERVOS) && isMixerUsingServos(); case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_2: @@ -674,7 +675,7 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_16: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_17: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_18: - return ((FlightLogFieldCondition)getServoCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1); + return ((FlightLogFieldCondition)getServoCount() >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1) && blackboxIncludeFlag(BLACKBOX_FEATURE_SERVOS); case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0: case FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_1: diff --git a/src/main/blackbox/blackbox.h b/src/main/blackbox/blackbox.h index ea7482cbcd5..a329c11df12 100644 --- a/src/main/blackbox/blackbox.h +++ b/src/main/blackbox/blackbox.h @@ -35,6 +35,7 @@ typedef enum { BLACKBOX_FEATURE_GYRO_PEAKS_ROLL = 1 << 10, BLACKBOX_FEATURE_GYRO_PEAKS_PITCH = 1 << 11, BLACKBOX_FEATURE_GYRO_PEAKS_YAW = 1 << 12, + BLACKBOX_FEATURE_SERVOS = 1 << 13, } blackboxFeatureMask_e; typedef struct blackboxConfig_s { uint16_t rate_num; @@ -55,4 +56,4 @@ void blackboxFinish(void); bool blackboxMayEditConfig(void); void blackboxIncludeFlagSet(uint32_t mask); void blackboxIncludeFlagClear(uint32_t mask); -bool blackboxIncludeFlag(uint32_t mask); \ No newline at end of file +bool blackboxIncludeFlag(uint32_t mask); diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 0ea43fd0ce7..32210d6ceee 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -183,6 +183,7 @@ static const char * const blackboxIncludeFlagNames[] = { "PEAKS_R", "PEAKS_P", "PEAKS_Y", + "SERVOS", NULL }; #endif @@ -1087,7 +1088,7 @@ static void cliAdjustmentRange(char *cmdline) } static void printMotorMix(uint8_t dumpMask, const motorMixer_t *primaryMotorMixer, const motorMixer_t *defaultprimaryMotorMixer) -{ +{ const char *format = "mmix %d %s %s %s %s"; char buf0[FTOA_BUFFER_SIZE]; char buf1[FTOA_BUFFER_SIZE]; @@ -1351,7 +1352,7 @@ static void cliTempSensor(char *cmdline) #endif #ifdef USE_FW_AUTOLAND -static void printFwAutolandApproach(uint8_t dumpMask, const navFwAutolandApproach_t *navFwAutolandApproach, const navFwAutolandApproach_t *defaultFwAutolandApproach) +static void printFwAutolandApproach(uint8_t dumpMask, const navFwAutolandApproach_t *navFwAutolandApproach, const navFwAutolandApproach_t *defaultFwAutolandApproach) { const char *format = "fwapproach %u %d %d %u %d %d %u"; for (uint8_t i = 0; i < MAX_FW_LAND_APPOACH_SETTINGS; i++) { @@ -1398,7 +1399,7 @@ static void cliFwAutolandApproach(char * cmdline) if ((ptr = nextArg(ptr))) { landDirection = fastA2I(ptr); - + if (landDirection != 0 && landDirection != 1) { cliShowParseError(); return; @@ -1428,7 +1429,7 @@ static void cliFwAutolandApproach(char * cmdline) validArgumentCount++; } - + if ((ptr = nextArg(ptr))) { isSeaLevelRef = fastA2I(ptr); validArgumentCount++; @@ -1842,7 +1843,7 @@ static void cliLedPinPWM(char *cmdline) if (isEmpty(cmdline)) { ledPinStopPWM(); cliPrintLine("PWM stopped"); - } else { + } else { i = fastA2I(cmdline); ledPinStartPWM(i); cliPrintLinef("PWM started: %d%%",i); @@ -3739,8 +3740,8 @@ static void cliStatus(char *cmdline) #if defined(AT32F43x) cliPrintLine("AT32 system clocks:"); crm_clocks_freq_type clocks; - crm_clocks_freq_get(&clocks); - + crm_clocks_freq_get(&clocks); + cliPrintLinef(" SYSCLK = %d MHz", clocks.sclk_freq / 1000000); cliPrintLinef(" ABH = %d MHz", clocks.ahb_freq / 1000000); cliPrintLinef(" ABP1 = %d MHz", clocks.apb1_freq / 1000000); @@ -4382,7 +4383,7 @@ static const char *_ubloxGetQuality(uint8_t quality) case UBLOX_SIG_QUALITY_CODE_LOCK_TIME_SYNC: return "Code locked and time sync"; case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC: case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC2: - case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC3: + case UBLOX_SIG_QUALITY_CODE_CARRIER_LOCK_TIME_SYNC3: return "Code and carrier locked and time sync"; default: return "Unknown"; } From ed4be684a2ab44acc2e1dcf0d7c22d99fcf8756d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:37:40 +0200 Subject: [PATCH 410/429] Better comments --- src/main/rx/sbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 1549ba74a8b..21aef81e4b2 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -85,7 +85,7 @@ static void sbusDataReceive(uint16_t c, void *data) if (timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { sbusFrameData->state = STATE_SBUS_SYNC; } else if ((sbusFrameData->state == STATE_SBUS_PAYLOAD || sbusFrameData->state == STATE_SBUS26_PAYLOAD) && timeSinceLastByteUs >= 300) { - // payload is pausing too long, possible if some telemetry have been sent between frames + // payload is pausing too long, possible if some telemetry have been sent between frames, or false positves mid frame sbusFrameData->state = STATE_SBUS_SYNC; } From ad9e074f1ee454a915b0dd752396800f1769e9d6 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 21:32:42 +0200 Subject: [PATCH 411/429] Update blackbox.c --- src/main/blackbox/blackbox.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 400ad17762a..1222af19cd8 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -711,8 +711,6 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition) case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_32: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_33: case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_34: - case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_35: - case FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_36: */ return ((FlightLogFieldCondition)MIN(getServoCount(), 26) >= condition - FLIGHT_LOG_FIELD_CONDITION_AT_LEAST_SERVOS_1 + 1) && blackboxIncludeFlag(BLACKBOX_FEATURE_SERVOS); From ac03ee3c162115db018f76dba876033728aa29ae Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 22:05:13 +0200 Subject: [PATCH 412/429] Allow number of servos exceed pwm outputs, if servo protocol is sbus_pwm --- src/main/drivers/pwm_mapping.c | 11 +++++++++-- src/main/drivers/pwm_output.c | 2 +- src/main/io/servo_sbus.h | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index 5ed17d7bb9a..d631243790a 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -42,6 +42,7 @@ #include "sensors/rangefinder.h" #include "io/serial.h" +#include "io/servo_sbus.h" enum { MAP_TO_NONE, @@ -442,15 +443,21 @@ static void pwmInitServos(timMotorServoHardware_t * timOutputs) return; } + // If mixer requests more servos than we have timer outputs - throw an error - if (servoCount > timOutputs->maxTimServoCount) { + uint16_t maxServos = timOutputs->maxTimServoCount; + if(servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM) { + maxServos = MAX(SERVO_SBUS_MAX_SERVOS, timOutputs->maxTimServoCount); + } + + if (servoCount > maxServos) { pwmInitError = PWM_INIT_ERROR_NOT_ENOUGH_SERVO_OUTPUTS; LOG_ERROR(PWM, "Too many servos. Mixer requested %d, timer outputs %d", servoCount, timOutputs->maxTimServoCount); return; } // Configure individual servo outputs - for (int idx = 0; idx < servoCount; idx++) { + for (int idx = 0; idx < MIN(servoCount, timOutputs->maxTimServoCount); idx++) { const timerHardware_t *timHw = timOutputs->timServos[idx]; if (!pwmServoConfig(timHw, idx, servoConfig()->servoPwmRate, servoConfig()->servoCenterPulse, feature(FEATURE_PWM_OUTPUT_ENABLE))) { diff --git a/src/main/drivers/pwm_output.c b/src/main/drivers/pwm_output.c index faa9cd373d9..619f4b95db5 100644 --- a/src/main/drivers/pwm_output.c +++ b/src/main/drivers/pwm_output.c @@ -638,7 +638,7 @@ ioTag_t pwmGetMotorPinTag(int motorIndex) static void pwmServoWriteStandard(uint8_t index, uint16_t value) { - if (servos[index]) { + if (index < MAX_SERVOS && servos[index]) { *servos[index]->ccr = value; } } diff --git a/src/main/io/servo_sbus.h b/src/main/io/servo_sbus.h index 0dcc14ac8de..2def87b7bb7 100644 --- a/src/main/io/servo_sbus.h +++ b/src/main/io/servo_sbus.h @@ -24,6 +24,8 @@ #pragma once +#define SERVO_SBUS_MAX_SERVOS 18 + bool sbusServoInitialize(void); void sbusServoUpdate(uint8_t index, uint16_t value); void sbusServoSendUpdate(void); From 8f55d6595dcb37a2f1e6868305af8aba5998486e Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Thu, 1 Aug 2024 22:10:57 +0200 Subject: [PATCH 413/429] Build fixes --- src/main/drivers/pwm_mapping.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 08123130f2c..3f08d9b500a 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -21,6 +21,7 @@ #include "flight/mixer.h" #include "flight/mixer_profile.h" #include "flight/servos.h" +#include "common/maths.h" #if defined(TARGET_MOTOR_COUNT) #define MAX_MOTORS TARGET_MOTOR_COUNT From f7a5af165a8e8f6baad30ba5c1c4f66045310422 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 09:55:48 +0200 Subject: [PATCH 414/429] Rename frame byte Remove SBUS26 name, as it will likely have other modes in the future. --- src/main/rx/sbus_channels.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/rx/sbus_channels.h b/src/main/rx/sbus_channels.h index 4ff065f8d25..a0276ac005c 100644 --- a/src/main/rx/sbus_channels.h +++ b/src/main/rx/sbus_channels.h @@ -31,7 +31,7 @@ #define SBUS_FRAME_SIZE (SBUS_CHANNEL_DATA_LENGTH + 2) #define SBUS_FRAME_BEGIN_BYTE ((uint8_t)0x0F) -#define SBUS26_FRAME_BEGIN_BYTE ((uint8_t)0x2F) +#define SBUS2_HIGHFRAME_BEGIN_BYTE ((uint8_t)0x2F) #define SBUS_BAUDRATE 100000 #define SBUS_BAUDRATE_FAST 200000 From 124a0d31e5a50eadde02c8a045320d0aca4be5f2 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 09:58:34 +0200 Subject: [PATCH 415/429] Continue sync byte renaming --- src/main/rx/sbus.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 21aef81e4b2..a7ba93456f4 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -95,7 +95,7 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if ((uint8_t)c == SBUS26_FRAME_BEGIN_BYTE) { + } else if ((uint8_t)c == SBUS2_HIGHFRAME_BEGIN_BYTE) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD; @@ -180,12 +180,6 @@ static void sbusDataReceive(uint16_t c, void *data) case STATE_SBUS_WAIT_SYNC: // Stay at this state and do nothing. Exit will be handled before byte is processed if the // inter-frame gap is long enough - if (c == SBUS26_FRAME_BEGIN_BYTE || c == 0xF2 || c == 0x2c) { - sbusFrameData->position = 0; - sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; - sbusFrameData->state = STATE_SBUS26_PAYLOAD; - } - break; } } From f5e46e88326a6dc71be5cc2beba12c513d292c5d Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:20:55 +0200 Subject: [PATCH 416/429] Update pwm_mapping.h --- src/main/drivers/pwm_mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 9b774bfac9d..08123130f2c 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -28,7 +28,7 @@ #define MAX_MOTORS 12 #endif -#define MAX_SERVOS 34 +#define MAX_SERVOS 18 #define PWM_TIMER_HZ 1000000 From aec8276c9b5ed93eef50abfca45c3cc31ec051a3 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:23:07 +0200 Subject: [PATCH 417/429] Update servos.h to match pwm_mapping.h --- src/main/flight/servos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 79ab18caa36..634c7b0cd58 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 34 +#define MAX_SUPPORTED_SERVOS 18 // These must be consecutive typedef enum { From adf73f1338b07f37b11fb1a87be3062d96d37417 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:54:14 +0200 Subject: [PATCH 418/429] before merging master --- src/main/drivers/pwm_mapping.h | 2 +- src/main/flight/servos.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 47311768aec..3f08d9b500a 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -29,7 +29,7 @@ #define MAX_MOTORS 12 #endif -#define MAX_SERVOS 34 +#define MAX_SERVOS 18 #define PWM_TIMER_HZ 1000000 diff --git a/src/main/flight/servos.h b/src/main/flight/servos.h index 79ab18caa36..23ac3fda495 100644 --- a/src/main/flight/servos.h +++ b/src/main/flight/servos.h @@ -20,7 +20,7 @@ #include "config/parameter_group.h" #include "programming/logic_condition.h" -#define MAX_SUPPORTED_SERVOS 34 +#define MAX_SUPPORTED_SERVOS 18 // These must be consecutive typedef enum { @@ -68,7 +68,6 @@ typedef enum { INPUT_HEADTRACKER_ROLL = 41, INPUT_RC_CH17 = 42, INPUT_RC_CH18 = 43, -#ifdef USE_24CHANNELS INPUT_RC_CH19 = 44, INPUT_RC_CH20 = 45, INPUT_RC_CH21 = 46, @@ -85,7 +84,6 @@ typedef enum { INPUT_RC_CH32 = 57, INPUT_RC_CH33 = 58, INPUT_RC_CH34 = 59, -#endif INPUT_SOURCE_COUNT } inputSource_e; From d61d3524d0c949c69a6469ad8aa97d90ae7aa150 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:55:03 +0200 Subject: [PATCH 419/429] rename USE_24CHANELS to USE_34CHANNELS --- src/main/fc/rc_controls.h | 12 +++++++++++- src/main/flight/servos.c | 12 +++++++++++- src/main/rx/jetiexbus.c | 2 +- src/main/target/common.h | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 3705a29c3a1..f5b96f2d239 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -40,13 +40,23 @@ typedef enum rc_alias { AUX12, // 16 AUX13, // 17 AUX14, // 18 -#ifdef USE_24CHANNELS +#ifdef USE_34CHANNELS AUX15, // 19 AUX16, // 20 AUX17, // 21 AUX18, // 22 AUX19, // 23 AUX20, // 24 + AUX21, // 25 + AUX22, // 26 + AUX23, // 27 + AUX24, // 28 + AUX25, // 29 + AUX26, // 30 + AUX27, // 31 + AUX28, // 32 + AUX29, // 33 + AUX30, // 34 #endif } rc_alias_e; diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index 5ac98f78215..40711706e78 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -349,13 +349,23 @@ void servoMixer(float dT) input[INPUT_RC_CH16] = GET_RX_CHANNEL_INPUT(AUX12); input[INPUT_RC_CH17] = GET_RX_CHANNEL_INPUT(AUX13); input[INPUT_RC_CH18] = GET_RX_CHANNEL_INPUT(AUX14); -#ifdef USE_24CHANNELS +#ifdef USE_34CHANNELS input[INPUT_RC_CH19] = GET_RX_CHANNEL_INPUT(AUX15); input[INPUT_RC_CH20] = GET_RX_CHANNEL_INPUT(AUX16); input[INPUT_RC_CH21] = GET_RX_CHANNEL_INPUT(AUX17); input[INPUT_RC_CH22] = GET_RX_CHANNEL_INPUT(AUX18); input[INPUT_RC_CH23] = GET_RX_CHANNEL_INPUT(AUX19); input[INPUT_RC_CH24] = GET_RX_CHANNEL_INPUT(AUX20); + input[INPUT_RC_CH25] = GET_RX_CHANNEL_INPUT(AUX21); + input[INPUT_RC_CH26] = GET_RX_CHANNEL_INPUT(AUX22); + input[INPUT_RC_CH27] = GET_RX_CHANNEL_INPUT(AUX23); + input[INPUT_RC_CH28] = GET_RX_CHANNEL_INPUT(AUX24); + input[INPUT_RC_CH29] = GET_RX_CHANNEL_INPUT(AUX25); + input[INPUT_RC_CH30] = GET_RX_CHANNEL_INPUT(AUX26); + input[INPUT_RC_CH31] = GET_RX_CHANNEL_INPUT(AUX27); + input[INPUT_RC_CH32] = GET_RX_CHANNEL_INPUT(AUX28); + input[INPUT_RC_CH33] = GET_RX_CHANNEL_INPUT(AUX29); + input[INPUT_RC_CH34] = GET_RX_CHANNEL_INPUT(AUX30); #endif #undef GET_RX_CHANNEL_INPUT diff --git a/src/main/rx/jetiexbus.c b/src/main/rx/jetiexbus.c index 35564833994..9e3c04d2c12 100644 --- a/src/main/rx/jetiexbus.c +++ b/src/main/rx/jetiexbus.c @@ -64,7 +64,7 @@ #define JETIEXBUS_OPTIONS (SERIAL_STOPBITS_1 | SERIAL_PARITY_NO) #define JETIEXBUS_MIN_FRAME_GAP 1000 -#ifdef USE_24CHANNELS +#ifdef USE_34CHANNELS #define JETIEXBUS_CHANNEL_COUNT 24 #else #define JETIEXBUS_CHANNEL_COUNT 16 diff --git a/src/main/target/common.h b/src/main/target/common.h index 51f1fbf6ea6..f7cc3f747ce 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -206,7 +206,7 @@ #define USE_SERIALRX_SUMD #define USE_TELEMETRY_HOTT #define USE_HOTT_TEXTMODE -#define USE_24CHANNELS +#define USE_34CHANNELS #define MAX_MIXER_PROFILE_COUNT 2 #define USE_SMARTPORT_MASTER #elif !defined(STM32F7) From a863afadf06742559e06cc46187196f99395b7dd Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 2 Aug 2024 15:58:54 +0200 Subject: [PATCH 420/429] Update pwm_mapping.c --- src/main/drivers/pwm_mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index d631243790a..2d01127a504 100644 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -446,7 +446,7 @@ static void pwmInitServos(timMotorServoHardware_t * timOutputs) // If mixer requests more servos than we have timer outputs - throw an error uint16_t maxServos = timOutputs->maxTimServoCount; - if(servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM) { + if (servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM) { maxServos = MAX(SERVO_SBUS_MAX_SERVOS, timOutputs->maxTimServoCount); } From a53c3030d880af6d7a325beeed47afeec6c54c1a Mon Sep 17 00:00:00 2001 From: KY-S0ong <156529018+KY-S0ong@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:35:01 -0400 Subject: [PATCH 421/429] Update USB Flashing.md --- docs/USB Flashing.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/USB Flashing.md b/docs/USB Flashing.md index 4b885ef02eb..e3bba4291b8 100644 --- a/docs/USB Flashing.md +++ b/docs/USB Flashing.md @@ -50,6 +50,15 @@ With the board connected and in bootloader mode (reset it by sending the charact * Select `STM32 BOOTLOADER` in the device list * Choose `WinUSB (v6.x.x.x)` in the right hand box +## Platoform: Mac-OS + +The Configuator devices can have a problem accesing USB devices on Mac-OS. This is ussaly solved by a cable change. + +* The official Apple USB-C to USB-C will not work no matter orentation. +* Make sure the cable you are using support data transfer + * For best results, use a USB-C to USB-A cable (And a dongle if your computer does not have an USB-A port) + * Dongle side pluged into the computer + ![Zadig Driver Procedure](assets/images/zadig-dfu.png) * Click Replace Driver From e8f9503d8f615bd20fbc6f304273f8db5287f64f Mon Sep 17 00:00:00 2001 From: KY-S0ong <156529018+KY-S0ong@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:50:52 -0400 Subject: [PATCH 422/429] Update USB Flashing.md Adds instructions on how to use the Configurator on Mac-OS --- docs/USB Flashing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/USB Flashing.md b/docs/USB Flashing.md index e3bba4291b8..b0fd876d9cf 100644 --- a/docs/USB Flashing.md +++ b/docs/USB Flashing.md @@ -52,7 +52,7 @@ With the board connected and in bootloader mode (reset it by sending the charact ## Platoform: Mac-OS -The Configuator devices can have a problem accesing USB devices on Mac-OS. This is ussaly solved by a cable change. +Configuator devices can have a problem accesing USB devices on Mac-OS. This is *ussaly* solved by a cable change. * The official Apple USB-C to USB-C will not work no matter orentation. * Make sure the cable you are using support data transfer From a548bc6165f4d5f7c830506e98ffbe4052faf7cd Mon Sep 17 00:00:00 2001 From: KY-S0ong <156529018+KY-S0ong@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:54:53 -0400 Subject: [PATCH 423/429] Update USB Flashing.md Fixed some formatting. Still for Mac-OS help --- docs/USB Flashing.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/USB Flashing.md b/docs/USB Flashing.md index b0fd876d9cf..4981e95a043 100644 --- a/docs/USB Flashing.md +++ b/docs/USB Flashing.md @@ -49,6 +49,12 @@ With the board connected and in bootloader mode (reset it by sending the charact * Choose Options > List All Devices * Select `STM32 BOOTLOADER` in the device list * Choose `WinUSB (v6.x.x.x)` in the right hand box + +![Zadig Driver Procedure](assets/images/zadig-dfu.png) + +* Click Replace Driver +* Restart the Configurator (make sure it is completely closed, logout and login if unsure) +* Now the DFU device should be seen by Configurator ## Platoform: Mac-OS @@ -58,13 +64,6 @@ Configuator devices can have a problem accesing USB devices on Mac-OS. This is * * Make sure the cable you are using support data transfer * For best results, use a USB-C to USB-A cable (And a dongle if your computer does not have an USB-A port) * Dongle side pluged into the computer - -![Zadig Driver Procedure](assets/images/zadig-dfu.png) - -* Click Replace Driver -* Restart the Configurator (make sure it is completely closed, logout and login if unsure) -* Now the DFU device should be seen by Configurator - ## Using `dfu-util` From 70ecef84cb8168f26426def36b6308b9a3030228 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Mon, 5 Aug 2024 19:36:47 -0500 Subject: [PATCH 424/429] cli.c: Add reason for Navigation Unsafe to status --- src/main/fc/cli.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 7a3e1f1b78f..ee5cb289a94 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -3894,6 +3894,24 @@ static void cliStatus(char *cmdline) cliPrintErrorLinef("Invalid setting: %s", buf); } } + +#if defined(USE_OSD) + if (armingFlags & ARMING_DISABLED_NAVIGATION_UNSAFE) { + navArmingBlocker_e reason = navigationIsBlockingArming(NULL); + if (reason & NAV_ARMING_BLOCKER_JUMP_WAYPOINT_ERROR) + cliPrintLinef(" %s", OSD_MSG_JUMP_WP_MISCONFIG); + if (reason & NAV_ARMING_BLOCKER_MISSING_GPS_FIX) { + cliPrintLinef(" %s", OSD_MSG_WAITING_GPS_FIX); + } else { + if (reason & NAV_ARMING_BLOCKER_NAV_IS_ALREADY_ACTIVE) + cliPrintLinef(" %s", OSD_MSG_DISABLE_NAV_FIRST); + if (reason & NAV_ARMING_BLOCKER_FIRST_WAYPOINT_TOO_FAR) + cliPrintLinef(" FIRST WP TOO FAR"); + } + } +#endif + + #else cliPrintLinef("Arming disabled flags: 0x%lx", armingFlags & ARMING_DISABLED_ALL_FLAGS); #endif From 0f04b7e98ef8bfdb576f0ffe59d1c4284ecff675 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:40:14 +0200 Subject: [PATCH 425/429] Support SBUS2 FASSTest 12 channel short frame time --- src/main/fc/fc_tasks.c | 2 +- src/main/rx/sbus.c | 16 +++++++++++++--- src/main/rx/sbus.h | 3 ++- src/main/telemetry/sbus2.c | 6 +++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 107a0e732b6..afb880db526 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -439,7 +439,7 @@ void fcTasksInit(void) #endif #if defined(USE_TELEMETRY) && defined(USE_TELEMETRY_SBUS2) - setTaskEnabled(TASK_TELEMETRY_SBUS2,rxConfig()->receiverType == RX_TYPE_SERIAL && rxConfig()->serialrx_provider == SERIALRX_SBUS2); + setTaskEnabled(TASK_TELEMETRY_SBUS2,feature(FEATURE_TELEMETRY) && rxConfig()->receiverType == RX_TYPE_SERIAL && rxConfig()->serialrx_provider == SERIALRX_SBUS2); #endif #ifdef USE_ADAPTIVE_FILTER diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index a7ba93456f4..f08267eeb1d 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -71,6 +71,7 @@ typedef struct sbusFrameData_s { static uint8_t sbus2ActiveTelemetryPage = 0; static uint8_t sbus2ActiveTelemetrySlot = 0; +static uint8_t sbus2ShortFrameInterval = 0; timeUs_t frameTime = 0; // Receive ISR callback @@ -81,10 +82,16 @@ static void sbusDataReceive(uint16_t c, void *data) const timeDelta_t timeSinceLastByteUs = cmpTimeUs(currentTimeUs, sbusFrameData->lastActivityTimeUs); sbusFrameData->lastActivityTimeUs = currentTimeUs; + const int32_t syncInterval = sbus2ShortFrameInterval + ? ((6300 - SBUS_BYTE_TIME_US(25)) / 2) + : rxConfig()->sbusSyncInterval; + + // Handle inter-frame gap. We dwell in STATE_SBUS_WAIT_SYNC state ignoring all incoming bytes until we get long enough quite period on the wire - if (timeSinceLastByteUs >= rxConfig()->sbusSyncInterval) { + if ((sbusFrameData->state == STATE_SBUS_WAIT_SYNC && timeSinceLastByteUs >= syncInterval) + || (rxConfig()->serialrx_provider == SERIALRX_SBUS2 && timeSinceLastByteUs >= SBUS_BYTE_TIME_US(3))) { sbusFrameData->state = STATE_SBUS_SYNC; - } else if ((sbusFrameData->state == STATE_SBUS_PAYLOAD || sbusFrameData->state == STATE_SBUS26_PAYLOAD) && timeSinceLastByteUs >= 300) { + } else if ((sbusFrameData->state == STATE_SBUS_PAYLOAD || sbusFrameData->state == STATE_SBUS26_PAYLOAD) && timeSinceLastByteUs >= SBUS_BYTE_TIME_US(3)) { // payload is pausing too long, possible if some telemetry have been sent between frames, or false positves mid frame sbusFrameData->state = STATE_SBUS_SYNC; } @@ -95,7 +102,7 @@ static void sbusDataReceive(uint16_t c, void *data) sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS_PAYLOAD; - } else if ((uint8_t)c == SBUS2_HIGHFRAME_BEGIN_BYTE) { + } else if (c == SBUS2_HIGHFRAME_BEGIN_BYTE) { sbusFrameData->position = 0; sbusFrameData->buffer[sbusFrameData->position++] = (uint8_t)c; sbusFrameData->state = STATE_SBUS26_PAYLOAD; @@ -113,12 +120,15 @@ static void sbusDataReceive(uint16_t c, void *data) switch (frame->endByte) { case 0x00: // This is S.BUS 1 case 0x04: // S.BUS 2 telemetry page 1 + case 0x08: // S.BUS 2 fast frame pace, not telemetry. case 0x14: // S.BUS 2 telemetry page 2 case 0x24: // S.BUS 2 telemetry page 3 case 0x34: // S.BUS 2 telemetry page 4 if(frame->endByte & 0x4) { sbus2ActiveTelemetryPage = (frame->endByte >> 4) & 0xF; frameTime = currentTimeUs; + } else if(frame->endByte == 0x08) { + sbus2ShortFrameInterval = 1; } else { sbus2ActiveTelemetryPage = 0; sbus2ActiveTelemetrySlot = 0; diff --git a/src/main/rx/sbus.h b/src/main/rx/sbus.h index 810b577693e..20ed82e2dae 100644 --- a/src/main/rx/sbus.h +++ b/src/main/rx/sbus.h @@ -18,13 +18,14 @@ #pragma once #define SBUS_DEFAULT_INTERFRAME_DELAY_US 3000 // According to FrSky interframe is 6.67ms, we go smaller just in case -#define SBUS_MIN_SYNC_DELAY_US MS2US(2) // 2ms #include "rx/rx.h" bool sbusInit(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); bool sbusInitFast(const rxConfig_t *initialRxConfig, rxRuntimeConfig_t *rxRuntimeConfig); +#define SBUS_BYTE_TIME_US(bytes) MS2US(10 * 12 * bytes) // 10us per bit * (1 start + 8 data + 1 parity + 2 stop) * number of bytes + #ifdef USE_TELEMETRY_SBUS2 uint8_t sbusGetCurrentTelemetryPage(void); uint8_t sbusGetCurrentTelemetryNextSlot(void); diff --git a/src/main/telemetry/sbus2.c b/src/main/telemetry/sbus2.c index dc5fb81d77d..1e800f2f098 100644 --- a/src/main/telemetry/sbus2.c +++ b/src/main/telemetry/sbus2.c @@ -25,6 +25,10 @@ #include "common/time.h" #include "common/axis.h" +#include "config/feature.h" + +#include "fc/config.h" + #include "telemetry/telemetry.h" #include "telemetry/sbus2.h" #include "telemetry/sbus2_sensors.h" @@ -164,7 +168,7 @@ void sbus2IncrementTelemetrySlot(timeUs_t currentTimeUs) FAST_CODE void taskSendSbus2Telemetry(timeUs_t currentTimeUs) { - if (!telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || + if (!feature(FEATURE_TELEMETRY) || !telemetrySharedPort || rxConfig()->receiverType != RX_TYPE_SERIAL || rxConfig()->serialrx_provider != SERIALRX_SBUS2) { return; } From 069a61cea5e7e8fa2137349bdc8df120dbfda219 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Thu, 8 Aug 2024 10:16:35 +0200 Subject: [PATCH 426/429] add h7 svd file --- cmake/stm32h7.cmake | 1 + dev/svd/STM32H743.svd | 105015 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 105016 insertions(+) create mode 100644 dev/svd/STM32H743.svd diff --git a/cmake/stm32h7.cmake b/cmake/stm32h7.cmake index 08e7686b8f4..81a8b2d889d 100644 --- a/cmake/stm32h7.cmake +++ b/cmake/stm32h7.cmake @@ -216,6 +216,7 @@ macro(define_target_stm32h7 subfamily size) COMPILE_DEFINITIONS ${definitions} LINKER_SCRIPT stm32_flash_h7${subfamily}x${size} ${${func_ARGV}} + SVD STM32H7${subfamily} ) endfunction() endmacro() diff --git a/dev/svd/STM32H743.svd b/dev/svd/STM32H743.svd new file mode 100644 index 00000000000..768431e55a6 --- /dev/null +++ b/dev/svd/STM32H743.svd @@ -0,0 +1,105015 @@ + + + STM32H743 + 1.3 + STM32H743 + + CM7 + r0p1 + little + true + true + 4 + false + + + + 8 + + 32 + + 0x20 + 0x0 + 0xFFFFFFFF + + + COMP1 + COMP1 + COMP1 + 0x58003800 + + 0x0 + 0x400 + registers + + + COMP + COMP1 and COMP2 + 137 + + + + SR + SR + Comparator status register + 0x0 + 0x20 + read-only + 0x00000000 + + + C1VAL + COMP channel 1 output status + bit + 0 + 1 + + + C2VAL + COMP channel 2 output status + bit + 1 + 1 + + + C1IF + COMP channel 1 Interrupt + Flag + 16 + 1 + + + C2IF + COMP channel 2 Interrupt + Flag + 17 + 1 + + + + + ICFR + ICFR + Comparator interrupt clear flag + register + 0x4 + 0x20 + write-only + 0x00000000 + + + CC1IF + Clear COMP channel 1 Interrupt + Flag + 16 + 1 + + + CC2IF + Clear COMP channel 2 Interrupt + Flag + 17 + 1 + + + + + OR + OR + Comparator option register + 0x8 + 0x20 + read-write + 0x00000000 + + + AFOP + Selection of source for alternate + function of output ports + 0 + 11 + + + OR + Option Register + 11 + 21 + + + + + CFGR1 + CFGR1 + Comparator configuration register + 1 + 0xC + 0x20 + read-write + 0x00000000 + + + EN + COMP channel 1 enable bit + 0 + 1 + + + BRGEN + Scaler bridge enable + 1 + 1 + + + SCALEN + Voltage scaler enable bit + 2 + 1 + + + POLARITY + COMP channel 1 polarity selection + bit + 3 + 1 + + + ITEN + COMP channel 1 interrupt + enable + 6 + 1 + + + HYST + COMP channel 1 hysteresis selection + bits + 8 + 2 + + + PWRMODE + Power Mode of the COMP channel + 1 + 12 + 2 + + + INMSEL + COMP channel 1 inverting input selection + field + 16 + 3 + + + INPSEL + COMP channel 1 non-inverting input + selection bit + 20 + 1 + + + BLANKING + COMP channel 1 blanking source selection + bits + 24 + 4 + + + LOCK + Lock bit + 31 + 1 + + + + + CFGR2 + CFGR2 + Comparator configuration register + 2 + 0x10 + 0x20 + read-write + 0x00000000 + + + EN + COMP channel 1 enable bit + 0 + 1 + + + BRGEN + Scaler bridge enable + 1 + 1 + + + SCALEN + Voltage scaler enable bit + 2 + 1 + + + POLARITY + COMP channel 1 polarity selection + bit + 3 + 1 + + + WINMODE + Window comparator mode selection + bit + 4 + 1 + + + ITEN + COMP channel 1 interrupt + enable + 6 + 1 + + + HYST + COMP channel 1 hysteresis selection + bits + 8 + 2 + + + PWRMODE + Power Mode of the COMP channel + 1 + 12 + 2 + + + INMSEL + COMP channel 1 inverting input selection + field + 16 + 3 + + + INPSEL + COMP channel 1 non-inverting input + selection bit + 20 + 1 + + + BLANKING + COMP channel 1 blanking source selection + bits + 24 + 4 + + + LOCK + Lock bit + 31 + 1 + + + + + + + CRS + CRS + CRS + 0x40008400 + + 0x0 + 0x400 + registers + + + CRS + Clock Recovery System globa + 144 + + + + CR + CR + CRS control register + 0x0 + 0x20 + 0x00002000 + + + SYNCOKIE + SYNC event OK interrupt + enable + 0 + 1 + read-write + + + SYNCWARNIE + SYNC warning interrupt + enable + 1 + 1 + read-write + + + ERRIE + Synchronization or trimming error + interrupt enable + 2 + 1 + read-write + + + ESYNCIE + Expected SYNC interrupt + enable + 3 + 1 + read-write + + + CEN + Frequency error counter enable This bit + enables the oscillator clock for the frequency error + counter. When this bit is set, the CRS_CFGR register + is write-protected and cannot be + modified. + 5 + 1 + read-write + + + AUTOTRIMEN + Automatic trimming enable This bit + enables the automatic hardware adjustment of TRIM + bits according to the measured frequency error + between two SYNC events. If this bit is set, the TRIM + bits are read-only. The TRIM value can be adjusted by + hardware by one or two steps at a time, depending on + the measured frequency error value. Refer to + Section7.3.4: Frequency error evaluation and + automatic trimming for more details. + 6 + 1 + read-write + + + SWSYNC + Generate software SYNC event This bit is + set by software in order to generate a software SYNC + event. It is automatically cleared by + hardware. + 7 + 1 + read-only + + + TRIM + HSI48 oscillator smooth trimming These + bits provide a user-programmable trimming value to + the HSI48 oscillator. They can be programmed to + adjust to variations in voltage and temperature that + influence the frequency of the HSI48. The default + value is 32, which corresponds to the middle of the + trimming interval. The trimming step is around 67 kHz + between two consecutive TRIM steps. A higher TRIM + value corresponds to a higher output frequency. When + the AUTOTRIMEN bit is set, this field is controlled + by hardware and is read-only. + 8 + 6 + read-write + + + + + CFGR + CFGR + This register can be written only when the + frequency error counter is disabled (CEN bit is cleared + in CRS_CR). When the counter is enabled, this register is + write-protected. + 0x4 + 0x20 + read-write + 0x2022BB7F + + + RELOAD + Counter reload value RELOAD is the value + to be loaded in the frequency error counter with each + SYNC event. Refer to Section7.3.3: Frequency error + measurement for more details about counter + behavior. + 0 + 16 + + + FELIM + Frequency error limit FELIM contains the + value to be used to evaluate the captured frequency + error value latched in the FECAP[15:0] bits of the + CRS_ISR register. Refer to Section7.3.4: Frequency + error evaluation and automatic trimming for more + details about FECAP evaluation. + 16 + 8 + + + SYNCDIV + SYNC divider These bits are set and + cleared by software to control the division factor of + the SYNC signal. + 24 + 3 + + + SYNCSRC + SYNC signal source selection These bits + are set and cleared by software to select the SYNC + signal source. Note: When using USB LPM (Link Power + Management) and the device is in Sleep mode, the + periodic USB SOF will not be generated by the host. + No SYNC signal will therefore be provided to the CRS + to calibrate the HSI48 on the run. To guarantee the + required clock precision after waking up from Sleep + mode, the LSE or reference clock on the GPIOs should + be used as SYNC signal. + 28 + 2 + + + SYNCPOL + SYNC polarity selection This bit is set + and cleared by software to select the input polarity + for the SYNC signal source. + 31 + 1 + + + + + ISR + ISR + CRS interrupt and status + register + 0x8 + 0x20 + read-only + 0x00000000 + + + SYNCOKF + SYNC event OK flag This flag is set by + hardware when the measured frequency error is smaller + than FELIM * 3. This means that either no adjustment + of the TRIM value is needed or that an adjustment by + one trimming step is enough to compensate the + frequency error. An interrupt is generated if the + SYNCOKIE bit is set in the CRS_CR register. It is + cleared by software by setting the SYNCOKC bit in the + CRS_ICR register. + 0 + 1 + + + SYNCWARNF + SYNC warning flag This flag is set by + hardware when the measured frequency error is greater + than or equal to FELIM * 3, but smaller than FELIM * + 128. This means that to compensate the frequency + error, the TRIM value must be adjusted by two steps + or more. An interrupt is generated if the SYNCWARNIE + bit is set in the CRS_CR register. It is cleared by + software by setting the SYNCWARNC bit in the CRS_ICR + register. + 1 + 1 + + + ERRF + Error flag This flag is set by hardware + in case of any synchronization or trimming error. It + is the logical OR of the TRIMOVF, SYNCMISS and + SYNCERR bits. An interrupt is generated if the ERRIE + bit is set in the CRS_CR register. It is cleared by + software in reaction to setting the ERRC bit in the + CRS_ICR register, which clears the TRIMOVF, SYNCMISS + and SYNCERR bits. + 2 + 1 + + + ESYNCF + Expected SYNC flag This flag is set by + hardware when the frequency error counter reached a + zero value. An interrupt is generated if the ESYNCIE + bit is set in the CRS_CR register. It is cleared by + software by setting the ESYNCC bit in the CRS_ICR + register. + 3 + 1 + + + SYNCERR + SYNC error This flag is set by hardware + when the SYNC pulse arrives before the ESYNC event + and the measured frequency error is greater than or + equal to FELIM * 128. This means that the frequency + error is too big (internal frequency too low) to be + compensated by adjusting the TRIM value, and that + some other action should be taken. An interrupt is + generated if the ERRIE bit is set in the CRS_CR + register. It is cleared by software by setting the + ERRC bit in the CRS_ICR register. + 8 + 1 + + + SYNCMISS + SYNC missed This flag is set by hardware + when the frequency error counter reached value FELIM + * 128 and no SYNC was detected, meaning either that a + SYNC pulse was missed or that the frequency error is + too big (internal frequency too high) to be + compensated by adjusting the TRIM value, and that + some other action should be taken. At this point, the + frequency error counter is stopped (waiting for a + next SYNC) and an interrupt is generated if the ERRIE + bit is set in the CRS_CR register. It is cleared by + software by setting the ERRC bit in the CRS_ICR + register. + 9 + 1 + + + TRIMOVF + Trimming overflow or underflow This flag + is set by hardware when the automatic trimming tries + to over- or under-flow the TRIM value. An interrupt + is generated if the ERRIE bit is set in the CRS_CR + register. It is cleared by software by setting the + ERRC bit in the CRS_ICR register. + 10 + 1 + + + FEDIR + Frequency error direction FEDIR is the + counting direction of the frequency error counter + latched in the time of the last SYNC event. It shows + whether the actual frequency is below or above the + target. + 15 + 1 + + + FECAP + Frequency error capture FECAP is the + frequency error counter value latched in the time of + the last SYNC event. Refer to Section7.3.4: Frequency + error evaluation and automatic trimming for more + details about FECAP usage. + 16 + 16 + + + + + ICR + ICR + CRS interrupt flag clear + register + 0xC + 0x20 + read-write + 0x00000000 + + + SYNCOKC + SYNC event OK clear flag Writing 1 to + this bit clears the SYNCOKF flag in the CRS_ISR + register. + 0 + 1 + + + SYNCWARNC + SYNC warning clear flag Writing 1 to + this bit clears the SYNCWARNF flag in the CRS_ISR + register. + 1 + 1 + + + ERRC + Error clear flag Writing 1 to this bit + clears TRIMOVF, SYNCMISS and SYNCERR bits and + consequently also the ERRF flag in the CRS_ISR + register. + 2 + 1 + + + ESYNCC + Expected SYNC clear flag Writing 1 to + this bit clears the ESYNCF flag in the CRS_ISR + register. + 3 + 1 + + + + + + + DAC + DAC + DAC + 0x40007400 + + 0x0 + 0x400 + registers + + + + CR + CR + DAC control register + 0x0 + 0x20 + read-write + 0x00000000 + + + EN1 + DAC channel1 enable This bit is set and + cleared by software to enable/disable DAC + channel1. + 0 + 1 + + + TEN1 + DAC channel1 trigger + enable + 1 + 1 + + + TSEL1 + DAC channel1 trigger selection These + bits select the external event used to trigger DAC + channel1. Note: Only used if bit TEN1 = 1 (DAC + channel1 trigger enabled). + 2 + 3 + + + WAVE1 + DAC channel1 noise/triangle wave + generation enable These bits are set and cleared by + software. Note: Only used if bit TEN1 = 1 (DAC + channel1 trigger enabled). + 6 + 2 + + + MAMP1 + DAC channel1 mask/amplitude selector + These bits are written by software to select mask in + wave generation mode or amplitude in triangle + generation mode. = 1011: Unmask bits[11:0] of LFSR/ + triangle amplitude equal to 4095 + 8 + 4 + + + DMAEN1 + DAC channel1 DMA enable This bit is set + and cleared by software. + 12 + 1 + + + DMAUDRIE1 + DAC channel1 DMA Underrun Interrupt + enable This bit is set and cleared by + software. + 13 + 1 + + + CEN1 + DAC Channel 1 calibration enable This + bit is set and cleared by software to enable/disable + DAC channel 1 calibration, it can be written only if + bit EN1=0 into DAC_CR (the calibration mode can be + entered/exit only when the DAC channel is disabled) + Otherwise, the write operation is + ignored. + 14 + 1 + + + EN2 + DAC channel2 enable This bit is set and + cleared by software to enable/disable DAC + channel2. + 16 + 1 + + + TEN2 + DAC channel2 trigger + enable + 17 + 1 + + + TSEL2 + DAC channel2 trigger selection These + bits select the external event used to trigger DAC + channel2 Note: Only used if bit TEN2 = 1 (DAC + channel2 trigger enabled). + 18 + 3 + + + WAVE2 + DAC channel2 noise/triangle wave + generation enable These bits are set/reset by + software. 1x: Triangle wave generation enabled Note: + Only used if bit TEN2 = 1 (DAC channel2 trigger + enabled) + 22 + 2 + + + MAMP2 + DAC channel2 mask/amplitude selector + These bits are written by software to select mask in + wave generation mode or amplitude in triangle + generation mode. = 1011: Unmask bits[11:0] of LFSR/ + triangle amplitude equal to 4095 + 24 + 4 + + + DMAEN2 + DAC channel2 DMA enable This bit is set + and cleared by software. + 28 + 1 + + + DMAUDRIE2 + DAC channel2 DMA underrun interrupt + enable This bit is set and cleared by + software. + 29 + 1 + + + CEN2 + DAC Channel 2 calibration enable This + bit is set and cleared by software to enable/disable + DAC channel 2 calibration, it can be written only if + bit EN2=0 into DAC_CR (the calibration mode can be + entered/exit only when the DAC channel is disabled) + Otherwise, the write operation is + ignored. + 30 + 1 + + + + + SWTRGR + SWTRGR + DAC software trigger register + 0x4 + 0x20 + write-only + 0x00000000 + + + SWTRIG1 + DAC channel1 software trigger This bit + is set by software to trigger the DAC in software + trigger mode. Note: This bit is cleared by hardware + (one APB1 clock cycle later) once the DAC_DHR1 + register value has been loaded into the DAC_DOR1 + register. + 0 + 1 + + + SWTRIG2 + DAC channel2 software trigger This bit + is set by software to trigger the DAC in software + trigger mode. Note: This bit is cleared by hardware + (one APB1 clock cycle later) once the DAC_DHR2 + register value has been loaded into the DAC_DOR2 + register. + 1 + 1 + + + + + DHR12R1 + DHR12R1 + DAC channel1 12-bit right-aligned data + holding register + 0x8 + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 12-bit right-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel1. + 0 + 12 + + + + + DHR12L1 + DHR12L1 + DAC channel1 12-bit left aligned data + holding register + 0xC + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 12-bit left-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel1. + 4 + 12 + + + + + DHR8R1 + DHR8R1 + DAC channel1 8-bit right aligned data + holding register + 0x10 + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 8-bit right-aligned data + These bits are written by software which specifies + 8-bit data for DAC channel1. + 0 + 8 + + + + + DHR12R2 + DHR12R2 + DAC channel2 12-bit right aligned data + holding register + 0x14 + 0x20 + read-write + 0x00000000 + + + DACC2DHR + DAC channel2 12-bit right-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel2. + 0 + 12 + + + + + DHR12L2 + DHR12L2 + DAC channel2 12-bit left aligned data + holding register + 0x18 + 0x20 + read-write + 0x00000000 + + + DACC2DHR + DAC channel2 12-bit left-aligned data + These bits are written by software which specify + 12-bit data for DAC channel2. + 4 + 12 + + + + + DHR8R2 + DHR8R2 + DAC channel2 8-bit right-aligned data + holding register + 0x1C + 0x20 + read-write + 0x00000000 + + + DACC2DHR + DAC channel2 8-bit right-aligned data + These bits are written by software which specifies + 8-bit data for DAC channel2. + 0 + 8 + + + + + DHR12RD + DHR12RD + Dual DAC 12-bit right-aligned data holding + register + 0x20 + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 12-bit right-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel1. + 0 + 12 + + + DACC2DHR + DAC channel2 12-bit right-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel2. + 16 + 12 + + + + + DHR12LD + DHR12LD + DUAL DAC 12-bit left aligned data holding + register + 0x24 + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 12-bit left-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel1. + 4 + 12 + + + DACC2DHR + DAC channel2 12-bit left-aligned data + These bits are written by software which specifies + 12-bit data for DAC channel2. + 20 + 12 + + + + + DHR8RD + DHR8RD + DUAL DAC 8-bit right aligned data holding + register + 0x28 + 0x20 + read-write + 0x00000000 + + + DACC1DHR + DAC channel1 8-bit right-aligned data + These bits are written by software which specifies + 8-bit data for DAC channel1. + 0 + 8 + + + DACC2DHR + DAC channel2 8-bit right-aligned data + These bits are written by software which specifies + 8-bit data for DAC channel2. + 8 + 8 + + + + + DOR1 + DOR1 + DAC channel1 data output + register + 0x2C + 0x20 + read-only + 0x00000000 + + + DACC1DOR + DAC channel1 data output These bits are + read-only, they contain data output for DAC + channel1. + 0 + 12 + + + + + DOR2 + DOR2 + DAC channel2 data output + register + 0x30 + 0x20 + read-only + 0x00000000 + + + DACC2DOR + DAC channel2 data output These bits are + read-only, they contain data output for DAC + channel2. + 0 + 12 + + + + + SR + SR + DAC status register + 0x34 + 0x20 + 0x00000000 + + + DMAUDR1 + DAC channel1 DMA underrun flag This bit + is set by hardware and cleared by software (by + writing it to 1). + 13 + 1 + read-write + + + CAL_FLAG1 + DAC Channel 1 calibration offset status + This bit is set and cleared by hardware + 14 + 1 + read-only + + + BWST1 + DAC Channel 1 busy writing sample time + flag This bit is systematically set just after Sample + & Hold mode enable and is set each time the + software writes the register DAC_SHSR1, It is cleared + by hardware when the write operation of DAC_SHSR1 is + complete. (It takes about 3LSI periods of + synchronization). + 15 + 1 + read-only + + + DMAUDR2 + DAC channel2 DMA underrun flag This bit + is set by hardware and cleared by software (by + writing it to 1). + 29 + 1 + read-write + + + CAL_FLAG2 + DAC Channel 2 calibration offset status + This bit is set and cleared by hardware + 30 + 1 + read-only + + + BWST2 + DAC Channel 2 busy writing sample time + flag This bit is systematically set just after Sample + & Hold mode enable and is set each time the + software writes the register DAC_SHSR2, It is cleared + by hardware when the write operation of DAC_SHSR2 is + complete. (It takes about 3 LSI periods of + synchronization). + 31 + 1 + read-only + + + + + CCR + CCR + DAC calibration control + register + 0x38 + 0x20 + read-write + 0x00000000 + + + OTRIM1 + DAC Channel 1 offset trimming + value + 0 + 5 + + + OTRIM2 + DAC Channel 2 offset trimming + value + 16 + 5 + + + + + MCR + MCR + DAC mode control register + 0x3C + 0x20 + read-write + 0x00000000 + + + MODE1 + DAC Channel 1 mode These bits can be + written only when the DAC is disabled and not in the + calibration mode (when bit EN1=0 and bit CEN1 =0 in + the DAC_CR register). If EN1=1 or CEN1 =1 the write + operation is ignored. They can be set and cleared by + software to select the DAC Channel 1 mode: DAC + Channel 1 in normal Mode DAC Channel 1 in sample + &amp; hold mode + 0 + 3 + + + MODE2 + DAC Channel 2 mode These bits can be + written only when the DAC is disabled and not in the + calibration mode (when bit EN2=0 and bit CEN2 =0 in + the DAC_CR register). If EN2=1 or CEN2 =1 the write + operation is ignored. They can be set and cleared by + software to select the DAC Channel 2 mode: DAC + Channel 2 in normal Mode DAC Channel 2 in sample + &amp; hold mode + 16 + 3 + + + + + SHSR1 + SHSR1 + DAC Sample and Hold sample time register + 1 + 0x40 + 0x20 + read-write + 0x00000000 + + + TSAMPLE1 + DAC Channel 1 sample Time (only valid in + sample &amp; hold mode) These bits can be written + when the DAC channel1 is disabled or also during + normal operation. in the latter case, the write can + be done only when BWSTx of DAC_SR register is low, If + BWSTx=1, the write operation is + ignored. + 0 + 10 + + + + + SHSR2 + SHSR2 + DAC Sample and Hold sample time register + 2 + 0x44 + 0x20 + read-write + 0x00000000 + + + TSAMPLE2 + DAC Channel 2 sample Time (only valid in + sample &amp; hold mode) These bits can be written + when the DAC channel2 is disabled or also during + normal operation. in the latter case, the write can + be done only when BWSTx of DAC_SR register is low, if + BWSTx=1, the write operation is + ignored. + 0 + 10 + + + + + SHHR + SHHR + DAC Sample and Hold hold time + register + 0x48 + 0x20 + read-write + 0x00010001 + + + THOLD1 + DAC Channel 1 hold Time (only valid in + sample &amp; hold mode) Hold time= (THOLD[9:0]) x + T LSI + 0 + 10 + + + THOLD2 + DAC Channel 2 hold time (only valid in + sample &amp; hold mode). Hold time= (THOLD[9:0]) + x T LSI + 16 + 10 + + + + + SHRR + SHRR + DAC Sample and Hold refresh time + register + 0x4C + 0x20 + read-write + 0x00010001 + + + TREFRESH1 + DAC Channel 1 refresh Time (only valid + in sample &amp; hold mode) Refresh time= + (TREFRESH[7:0]) x T LSI + 0 + 8 + + + TREFRESH2 + DAC Channel 2 refresh Time (only valid + in sample &amp; hold mode) Refresh time= + (TREFRESH[7:0]) x T LSI + 16 + 8 + + + + + + + BDMA + BDMA + BDMA + 0x58025400 + + 0x0 + 0x400 + registers + + + BDMA_CH1 + BDMA channel 1 interrupt + 129 + + + BDMA_CH2 + BDMA channel 2 interrupt + 130 + + + BDMA_CH3 + BDMA channel 3 interrupt + 131 + + + BDMA_CH4 + BDMA channel 4 interrupt + 132 + + + BDMA_CH5 + BDMA channel 5 interrupt + 133 + + + BDMA_CH6 + BDMA channel 6 interrupt + 134 + + + BDMA_CH7 + BDMA channel 7 interrupt + 135 + + + BDMA_CH8 + BDMA channel 8 interrupt + 136 + + + + ISR + ISR + DMA interrupt status register + 0x0 + 0x20 + read-only + 0x00000000 + + + GIF1 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 0 + 1 + + + TCIF1 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 1 + 1 + + + HTIF1 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 2 + 1 + + + TEIF1 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 3 + 1 + + + GIF2 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 4 + 1 + + + TCIF2 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 5 + 1 + + + HTIF2 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 6 + 1 + + + TEIF2 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 7 + 1 + + + GIF3 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 8 + 1 + + + TCIF3 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 9 + 1 + + + HTIF3 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 10 + 1 + + + TEIF3 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 11 + 1 + + + GIF4 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 12 + 1 + + + TCIF4 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 13 + 1 + + + HTIF4 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 14 + 1 + + + TEIF4 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 15 + 1 + + + GIF5 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 16 + 1 + + + TCIF5 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 17 + 1 + + + HTIF5 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 18 + 1 + + + TEIF5 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 19 + 1 + + + GIF6 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 20 + 1 + + + TCIF6 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 21 + 1 + + + HTIF6 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 22 + 1 + + + TEIF6 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 23 + 1 + + + GIF7 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 24 + 1 + + + TCIF7 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 25 + 1 + + + HTIF7 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 26 + 1 + + + TEIF7 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 27 + 1 + + + GIF8 + Channel x global interrupt flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 28 + 1 + + + TCIF8 + Channel x transfer complete flag (x = + 1..8) This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 29 + 1 + + + HTIF8 + Channel x half transfer flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 30 + 1 + + + TEIF8 + Channel x transfer error flag (x = 1..8) + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCR register. + 31 + 1 + + + + + IFCR + IFCR + DMA interrupt flag clear + register + 0x4 + 0x20 + write-only + 0x00000000 + + + CGIF1 + Channel x global interrupt clear This + bit is set and cleared by software. + 0 + 1 + + + CTCIF1 + Channel x transfer complete clear This + bit is set and cleared by software. + 1 + 1 + + + CHTIF1 + Channel x half transfer clear This bit + is set and cleared by software. + 2 + 1 + + + CTEIF1 + Channel x transfer error clear This bit + is set and cleared by software. + 3 + 1 + + + CGIF2 + Channel x global interrupt clear This + bit is set and cleared by software. + 4 + 1 + + + CTCIF2 + Channel x transfer complete clear This + bit is set and cleared by software. + 5 + 1 + + + CHTIF2 + Channel x half transfer clear This bit + is set and cleared by software. + 6 + 1 + + + CTEIF2 + Channel x transfer error clear This bit + is set and cleared by software. + 7 + 1 + + + CGIF3 + Channel x global interrupt clear This + bit is set and cleared by software. + 8 + 1 + + + CTCIF3 + Channel x transfer complete clear This + bit is set and cleared by software. + 9 + 1 + + + CHTIF3 + Channel x half transfer clear This bit + is set and cleared by software. + 10 + 1 + + + CTEIF3 + Channel x transfer error clear This bit + is set and cleared by software. + 11 + 1 + + + CGIF4 + Channel x global interrupt clear This + bit is set and cleared by software. + 12 + 1 + + + CTCIF4 + Channel x transfer complete clear This + bit is set and cleared by software. + 13 + 1 + + + CHTIF4 + Channel x half transfer clear This bit + is set and cleared by software. + 14 + 1 + + + CTEIF4 + Channel x transfer error clear This bit + is set and cleared by software. + 15 + 1 + + + CGIF5 + Channel x global interrupt clear This + bit is set and cleared by software. + 16 + 1 + + + CTCIF5 + Channel x transfer complete clear This + bit is set and cleared by software. + 17 + 1 + + + CHTIF5 + Channel x half transfer clear This bit + is set and cleared by software. + 18 + 1 + + + CTEIF5 + Channel x transfer error clear This bit + is set and cleared by software. + 19 + 1 + + + CGIF6 + Channel x global interrupt clear This + bit is set and cleared by software. + 20 + 1 + + + CTCIF6 + Channel x transfer complete clear This + bit is set and cleared by software. + 21 + 1 + + + CHTIF6 + Channel x half transfer clear This bit + is set and cleared by software. + 22 + 1 + + + CTEIF6 + Channel x transfer error clear This bit + is set and cleared by software. + 23 + 1 + + + CGIF7 + Channel x global interrupt clear This + bit is set and cleared by software. + 24 + 1 + + + CTCIF7 + Channel x transfer complete clear This + bit is set and cleared by software. + 25 + 1 + + + CHTIF7 + Channel x half transfer clear This bit + is set and cleared by software. + 26 + 1 + + + CTEIF7 + Channel x transfer error clear This bit + is set and cleared by software. + 27 + 1 + + + CGIF8 + Channel x global interrupt clear This + bit is set and cleared by software. + 28 + 1 + + + CTCIF8 + Channel x transfer complete clear This + bit is set and cleared by software. + 29 + 1 + + + CHTIF8 + Channel x half transfer clear This bit + is set and cleared by software. + 30 + 1 + + + CTEIF8 + Channel x transfer error clear This bit + is set and cleared by software. + 31 + 1 + + + + + CCR1 + CCR1 + DMA channel x configuration + register + 0x8 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR1 + CNDTR1 + DMA channel x number of data + register + 0xC + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR1 + CPAR1 + This register must not be written when the + channel is enabled. + 0x10 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR1 + CMAR1 + This register must not be written when the + channel is enabled. + 0x14 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR2 + CCR2 + DMA channel x configuration + register + 0x1C + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR2 + CNDTR2 + DMA channel x number of data + register + 0x20 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR2 + CPAR2 + This register must not be written when the + channel is enabled. + 0x24 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR2 + CMAR2 + This register must not be written when the + channel is enabled. + 0x28 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR3 + CCR3 + DMA channel x configuration + register + 0x30 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR3 + CNDTR3 + DMA channel x number of data + register + 0x34 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR3 + CPAR3 + This register must not be written when the + channel is enabled. + 0x38 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR3 + CMAR3 + This register must not be written when the + channel is enabled. + 0x3C + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR4 + CCR4 + DMA channel x configuration + register + 0x44 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR4 + CNDTR4 + DMA channel x number of data + register + 0x48 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR4 + CPAR4 + This register must not be written when the + channel is enabled. + 0x4C + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR4 + CMAR4 + This register must not be written when the + channel is enabled. + 0x50 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR5 + CCR5 + DMA channel x configuration + register + 0x58 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR5 + CNDTR5 + DMA channel x number of data + register + 0x5C + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR5 + CPAR5 + This register must not be written when the + channel is enabled. + 0x60 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR5 + CMAR5 + This register must not be written when the + channel is enabled. + 0x64 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR6 + CCR6 + DMA channel x configuration + register + 0x6C + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR6 + CNDTR6 + DMA channel x number of data + register + 0x70 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR6 + CPAR6 + This register must not be written when the + channel is enabled. + 0x74 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR6 + CMAR6 + This register must not be written when the + channel is enabled. + 0x78 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR7 + CCR7 + DMA channel x configuration + register + 0x80 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR7 + CNDTR7 + DMA channel x number of data + register + 0x84 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR7 + CPAR7 + This register must not be written when the + channel is enabled. + 0x88 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR7 + CMAR7 + This register must not be written when the + channel is enabled. + 0x8C + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CCR8 + CCR8 + DMA channel x configuration + register + 0x94 + 0x20 + read-write + 0x00000000 + + + EN + Channel enable This bit is set and + cleared by software. + 0 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 1 + 1 + + + HTIE + Half transfer interrupt enable This bit + is set and cleared by software. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 3 + 1 + + + DIR + Data transfer direction This bit is set + and cleared by software. + 4 + 1 + + + CIRC + Circular mode This bit is set and + cleared by software. + 5 + 1 + + + PINC + Peripheral increment mode This bit is + set and cleared by software. + 6 + 1 + + + MINC + Memory increment mode This bit is set + and cleared by software. + 7 + 1 + + + PSIZE + Peripheral size These bits are set and + cleared by software. + 8 + 2 + + + MSIZE + Memory size These bits are set and + cleared by software. + 10 + 2 + + + PL + Channel priority level These bits are + set and cleared by software. + 12 + 2 + + + MEM2MEM + Memory to memory mode This bit is set + and cleared by software. + 14 + 1 + + + + + CNDTR8 + CNDTR8 + DMA channel x number of data + register + 0x98 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data to transfer Number of + data to be transferred (0 up to 65535). This register + can only be written when the channel is disabled. + Once the channel is enabled, this register is + read-only, indicating the remaining bytes to be + transmitted. This register decrements after each DMA + transfer. Once the transfer is completed, this + register can either stay at zero or be reloaded + automatically by the value previously programmed if + the channel is configured in auto-reload mode. If + this register is zero, no transaction can be served + whether the channel is enabled or not. + 0 + 16 + + + + + CPAR8 + CPAR8 + This register must not be written when the + channel is enabled. + 0x9C + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address Base address of the + peripheral data register from/to which the data will + be read/written. When PSIZE is 01 (16-bit), the PA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When PSIZE is 10 (32-bit), PA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + CMAR8 + CMAR8 + This register must not be written when the + channel is enabled. + 0xA0 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Base address of the + memory area from/to which the data will be + read/written. When MSIZE is 01 (16-bit), the MA[0] + bit is ignored. Access is automatically aligned to a + half-word address. When MSIZE is 10 (32-bit), MA[1:0] + are ignored. Access is automatically aligned to a + word address. + 0 + 32 + + + + + + + DMA2D + DMA2D + DMA2D + 0x52001000 + + 0x0 + 0x400 + registers + + + DMA2D + DMA2D global interrupt + 90 + + + + CR + CR + DMA2D control register + 0x0 + 0x20 + read-write + 0x00000000 + + + START + Start This bit can be used to launch the + DMA2D according to the parameters loaded in the + various configuration registers + 0 + 1 + + + SUSP + Suspend This bit can be used to suspend + the current transfer. This bit is set and reset by + software. It is automatically reset by hardware when + the START bit is reset. + 1 + 1 + + + ABORT + Abort This bit can be used to abort the + current transfer. This bit is set by software and is + automatically reset by hardware when the START bit is + reset. + 2 + 1 + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 8 + 1 + + + TCIE + Transfer complete interrupt enable This + bit is set and cleared by software. + 9 + 1 + + + TWIE + Transfer watermark interrupt enable This + bit is set and cleared by software. + 10 + 1 + + + CAEIE + CLUT access error interrupt enable This + bit is set and cleared by software. + 11 + 1 + + + CTCIE + CLUT transfer complete interrupt enable + This bit is set and cleared by + software. + 12 + 1 + + + CEIE + Configuration Error Interrupt Enable + This bit is set and cleared by + software. + 13 + 1 + + + MODE + DMA2D mode This bit is set and cleared + by software. It cannot be modified while a transfer + is ongoing. + 16 + 2 + + + + + ISR + ISR + DMA2D Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + TEIF + Transfer error interrupt flag This bit + is set when an error occurs during a DMA transfer + (data transfer or automatic CLUT + loading). + 0 + 1 + + + TCIF + Transfer complete interrupt flag This + bit is set when a DMA2D transfer operation is + complete (data transfer only). + 1 + 1 + + + TWIF + Transfer watermark interrupt flag This + bit is set when the last pixel of the watermarked + line has been transferred. + 2 + 1 + + + CAEIF + CLUT access error interrupt flag This + bit is set when the CPU accesses the CLUT while the + CLUT is being automatically copied from a system + memory to the internal DMA2D. + 3 + 1 + + + CTCIF + CLUT transfer complete interrupt flag + This bit is set when the CLUT copy from a system + memory area to the internal DMA2D memory is + complete. + 4 + 1 + + + CEIF + Configuration error interrupt flag This + bit is set when the START bit of DMA2D_CR, + DMA2DFGPFCCR or DMA2D_BGPFCCR is set and a wrong + configuration has been programmed. + 5 + 1 + + + + + IFCR + IFCR + DMA2D interrupt flag clear + register + 0x8 + 0x20 + read-write + 0x00000000 + + + CTEIF + Clear Transfer error interrupt flag + Programming this bit to 1 clears the TEIF flag in the + DMA2D_ISR register + 0 + 1 + + + CTCIF + Clear transfer complete interrupt flag + Programming this bit to 1 clears the TCIF flag in the + DMA2D_ISR register + 1 + 1 + + + CTWIF + Clear transfer watermark interrupt flag + Programming this bit to 1 clears the TWIF flag in the + DMA2D_ISR register + 2 + 1 + + + CAECIF + Clear CLUT access error interrupt flag + Programming this bit to 1 clears the CAEIF flag in + the DMA2D_ISR register + 3 + 1 + + + CCTCIF + Clear CLUT transfer complete interrupt + flag Programming this bit to 1 clears the CTCIF flag + in the DMA2D_ISR register + 4 + 1 + + + CCEIF + Clear configuration error interrupt flag + Programming this bit to 1 clears the CEIF flag in the + DMA2D_ISR register + 5 + 1 + + + + + FGMAR + FGMAR + DMA2D foreground memory address + register + 0xC + 0x20 + read-write + 0x00000000 + + + MA + Memory address Address of the data used + for the foreground image. This register can only be + written when data transfers are disabled. Once the + data transfer has started, this register is + read-only. The address alignment must match the image + format selected e.g. a 32-bit per pixel format must + be 32-bit aligned, a 16-bit per pixel format must be + 16-bit aligned and a 4-bit per pixel format must be + 8-bit aligned. + 0 + 32 + + + + + FGOR + FGOR + DMA2D foreground offset + register + 0x10 + 0x20 + read-write + 0x00000000 + + + LO + Line offset Line offset used for the + foreground expressed in pixel. This value is used to + generate the address. It is added at the end of each + line to determine the starting address of the next + line. These bits can only be written when data + transfers are disabled. Once a data transfer has + started, they become read-only. If the image format + is 4-bit per pixel, the line offset must be + even. + 0 + 14 + + + + + BGMAR + BGMAR + DMA2D background memory address + register + 0x14 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Address of the data used + for the background image. This register can only be + written when data transfers are disabled. Once a data + transfer has started, this register is read-only. The + address alignment must match the image format + selected e.g. a 32-bit per pixel format must be + 32-bit aligned, a 16-bit per pixel format must be + 16-bit aligned and a 4-bit per pixel format must be + 8-bit aligned. + 0 + 32 + + + + + BGOR + BGOR + DMA2D background offset + register + 0x18 + 0x20 + read-write + 0x00000000 + + + LO + Line offset Line offset used for the + background image (expressed in pixel). This value is + used for the address generation. It is added at the + end of each line to determine the starting address of + the next line. These bits can only be written when + data transfers are disabled. Once data transfer has + started, they become read-only. If the image format + is 4-bit per pixel, the line offset must be + even. + 0 + 14 + + + + + FGPFCCR + FGPFCCR + DMA2D foreground PFC control + register + 0x1C + 0x20 + read-write + 0x00000000 + + + CM + Color mode These bits defines the color + format of the foreground image. They can only be + written when data transfers are disabled. Once the + transfer has started, they are read-only. others: + meaningless + 0 + 4 + + + CCM + CLUT color mode This bit defines the + color format of the CLUT. It can only be written when + the transfer is disabled. Once the CLUT transfer has + started, this bit is read-only. + 4 + 1 + + + START + Start This bit can be set to start the + automatic loading of the CLUT. It is automatically + reset: ** at the end of the transfer ** when the + transfer is aborted by the user application by + setting the ABORT bit in DMA2D_CR ** when a transfer + error occurs ** when the transfer has not started due + to a configuration error or another transfer + operation already ongoing (data transfer or automatic + background CLUT transfer). + 5 + 1 + + + CS + CLUT size These bits define the size of + the CLUT used for the foreground image. Once the CLUT + transfer has started, this field is read-only. The + number of CLUT entries is equal to CS[7:0] + + 1. + 8 + 8 + + + AM + Alpha mode These bits select the alpha + channel value to be used for the foreground image. + They can only be written data the transfer are + disabled. Once the transfer has started, they become + read-only. other configurations are + meaningless + 16 + 2 + + + CSS + Chroma Sub-Sampling These bits define + the chroma sub-sampling mode for YCbCr color mode. + Once the transfer has started, these bits are + read-only. others: meaningless + 18 + 2 + + + AI + Alpha Inverted This bit inverts the + alpha value. Once the transfer has started, this bit + is read-only. + 20 + 1 + + + RBS + Red Blue Swap This bit allows to swap + the R &amp; B to support BGR or ABGR color + formats. Once the transfer has started, this bit is + read-only. + 21 + 1 + + + ALPHA + Alpha value These bits define a fixed + alpha channel value which can replace the original + alpha value or be multiplied by the original alpha + value according to the alpha mode selected through + the AM[1:0] bits. These bits can only be written when + data transfers are disabled. Once a transfer has + started, they become read-only. + 24 + 8 + + + + + FGCOLR + FGCOLR + DMA2D foreground color + register + 0x20 + 0x20 + read-write + 0x00000000 + + + BLUE + Blue Value These bits defines the blue + value for the A4 or A8 mode of the foreground image. + They can only be written when data transfers are + disabled. Once the transfer has started, They are + read-only. + 0 + 8 + + + GREEN + Green Value These bits defines the green + value for the A4 or A8 mode of the foreground image. + They can only be written when data transfers are + disabled. Once the transfer has started, They are + read-only. + 8 + 8 + + + RED + Red Value These bits defines the red + value for the A4 or A8 mode of the foreground image. + They can only be written when data transfers are + disabled. Once the transfer has started, they are + read-only. + 16 + 8 + + + + + BGPFCCR + BGPFCCR + DMA2D background PFC control + register + 0x24 + 0x20 + read-write + 0x00000000 + + + CM + Color mode These bits define the color + format of the foreground image. These bits can only + be written when data transfers are disabled. Once the + transfer has started, they are read-only. others: + meaningless + 0 + 4 + + + CCM + CLUT Color mode These bits define the + color format of the CLUT. This register can only be + written when the transfer is disabled. Once the CLUT + transfer has started, this bit is + read-only. + 4 + 1 + + + START + Start This bit is set to start the + automatic loading of the CLUT. This bit is + automatically reset: ** at the end of the transfer ** + when the transfer is aborted by the user application + by setting the ABORT bit in the DMA2D_CR ** when a + transfer error occurs ** when the transfer has not + started due to a configuration error or another + transfer operation already on going (data transfer or + automatic BackGround CLUT transfer). + 5 + 1 + + + CS + CLUT size These bits define the size of + the CLUT used for the BG. Once the CLUT transfer has + started, this field is read-only. The number of CLUT + entries is equal to CS[7:0] + 1. + 8 + 8 + + + AM + Alpha mode These bits define which alpha + channel value to be used for the background image. + These bits can only be written when data transfers + are disabled. Once the transfer has started, they are + read-only. others: meaningless + 16 + 2 + + + AI + Alpha Inverted This bit inverts the + alpha value. Once the transfer has started, this bit + is read-only. + 20 + 1 + + + RBS + Red Blue Swap This bit allows to swap + the R &amp; B to support BGR or ABGR color + formats. Once the transfer has started, this bit is + read-only. + 21 + 1 + + + ALPHA + Alpha value These bits define a fixed + alpha channel value which can replace the original + alpha value or be multiplied with the original alpha + value according to the alpha mode selected with bits + AM[1: 0]. These bits can only be written when data + transfers are disabled. Once the transfer has + started, they are read-only. + 24 + 8 + + + + + BGCOLR + BGCOLR + DMA2D background color + register + 0x28 + 0x20 + read-write + 0x00000000 + + + BLUE + Blue Value These bits define the blue + value for the A4 or A8 mode of the background. These + bits can only be written when data transfers are + disabled. Once the transfer has started, they are + read-only. + 0 + 8 + + + GREEN + Green Value These bits define the green + value for the A4 or A8 mode of the background. These + bits can only be written when data transfers are + disabled. Once the transfer has started, they are + read-only. + 8 + 8 + + + RED + Red Value These bits define the red + value for the A4 or A8 mode of the background. These + bits can only be written when data transfers are + disabled. Once the transfer has started, they are + read-only. + 16 + 8 + + + + + FGCMAR + FGCMAR + DMA2D foreground CLUT memory address + register + 0x2C + 0x20 + read-write + 0x00000000 + + + MA + Memory Address Address of the data used + for the CLUT address dedicated to the foreground + image. This register can only be written when no + transfer is ongoing. Once the CLUT transfer has + started, this register is read-only. If the + foreground CLUT format is 32-bit, the address must be + 32-bit aligned. + 0 + 32 + + + + + BGCMAR + BGCMAR + DMA2D background CLUT memory address + register + 0x30 + 0x20 + read-write + 0x00000000 + + + MA + Memory address Address of the data used + for the CLUT address dedicated to the background + image. This register can only be written when no + transfer is on going. Once the CLUT transfer has + started, this register is read-only. If the + background CLUT format is 32-bit, the address must be + 32-bit aligned. + 0 + 32 + + + + + OPFCCR + OPFCCR + DMA2D output PFC control + register + 0x34 + 0x20 + read-write + 0x00000000 + + + CM + Color mode These bits define the color + format of the output image. These bits can only be + written when data transfers are disabled. Once the + transfer has started, they are read-only. others: + meaningless + 0 + 3 + + + AI + Alpha Inverted This bit inverts the + alpha value. Once the transfer has started, this bit + is read-only. + 20 + 1 + + + RBS + Red Blue Swap This bit allows to swap + the R &amp; B to support BGR or ABGR color + formats. Once the transfer has started, this bit is + read-only. + 21 + 1 + + + + + OCOLR + OCOLR + DMA2D output color register + 0x38 + 0x20 + read-write + 0x00000000 + + + BLUE + Blue Value These bits define the blue + value of the output image. These bits can only be + written when data transfers are disabled. Once the + transfer has started, they are + read-only. + 0 + 8 + + + GREEN + Green Value These bits define the green + value of the output image. These bits can only be + written when data transfers are disabled. Once the + transfer has started, they are + read-only. + 8 + 8 + + + RED + Red Value These bits define the red + value of the output image. These bits can only be + written when data transfers are disabled. Once the + transfer has started, they are + read-only. + 16 + 8 + + + ALPHA + Alpha Channel Value These bits define + the alpha channel of the output color. These bits can + only be written when data transfers are disabled. + Once the transfer has started, they are + read-only. + 24 + 8 + + + + + OMAR + OMAR + DMA2D output memory address + register + 0x3C + 0x20 + read-write + 0x00000000 + + + MA + Memory Address Address of the data used + for the output FIFO. These bits can only be written + when data transfers are disabled. Once the transfer + has started, they are read-only. The address + alignment must match the image format selected e.g. a + 32-bit per pixel format must be 32-bit aligned and a + 16-bit per pixel format must be 16-bit + aligned. + 0 + 32 + + + + + OOR + OOR + DMA2D output offset register + 0x40 + 0x20 + read-write + 0x00000000 + + + LO + Line Offset Line offset used for the + output (expressed in pixels). This value is used for + the address generation. It is added at the end of + each line to determine the starting address of the + next line. These bits can only be written when data + transfers are disabled. Once the transfer has + started, they are read-only. + 0 + 14 + + + + + NLR + NLR + DMA2D number of line register + 0x44 + 0x20 + read-write + 0x00000000 + + + NL + Number of lines Number of lines of the + area to be transferred. These bits can only be + written when data transfers are disabled. Once the + transfer has started, they are + read-only. + 0 + 16 + + + PL + Pixel per lines Number of pixels per + lines of the area to be transferred. These bits can + only be written when data transfers are disabled. + Once the transfer has started, they are read-only. If + any of the input image format is 4-bit per pixel, + pixel per lines must be even. + 16 + 14 + + + + + LWR + LWR + DMA2D line watermark register + 0x48 + 0x20 + read-write + 0x00000000 + + + LW + Line watermark These bits allow to + configure the line watermark for interrupt + generation. An interrupt is raised when the last + pixel of the watermarked line has been transferred. + These bits can only be written when data transfers + are disabled. Once the transfer has started, they are + read-only. + 0 + 16 + + + + + AMTCR + AMTCR + DMA2D AXI master timer configuration + register + 0x4C + 0x20 + read-write + 0x00000000 + + + EN + Enable Enables the dead time + functionality. + 0 + 1 + + + DT + Dead Time Dead time value in the AXI + clock cycle inserted between two consecutive accesses + on the AXI master port. These bits represent the + minimum guaranteed number of cycles between two + consecutive AXI accesses. + 8 + 8 + + + + + + + DMAMUX2 + DMAMUX + DMAMUX + 0x58025800 + + 0x0 + 0x400 + registers + + + DMAMUX2_OVR + DMAMUX2 overrun interrupt + 128 + + + + C0CR + C0CR + DMAMux - DMA request line multiplexer + channel x control register + 0x0 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C1CR + C1CR + DMAMux - DMA request line multiplexer + channel x control register + 0x4 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C2CR + C2CR + DMAMux - DMA request line multiplexer + channel x control register + 0x8 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C3CR + C3CR + DMAMux - DMA request line multiplexer + channel x control register + 0xC + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C4CR + C4CR + DMAMux - DMA request line multiplexer + channel x control register + 0x10 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C5CR + C5CR + DMAMux - DMA request line multiplexer + channel x control register + 0x14 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C6CR + C6CR + DMAMux - DMA request line multiplexer + channel x control register + 0x18 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C7CR + C7CR + DMAMux - DMA request line multiplexer + channel x control register + 0x1C + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + RG0CR + RG0CR + DMAMux - DMA request generator channel x + control register + 0x100 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG1CR + RG1CR + DMAMux - DMA request generator channel x + control register + 0x104 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG2CR + RG2CR + DMAMux - DMA request generator channel x + control register + 0x108 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG3CR + RG3CR + DMAMux - DMA request generator channel x + control register + 0x10C + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG4CR + RG4CR + DMAMux - DMA request generator channel x + control register + 0x110 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG5CR + RG5CR + DMAMux - DMA request generator channel x + control register + 0x114 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG6CR + RG6CR + DMAMux - DMA request generator channel x + control register + 0x118 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG7CR + RG7CR + DMAMux - DMA request generator channel x + control register + 0x11C + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RGSR + RGSR + DMAMux - DMA request generator status + register + 0x140 + 0x20 + read-only + 0x00000000 + + + OF + Trigger event overrun flag The flag is + set when a trigger event occurs on DMA request + generator channel x, while the DMA request generator + counter value is lower than GNBREQ. The flag is + cleared by writing 1 to the corresponding COFx bit in + DMAMUX_RGCFR register. + 0 + 8 + + + + + RGCFR + RGCFR + DMAMux - DMA request generator clear flag + register + 0x144 + 0x20 + write-only + 0x00000000 + + + COF + Clear trigger event overrun flag Upon + setting, this bit clears the corresponding overrun + flag OFx in the DMAMUX_RGCSR register. + 0 + 8 + + + + + CSR + CSR + DMAMUX request line multiplexer interrupt + channel status register + 0x80 + 0x20 + read-only + 0x00000000 + + + SOF + Synchronization overrun event + flag + 0 + 16 + + + + + CFR + CFR + DMAMUX request line multiplexer interrupt + clear flag register + 0x84 + 0x20 + write-only + 0x00000000 + + + CSOF + Clear synchronization overrun event + flag + 0 + 16 + + + + + + + FMC + FMC + FMC + 0x52004000 + + 0x0 + 0x400 + registers + + + FMC + FMC global interrupt + 48 + + + + BCR1 + BCR1 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories. + 0x0 + 0x20 + read-write + 0x000030DB + + + MBKEN + Memory bank enable bit This bit enables + the memory bank. After reset Bank1 is enabled, all + others are disabled. Accessing a disabled bank causes + an ERROR on AXI bus. + 0 + 1 + + + MUXEN + Address/data multiplexing enable bit + When this bit is set, the address and data values are + multiplexed on the data bus, valid only with NOR and + PSRAM memories: + 1 + 1 + + + MTYP + Memory type These bits define the type + of external memory attached to the corresponding + memory bank: + 2 + 2 + + + MWID + Memory data bus width Defines the + external memory device width, valid for all type of + memories. + 4 + 2 + + + FACCEN + Flash access enable This bit enables NOR + Flash memory access operations. + 6 + 1 + + + BURSTEN + Burst enable bit This bit + enables/disables synchronous accesses during read + operations. It is valid only for synchronous memories + operating in Burst mode: + 8 + 1 + + + WAITPOL + Wait signal polarity bit This bit + defines the polarity of the wait signal from memory + used for either in synchronous or asynchronous + mode: + 9 + 1 + + + WAITCFG + Wait timing configuration The NWAIT + signal indicates whether the data from the memory are + valid or if a wait state must be inserted when + accessing the memory in synchronous mode. This + configuration bit determines if NWAIT is asserted by + the memory one clock cycle before the wait state or + during the wait state: + 11 + 1 + + + WREN + Write enable bit This bit indicates + whether write operations are enabled/disabled in the + bank by the FMC: + 12 + 1 + + + WAITEN + Wait enable bit This bit + enables/disables wait-state insertion via the NWAIT + signal when accessing the memory in synchronous + mode. + 13 + 1 + + + EXTMOD + Extended mode enable. This bit enables + the FMC to program the write timings for asynchronous + accesses inside the FMC_BWTR register, thus resulting + in different timings for read and write operations. + Note: When the extended mode is disabled, the FMC can + operate in Mode1 or Mode2 as follows: ** Mode 1 is + the default mode when the SRAM/PSRAM memory type is + selected (MTYP =0x0 or 0x01) ** Mode 2 is the default + mode when the NOR memory type is selected (MTYP = + 0x10). + 14 + 1 + + + ASYNCWAIT + Wait signal during asynchronous + transfers This bit enables/disables the FMC to use + the wait signal even during an asynchronous + protocol. + 15 + 1 + + + CPSIZE + CRAM Page Size These are used for + Cellular RAM 1.5 which does not allow burst access to + cross the address boundaries between pages. When + these bits are configured, the FMC controller splits + automatically the burst access when the memory page + size is reached (refer to memory datasheet for page + size). Other configuration: reserved. + 16 + 3 + + + CBURSTRW + Write burst enable For PSRAM (CRAM) + operating in Burst mode, the bit enables synchronous + accesses during write operations. The enable bit for + synchronous read accesses is the BURSTEN bit in the + FMC_BCRx register. + 19 + 1 + + + CCLKEN + Continuous Clock Enable This bit enables + the FMC_CLK clock output to external memory devices. + Note: The CCLKEN bit of the FMC_BCR2..4 registers is + dont care. It is only enabled through the FMC_BCR1 + register. Bank 1 must be configured in synchronous + mode to generate the FMC_CLK continuous clock. If + CCLKEN bit is set, the FMC_CLK clock ratio is + specified by CLKDIV value in the FMC_BTR1 register. + CLKDIV in FMC_BWTR1 is dont care. If the synchronous + mode is used and CCLKEN bit is set, the synchronous + memories connected to other banks than Bank 1 are + clocked by the same clock (the CLKDIV value in the + FMC_BTR2..4 and FMC_BWTR2..4 registers for other + banks has no effect.) + 20 + 1 + + + WFDIS + Write FIFO Disable This bit disables the + Write FIFO used by the FMC controller. Note: The + WFDIS bit of the FMC_BCR2..4 registers is dont care. + It is only enabled through the FMC_BCR1 + register. + 21 + 1 + + + BMAP + FMC bank mapping These bits allows + different to remap SDRAM bank2 or swap the FMC + NOR/PSRAM and SDRAM banks.Refer to Table 10 for Note: + The BMAP bits of the FMC_BCR2..4 registers are dont + care. It is only enabled through the FMC_BCR1 + register. + 24 + 2 + + + FMCEN + FMC controller Enable This bit + enables/disables the FMC controller. Note: The FMCEN + bit of the FMC_BCR2..4 registers is dont care. It is + only enabled through the FMC_BCR1 + register. + 31 + 1 + + + + + BTR1 + BTR1 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories.If the EXTMOD bit is set in the + FMC_BCRx register, then this register is partitioned for + write and read access, that is, 2 registers are + available: one to configure read accesses (this register) + and one to configure write accesses (FMC_BWTRx + registers). + 0x4 + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration These bits + are written by software to define the duration of the + address setup phase (refer to Figure81 to Figure93), + used in SRAMs, ROMs and asynchronous NOR Flash: For + each access mode address setup phase duration, please + refer to the respective figure (refer to Figure81 to + Figure93). Note: In synchronous accesses, this value + is dont care. In Muxed mode or Mode D, the minimum + value for ADDSET is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in mode D or multiplexed accesses: For each + access mode address-hold phase duration, please refer + to the respective figure (Figure81 to Figure93). + Note: In synchronous accesses, this value is not + used, the address hold phase is always 1 memory clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous accesses: For each memory type and + access mode data-phase duration, please refer to the + respective figure (Figure81 to Figure93). Example: + Mode1, write access, DATAST=1: Data-phase duration= + DATAST+1 = 2 KCK_FMC clock cycles. Note: In + synchronous accesses, this value is dont + care. + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write-to-read or read-to write transaction. The + programmed bus turnaround delay is inserted between + an asynchronous read (in muxed or mode D) or write + transaction and any other asynchronous /synchronous + read/write from/to a static bank. If a read operation + is performed, the bank can be the same or a different + one, whereas it must be different in case of write + operation to the bank, except in muxed mode or mode + D. In some cases, whatever the programmed BUSTRUN + values, the bus turnaround delay is fixed as follows: + The bus turnaround delay is not inserted between two + consecutive asynchronous write transfers to the same + static memory bank except in muxed mode and mode D. + There is a bus turnaround delay of 1 FMC clock cycle + between: Two consecutive asynchronous read transfers + to the same static memory bank except for modes muxed + and D. An asynchronous read to an asynchronous or + synchronous write to any static bank or dynamic bank + except in modes muxed and D mode. There is a bus + turnaround delay of 2 FMC clock cycle between: Two + consecutive synchronous write operations (in Burst or + Single mode) to the same bank. A synchronous write + (burst or single) access and an asynchronous write or + read transfer to or from static memory bank (the bank + can be the same or a different one in case of a read + operation. Two consecutive synchronous read + operations (in Burst or Single mode) followed by any + synchronous/asynchronous read or write from/to + another static memory bank. There is a bus turnaround + delay of 3 FMC clock cycle between: Two consecutive + synchronous write operations (in Burst or Single + mode) to different static banks. A synchronous write + access (in Burst or Single mode) and a synchronous + read from the same or a different bank. The bus + turnaround delay allows to match the minimum time + between consecutive transactions (tEHEL from NEx high + to NEx low) and the maximum time required by the + memory to free the data bus after a read access + (tEHQZ): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin and (BUSTRUN + 2)KCK_FMC period &#8805; + tEHQZmax if EXTMOD = 0 (BUSTRUN + 2)KCK_FMC period + &#8805; max (tEHELmin, tEHQZmax) if EXTMOD = 126. + ... + 16 + 4 + + + CLKDIV + Clock divide ratio (for FMC_CLK signal) + These bits define the period of FMC_CLK clock output + signal, expressed in number of KCK_FMC cycles: In + asynchronous NOR Flash, SRAM or PSRAM accesses, this + value is dont care. Note: Refer to Section20.6.5: + Synchronous transactions for FMC_CLK divider ratio + formula) + 20 + 4 + + + DATLAT + Data latency for synchronous memory For + synchronous access with read write burst mode enabled + these bits define the number of memory clock + cycles + 24 + 4 + + + ACCMOD + Access mode These bits specify the + asynchronous access modes as shown in the timing + diagrams. They are taken into account only when the + EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BCR2 + BCR2 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories. + 0x8 + 0x20 + read-write + 0x000030D2 + + + MBKEN + Memory bank enable bit This bit enables + the memory bank. After reset Bank1 is enabled, all + others are disabled. Accessing a disabled bank causes + an ERROR on AXI bus. + 0 + 1 + + + MUXEN + Address/data multiplexing enable bit + When this bit is set, the address and data values are + multiplexed on the data bus, valid only with NOR and + PSRAM memories: + 1 + 1 + + + MTYP + Memory type These bits define the type + of external memory attached to the corresponding + memory bank: + 2 + 2 + + + MWID + Memory data bus width Defines the + external memory device width, valid for all type of + memories. + 4 + 2 + + + FACCEN + Flash access enable This bit enables NOR + Flash memory access operations. + 6 + 1 + + + BURSTEN + Burst enable bit This bit + enables/disables synchronous accesses during read + operations. It is valid only for synchronous memories + operating in Burst mode: + 8 + 1 + + + WAITPOL + Wait signal polarity bit This bit + defines the polarity of the wait signal from memory + used for either in synchronous or asynchronous + mode: + 9 + 1 + + + WAITCFG + Wait timing configuration The NWAIT + signal indicates whether the data from the memory are + valid or if a wait state must be inserted when + accessing the memory in synchronous mode. This + configuration bit determines if NWAIT is asserted by + the memory one clock cycle before the wait state or + during the wait state: + 11 + 1 + + + WREN + Write enable bit This bit indicates + whether write operations are enabled/disabled in the + bank by the FMC: + 12 + 1 + + + WAITEN + Wait enable bit This bit + enables/disables wait-state insertion via the NWAIT + signal when accessing the memory in synchronous + mode. + 13 + 1 + + + EXTMOD + Extended mode enable. This bit enables + the FMC to program the write timings for asynchronous + accesses inside the FMC_BWTR register, thus resulting + in different timings for read and write operations. + Note: When the extended mode is disabled, the FMC can + operate in Mode1 or Mode2 as follows: ** Mode 1 is + the default mode when the SRAM/PSRAM memory type is + selected (MTYP =0x0 or 0x01) ** Mode 2 is the default + mode when the NOR memory type is selected (MTYP = + 0x10). + 14 + 1 + + + ASYNCWAIT + Wait signal during asynchronous + transfers This bit enables/disables the FMC to use + the wait signal even during an asynchronous + protocol. + 15 + 1 + + + CPSIZE + CRAM Page Size These are used for + Cellular RAM 1.5 which does not allow burst access to + cross the address boundaries between pages. When + these bits are configured, the FMC controller splits + automatically the burst access when the memory page + size is reached (refer to memory datasheet for page + size). Other configuration: reserved. + 16 + 3 + + + CBURSTRW + Write burst enable For PSRAM (CRAM) + operating in Burst mode, the bit enables synchronous + accesses during write operations. The enable bit for + synchronous read accesses is the BURSTEN bit in the + FMC_BCRx register. + 19 + 1 + + + CCLKEN + Continuous Clock Enable This bit enables + the FMC_CLK clock output to external memory devices. + Note: The CCLKEN bit of the FMC_BCR2..4 registers is + dont care. It is only enabled through the FMC_BCR1 + register. Bank 1 must be configured in synchronous + mode to generate the FMC_CLK continuous clock. If + CCLKEN bit is set, the FMC_CLK clock ratio is + specified by CLKDIV value in the FMC_BTR1 register. + CLKDIV in FMC_BWTR1 is dont care. If the synchronous + mode is used and CCLKEN bit is set, the synchronous + memories connected to other banks than Bank 1 are + clocked by the same clock (the CLKDIV value in the + FMC_BTR2..4 and FMC_BWTR2..4 registers for other + banks has no effect.) + 20 + 1 + + + WFDIS + Write FIFO Disable This bit disables the + Write FIFO used by the FMC controller. Note: The + WFDIS bit of the FMC_BCR2..4 registers is dont care. + It is only enabled through the FMC_BCR1 + register. + 21 + 1 + + + BMAP + FMC bank mapping These bits allows + different to remap SDRAM bank2 or swap the FMC + NOR/PSRAM and SDRAM banks.Refer to Table 10 for Note: + The BMAP bits of the FMC_BCR2..4 registers are dont + care. It is only enabled through the FMC_BCR1 + register. + 24 + 2 + + + FMCEN + FMC controller Enable This bit + enables/disables the FMC controller. Note: The FMCEN + bit of the FMC_BCR2..4 registers is dont care. It is + only enabled through the FMC_BCR1 + register. + 31 + 1 + + + + + BTR2 + BTR2 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories.If the EXTMOD bit is set in the + FMC_BCRx register, then this register is partitioned for + write and read access, that is, 2 registers are + available: one to configure read accesses (this register) + and one to configure write accesses (FMC_BWTRx + registers). + 0xC + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration These bits + are written by software to define the duration of the + address setup phase (refer to Figure81 to Figure93), + used in SRAMs, ROMs and asynchronous NOR Flash: For + each access mode address setup phase duration, please + refer to the respective figure (refer to Figure81 to + Figure93). Note: In synchronous accesses, this value + is dont care. In Muxed mode or Mode D, the minimum + value for ADDSET is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in mode D or multiplexed accesses: For each + access mode address-hold phase duration, please refer + to the respective figure (Figure81 to Figure93). + Note: In synchronous accesses, this value is not + used, the address hold phase is always 1 memory clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous accesses: For each memory type and + access mode data-phase duration, please refer to the + respective figure (Figure81 to Figure93). Example: + Mode1, write access, DATAST=1: Data-phase duration= + DATAST+1 = 2 KCK_FMC clock cycles. Note: In + synchronous accesses, this value is dont + care. + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write-to-read or read-to write transaction. The + programmed bus turnaround delay is inserted between + an asynchronous read (in muxed or mode D) or write + transaction and any other asynchronous /synchronous + read/write from/to a static bank. If a read operation + is performed, the bank can be the same or a different + one, whereas it must be different in case of write + operation to the bank, except in muxed mode or mode + D. In some cases, whatever the programmed BUSTRUN + values, the bus turnaround delay is fixed as follows: + The bus turnaround delay is not inserted between two + consecutive asynchronous write transfers to the same + static memory bank except in muxed mode and mode D. + There is a bus turnaround delay of 1 FMC clock cycle + between: Two consecutive asynchronous read transfers + to the same static memory bank except for modes muxed + and D. An asynchronous read to an asynchronous or + synchronous write to any static bank or dynamic bank + except in modes muxed and D mode. There is a bus + turnaround delay of 2 FMC clock cycle between: Two + consecutive synchronous write operations (in Burst or + Single mode) to the same bank. A synchronous write + (burst or single) access and an asynchronous write or + read transfer to or from static memory bank (the bank + can be the same or a different one in case of a read + operation. Two consecutive synchronous read + operations (in Burst or Single mode) followed by any + synchronous/asynchronous read or write from/to + another static memory bank. There is a bus turnaround + delay of 3 FMC clock cycle between: Two consecutive + synchronous write operations (in Burst or Single + mode) to different static banks. A synchronous write + access (in Burst or Single mode) and a synchronous + read from the same or a different bank. The bus + turnaround delay allows to match the minimum time + between consecutive transactions (tEHEL from NEx high + to NEx low) and the maximum time required by the + memory to free the data bus after a read access + (tEHQZ): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin and (BUSTRUN + 2)KCK_FMC period &#8805; + tEHQZmax if EXTMOD = 0 (BUSTRUN + 2)KCK_FMC period + &#8805; max (tEHELmin, tEHQZmax) if EXTMOD = 1. + ... + 16 + 4 + + + CLKDIV + Clock divide ratio (for FMC_CLK signal) + These bits define the period of FMC_CLK clock output + signal, expressed in number of KCK_FMC cycles: In + asynchronous NOR Flash, SRAM or PSRAM accesses, this + value is dont care. Note: Refer to Section20.6.5: + Synchronous transactions for FMC_CLK divider ratio + formula) + 20 + 4 + + + DATLAT + Data latency for synchronous memory For + synchronous access with read write burst mode enabled + these bits define the number of memory clock + cycles + 24 + 4 + + + ACCMOD + Access mode These bits specify the + asynchronous access modes as shown in the timing + diagrams. They are taken into account only when the + EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BCR3 + BCR3 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories. + 0x10 + 0x20 + read-write + 0x000030D2 + + + MBKEN + Memory bank enable bit This bit enables + the memory bank. After reset Bank1 is enabled, all + others are disabled. Accessing a disabled bank causes + an ERROR on AXI bus. + 0 + 1 + + + MUXEN + Address/data multiplexing enable bit + When this bit is set, the address and data values are + multiplexed on the data bus, valid only with NOR and + PSRAM memories: + 1 + 1 + + + MTYP + Memory type These bits define the type + of external memory attached to the corresponding + memory bank: + 2 + 2 + + + MWID + Memory data bus width Defines the + external memory device width, valid for all type of + memories. + 4 + 2 + + + FACCEN + Flash access enable This bit enables NOR + Flash memory access operations. + 6 + 1 + + + BURSTEN + Burst enable bit This bit + enables/disables synchronous accesses during read + operations. It is valid only for synchronous memories + operating in Burst mode: + 8 + 1 + + + WAITPOL + Wait signal polarity bit This bit + defines the polarity of the wait signal from memory + used for either in synchronous or asynchronous + mode: + 9 + 1 + + + WAITCFG + Wait timing configuration The NWAIT + signal indicates whether the data from the memory are + valid or if a wait state must be inserted when + accessing the memory in synchronous mode. This + configuration bit determines if NWAIT is asserted by + the memory one clock cycle before the wait state or + during the wait state: + 11 + 1 + + + WREN + Write enable bit This bit indicates + whether write operations are enabled/disabled in the + bank by the FMC: + 12 + 1 + + + WAITEN + Wait enable bit This bit + enables/disables wait-state insertion via the NWAIT + signal when accessing the memory in synchronous + mode. + 13 + 1 + + + EXTMOD + Extended mode enable. This bit enables + the FMC to program the write timings for asynchronous + accesses inside the FMC_BWTR register, thus resulting + in different timings for read and write operations. + Note: When the extended mode is disabled, the FMC can + operate in Mode1 or Mode2 as follows: ** Mode 1 is + the default mode when the SRAM/PSRAM memory type is + selected (MTYP =0x0 or 0x01) ** Mode 2 is the default + mode when the NOR memory type is selected (MTYP = + 0x10). + 14 + 1 + + + ASYNCWAIT + Wait signal during asynchronous + transfers This bit enables/disables the FMC to use + the wait signal even during an asynchronous + protocol. + 15 + 1 + + + CPSIZE + CRAM Page Size These are used for + Cellular RAM 1.5 which does not allow burst access to + cross the address boundaries between pages. When + these bits are configured, the FMC controller splits + automatically the burst access when the memory page + size is reached (refer to memory datasheet for page + size). Other configuration: reserved. + 16 + 3 + + + CBURSTRW + Write burst enable For PSRAM (CRAM) + operating in Burst mode, the bit enables synchronous + accesses during write operations. The enable bit for + synchronous read accesses is the BURSTEN bit in the + FMC_BCRx register. + 19 + 1 + + + CCLKEN + Continuous Clock Enable This bit enables + the FMC_CLK clock output to external memory devices. + Note: The CCLKEN bit of the FMC_BCR2..4 registers is + dont care. It is only enabled through the FMC_BCR1 + register. Bank 1 must be configured in synchronous + mode to generate the FMC_CLK continuous clock. If + CCLKEN bit is set, the FMC_CLK clock ratio is + specified by CLKDIV value in the FMC_BTR1 register. + CLKDIV in FMC_BWTR1 is dont care. If the synchronous + mode is used and CCLKEN bit is set, the synchronous + memories connected to other banks than Bank 1 are + clocked by the same clock (the CLKDIV value in the + FMC_BTR2..4 and FMC_BWTR2..4 registers for other + banks has no effect.) + 20 + 1 + + + WFDIS + Write FIFO Disable This bit disables the + Write FIFO used by the FMC controller. Note: The + WFDIS bit of the FMC_BCR2..4 registers is dont care. + It is only enabled through the FMC_BCR1 + register. + 21 + 1 + + + BMAP + FMC bank mapping These bits allows + different to remap SDRAM bank2 or swap the FMC + NOR/PSRAM and SDRAM banks.Refer to Table 10 for Note: + The BMAP bits of the FMC_BCR2..4 registers are dont + care. It is only enabled through the FMC_BCR1 + register. + 24 + 2 + + + FMCEN + FMC controller Enable This bit + enables/disables the FMC controller. Note: The FMCEN + bit of the FMC_BCR2..4 registers is dont care. It is + only enabled through the FMC_BCR1 + register. + 31 + 1 + + + + + BTR3 + BTR3 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories.If the EXTMOD bit is set in the + FMC_BCRx register, then this register is partitioned for + write and read access, that is, 2 registers are + available: one to configure read accesses (this register) + and one to configure write accesses (FMC_BWTRx + registers). + 0x14 + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration These bits + are written by software to define the duration of the + address setup phase (refer to Figure81 to Figure93), + used in SRAMs, ROMs and asynchronous NOR Flash: For + each access mode address setup phase duration, please + refer to the respective figure (refer to Figure81 to + Figure93). Note: In synchronous accesses, this value + is dont care. In Muxed mode or Mode D, the minimum + value for ADDSET is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in mode D or multiplexed accesses: For each + access mode address-hold phase duration, please refer + to the respective figure (Figure81 to Figure93). + Note: In synchronous accesses, this value is not + used, the address hold phase is always 1 memory clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous accesses: For each memory type and + access mode data-phase duration, please refer to the + respective figure (Figure81 to Figure93). Example: + Mode1, write access, DATAST=1: Data-phase duration= + DATAST+1 = 2 KCK_FMC clock cycles. Note: In + synchronous accesses, this value is dont + care. + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write-to-read or read-to write transaction. The + programmed bus turnaround delay is inserted between + an asynchronous read (in muxed or mode D) or write + transaction and any other asynchronous /synchronous + read/write from/to a static bank. If a read operation + is performed, the bank can be the same or a different + one, whereas it must be different in case of write + operation to the bank, except in muxed mode or mode + D. In some cases, whatever the programmed BUSTRUN + values, the bus turnaround delay is fixed as follows: + The bus turnaround delay is not inserted between two + consecutive asynchronous write transfers to the same + static memory bank except in muxed mode and mode D. + There is a bus turnaround delay of 1 FMC clock cycle + between: Two consecutive asynchronous read transfers + to the same static memory bank except for modes muxed + and D. An asynchronous read to an asynchronous or + synchronous write to any static bank or dynamic bank + except in modes muxed and D mode. There is a bus + turnaround delay of 2 FMC clock cycle between: Two + consecutive synchronous write operations (in Burst or + Single mode) to the same bank. A synchronous write + (burst or single) access and an asynchronous write or + read transfer to or from static memory bank (the bank + can be the same or a different one in case of a read + operation. Two consecutive synchronous read + operations (in Burst or Single mode) followed by any + synchronous/asynchronous read or write from/to + another static memory bank. There is a bus turnaround + delay of 3 FMC clock cycle between: Two consecutive + synchronous write operations (in Burst or Single + mode) to different static banks. A synchronous write + access (in Burst or Single mode) and a synchronous + read from the same or a different bank. The bus + turnaround delay allows to match the minimum time + between consecutive transactions (tEHEL from NEx high + to NEx low) and the maximum time required by the + memory to free the data bus after a read access + (tEHQZ): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin and (BUSTRUN + 2)KCK_FMC period &#8805; + tEHQZmax if EXTMOD = 0 (BUSTRUN + 2)KCK_FMC period + &#8805; max (tEHELmin, tEHQZmax) if EXTMOD =1. + ... + 16 + 4 + + + CLKDIV + Clock divide ratio (for FMC_CLK signal) + These bits define the period of FMC_CLK clock output + signal, expressed in number of KCK_FMC cycles: In + asynchronous NOR Flash, SRAM or PSRAM accesses, this + value is dont care. Note: Refer to Section20.6.5: + Synchronous transactions for FMC_CLK divider ratio + formula) + 20 + 4 + + + DATLAT + Data latency for synchronous memory For + synchronous access with read write burst mode enabled + these bits define the number of memory clock + cycles + 24 + 4 + + + ACCMOD + Access mode These bits specify the + asynchronous access modes as shown in the timing + diagrams. They are taken into account only when the + EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BCR4 + BCR4 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories. + 0x18 + 0x20 + read-write + 0x000030D2 + + + MBKEN + Memory bank enable bit This bit enables + the memory bank. After reset Bank1 is enabled, all + others are disabled. Accessing a disabled bank causes + an ERROR on AXI bus. + 0 + 1 + + + MUXEN + Address/data multiplexing enable bit + When this bit is set, the address and data values are + multiplexed on the data bus, valid only with NOR and + PSRAM memories: + 1 + 1 + + + MTYP + Memory type These bits define the type + of external memory attached to the corresponding + memory bank: + 2 + 2 + + + MWID + Memory data bus width Defines the + external memory device width, valid for all type of + memories. + 4 + 2 + + + FACCEN + Flash access enable This bit enables NOR + Flash memory access operations. + 6 + 1 + + + BURSTEN + Burst enable bit This bit + enables/disables synchronous accesses during read + operations. It is valid only for synchronous memories + operating in Burst mode: + 8 + 1 + + + WAITPOL + Wait signal polarity bit This bit + defines the polarity of the wait signal from memory + used for either in synchronous or asynchronous + mode: + 9 + 1 + + + WAITCFG + Wait timing configuration The NWAIT + signal indicates whether the data from the memory are + valid or if a wait state must be inserted when + accessing the memory in synchronous mode. This + configuration bit determines if NWAIT is asserted by + the memory one clock cycle before the wait state or + during the wait state: + 11 + 1 + + + WREN + Write enable bit This bit indicates + whether write operations are enabled/disabled in the + bank by the FMC: + 12 + 1 + + + WAITEN + Wait enable bit This bit + enables/disables wait-state insertion via the NWAIT + signal when accessing the memory in synchronous + mode. + 13 + 1 + + + EXTMOD + Extended mode enable. This bit enables + the FMC to program the write timings for asynchronous + accesses inside the FMC_BWTR register, thus resulting + in different timings for read and write operations. + Note: When the extended mode is disabled, the FMC can + operate in Mode1 or Mode2 as follows: ** Mode 1 is + the default mode when the SRAM/PSRAM memory type is + selected (MTYP =0x0 or 0x01) ** Mode 2 is the default + mode when the NOR memory type is selected (MTYP = + 0x10). + 14 + 1 + + + ASYNCWAIT + Wait signal during asynchronous + transfers This bit enables/disables the FMC to use + the wait signal even during an asynchronous + protocol. + 15 + 1 + + + CPSIZE + CRAM Page Size These are used for + Cellular RAM 1.5 which does not allow burst access to + cross the address boundaries between pages. When + these bits are configured, the FMC controller splits + automatically the burst access when the memory page + size is reached (refer to memory datasheet for page + size). Other configuration: reserved. + 16 + 3 + + + CBURSTRW + Write burst enable For PSRAM (CRAM) + operating in Burst mode, the bit enables synchronous + accesses during write operations. The enable bit for + synchronous read accesses is the BURSTEN bit in the + FMC_BCRx register. + 19 + 1 + + + CCLKEN + Continuous Clock Enable This bit enables + the FMC_CLK clock output to external memory devices. + Note: The CCLKEN bit of the FMC_BCR2..4 registers is + dont care. It is only enabled through the FMC_BCR1 + register. Bank 1 must be configured in synchronous + mode to generate the FMC_CLK continuous clock. If + CCLKEN bit is set, the FMC_CLK clock ratio is + specified by CLKDIV value in the FMC_BTR1 register. + CLKDIV in FMC_BWTR1 is dont care. If the synchronous + mode is used and CCLKEN bit is set, the synchronous + memories connected to other banks than Bank 1 are + clocked by the same clock (the CLKDIV value in the + FMC_BTR2..4 and FMC_BWTR2..4 registers for other + banks has no effect.) + 20 + 1 + + + WFDIS + Write FIFO Disable This bit disables the + Write FIFO used by the FMC controller. Note: The + WFDIS bit of the FMC_BCR2..4 registers is dont care. + It is only enabled through the FMC_BCR1 + register. + 21 + 1 + + + BMAP + FMC bank mapping These bits allows + different to remap SDRAM bank2 or swap the FMC + NOR/PSRAM and SDRAM banks.Refer to Table 10 for Note: + The BMAP bits of the FMC_BCR2..4 registers are dont + care. It is only enabled through the FMC_BCR1 + register. + 24 + 2 + + + FMCEN + FMC controller Enable This bit + enables/disables the FMC controller. Note: The FMCEN + bit of the FMC_BCR2..4 registers is dont care. It is + only enabled through the FMC_BCR1 + register. + 31 + 1 + + + + + BTR4 + BTR4 + This register contains the control + information of each memory bank, used for SRAMs, PSRAM + and NOR Flash memories.If the EXTMOD bit is set in the + FMC_BCRx register, then this register is partitioned for + write and read access, that is, 2 registers are + available: one to configure read accesses (this register) + and one to configure write accesses (FMC_BWTRx + registers). + 0x1C + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration These bits + are written by software to define the duration of the + address setup phase (refer to Figure81 to Figure93), + used in SRAMs, ROMs and asynchronous NOR Flash: For + each access mode address setup phase duration, please + refer to the respective figure (refer to Figure81 to + Figure93). Note: In synchronous accesses, this value + is dont care. In Muxed mode or Mode D, the minimum + value for ADDSET is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in mode D or multiplexed accesses: For each + access mode address-hold phase duration, please refer + to the respective figure (Figure81 to Figure93). + Note: In synchronous accesses, this value is not + used, the address hold phase is always 1 memory clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous accesses: For each memory type and + access mode data-phase duration, please refer to the + respective figure (Figure81 to Figure93). Example: + Mode1, write access, DATAST=1: Data-phase duration= + DATAST+1 = 2 KCK_FMC clock cycles. Note: In + synchronous accesses, this value is dont + care. + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write-to-read or read-to write transaction. The + programmed bus turnaround delay is inserted between + an asynchronous read (in muxed or mode D) or write + transaction and any other asynchronous /synchronous + read/write from/to a static bank. If a read operation + is performed, the bank can be the same or a different + one, whereas it must be different in case of write + operation to the bank, except in muxed mode or mode + D. In some cases, whatever the programmed BUSTRUN + values, the bus turnaround delay is fixed as follows: + The bus turnaround delay is not inserted between two + consecutive asynchronous write transfers to the same + static memory bank except in muxed mode and mode D. + There is a bus turnaround delay of 1 FMC clock cycle + between: Two consecutive asynchronous read transfers + to the same static memory bank except for modes muxed + and D. An asynchronous read to an asynchronous or + synchronous write to any static bank or dynamic bank + except in modes muxed and D mode. There is a bus + turnaround delay of 2 FMC clock cycle between: Two + consecutive synchronous write operations (in Burst or + Single mode) to the same bank. A synchronous write + (burst or single) access and an asynchronous write or + read transfer to or from static memory bank (the bank + can be the same or a different one in case of a read + operation. Two consecutive synchronous read + operations (in Burst or Single mode) followed by any + synchronous/asynchronous read or write from/to + another static memory bank. There is a bus turnaround + delay of 3 FMC clock cycle between: Two consecutive + synchronous write operations (in Burst or Single + mode) to different static banks. A synchronous write + access (in Burst or Single mode) and a synchronous + read from the same or a different bank. The bus + turnaround delay allows to match the minimum time + between consecutive transactions (tEHEL from NEx high + to NEx low) and the maximum time required by the + memory to free the data bus after a read access + (tEHQZ): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin and (BUSTRUN + 2)KCK_FMC period &#8805; + tEHQZmax if EXTMOD = 0 (BUSTRUN + 2)KCK_FMC period + &#8805; max (tEHELmin, tEHQZmax) if EXTMOD =1. + ... + 16 + 4 + + + CLKDIV + Clock divide ratio (for FMC_CLK signal) + These bits define the period of FMC_CLK clock output + signal, expressed in number of KCK_FMC cycles: In + asynchronous NOR Flash, SRAM or PSRAM accesses, this + value is dont care. Note: Refer to Section20.6.5: + Synchronous transactions for FMC_CLK divider ratio + formula) + 20 + 4 + + + DATLAT + Data latency for synchronous memory For + synchronous access with read write burst mode enabled + these bits define the number of memory clock + cycles + 24 + 4 + + + ACCMOD + Access mode These bits specify the + asynchronous access modes as shown in the timing + diagrams. They are taken into account only when the + EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + PCR + PCR + NAND Flash control registers + 0x80 + 0x20 + read-write + 0x00000018 + + + PWAITEN + Wait feature enable bit. This bit + enables the Wait feature for the NAND Flash memory + bank: + 1 + 1 + + + PBKEN + NAND Flash memory bank enable bit. This + bit enables the memory bank. Accessing a disabled + memory bank causes an ERROR on AXI bus + 2 + 1 + + + PWID + Data bus width. These bits define the + external memory device width. + 4 + 2 + + + ECCEN + ECC computation logic enable + bit + 6 + 1 + + + TCLR + CLE to RE delay. These bits set time + from CLE low to RE low in number of KCK_FMC clock + cycles. The time is give by the following formula: + t_clr = (TCLR + SET + 2) TKCK_FMC where TKCK_FMC is + the KCK_FMC clock period Note: Set is MEMSET or + ATTSET according to the addressed + space. + 9 + 4 + + + TAR + ALE to RE delay. These bits set time + from ALE low to RE low in number of KCK_FMC clock + cycles. Time is: t_ar = (TAR + SET + 2) TKCK_FMC + where TKCK_FMC is the FMC clock period Note: Set is + MEMSET or ATTSET according to the addressed + space. + 13 + 4 + + + ECCPS + ECC page size. These bits define the + page size for the extended ECC: + 17 + 3 + + + + + SR + SR + This register contains information about the + FIFO status and interrupt. The FMC features a FIFO that + is used when writing to memories to transfer up to 16 + words of data.This is used to quickly write to the FIFO + and free the AXI bus for transactions to peripherals + other than the FMC, while the FMC is draining its FIFO + into the memory. One of these register bits indicates the + status of the FIFO, for ECC purposes.The ECC is + calculated while the data are written to the memory. To + read the correct ECC, the software must consequently wait + until the FIFO is empty. + 0x84 + 0x20 + 0x00000040 + + + IRS + Interrupt rising edge status The flag is + set by hardware and reset by software. Note: If this + bit is written by software to 1 it will be + set. + 0 + 1 + read-write + + + ILS + Interrupt high-level status The flag is + set by hardware and reset by software. + 1 + 1 + read-write + + + IFS + Interrupt falling edge status The flag + is set by hardware and reset by software. Note: If + this bit is written by software to 1 it will be + set. + 2 + 1 + read-write + + + IREN + Interrupt rising edge detection enable + bit + 3 + 1 + read-write + + + ILEN + Interrupt high-level detection enable + bit + 4 + 1 + read-write + + + IFEN + Interrupt falling edge detection enable + bit + 5 + 1 + read-write + + + FEMPT + FIFO empty. Read-only bit that provides + the status of the FIFO + 6 + 1 + read-only + + + + + PMEM + PMEM + The FMC_PMEM read/write register contains + the timing information for NAND Flash memory bank. This + information is used to access either the common memory + space of the NAND Flash for command, address write access + and data read/write access. + 0x88 + 0x20 + read-write + 0xFCFCFCFC + + + MEMSET + Common memory x setup time These bits + define the number of KCK_FMC (+1) clock cycles to set + up the address before the command assertion (NWE, + NOE), for NAND Flash read or write access to common + memory space: + 0 + 8 + + + MEMWAIT + Common memory wait time These bits + define the minimum number of KCK_FMC (+1) clock + cycles to assert the command (NWE, NOE), for NAND + Flash read or write access to common memory space. + The duration of command assertion is extended if the + wait signal (NWAIT) is active (low) at the end of the + programmed value of KCK_FMC: + 8 + 8 + + + MEMHOLD + Common memory hold time These bits + define the number of KCK_FMC clock cycles for write + accesses and KCK_FMC+1 clock cycles for read accesses + during which the address is held (and data for write + accesses) after the command is de-asserted (NWE, + NOE), for NAND Flash read or write access to common + memory space: + 16 + 8 + + + MEMHIZ + Common memory x data bus Hi-Z time These + bits define the number of KCK_FMC clock cycles during + which the data bus is kept Hi-Z after the start of a + NAND Flash write access to common memory space. This + is only valid for write transactions: + 24 + 8 + + + + + PATT + PATT + The FMC_PATT read/write register contains + the timing information for NAND Flash memory bank. It is + used for 8-bit accesses to the attribute memory space of + the NAND Flash for the last address write access if the + timing must differ from that of previous accesses (for + Ready/Busy management, refer to Section20.8.5: NAND Flash + prewait feature). + 0x8C + 0x20 + read-write + 0xFCFCFCFC + + + ATTSET + Attribute memory setup time These bits + define the number of KCK_FMC (+1) clock cycles to set + up address before the command assertion (NWE, NOE), + for NAND Flash read or write access to attribute + memory space: + 0 + 8 + + + ATTWAIT + Attribute memory wait time These bits + define the minimum number of x KCK_FMC (+1) clock + cycles to assert the command (NWE, NOE), for NAND + Flash read or write access to attribute memory space. + The duration for command assertion is extended if the + wait signal (NWAIT) is active (low) at the end of the + programmed value of KCK_FMC: + 8 + 8 + + + ATTHOLD + Attribute memory hold time These bits + define the number of KCK_FMC clock cycles during + which the address is held (and data for write access) + after the command de-assertion (NWE, NOE), for NAND + Flash read or write access to attribute memory + space: + 16 + 8 + + + ATTHIZ + Attribute memory data bus Hi-Z time + These bits define the number of KCK_FMC clock cycles + during which the data bus is kept in Hi-Z after the + start of a NAND Flash write access to attribute + memory space on socket. Only valid for writ + transaction: + 24 + 8 + + + + + ECCR + ECCR + This register contain the current error + correction code value computed by the ECC computation + modules of the FMC NAND controller. When the CPU + reads/writes the data from a NAND Flash memory page at + the correct address (refer to Section20.8.6: Computation + of the error correction code (ECC) in NAND Flash memory), + the data read/written from/to the NAND Flash memory are + processed automatically by the ECC computation module. + When X bytes have been read (according to the ECCPS field + in the FMC_PCR registers), the CPU must read the computed + ECC value from the FMC_ECC registers. It then verifies if + these computed parity data are the same as the parity + value recorded in the spare area, to determine whether a + page is valid, and, to correct it otherwise. The FMC_ECCR + register should be cleared after being read by setting + the ECCEN bit to 0. To compute a new data block, the + ECCEN bit must be set to 1. + 0x94 + 0x20 + read-only + 0x00000000 + + + ECC + ECC result This field contains the value + computed by the ECC computation logic. Table167 + describes the contents of these bit + fields. + 0 + 32 + + + + + BWTR1 + BWTR1 + This register contains the control + information of each memory bank. It is used for SRAMs, + PSRAMs and NOR Flash memories. When the EXTMOD bit is set + in the FMC_BCRx register, then this register is active + for write access. + 0x104 + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration. These bits + are written by software to define the duration of the + address setup phase in KCK_FMC cycles (refer to + Figure81 to Figure93), used in asynchronous accesses: + ... Note: In synchronous accesses, this value is not + used, the address setup phase is always 1 Flash clock + period duration. In muxed mode, the minimum ADDSET + value is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration. These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in asynchronous multiplexed accesses: ... Note: + In synchronous NOR Flash accesses, this value is not + used, the address hold phase is always 1 Flash clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration. These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous SRAM, PSRAM and NOR Flash memory + accesses: + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write transaction to match the minimum time between + consecutive transactions (tEHEL from ENx high to ENx + low): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin. The programmed bus turnaround delay is + inserted between a an asynchronous write transfer and + any other asynchronous /synchronous read or write + transfer to or from a static bank. If a read + operation is performed, the bank can be the same or a + different one, whereas it must be different in case + of write operation to the bank, except in muxed mode + or mode D. In some cases, whatever the programmed + BUSTRUN values, the bus turnaround delay is fixed as + follows: The bus turnaround delay is not inserted + between two consecutive asynchronous write transfers + to the same static memory bank except for muxed mode + and mode D. There is a bus turnaround delay of 2 FMC + clock cycle between: Two consecutive synchronous + write operations (in Burst or Single mode) to the + same bank A synchronous write transfer ((in Burst or + Single mode) and an asynchronous write or read + transfer to or from static memory bank. There is a + bus turnaround delay of 3 FMC clock cycle between: + Two consecutive synchronous write operations (in + Burst or Single mode) to different static banks. A + synchronous write transfer (in Burst or Single mode) + and a synchronous read from the same or a different + bank. ... + 16 + 4 + + + ACCMOD + Access mode. These bits specify the + asynchronous access modes as shown in the next timing + diagrams.These bits are taken into account only when + the EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BWTR2 + BWTR2 + This register contains the control + information of each memory bank. It is used for SRAMs, + PSRAMs and NOR Flash memories. When the EXTMOD bit is set + in the FMC_BCRx register, then this register is active + for write access. + 0x10C + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration. These bits + are written by software to define the duration of the + address setup phase in KCK_FMC cycles (refer to + Figure81 to Figure93), used in asynchronous accesses: + ... Note: In synchronous accesses, this value is not + used, the address setup phase is always 1 Flash clock + period duration. In muxed mode, the minimum ADDSET + value is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration. These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in asynchronous multiplexed accesses: ... Note: + In synchronous NOR Flash accesses, this value is not + used, the address hold phase is always 1 Flash clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration. These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous SRAM, PSRAM and NOR Flash memory + accesses: + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write transaction to match the minimum time between + consecutive transactions (tEHEL from ENx high to ENx + low): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin. The programmed bus turnaround delay is + inserted between a an asynchronous write transfer and + any other asynchronous /synchronous read or write + transfer to or from a static bank. If a read + operation is performed, the bank can be the same or a + different one, whereas it must be different in case + of write operation to the bank, except in muxed mode + or mode D. In some cases, whatever the programmed + BUSTRUN values, the bus turnaround delay is fixed as + follows: The bus turnaround delay is not inserted + between two consecutive asynchronous write transfers + to the same static memory bank except for muxed mode + and mode D. There is a bus turnaround delay of 2 FMC + clock cycle between: Two consecutive synchronous + write operations (in Burst or Single mode) to the + same bank A synchronous write transfer ((in Burst or + Single mode) and an asynchronous write or read + transfer to or from static memory bank. There is a + bus turnaround delay of 3 FMC clock cycle between: + Two consecutive synchronous write operations (in + Burst or Single mode) to different static banks. A + synchronous write transfer (in Burst or Single mode) + and a synchronous read from the same or a different + bank. ... + 16 + 4 + + + ACCMOD + Access mode. These bits specify the + asynchronous access modes as shown in the next timing + diagrams.These bits are taken into account only when + the EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BWTR3 + BWTR3 + This register contains the control + information of each memory bank. It is used for SRAMs, + PSRAMs and NOR Flash memories. When the EXTMOD bit is set + in the FMC_BCRx register, then this register is active + for write access. + 0x114 + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration. These bits + are written by software to define the duration of the + address setup phase in KCK_FMC cycles (refer to + Figure81 to Figure93), used in asynchronous accesses: + ... Note: In synchronous accesses, this value is not + used, the address setup phase is always 1 Flash clock + period duration. In muxed mode, the minimum ADDSET + value is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration. These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in asynchronous multiplexed accesses: ... Note: + In synchronous NOR Flash accesses, this value is not + used, the address hold phase is always 1 Flash clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration. These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous SRAM, PSRAM and NOR Flash memory + accesses: + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write transaction to match the minimum time between + consecutive transactions (tEHEL from ENx high to ENx + low): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin. The programmed bus turnaround delay is + inserted between a an asynchronous write transfer and + any other asynchronous /synchronous read or write + transfer to or from a static bank. If a read + operation is performed, the bank can be the same or a + different one, whereas it must be different in case + of write operation to the bank, except in muxed mode + or mode D. In some cases, whatever the programmed + BUSTRUN values, the bus turnaround delay is fixed as + follows: The bus turnaround delay is not inserted + between two consecutive asynchronous write transfers + to the same static memory bank except for muxed mode + and mode D. There is a bus turnaround delay of 2 FMC + clock cycle between: Two consecutive synchronous + write operations (in Burst or Single mode) to the + same bank A synchronous write transfer ((in Burst or + Single mode) and an asynchronous write or read + transfer to or from static memory bank. There is a + bus turnaround delay of 3 FMC clock cycle between: + Two consecutive synchronous write operations (in + Burst or Single mode) to different static banks. A + synchronous write transfer (in Burst or Single mode) + and a synchronous read from the same or a different + bank. ... + 16 + 4 + + + ACCMOD + Access mode. These bits specify the + asynchronous access modes as shown in the next timing + diagrams.These bits are taken into account only when + the EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + BWTR4 + BWTR4 + This register contains the control + information of each memory bank. It is used for SRAMs, + PSRAMs and NOR Flash memories. When the EXTMOD bit is set + in the FMC_BCRx register, then this register is active + for write access. + 0x11C + 0x20 + read-write + 0x0FFFFFFF + + + ADDSET + Address setup phase duration. These bits + are written by software to define the duration of the + address setup phase in KCK_FMC cycles (refer to + Figure81 to Figure93), used in asynchronous accesses: + ... Note: In synchronous accesses, this value is not + used, the address setup phase is always 1 Flash clock + period duration. In muxed mode, the minimum ADDSET + value is 1. + 0 + 4 + + + ADDHLD + Address-hold phase duration. These bits + are written by software to define the duration of the + address hold phase (refer to Figure81 to Figure93), + used in asynchronous multiplexed accesses: ... Note: + In synchronous NOR Flash accesses, this value is not + used, the address hold phase is always 1 Flash clock + period duration. + 4 + 4 + + + DATAST + Data-phase duration. These bits are + written by software to define the duration of the + data phase (refer to Figure81 to Figure93), used in + asynchronous SRAM, PSRAM and NOR Flash memory + accesses: + 8 + 8 + + + BUSTURN + Bus turnaround phase duration These bits + are written by software to add a delay at the end of + a write transaction to match the minimum time between + consecutive transactions (tEHEL from ENx high to ENx + low): (BUSTRUN + 1) KCK_FMC period &#8805; + tEHELmin. The programmed bus turnaround delay is + inserted between a an asynchronous write transfer and + any other asynchronous /synchronous read or write + transfer to or from a static bank. If a read + operation is performed, the bank can be the same or a + different one, whereas it must be different in case + of write operation to the bank, except in muxed mode + or mode D. In some cases, whatever the programmed + BUSTRUN values, the bus turnaround delay is fixed as + follows: The bus turnaround delay is not inserted + between two consecutive asynchronous write transfers + to the same static memory bank except for muxed mode + and mode D. There is a bus turnaround delay of 2 FMC + clock cycle between: Two consecutive synchronous + write operations (in Burst or Single mode) to the + same bank A synchronous write transfer ((in Burst or + Single mode) and an asynchronous write or read + transfer to or from static memory bank. There is a + bus turnaround delay of 3 FMC clock cycle between: + Two consecutive synchronous write operations (in + Burst or Single mode) to different static banks. A + synchronous write transfer (in Burst or Single mode) + and a synchronous read from the same or a different + bank. ... + 16 + 4 + + + ACCMOD + Access mode. These bits specify the + asynchronous access modes as shown in the next timing + diagrams.These bits are taken into account only when + the EXTMOD bit in the FMC_BCRx register is + 1. + 28 + 2 + + + + + SDCR1 + SDCR1 + This register contains the control + parameters for each SDRAM memory bank + 0x140 + 0x20 + read-write + 0x000002D0 + + + NC + Number of column address bits These bits + define the number of bits of a column + address. + 0 + 2 + + + NR + Number of row address bits These bits + define the number of bits of a row + address. + 2 + 2 + + + MWID + Memory data bus width. These bits define + the memory device width. + 4 + 2 + + + NB + Number of internal banks This bit sets + the number of internal banks. + 6 + 1 + + + CAS + CAS Latency This bits sets the SDRAM CAS + latency in number of memory clock + cycles + 7 + 2 + + + WP + Write protection This bit enables write + mode access to the SDRAM bank. + 9 + 1 + + + SDCLK + SDRAM clock configuration These bits + define the SDRAM clock period for both SDRAM banks + and allow disabling the clock before changing the + frequency. In this case the SDRAM must be + re-initialized. Note: The corresponding bits in the + FMC_SDCR2 register is read only. + 10 + 2 + + + RBURST + Burst read This bit enables burst read + mode. The SDRAM controller anticipates the next read + commands during the CAS latency and stores data in + the Read FIFO. Note: The corresponding bit in the + FMC_SDCR2 register is read only. + 12 + 1 + + + RPIPE + Read pipe These bits define the delay, + in KCK_FMC clock cycles, for reading data after CAS + latency. Note: The corresponding bits in the + FMC_SDCR2 register is read only. + 13 + 2 + + + + + SDCR2 + SDCR2 + This register contains the control + parameters for each SDRAM memory bank + 0x144 + 0x20 + read-write + 0x000002D0 + + + NC + Number of column address bits These bits + define the number of bits of a column + address. + 0 + 2 + + + NR + Number of row address bits These bits + define the number of bits of a row + address. + 2 + 2 + + + MWID + Memory data bus width. These bits define + the memory device width. + 4 + 2 + + + NB + Number of internal banks This bit sets + the number of internal banks. + 6 + 1 + + + CAS + CAS Latency This bits sets the SDRAM CAS + latency in number of memory clock + cycles + 7 + 2 + + + WP + Write protection This bit enables write + mode access to the SDRAM bank. + 9 + 1 + + + SDCLK + SDRAM clock configuration These bits + define the SDRAM clock period for both SDRAM banks + and allow disabling the clock before changing the + frequency. In this case the SDRAM must be + re-initialized. Note: The corresponding bits in the + FMC_SDCR2 register is read only. + 10 + 2 + + + RBURST + Burst read This bit enables burst read + mode. The SDRAM controller anticipates the next read + commands during the CAS latency and stores data in + the Read FIFO. Note: The corresponding bit in the + FMC_SDCR2 register is read only. + 12 + 1 + + + RPIPE + Read pipe These bits define the delay, + in KCK_FMC clock cycles, for reading data after CAS + latency. Note: The corresponding bits in the + FMC_SDCR2 register is read only. + 13 + 2 + + + + + SDTR1 + SDTR1 + This register contains the timing parameters + of each SDRAM bank + 0x148 + 0x20 + read-write + 0x0FFFFFFF + + + TMRD + Load Mode Register to Active These bits + define the delay between a Load Mode Register command + and an Active or Refresh command in number of memory + clock cycles. .... + 0 + 4 + + + TXSR + Exit Self-refresh delay These bits + define the delay from releasing the Self-refresh + command to issuing the Activate command in number of + memory clock cycles. .... Note: If two SDRAM devices + are used, the FMC_SDTR1 and FMC_SDTR2 must be + programmed with the same TXSR timing corresponding to + the slowest SDRAM device. + 4 + 4 + + + TRAS + Self refresh time These bits define the + minimum Self-refresh period in number of memory clock + cycles. .... + 8 + 4 + + + TRC + Row cycle delay These bits define the + delay between the Refresh command and the Activate + command, as well as the delay between two consecutive + Refresh commands. It is expressed in number of memory + clock cycles. The TRC timing is only configured in + the FMC_SDTR1 register. If two SDRAM devices are + used, the TRC must be programmed with the timings of + the slowest device. .... Note: TRC must match the TRC + and TRFC (Auto Refresh period) timings defined in the + SDRAM device datasheet. Note: The corresponding bits + in the FMC_SDTR2 register are dont + care. + 12 + 4 + + + TWR + Recovery delay These bits define the + delay between a Write and a Precharge command in + number of memory clock cycles. .... Note: TWR must be + programmed to match the write recovery time (tWR) + defined in the SDRAM datasheet, and to guarantee + that: TWR &#8805; TRAS - TRCD and TWR + &#8805;TRC - TRCD - TRP Example: TRAS= 4 cycles, + TRCD= 2 cycles. So, TWR &gt;= 2 cycles. TWR must + be programmed to 0x1. If two SDRAM devices are used, + the FMC_SDTR1 and FMC_SDTR2 must be programmed with + the same TWR timing corresponding to the slowest + SDRAM device. + 16 + 4 + + + TRP + Row precharge delay These bits define + the delay between a Precharge command and another + command in number of memory clock cycles. The TRP + timing is only configured in the FMC_SDTR1 register. + If two SDRAM devices are used, the TRP must be + programmed with the timing of the slowest device. + .... Note: The corresponding bits in the FMC_SDTR2 + register are dont care. + 20 + 4 + + + TRCD + Row to column delay These bits define + the delay between the Activate command and a + Read/Write command in number of memory clock cycles. + .... + 24 + 4 + + + + + SDTR2 + SDTR2 + This register contains the timing parameters + of each SDRAM bank + 0x14C + 0x20 + read-write + 0x0FFFFFFF + + + TMRD + Load Mode Register to Active These bits + define the delay between a Load Mode Register command + and an Active or Refresh command in number of memory + clock cycles. .... + 0 + 4 + + + TXSR + Exit Self-refresh delay These bits + define the delay from releasing the Self-refresh + command to issuing the Activate command in number of + memory clock cycles. .... Note: If two SDRAM devices + are used, the FMC_SDTR1 and FMC_SDTR2 must be + programmed with the same TXSR timing corresponding to + the slowest SDRAM device. + 4 + 4 + + + TRAS + Self refresh time These bits define the + minimum Self-refresh period in number of memory clock + cycles. .... + 8 + 4 + + + TRC + Row cycle delay These bits define the + delay between the Refresh command and the Activate + command, as well as the delay between two consecutive + Refresh commands. It is expressed in number of memory + clock cycles. The TRC timing is only configured in + the FMC_SDTR1 register. If two SDRAM devices are + used, the TRC must be programmed with the timings of + the slowest device. .... Note: TRC must match the TRC + and TRFC (Auto Refresh period) timings defined in the + SDRAM device datasheet. Note: The corresponding bits + in the FMC_SDTR2 register are dont + care. + 12 + 4 + + + TWR + Recovery delay These bits define the + delay between a Write and a Precharge command in + number of memory clock cycles. .... Note: TWR must be + programmed to match the write recovery time (tWR) + defined in the SDRAM datasheet, and to guarantee + that: TWR &#8805; TRAS - TRCD and TWR + &#8805;TRC - TRCD - TRP Example: TRAS= 4 cycles, + TRCD= 2 cycles. So, TWR &gt;= 2 cycles. TWR must + be programmed to 0x1. If two SDRAM devices are used, + the FMC_SDTR1 and FMC_SDTR2 must be programmed with + the same TWR timing corresponding to the slowest + SDRAM device. + 16 + 4 + + + TRP + Row precharge delay These bits define + the delay between a Precharge command and another + command in number of memory clock cycles. The TRP + timing is only configured in the FMC_SDTR1 register. + If two SDRAM devices are used, the TRP must be + programmed with the timing of the slowest device. + .... Note: The corresponding bits in the FMC_SDTR2 + register are dont care. + 20 + 4 + + + TRCD + Row to column delay These bits define + the delay between the Activate command and a + Read/Write command in number of memory clock cycles. + .... + 24 + 4 + + + + + SDCMR + SDCMR + This register contains the command issued + when the SDRAM device is accessed. This register is used + to initialize the SDRAM device, and to activate the + Self-refresh and the Power-down modes. As soon as the + MODE field is written, the command will be issued only to + one or to both SDRAM banks according to CTB1 and CTB2 + command bits. This register is the same for both SDRAM + banks. + 0x150 + 0x20 + read-write + 0x00000000 + + + MODE + Command mode These bits define the + command issued to the SDRAM device. Note: When a + command is issued, at least one Command Target Bank + bit ( CTB1 or CTB2) must be set otherwise the command + will be ignored. Note: If two SDRAM banks are used, + the Auto-refresh and PALL command must be issued + simultaneously to the two devices with CTB1 and CTB2 + bits set otherwise the command will be ignored. Note: + If only one SDRAM bank is used and a command is + issued with its associated CTB bit set, the other CTB + bit of the unused bank must be kept to + 0. + 0 + 3 + + + CTB2 + Command Target Bank 2 This bit indicates + whether the command will be issued to SDRAM Bank 2 or + not. + 3 + 1 + + + CTB1 + Command Target Bank 1 This bit indicates + whether the command will be issued to SDRAM Bank 1 or + not. + 4 + 1 + + + NRFS + Number of Auto-refresh These bits define + the number of consecutive Auto-refresh commands + issued when MODE = 011. .... + 5 + 4 + + + MRD + Mode Register definition This 14-bit + field defines the SDRAM Mode Register content. The + Mode Register is programmed using the Load Mode + Register command. The MRD[13:0] bits are also used to + program the extended mode register for mobile + SDRAM. + 9 + 14 + + + + + SDRTR + SDRTR + This register sets the refresh rate in + number of SDCLK clock cycles between the refresh cycles + by configuring the Refresh Timer Count value.Examplewhere + 64 ms is the SDRAM refresh period.The refresh rate must + be increased by 20 SDRAM clock cycles (as in the above + example) to obtain a safe margin if an internal refresh + request occurs when a read request has been accepted. It + corresponds to a COUNT value of 0000111000000 (448). This + 13-bit field is loaded into a timer which is decremented + using the SDRAM clock. This timer generates a refresh + pulse when zero is reached. The COUNT value must be set + at least to 41 SDRAM clock cycles.As soon as the + FMC_SDRTR register is programmed, the timer starts + counting. If the value programmed in the register is 0, + no refresh is carried out. This register must not be + reprogrammed after the initialization procedure to avoid + modifying the refresh rate.Each time a refresh pulse is + generated, this 13-bit COUNT field is reloaded into the + counter.If a memory access is in progress, the + Auto-refresh request is delayed. However, if the memory + access and Auto-refresh requests are generated + simultaneously, the Auto-refresh takes precedence. If the + memory access occurs during a refresh operation, the + request is buffered to be processed when the refresh is + complete.This register is common to SDRAM bank 1 and bank + 2. + 0x154 + 0x20 + 0x00000000 + + + CRE + Clear Refresh error flag This bit is + used to clear the Refresh Error Flag (RE) in the + Status Register. + 0 + 1 + write-only + + + COUNT + Refresh Timer Count This 13-bit field + defines the refresh rate of the SDRAM device. It is + expressed in number of memory clock cycles. It must + be set at least to 41 SDRAM clock cycles (0x29). + Refresh rate = (COUNT + 1) x SDRAM frequency clock + COUNT = (SDRAM refresh period / Number of rows) - + 20 + 1 + 13 + read-write + + + REIE + RES Interrupt Enable + 14 + 1 + read-write + + + + + SDSR + SDSR + SDRAM Status register + 0x158 + 0x20 + read-only + 0x00000000 + + + RE + Refresh error flag An interrupt is + generated if REIE = 1 and RE = 1 + 0 + 1 + + + MODES1 + Status Mode for Bank 1 These bits define + the Status Mode of SDRAM Bank 1. + 1 + 2 + + + MODES2 + Status Mode for Bank 2 These bits define + the Status Mode of SDRAM Bank 2. + 3 + 2 + + + + + + + CEC + CEC + CEC + 0x40006C00 + + 0x0 + 0x400 + registers + + + CEC + HDMI-CEC global interrupt + 94 + + + + CR + CR + CEC control register + 0x0 + 0x20 + read-write + 0x00000000 + + + CECEN + CEC Enable The CECEN bit is set and + cleared by software. CECEN=1 starts message reception + and enables the TXSOM control. CECEN=0 disables the + CEC peripheral, clears all bits of CEC_CR register + and aborts any on-going reception or + transmission. + 0 + 1 + + + TXSOM + Tx Start Of Message TXSOM is set by + software to command transmission of the first byte of + a CEC message. If the CEC message consists of only + one byte, TXEOM must be set before of TXSOM. + Start-Bit is effectively started on the CEC line + after SFT is counted. If TXSOM is set while a message + reception is ongoing, transmission will start after + the end of reception. TXSOM is cleared by hardware + after the last byte of the message is sent with a + positive acknowledge (TXEND=1), in case of + transmission underrun (TXUDR=1), negative acknowledge + (TXACKE=1), and transmission error (TXERR=1). It is + also cleared by CECEN=0. It is not cleared and + transmission is automatically retried in case of + arbitration lost (ARBLST=1). TXSOM can be also used + as a status bit informing application whether any + transmission request is pending or under execution. + The application can abort a transmission request at + any time by clearing the CECEN bit. Note: TXSOM must + be set when CECEN=1 TXSOM must be set when + transmission data is available into TXDR HEADERs + first four bits containing own peripheral address are + taken from TXDR[7:4], not from CEC_CFGR.OAR which is + used only for reception + 1 + 1 + + + TXEOM + Tx End Of Message The TXEOM bit is set + by software to command transmission of the last byte + of a CEC message. TXEOM is cleared by hardware at the + same time and under the same conditions as for TXSOM. + Note: TXEOM must be set when CECEN=1 TXEOM must be + set before writing transmission data to TXDR If TXEOM + is set when TXSOM=0, transmitted message will consist + of 1 byte (HEADER) only (PING message) + 2 + 1 + + + + + CFGR + CFGR + This register is used to configure the + HDMI-CEC controller. It is mandatory to write CEC_CFGR + only when CECEN=0. + 0x4 + 0x20 + read-write + 0x00000000 + + + SFT + Signal Free Time SFT bits are set by + software. In the SFT=0x0 configuration the number of + nominal data bit periods waited before transmission + is ruled by hardware according to the transmission + history. In all the other configurations the SFT + number is determined by software. * 0x0 ** 2.5 + Data-Bit periods if CEC is the last bus initiator + with unsuccessful transmission (ARBLST=1, TXERR=1, + TXUDR=1 or TXACKE= 1) ** 4 Data-Bit periods if CEC is + the new bus initiator ** 6 Data-Bit periods if CEC is + the last bus initiator with successful transmission + (TXEOM=1) * 0x1: 0.5 nominal data bit periods * 0x2: + 1.5 nominal data bit periods * 0x3: 2.5 nominal data + bit periods * 0x4: 3.5 nominal data bit periods * + 0x5: 4.5 nominal data bit periods * 0x6: 5.5 nominal + data bit periods * 0x7: 6.5 nominal data bit + periods + 0 + 3 + + + RXTOL + Rx-Tolerance The RXTOL bit is set and + cleared by software. ** Start-Bit, +/- 200 s rise, + +/- 200 s fall. ** Data-Bit: +/- 200 s rise. +/- 350 + s fall. ** Start-Bit: +/- 400 s rise, +/- 400 s fall + ** Data-Bit: +/-300 s rise, +/- 500 s + fall + 3 + 1 + + + BRESTP + Rx-Stop on Bit Rising Error The BRESTP + bit is set and cleared by software. + 4 + 1 + + + BREGEN + Generate Error-Bit on Bit Rising Error + The BREGEN bit is set and cleared by software. Note: + If BRDNOGEN=0, an Error-bit is generated upon BRE + detection with BRESTP=1 in broadcast even if + BREGEN=0 + 5 + 1 + + + LBPEGEN + Generate Error-Bit on Long Bit Period + Error The LBPEGEN bit is set and cleared by software. + Note: If BRDNOGEN=0, an Error-bit is generated upon + LBPE detection in broadcast even if + LBPEGEN=0 + 6 + 1 + + + BRDNOGEN + Avoid Error-Bit Generation in Broadcast + The BRDNOGEN bit is set and cleared by + software. + 7 + 1 + + + SFTOPT + SFT Option Bit The SFTOPT bit is set and + cleared by software. + 8 + 1 + + + OAR + Own addresses configuration The OAR bits + are set by software to select which destination + logical addresses has to be considered in receive + mode. Each bit, when set, enables the CEC logical + address identified by the given bit position. At the + end of HEADER reception, the received destination + address is compared with the enabled addresses. In + case of matching address, the incoming message is + acknowledged and received. In case of non-matching + address, the incoming message is received only in + listen mode (LSTN=1), but without acknowledge sent. + Broadcast messages are always received. Example: OAR + = 0b000 0000 0010 0001 means that CEC acknowledges + addresses 0x0 and 0x5. Consequently, each message + directed to one of these addresses is + received. + 16 + 15 + + + LSTN + Listen mode LSTN bit is set and cleared + by software. + 31 + 1 + + + + + TXDR + TXDR + CEC Tx data register + 0x8 + 0x20 + write-only + 0x00000000 + + + TXD + Tx Data register. TXD is a write-only + register containing the data byte to be transmitted. + Note: TXD must be written when + TXSTART=1 + 0 + 8 + + + + + RXDR + RXDR + CEC Rx Data Register + 0xC + 0x20 + read-only + 0x00000000 + + + RXD + Rx Data register. RXD is read-only and + contains the last data byte which has been received + from the CEC line. + 0 + 8 + + + + + ISR + ISR + CEC Interrupt and Status + Register + 0x10 + 0x20 + read-write + 0x00000000 + + + RXBR + Rx-Byte Received The RXBR bit is set by + hardware to inform application that a new byte has + been received from the CEC line and stored into the + RXD buffer. RXBR is cleared by software write at + 1. + 0 + 1 + + + RXEND + End Of Reception RXEND is set by + hardware to inform application that the last byte of + a CEC message is received from the CEC line and + stored into the RXD buffer. RXEND is set at the same + time of RXBR. RXEND is cleared by software write at + 1. + 1 + 1 + + + RXOVR + Rx-Overrun RXOVR is set by hardware if + RXBR is not yet cleared at the time a new byte is + received on the CEC line and stored into RXD. RXOVR + assertion stops message reception so that no + acknowledge is sent. In case of broadcast, a negative + acknowledge is sent. RXOVR is cleared by software + write at 1. + 2 + 1 + + + BRE + Rx-Bit Rising Error BRE is set by + hardware in case a Data-Bit waveform is detected with + Bit Rising Error. BRE is set either at the time the + misplaced rising edge occurs, or at the end of the + maximum BRE tolerance allowed by RXTOL, in case + rising edge is still longing. BRE stops message + reception if BRESTP=1. BRE generates an Error-Bit on + the CEC line if BREGEN=1. BRE is cleared by software + write at 1. + 3 + 1 + + + SBPE + Rx-Short Bit Period Error SBPE is set by + hardware in case a Data-Bit waveform is detected with + Short Bit Period Error. SBPE is set at the time the + anticipated falling edge occurs. SBPE generates an + Error-Bit on the CEC line. SBPE is cleared by + software write at 1. + 4 + 1 + + + LBPE + Rx-Long Bit Period Error LBPE is set by + hardware in case a Data-Bit waveform is detected with + Long Bit Period Error. LBPE is set at the end of the + maximum bit-extension tolerance allowed by RXTOL, in + case falling edge is still longing. LBPE always stops + reception of the CEC message. LBPE generates an + Error-Bit on the CEC line if LBPEGEN=1. In case of + broadcast, Error-Bit is generated even in case of + LBPEGEN=0. LBPE is cleared by software write at + 1. + 5 + 1 + + + RXACKE + Rx-Missing Acknowledge In receive mode, + RXACKE is set by hardware to inform application that + no acknowledge was seen on the CEC line. RXACKE + applies only for broadcast messages and in listen + mode also for not directly addressed messages + (destination address not enabled in OAR). RXACKE + aborts message reception. RXACKE is cleared by + software write at 1. + 6 + 1 + + + ARBLST + Arbitration Lost ARBLST is set by + hardware to inform application that CEC device is + switching to reception due to arbitration lost event + following the TXSOM command. ARBLST can be due either + to a contending CEC device starting earlier or + starting at the same time but with higher HEADER + priority. After ARBLST assertion TXSOM bit keeps + pending for next transmission attempt. ARBLST is + cleared by software write at 1. + 7 + 1 + + + TXBR + Tx-Byte Request TXBR is set by hardware + to inform application that the next transmission data + has to be written to TXDR. TXBR is set when the 4th + bit of currently transmitted byte is sent. + Application must write the next byte to TXDR within 6 + nominal data-bit periods before transmission underrun + error occurs (TXUDR). TXBR is cleared by software + write at 1. + 8 + 1 + + + TXEND + End of Transmission TXEND is set by + hardware to inform application that the last byte of + the CEC message has been successfully transmitted. + TXEND clears the TXSOM and TXEOM control bits. TXEND + is cleared by software write at 1. + 9 + 1 + + + TXUDR + Tx-Buffer Underrun In transmission mode, + TXUDR is set by hardware if application was not in + time to load TXDR before of next byte transmission. + TXUDR aborts message transmission and clears TXSOM + and TXEOM control bits. TXUDR is cleared by software + write at 1 + 10 + 1 + + + TXERR + Tx-Error In transmission mode, TXERR is + set by hardware if the CEC initiator detects low + impedance on the CEC line while it is released. TXERR + aborts message transmission and clears TXSOM and + TXEOM controls. TXERR is cleared by software write at + 1. + 11 + 1 + + + TXACKE + Tx-Missing Acknowledge Error In + transmission mode, TXACKE is set by hardware to + inform application that no acknowledge was received. + In case of broadcast transmission, TXACKE informs + application that a negative acknowledge was received. + TXACKE aborts message transmission and clears TXSOM + and TXEOM controls. TXACKE is cleared by software + write at 1. + 12 + 1 + + + + + IER + IER + CEC interrupt enable register + 0x14 + 0x20 + read-write + 0x00000000 + + + RXBRIE + Rx-Byte Received Interrupt Enable The + RXBRIE bit is set and cleared by + software. + 0 + 1 + + + RXENDIE + End Of Reception Interrupt Enable The + RXENDIE bit is set and cleared by + software. + 1 + 1 + + + RXOVRIE + Rx-Buffer Overrun Interrupt Enable The + RXOVRIE bit is set and cleared by + software. + 2 + 1 + + + BREIE + Bit Rising Error Interrupt Enable The + BREIE bit is set and cleared by + software. + 3 + 1 + + + SBPEIE + Short Bit Period Error Interrupt Enable + The SBPEIE bit is set and cleared by + software. + 4 + 1 + + + LBPEIE + Long Bit Period Error Interrupt Enable + The LBPEIE bit is set and cleared by + software. + 5 + 1 + + + RXACKIE + Rx-Missing Acknowledge Error Interrupt + Enable The RXACKIE bit is set and cleared by + software. + 6 + 1 + + + ARBLSTIE + Arbitration Lost Interrupt Enable The + ARBLSTIE bit is set and cleared by + software. + 7 + 1 + + + TXBRIE + Tx-Byte Request Interrupt Enable The + TXBRIE bit is set and cleared by + software. + 8 + 1 + + + TXENDIE + Tx-End Of Message Interrupt Enable The + TXENDIE bit is set and cleared by + software. + 9 + 1 + + + TXUDRIE + Tx-Underrun Interrupt Enable The TXUDRIE + bit is set and cleared by software. + 10 + 1 + + + TXERRIE + Tx-Error Interrupt Enable The TXERRIE + bit is set and cleared by software. + 11 + 1 + + + TXACKIE + Tx-Missing Acknowledge Error Interrupt + Enable The TXACKEIE bit is set and cleared by + software. + 12 + 1 + + + + + + + HSEM + HSEM + HSEM + 0x58026400 + + 0x0 + 0x400 + registers + + + HSEM0 + HSEM global interrupt 1 + 125 + + + + HSEM_R0 + HSEM_R0 + HSEM register HSEM_R0 HSEM_R31 + 0x0 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R1 + HSEM_R1 + HSEM register HSEM_R0 HSEM_R31 + 0x4 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R2 + HSEM_R2 + HSEM register HSEM_R0 HSEM_R31 + 0x8 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R3 + HSEM_R3 + HSEM register HSEM_R0 HSEM_R31 + 0xC + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R4 + HSEM_R4 + HSEM register HSEM_R0 HSEM_R31 + 0x10 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R5 + HSEM_R5 + HSEM register HSEM_R0 HSEM_R31 + 0x14 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R6 + HSEM_R6 + HSEM register HSEM_R0 HSEM_R31 + 0x18 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R7 + HSEM_R7 + HSEM register HSEM_R0 HSEM_R31 + 0x1C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R8 + HSEM_R8 + HSEM register HSEM_R0 HSEM_R31 + 0x20 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R9 + HSEM_R9 + HSEM register HSEM_R0 HSEM_R31 + 0x24 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R10 + HSEM_R10 + HSEM register HSEM_R0 HSEM_R31 + 0x28 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R11 + HSEM_R11 + HSEM register HSEM_R0 HSEM_R31 + 0x2C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R12 + HSEM_R12 + HSEM register HSEM_R0 HSEM_R31 + 0x30 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R13 + HSEM_R13 + HSEM register HSEM_R0 HSEM_R31 + 0x34 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R14 + HSEM_R14 + HSEM register HSEM_R0 HSEM_R31 + 0x38 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R15 + HSEM_R15 + HSEM register HSEM_R0 HSEM_R31 + 0x3C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R16 + HSEM_R16 + HSEM register HSEM_R0 HSEM_R31 + 0x40 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R17 + HSEM_R17 + HSEM register HSEM_R0 HSEM_R31 + 0x44 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R18 + HSEM_R18 + HSEM register HSEM_R0 HSEM_R31 + 0x48 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R19 + HSEM_R19 + HSEM register HSEM_R0 HSEM_R31 + 0x4C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R20 + HSEM_R20 + HSEM register HSEM_R0 HSEM_R31 + 0x50 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R21 + HSEM_R21 + HSEM register HSEM_R0 HSEM_R31 + 0x54 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R22 + HSEM_R22 + HSEM register HSEM_R0 HSEM_R31 + 0x58 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R23 + HSEM_R23 + HSEM register HSEM_R0 HSEM_R31 + 0x5C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R24 + HSEM_R24 + HSEM register HSEM_R0 HSEM_R31 + 0x60 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R25 + HSEM_R25 + HSEM register HSEM_R0 HSEM_R31 + 0x64 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R26 + HSEM_R26 + HSEM register HSEM_R0 HSEM_R31 + 0x68 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R27 + HSEM_R27 + HSEM register HSEM_R0 HSEM_R31 + 0x6C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R28 + HSEM_R28 + HSEM register HSEM_R0 HSEM_R31 + 0x70 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R29 + HSEM_R29 + HSEM register HSEM_R0 HSEM_R31 + 0x74 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R30 + HSEM_R30 + HSEM register HSEM_R0 HSEM_R31 + 0x78 + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_R31 + HSEM_R31 + HSEM register HSEM_R0 HSEM_R31 + 0x7C + 0x20 + read-write + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR0 + HSEM_RLR0 + HSEM Read lock register + 0x80 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR1 + HSEM_RLR1 + HSEM Read lock register + 0x84 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR2 + HSEM_RLR2 + HSEM Read lock register + 0x88 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR3 + HSEM_RLR3 + HSEM Read lock register + 0x8C + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR4 + HSEM_RLR4 + HSEM Read lock register + 0x90 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR5 + HSEM_RLR5 + HSEM Read lock register + 0x94 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR6 + HSEM_RLR6 + HSEM Read lock register + 0x98 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR7 + HSEM_RLR7 + HSEM Read lock register + 0x9C + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR8 + HSEM_RLR8 + HSEM Read lock register + 0xA0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR9 + HSEM_RLR9 + HSEM Read lock register + 0xA4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR10 + HSEM_RLR10 + HSEM Read lock register + 0xA8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR11 + HSEM_RLR11 + HSEM Read lock register + 0xAC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR12 + HSEM_RLR12 + HSEM Read lock register + 0xB0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR13 + HSEM_RLR13 + HSEM Read lock register + 0xB4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR14 + HSEM_RLR14 + HSEM Read lock register + 0xB8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR15 + HSEM_RLR15 + HSEM Read lock register + 0xBC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR16 + HSEM_RLR16 + HSEM Read lock register + 0xC0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR17 + HSEM_RLR17 + HSEM Read lock register + 0xC4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR18 + HSEM_RLR18 + HSEM Read lock register + 0xC8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR19 + HSEM_RLR19 + HSEM Read lock register + 0xCC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR20 + HSEM_RLR20 + HSEM Read lock register + 0xD0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR21 + HSEM_RLR21 + HSEM Read lock register + 0xD4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR22 + HSEM_RLR22 + HSEM Read lock register + 0xD8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR23 + HSEM_RLR23 + HSEM Read lock register + 0xDC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR24 + HSEM_RLR24 + HSEM Read lock register + 0xE0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR25 + HSEM_RLR25 + HSEM Read lock register + 0xE4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR26 + HSEM_RLR26 + HSEM Read lock register + 0xE8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR27 + HSEM_RLR27 + HSEM Read lock register + 0xEC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR28 + HSEM_RLR28 + HSEM Read lock register + 0xF0 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR29 + HSEM_RLR29 + HSEM Read lock register + 0xF4 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR30 + HSEM_RLR30 + HSEM Read lock register + 0xF8 + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_RLR31 + HSEM_RLR31 + HSEM Read lock register + 0xFC + 0x20 + read-only + 0x00000000 + + + PROCID + Semaphore ProcessID + 0 + 8 + + + MASTERID + Semaphore MasterID + 8 + 8 + + + LOCK + Lock indication + 31 + 1 + + + + + HSEM_IER + HSEM_IER + HSEM Interrupt enable register + 0x100 + 0x20 + read-write + 0x00000000 + + + ISEM0 + Interrupt semaphore n enable + bit + 0 + 1 + + + ISEM1 + Interrupt semaphore n enable + bit + 1 + 1 + + + ISEM2 + Interrupt semaphore n enable + bit + 2 + 1 + + + ISEM3 + Interrupt semaphore n enable + bit + 3 + 1 + + + ISEM4 + Interrupt semaphore n enable + bit + 4 + 1 + + + ISEM5 + Interrupt semaphore n enable + bit + 5 + 1 + + + ISEM6 + Interrupt semaphore n enable + bit + 6 + 1 + + + ISEM7 + Interrupt semaphore n enable + bit + 7 + 1 + + + ISEM8 + Interrupt semaphore n enable + bit + 8 + 1 + + + ISEM9 + Interrupt semaphore n enable + bit + 9 + 1 + + + ISEM10 + Interrupt semaphore n enable + bit + 10 + 1 + + + ISEM11 + Interrupt semaphore n enable + bit + 11 + 1 + + + ISEM12 + Interrupt semaphore n enable + bit + 12 + 1 + + + ISEM13 + Interrupt semaphore n enable + bit + 13 + 1 + + + ISEM14 + Interrupt semaphore n enable + bit + 14 + 1 + + + ISEM15 + Interrupt semaphore n enable + bit + 15 + 1 + + + ISEM16 + Interrupt semaphore n enable + bit + 16 + 1 + + + ISEM17 + Interrupt semaphore n enable + bit + 17 + 1 + + + ISEM18 + Interrupt semaphore n enable + bit + 18 + 1 + + + ISEM19 + Interrupt semaphore n enable + bit + 19 + 1 + + + ISEM20 + Interrupt semaphore n enable + bit + 20 + 1 + + + ISEM21 + Interrupt semaphore n enable + bit + 21 + 1 + + + ISEM22 + Interrupt semaphore n enable + bit + 22 + 1 + + + ISEM23 + Interrupt semaphore n enable + bit + 23 + 1 + + + ISEM24 + Interrupt semaphore n enable + bit + 24 + 1 + + + ISEM25 + Interrupt semaphore n enable + bit + 25 + 1 + + + ISEM26 + Interrupt semaphore n enable + bit + 26 + 1 + + + ISEM27 + Interrupt semaphore n enable + bit + 27 + 1 + + + ISEM28 + Interrupt semaphore n enable + bit + 28 + 1 + + + ISEM29 + Interrupt semaphore n enable + bit + 29 + 1 + + + ISEM30 + Interrupt semaphore n enable + bit + 30 + 1 + + + ISEM31 + Interrupt(N) semaphore n enable + bit. + 31 + 1 + + + + + HSEM_ICR + HSEM_ICR + HSEM Interrupt clear register + 0x104 + 0x20 + read-only + 0x00000000 + + + ISEM0 + Interrupt(N) semaphore n clear + bit + 0 + 1 + + + ISEM1 + Interrupt(N) semaphore n clear + bit + 1 + 1 + + + ISEM2 + Interrupt(N) semaphore n clear + bit + 2 + 1 + + + ISEM3 + Interrupt(N) semaphore n clear + bit + 3 + 1 + + + ISEM4 + Interrupt(N) semaphore n clear + bit + 4 + 1 + + + ISEM5 + Interrupt(N) semaphore n clear + bit + 5 + 1 + + + ISEM6 + Interrupt(N) semaphore n clear + bit + 6 + 1 + + + ISEM7 + Interrupt(N) semaphore n clear + bit + 7 + 1 + + + ISEM8 + Interrupt(N) semaphore n clear + bit + 8 + 1 + + + ISEM9 + Interrupt(N) semaphore n clear + bit + 9 + 1 + + + ISEM10 + Interrupt(N) semaphore n clear + bit + 10 + 1 + + + ISEM11 + Interrupt(N) semaphore n clear + bit + 11 + 1 + + + ISEM12 + Interrupt(N) semaphore n clear + bit + 12 + 1 + + + ISEM13 + Interrupt(N) semaphore n clear + bit + 13 + 1 + + + ISEM14 + Interrupt(N) semaphore n clear + bit + 14 + 1 + + + ISEM15 + Interrupt(N) semaphore n clear + bit + 15 + 1 + + + ISEM16 + Interrupt(N) semaphore n clear + bit + 16 + 1 + + + ISEM17 + Interrupt(N) semaphore n clear + bit + 17 + 1 + + + ISEM18 + Interrupt(N) semaphore n clear + bit + 18 + 1 + + + ISEM19 + Interrupt(N) semaphore n clear + bit + 19 + 1 + + + ISEM20 + Interrupt(N) semaphore n clear + bit + 20 + 1 + + + ISEM21 + Interrupt(N) semaphore n clear + bit + 21 + 1 + + + ISEM22 + Interrupt(N) semaphore n clear + bit + 22 + 1 + + + ISEM23 + Interrupt(N) semaphore n clear + bit + 23 + 1 + + + ISEM24 + Interrupt(N) semaphore n clear + bit + 24 + 1 + + + ISEM25 + Interrupt(N) semaphore n clear + bit + 25 + 1 + + + ISEM26 + Interrupt(N) semaphore n clear + bit + 26 + 1 + + + ISEM27 + Interrupt(N) semaphore n clear + bit + 27 + 1 + + + ISEM28 + Interrupt(N) semaphore n clear + bit + 28 + 1 + + + ISEM29 + Interrupt(N) semaphore n clear + bit + 29 + 1 + + + ISEM30 + Interrupt(N) semaphore n clear + bit + 30 + 1 + + + ISEM31 + Interrupt(N) semaphore n clear + bit + 31 + 1 + + + + + HSEM_ISR + HSEM_ISR + HSEM Interrupt status register + 0x108 + 0x20 + read-only + 0x00000000 + + + ISEM0 + Interrupt(N) semaphore n status bit + before enable (mask) + 0 + 1 + + + ISEM1 + Interrupt(N) semaphore n status bit + before enable (mask) + 1 + 1 + + + ISEM2 + Interrupt(N) semaphore n status bit + before enable (mask) + 2 + 1 + + + ISEM3 + Interrupt(N) semaphore n status bit + before enable (mask) + 3 + 1 + + + ISEM4 + Interrupt(N) semaphore n status bit + before enable (mask) + 4 + 1 + + + ISEM5 + Interrupt(N) semaphore n status bit + before enable (mask) + 5 + 1 + + + ISEM6 + Interrupt(N) semaphore n status bit + before enable (mask) + 6 + 1 + + + ISEM7 + Interrupt(N) semaphore n status bit + before enable (mask) + 7 + 1 + + + ISEM8 + Interrupt(N) semaphore n status bit + before enable (mask) + 8 + 1 + + + ISEM9 + Interrupt(N) semaphore n status bit + before enable (mask) + 9 + 1 + + + ISEM10 + Interrupt(N) semaphore n status bit + before enable (mask) + 10 + 1 + + + ISEM11 + Interrupt(N) semaphore n status bit + before enable (mask) + 11 + 1 + + + ISEM12 + Interrupt(N) semaphore n status bit + before enable (mask) + 12 + 1 + + + ISEM13 + Interrupt(N) semaphore n status bit + before enable (mask) + 13 + 1 + + + ISEM14 + Interrupt(N) semaphore n status bit + before enable (mask) + 14 + 1 + + + ISEM15 + Interrupt(N) semaphore n status bit + before enable (mask) + 15 + 1 + + + ISEM16 + Interrupt(N) semaphore n status bit + before enable (mask) + 16 + 1 + + + ISEM17 + Interrupt(N) semaphore n status bit + before enable (mask) + 17 + 1 + + + ISEM18 + Interrupt(N) semaphore n status bit + before enable (mask) + 18 + 1 + + + ISEM19 + Interrupt(N) semaphore n status bit + before enable (mask) + 19 + 1 + + + ISEM20 + Interrupt(N) semaphore n status bit + before enable (mask) + 20 + 1 + + + ISEM21 + Interrupt(N) semaphore n status bit + before enable (mask) + 21 + 1 + + + ISEM22 + Interrupt(N) semaphore n status bit + before enable (mask) + 22 + 1 + + + ISEM23 + Interrupt(N) semaphore n status bit + before enable (mask) + 23 + 1 + + + ISEM24 + Interrupt(N) semaphore n status bit + before enable (mask) + 24 + 1 + + + ISEM25 + Interrupt(N) semaphore n status bit + before enable (mask) + 25 + 1 + + + ISEM26 + Interrupt(N) semaphore n status bit + before enable (mask) + 26 + 1 + + + ISEM27 + Interrupt(N) semaphore n status bit + before enable (mask) + 27 + 1 + + + ISEM28 + Interrupt(N) semaphore n status bit + before enable (mask) + 28 + 1 + + + ISEM29 + Interrupt(N) semaphore n status bit + before enable (mask) + 29 + 1 + + + ISEM30 + Interrupt(N) semaphore n status bit + before enable (mask) + 30 + 1 + + + ISEM31 + Interrupt(N) semaphore n status bit + before enable (mask) + 31 + 1 + + + + + HSEM_MISR + HSEM_MISR + HSEM Masked interrupt status + register + 0x10C + 0x20 + read-only + 0x00000000 + + + ISEM0 + masked interrupt(N) semaphore n status + bit after enable (mask) + 0 + 1 + + + ISEM1 + masked interrupt(N) semaphore n status + bit after enable (mask) + 1 + 1 + + + ISEM2 + masked interrupt(N) semaphore n status + bit after enable (mask) + 2 + 1 + + + ISEM3 + masked interrupt(N) semaphore n status + bit after enable (mask) + 3 + 1 + + + ISEM4 + masked interrupt(N) semaphore n status + bit after enable (mask) + 4 + 1 + + + ISEM5 + masked interrupt(N) semaphore n status + bit after enable (mask) + 5 + 1 + + + ISEM6 + masked interrupt(N) semaphore n status + bit after enable (mask) + 6 + 1 + + + ISEM7 + masked interrupt(N) semaphore n status + bit after enable (mask) + 7 + 1 + + + ISEM8 + masked interrupt(N) semaphore n status + bit after enable (mask) + 8 + 1 + + + ISEM9 + masked interrupt(N) semaphore n status + bit after enable (mask) + 9 + 1 + + + ISEM10 + masked interrupt(N) semaphore n status + bit after enable (mask) + 10 + 1 + + + ISEM11 + masked interrupt(N) semaphore n status + bit after enable (mask) + 11 + 1 + + + ISEM12 + masked interrupt(N) semaphore n status + bit after enable (mask) + 12 + 1 + + + ISEM13 + masked interrupt(N) semaphore n status + bit after enable (mask) + 13 + 1 + + + ISEM14 + masked interrupt(N) semaphore n status + bit after enable (mask) + 14 + 1 + + + ISEM15 + masked interrupt(N) semaphore n status + bit after enable (mask) + 15 + 1 + + + ISEM16 + masked interrupt(N) semaphore n status + bit after enable (mask) + 16 + 1 + + + ISEM17 + masked interrupt(N) semaphore n status + bit after enable (mask) + 17 + 1 + + + ISEM18 + masked interrupt(N) semaphore n status + bit after enable (mask) + 18 + 1 + + + ISEM19 + masked interrupt(N) semaphore n status + bit after enable (mask) + 19 + 1 + + + ISEM20 + masked interrupt(N) semaphore n status + bit after enable (mask) + 20 + 1 + + + ISEM21 + masked interrupt(N) semaphore n status + bit after enable (mask) + 21 + 1 + + + ISEM22 + masked interrupt(N) semaphore n status + bit after enable (mask) + 22 + 1 + + + ISEM23 + masked interrupt(N) semaphore n status + bit after enable (mask) + 23 + 1 + + + ISEM24 + masked interrupt(N) semaphore n status + bit after enable (mask) + 24 + 1 + + + ISEM25 + masked interrupt(N) semaphore n status + bit after enable (mask) + 25 + 1 + + + ISEM26 + masked interrupt(N) semaphore n status + bit after enable (mask) + 26 + 1 + + + ISEM27 + masked interrupt(N) semaphore n status + bit after enable (mask) + 27 + 1 + + + ISEM28 + masked interrupt(N) semaphore n status + bit after enable (mask) + 28 + 1 + + + ISEM29 + masked interrupt(N) semaphore n status + bit after enable (mask) + 29 + 1 + + + ISEM30 + masked interrupt(N) semaphore n status + bit after enable (mask) + 30 + 1 + + + ISEM31 + masked interrupt(N) semaphore n status + bit after enable (mask) + 31 + 1 + + + + + HSEM_CR + HSEM_CR + HSEM Clear register + 0x140 + 0x20 + read-write + 0x00000000 + + + MASTERID + MasterID of semaphores to be + cleared + 8 + 8 + + + KEY + Semaphore clear Key + 16 + 16 + + + + + HSEM_KEYR + HSEM_KEYR + HSEM Interrupt clear register + 0x144 + 0x20 + read-write + 0x00000000 + + + KEY + Semaphore Clear Key + 16 + 16 + + + + + + + I2C1 + I2C + I2C + 0x40005400 + + 0x0 + 0x400 + registers + + + I2C1_EV + I2C1 event interrupt + 31 + + + I2C1_ER + I2C1 error interrupt + 32 + + + + CR1 + CR1 + Access: No wait states, except if a write + access occurs while a write access to this register is + ongoing. In this case, wait states are inserted in the + second write access until the previous one is completed. + The latency of the second write access can be up to 2 x + PCLK1 + 6 x I2CCLK. + 0x0 + 0x20 + read-write + 0x00000000 + + + PE + Peripheral enable Note: When PE=0, the + I2C SCL and SDA lines are released. Internal state + machines and status bits are put back to their reset + value. When cleared, PE must be kept low for at least + 3 APB clock cycles. + 0 + 1 + + + TXIE + TX Interrupt enable + 1 + 1 + + + RXIE + RX Interrupt enable + 2 + 1 + + + ADDRIE + Address match Interrupt enable (slave + only) + 3 + 1 + + + NACKIE + Not acknowledge received Interrupt + enable + 4 + 1 + + + STOPIE + STOP detection Interrupt + enable + 5 + 1 + + + TCIE + Transfer Complete interrupt enable Note: + Any of these events will generate an interrupt: + Transfer Complete (TC) Transfer Complete Reload + (TCR) + 6 + 1 + + + ERRIE + Error interrupts enable Note: Any of + these errors generate an interrupt: Arbitration Loss + (ARLO) Bus Error detection (BERR) Overrun/Underrun + (OVR) Timeout detection (TIMEOUT) PEC error detection + (PECERR) Alert pin event detection + (ALERT) + 7 + 1 + + + DNF + Digital noise filter These bits are used + to configure the digital noise filter on SDA and SCL + input. The digital filter will filter spikes with a + length of up to DNF[3:0] * tI2CCLK ... Note: If the + analog filter is also enabled, the digital filter is + added to the analog filter. This filter can only be + programmed when the I2C is disabled (PE = + 0). + 8 + 4 + + + ANFOFF + Analog noise filter OFF Note: This bit + can only be programmed when the I2C is disabled (PE = + 0). + 12 + 1 + + + TXDMAEN + DMA transmission requests + enable + 14 + 1 + + + RXDMAEN + DMA reception requests + enable + 15 + 1 + + + SBC + Slave byte control This bit is used to + enable hardware byte control in slave + mode. + 16 + 1 + + + NOSTRETCH + Clock stretching disable This bit is + used to disable clock stretching in slave mode. It + must be kept cleared in master mode. Note: This bit + can only be programmed when the I2C is disabled (PE = + 0). + 17 + 1 + + + WUPEN + Wakeup from Stop mode enable Note: If + the Wakeup from Stop mode feature is not supported, + this bit is reserved and forced by hardware to 0. + Please refer to Section25.3: I2C implementation. + Note: WUPEN can be set only when DNF = + 0000 + 18 + 1 + + + GCEN + General call enable + 19 + 1 + + + SMBHEN + SMBus Host address enable Note: If the + SMBus feature is not supported, this bit is reserved + and forced by hardware to 0. Please refer to + Section25.3: I2C implementation. + 20 + 1 + + + SMBDEN + SMBus Device Default address enable + Note: If the SMBus feature is not supported, this bit + is reserved and forced by hardware to 0. Please refer + to Section25.3: I2C implementation. + 21 + 1 + + + ALERTEN + SMBus alert enable Device mode + (SMBHEN=0): Host mode (SMBHEN=1): Note: When + ALERTEN=0, the SMBA pin can be used as a standard + GPIO. If the SMBus feature is not supported, this bit + is reserved and forced by hardware to 0. Please refer + to Section25.3: I2C implementation. + 22 + 1 + + + PECEN + PEC enable Note: If the SMBus feature is + not supported, this bit is reserved and forced by + hardware to 0. Please refer to Section25.3: I2C + implementation. + 23 + 1 + + + + + CR2 + CR2 + Access: No wait states, except if a write + access occurs while a write access to this register is + ongoing. In this case, wait states are inserted in the + second write access until the previous one is completed. + The latency of the second write access can be up to 2 x + PCLK1 + 6 x I2CCLK. + 0x4 + 0x20 + read-write + 0x00000000 + + + SADD0 + Slave address bit 0 (master mode) In + 7-bit addressing mode (ADD10 = 0): This bit is dont + care In 10-bit addressing mode (ADD10 = 1): This bit + should be written with bit 0 of the slave address to + be sent Note: Changing these bits when the START bit + is set is not allowed. + 0 + 1 + + + SADD1 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 1 + 1 + + + SADD2 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 2 + 1 + + + SADD3 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 3 + 1 + + + SADD4 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 4 + 1 + + + SADD5 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 5 + 1 + + + SADD6 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 6 + 1 + + + SADD7 + Slave address bit 7:1 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits should + be written with the 7-bit slave address to be sent In + 10-bit addressing mode (ADD10 = 1): These bits should + be written with bits 7:1 of the slave address to be + sent. Note: Changing these bits when the START bit is + set is not allowed. + 7 + 1 + + + SADD8 + Slave address bit 9:8 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits are + dont care In 10-bit addressing mode (ADD10 = 1): + These bits should be written with bits 9:8 of the + slave address to be sent Note: Changing these bits + when the START bit is set is not + allowed. + 8 + 1 + + + SADD9 + Slave address bit 9:8 (master mode) In + 7-bit addressing mode (ADD10 = 0): These bits are + dont care In 10-bit addressing mode (ADD10 = 1): + These bits should be written with bits 9:8 of the + slave address to be sent Note: Changing these bits + when the START bit is set is not + allowed. + 9 + 1 + + + RD_WRN + Transfer direction (master mode) Note: + Changing this bit when the START bit is set is not + allowed. + 10 + 1 + + + ADD10 + 10-bit addressing mode (master mode) + Note: Changing this bit when the START bit is set is + not allowed. + 11 + 1 + + + HEAD10R + 10-bit address header only read + direction (master receiver mode) Note: Changing this + bit when the START bit is set is not + allowed. + 12 + 1 + + + START + Start generation This bit is set by + software, and cleared by hardware after the Start + followed by the address sequence is sent, by an + arbitration loss, by a timeout error detection, or + when PE = 0. It can also be cleared by software by + writing 1 to the ADDRCF bit in the I2C_ICR register. + If the I2C is already in master mode with AUTOEND = + 0, setting this bit generates a Repeated Start + condition when RELOAD=0, after the end of the NBYTES + transfer. Otherwise setting this bit will generate a + START condition once the bus is free. Note: Writing 0 + to this bit has no effect. The START bit can be set + even if the bus is BUSY or I2C is in slave mode. This + bit has no effect when RELOAD is set. + 13 + 1 + + + STOP + Stop generation (master mode) The bit is + set by software, cleared by hardware when a Stop + condition is detected, or when PE = 0. In Master + Mode: Note: Writing 0 to this bit has no + effect. + 14 + 1 + + + NACK + NACK generation (slave mode) The bit is + set by software, cleared by hardware when the NACK is + sent, or when a STOP condition or an Address matched + is received, or when PE=0. Note: Writing 0 to this + bit has no effect. This bit is used in slave mode + only: in master receiver mode, NACK is automatically + generated after last byte preceding STOP or RESTART + condition, whatever the NACK bit value. When an + overrun occurs in slave receiver NOSTRETCH mode, a + NACK is automatically generated whatever the NACK bit + value. When hardware PEC checking is enabled + (PECBYTE=1), the PEC acknowledge value does not + depend on the NACK value. + 15 + 1 + + + NBYTES + Number of bytes The number of bytes to + be transmitted/received is programmed there. This + field is dont care in slave mode with SBC=0. Note: + Changing these bits when the START bit is set is not + allowed. + 16 + 8 + + + RELOAD + NBYTES reload mode This bit is set and + cleared by software. + 24 + 1 + + + AUTOEND + Automatic end mode (master mode) This + bit is set and cleared by software. Note: This bit + has no effect in slave mode or when the RELOAD bit is + set. + 25 + 1 + + + PECBYTE + Packet error checking byte This bit is + set by software, and cleared by hardware when the PEC + is transferred, or when a STOP condition or an + Address matched is received, also when PE=0. Note: + Writing 0 to this bit has no effect. This bit has no + effect when RELOAD is set. This bit has no effect is + slave mode when SBC=0. If the SMBus feature is not + supported, this bit is reserved and forced by + hardware to 0. Please refer to Section25.3: I2C + implementation. + 26 + 1 + + + + + OAR1 + OAR1 + Access: No wait states, except if a write + access occurs while a write access to this register is + ongoing. In this case, wait states are inserted in the + second write access until the previous one is completed. + The latency of the second write access can be up to 2 x + PCLK1 + 6 x I2CCLK. + 0x8 + 0x20 + read-write + 0x00000000 + + + OA1 + Interface address 7-bit addressing mode: + dont care 10-bit addressing mode: bits 9:8 of address + Note: These bits can be written only when OA1EN=0. + OA1[7:1]: Interface address Bits 7:1 of address Note: + These bits can be written only when OA1EN=0. OA1[0]: + Interface address 7-bit addressing mode: dont care + 10-bit addressing mode: bit 0 of address Note: This + bit can be written only when OA1EN=0. + 0 + 10 + + + OA1MODE + Own Address 1 10-bit mode Note: This bit + can be written only when OA1EN=0. + 10 + 1 + + + OA1EN + Own Address 1 enable + 15 + 1 + + + + + OAR2 + OAR2 + Access: No wait states, except if a write + access occurs while a write access to this register is + ongoing. In this case, wait states are inserted in the + second write access until the previous one is completed. + The latency of the second write access can be up to 2 x + PCLK1 + 6 x I2CCLK. + 0xC + 0x20 + read-write + 0x00000000 + + + OA2 + Interface address bits 7:1 of address + Note: These bits can be written only when + OA2EN=0. + 1 + 7 + + + OA2MSK + Own Address 2 masks Note: These bits can + be written only when OA2EN=0. As soon as OA2MSK is + not equal to 0, the reserved I2C addresses (0b0000xxx + and 0b1111xxx) are not acknowledged even if the + comparison matches. + 8 + 3 + + + OA2EN + Own Address 2 enable + 15 + 1 + + + + + TIMINGR + TIMINGR + Access: No wait states + 0x10 + 0x20 + read-write + 0x00000000 + + + SCLL + SCL low period (master mode) This field + is used to generate the SCL low period in master + mode. tSCLL = (SCLL+1) x tPRESC Note: SCLL is also + used to generate tBUF and tSU:STA + timings. + 0 + 8 + + + SCLH + SCL high period (master mode) This field + is used to generate the SCL high period in master + mode. tSCLH = (SCLH+1) x tPRESC Note: SCLH is also + used to generate tSU:STO and tHD:STA + timing. + 8 + 8 + + + SDADEL + Data hold time This field is used to + generate the delay tSDADEL between SCL falling edge + and SDA edge. In master mode and in slave mode with + NOSTRETCH = 0, the SCL line is stretched low during + tSDADEL. tSDADEL= SDADEL x tPRESC Note: SDADEL is + used to generate tHD:DAT timing. + 16 + 4 + + + SCLDEL + Data setup time This field is used to + generate a delay tSCLDEL between SDA edge and SCL + rising edge. In master mode and in slave mode with + NOSTRETCH = 0, the SCL line is stretched low during + tSCLDEL. tSCLDEL = (SCLDEL+1) x tPRESC Note: tSCLDEL + is used to generate tSU:DAT timing. + 20 + 4 + + + PRESC + Timing prescaler This field is used to + prescale I2CCLK in order to generate the clock period + tPRESC used for data setup and hold counters (refer + to I2C timings on page9) and for SCL high and low + level counters (refer to I2C master initialization on + page24). tPRESC = (PRESC+1) x tI2CCLK + 28 + 4 + + + + + TIMEOUTR + TIMEOUTR + Access: No wait states, except if a write + access occurs while a write access to this register is + ongoing. In this case, wait states are inserted in the + second write access until the previous one is completed. + The latency of the second write access can be up to 2 x + PCLK1 + 6 x I2CCLK. + 0x14 + 0x20 + read-write + 0x00000000 + + + TIMEOUTA + Bus Timeout A This field is used to + configure: The SCL low timeout condition tTIMEOUT + when TIDLE=0 tTIMEOUT= (TIMEOUTA+1) x 2048 x tI2CCLK + The bus idle condition (both SCL and SDA high) when + TIDLE=1 tIDLE= (TIMEOUTA+1) x 4 x tI2CCLK Note: These + bits can be written only when + TIMOUTEN=0. + 0 + 12 + + + TIDLE + Idle clock timeout detection Note: This + bit can be written only when + TIMOUTEN=0. + 12 + 1 + + + TIMOUTEN + Clock timeout enable + 15 + 1 + + + TIMEOUTB + Bus timeout B This field is used to + configure the cumulative clock extension timeout: In + master mode, the master cumulative clock low extend + time (tLOW:MEXT) is detected In slave mode, the slave + cumulative clock low extend time (tLOW:SEXT) is + detected tLOW:EXT= (TIMEOUTB+1) x 2048 x tI2CCLK + Note: These bits can be written only when + TEXTEN=0. + 16 + 12 + + + TEXTEN + Extended clock timeout + enable + 31 + 1 + + + + + ISR + ISR + Access: No wait states + 0x18 + 0x20 + 0x00000001 + + + TXE + Transmit data register empty + (transmitters) This bit is set by hardware when the + I2C_TXDR register is empty. It is cleared when the + next data to be sent is written in the I2C_TXDR + register. This bit can be written to 1 by software in + order to flush the transmit data register I2C_TXDR. + Note: This bit is set by hardware when + PE=0. + 0 + 1 + read-write + + + TXIS + Transmit interrupt status (transmitters) + This bit is set by hardware when the I2C_TXDR + register is empty and the data to be transmitted must + be written in the I2C_TXDR register. It is cleared + when the next data to be sent is written in the + I2C_TXDR register. This bit can be written to 1 by + software when NOSTRETCH=1 only, in order to generate + a TXIS event (interrupt if TXIE=1 or DMA request if + TXDMAEN=1). Note: This bit is cleared by hardware + when PE=0. + 1 + 1 + read-write + + + RXNE + Receive data register not empty + (receivers) This bit is set by hardware when the + received data is copied into the I2C_RXDR register, + and is ready to be read. It is cleared when I2C_RXDR + is read. Note: This bit is cleared by hardware when + PE=0. + 2 + 1 + read-only + + + ADDR + Address matched (slave mode) This bit is + set by hardware as soon as the received slave address + matched with one of the enabled slave addresses. It + is cleared by software by setting ADDRCF bit. Note: + This bit is cleared by hardware when + PE=0. + 3 + 1 + read-only + + + NACKF + Not Acknowledge received flag This flag + is set by hardware when a NACK is received after a + byte transmission. It is cleared by software by + setting the NACKCF bit. Note: This bit is cleared by + hardware when PE=0. + 4 + 1 + read-only + + + STOPF + Stop detection flag This flag is set by + hardware when a Stop condition is detected on the bus + and the peripheral is involved in this transfer: + either as a master, provided that the STOP condition + is generated by the peripheral. or as a slave, + provided that the peripheral has been addressed + previously during this transfer. It is cleared by + software by setting the STOPCF bit. Note: This bit is + cleared by hardware when PE=0. + 5 + 1 + read-only + + + TC + Transfer Complete (master mode) This + flag is set by hardware when RELOAD=0, AUTOEND=0 and + NBYTES data have been transferred. It is cleared by + software when START bit or STOP bit is set. Note: + This bit is cleared by hardware when + PE=0. + 6 + 1 + read-only + + + TCR + Transfer Complete Reload This flag is + set by hardware when RELOAD=1 and NBYTES data have + been transferred. It is cleared by software when + NBYTES is written to a non-zero value. Note: This bit + is cleared by hardware when PE=0. This flag is only + for master mode, or for slave mode when the SBC bit + is set. + 7 + 1 + read-only + + + BERR + Bus error This flag is set by hardware + when a misplaced Start or Stop condition is detected + whereas the peripheral is involved in the transfer. + The flag is not set during the address phase in slave + mode. It is cleared by software by setting BERRCF + bit. Note: This bit is cleared by hardware when + PE=0. + 8 + 1 + read-only + + + ARLO + Arbitration lost This flag is set by + hardware in case of arbitration loss. It is cleared + by software by setting the ARLOCF bit. Note: This bit + is cleared by hardware when PE=0. + 9 + 1 + read-only + + + OVR + Overrun/Underrun (slave mode) This flag + is set by hardware in slave mode with NOSTRETCH=1, + when an overrun/underrun error occurs. It is cleared + by software by setting the OVRCF bit. Note: This bit + is cleared by hardware when PE=0. + 10 + 1 + read-only + + + PECERR + PEC Error in reception This flag is set + by hardware when the received PEC does not match with + the PEC register content. A NACK is automatically + sent after the wrong PEC reception. It is cleared by + software by setting the PECCF bit. Note: This bit is + cleared by hardware when PE=0. If the SMBus feature + is not supported, this bit is reserved and forced by + hardware to 0. Please refer to Section25.3: I2C + implementation. + 11 + 1 + read-only + + + TIMEOUT + Timeout or tLOW detection flag This flag + is set by hardware when a timeout or extended clock + timeout occurred. It is cleared by software by + setting the TIMEOUTCF bit. Note: This bit is cleared + by hardware when PE=0. If the SMBus feature is not + supported, this bit is reserved and forced by + hardware to 0. Please refer to Section25.3: I2C + implementation. + 12 + 1 + read-only + + + ALERT + SMBus alert This flag is set by hardware + when SMBHEN=1 (SMBus host configuration), ALERTEN=1 + and a SMBALERT event (falling edge) is detected on + SMBA pin. It is cleared by software by setting the + ALERTCF bit. Note: This bit is cleared by hardware + when PE=0. If the SMBus feature is not supported, + this bit is reserved and forced by hardware to 0. + Please refer to Section25.3: I2C + implementation. + 13 + 1 + read-only + + + BUSY + Bus busy This flag indicates that a + communication is in progress on the bus. It is set by + hardware when a START condition is detected. It is + cleared by hardware when a Stop condition is + detected, or when PE=0. + 15 + 1 + read-only + + + DIR + Transfer direction (Slave mode) This + flag is updated when an address match event occurs + (ADDR=1). + 16 + 1 + read-only + + + ADDCODE + Address match code (Slave mode) These + bits are updated with the received address when an + address match event occurs (ADDR = 1). In the case of + a 10-bit address, ADDCODE provides the 10-bit header + followed by the 2 MSBs of the address. + 17 + 7 + read-only + + + + + ICR + ICR + Access: No wait states + 0x1C + 0x20 + write-only + 0x00000000 + + + ADDRCF + Address matched flag clear Writing 1 to + this bit clears the ADDR flag in the I2C_ISR + register. Writing 1 to this bit also clears the START + bit in the I2C_CR2 register. + 3 + 1 + + + NACKCF + Not Acknowledge flag clear Writing 1 to + this bit clears the ACKF flag in I2C_ISR + register. + 4 + 1 + + + STOPCF + Stop detection flag clear Writing 1 to + this bit clears the STOPF flag in the I2C_ISR + register. + 5 + 1 + + + BERRCF + Bus error flag clear Writing 1 to this + bit clears the BERRF flag in the I2C_ISR + register. + 8 + 1 + + + ARLOCF + Arbitration Lost flag clear Writing 1 to + this bit clears the ARLO flag in the I2C_ISR + register. + 9 + 1 + + + OVRCF + Overrun/Underrun flag clear Writing 1 to + this bit clears the OVR flag in the I2C_ISR + register. + 10 + 1 + + + PECCF + PEC Error flag clear Writing 1 to this + bit clears the PECERR flag in the I2C_ISR register. + Note: If the SMBus feature is not supported, this bit + is reserved and forced by hardware to 0. Please refer + to Section25.3: I2C implementation. + 11 + 1 + + + TIMOUTCF + Timeout detection flag clear Writing 1 + to this bit clears the TIMEOUT flag in the I2C_ISR + register. Note: If the SMBus feature is not + supported, this bit is reserved and forced by + hardware to 0. Please refer to Section25.3: I2C + implementation. + 12 + 1 + + + ALERTCF + Alert flag clear Writing 1 to this bit + clears the ALERT flag in the I2C_ISR register. Note: + If the SMBus feature is not supported, this bit is + reserved and forced by hardware to 0. Please refer to + Section25.3: I2C implementation. + 13 + 1 + + + + + PECR + PECR + Access: No wait states + 0x20 + 0x20 + read-only + 0x00000000 + + + PEC + Packet error checking register This + field contains the internal PEC when PECEN=1. The PEC + is cleared by hardware when PE=0. + 0 + 8 + + + + + RXDR + RXDR + Access: No wait states + 0x24 + 0x20 + read-only + 0x00000000 + + + RXDATA + 8-bit receive data Data byte received + from the I2C bus. + 0 + 8 + + + + + TXDR + TXDR + Access: No wait states + 0x28 + 0x20 + read-write + 0x00000000 + + + TXDATA + 8-bit transmit data Data byte to be + transmitted to the I2C bus. Note: These bits can be + written only when TXE=1. + 0 + 8 + + + + + + + I2C2 + 0x40005800 + + I2C2_EV + I2C2 event interrupt + 33 + + + I2C2_ER + I2C2 error interrupt + 34 + + + + I2C3 + 0x40005C00 + + I2C3_EV + I2C3 event interrupt + 72 + + + I2C3_ER + I2C3 error interrupt + 73 + + + + I2C4 + 0x58001C00 + + I2C4_EV + I2C4 event interrupt + 95 + + + I2C4_ER + I2C4 error interrupt + 96 + + + + GPIOA + GPIO + GPIO + 0x58020000 + + 0x0 + 0x400 + registers + + + + MODER + MODER + GPIO port mode register + 0x0 + 0x20 + read-write + 0xABFFFFFF + + + MODE0 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 0 + 2 + + + MODE1 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 2 + 2 + + + MODE2 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 4 + 2 + + + MODE3 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 6 + 2 + + + MODE4 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 8 + 2 + + + MODE5 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 10 + 2 + + + MODE6 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 12 + 2 + + + MODE7 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 14 + 2 + + + MODE8 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 16 + 2 + + + MODE9 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 18 + 2 + + + MODE10 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 20 + 2 + + + MODE11 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 22 + 2 + + + MODE12 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 24 + 2 + + + MODE13 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 26 + 2 + + + MODE14 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 28 + 2 + + + MODE15 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O mode. + 30 + 2 + + + + + OTYPER + OTYPER + GPIO port output type register + 0x4 + 0x20 + read-write + 0x00000000 + + + OT0 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 0 + 1 + + + OT1 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 1 + 1 + + + OT2 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 2 + 1 + + + OT3 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 3 + 1 + + + OT4 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 4 + 1 + + + OT5 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 5 + 1 + + + OT6 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 6 + 1 + + + OT7 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 7 + 1 + + + OT8 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 8 + 1 + + + OT9 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 9 + 1 + + + OT10 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 10 + 1 + + + OT11 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 11 + 1 + + + OT12 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 12 + 1 + + + OT13 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 13 + 1 + + + OT14 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 14 + 1 + + + OT15 + Port x configuration bits (y = 0..15) + These bits are written by software to configure the + I/O output type. + 15 + 1 + + + + + OSPEEDR + OSPEEDR + GPIO port output speed + register + 0x8 + 0x20 + read-write + 0x0C000000 + + + OSPEED0 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 0 + 2 + + + OSPEED1 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 2 + 2 + + + OSPEED2 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 4 + 2 + + + OSPEED3 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 6 + 2 + + + OSPEED4 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 8 + 2 + + + OSPEED5 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 10 + 2 + + + OSPEED6 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 12 + 2 + + + OSPEED7 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 14 + 2 + + + OSPEED8 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 16 + 2 + + + OSPEED9 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 18 + 2 + + + OSPEED10 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 20 + 2 + + + OSPEED11 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 22 + 2 + + + OSPEED12 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 24 + 2 + + + OSPEED13 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 26 + 2 + + + OSPEED14 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 28 + 2 + + + OSPEED15 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O output speed. Note: Refer to the + device datasheet for the frequency specifications and + the power supply and load conditions for each + speed. + 30 + 2 + + + + + PUPDR + PUPDR + GPIO port pull-up/pull-down + register + 0xC + 0x20 + read-write + 0x12100000 + + + PUPD0 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 0 + 2 + + + PUPD1 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 2 + 2 + + + PUPD2 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 4 + 2 + + + PUPD3 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 6 + 2 + + + PUPD4 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 8 + 2 + + + PUPD5 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 10 + 2 + + + PUPD6 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 12 + 2 + + + PUPD7 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 14 + 2 + + + PUPD8 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 16 + 2 + + + PUPD9 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 18 + 2 + + + PUPD10 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 20 + 2 + + + PUPD11 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 22 + 2 + + + PUPD12 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 24 + 2 + + + PUPD13 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 26 + 2 + + + PUPD14 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 28 + 2 + + + PUPD15 + [1:0]: Port x configuration bits (y = + 0..15) These bits are written by software to + configure the I/O pull-up or pull-down + 30 + 2 + + + + + IDR + IDR + GPIO port input data register + 0x10 + 0x20 + read-only + 0x00000000 + + + ID0 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 0 + 1 + + + ID1 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 1 + 1 + + + ID2 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 2 + 1 + + + ID3 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 3 + 1 + + + ID4 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 4 + 1 + + + ID5 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 5 + 1 + + + ID6 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 6 + 1 + + + ID7 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 7 + 1 + + + ID8 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 8 + 1 + + + ID9 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 9 + 1 + + + ID10 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 10 + 1 + + + ID11 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 11 + 1 + + + ID12 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 12 + 1 + + + ID13 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 13 + 1 + + + ID14 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 14 + 1 + + + ID15 + Port input data bit (y = 0..15) These + bits are read-only. They contain the input value of + the corresponding I/O port. + 15 + 1 + + + + + ODR + ODR + GPIO port output data register + 0x14 + 0x20 + read-write + 0x00000000 + + + OD0 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 0 + 1 + + + OD1 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 1 + 1 + + + OD2 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 2 + 1 + + + OD3 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 3 + 1 + + + OD4 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 4 + 1 + + + OD5 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 5 + 1 + + + OD6 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 6 + 1 + + + OD7 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 7 + 1 + + + OD8 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 8 + 1 + + + OD9 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 9 + 1 + + + OD10 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 10 + 1 + + + OD11 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 11 + 1 + + + OD12 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 12 + 1 + + + OD13 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 13 + 1 + + + OD14 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 14 + 1 + + + OD15 + Port output data bit These bits can be + read and written by software. Note: For atomic bit + set/reset, the OD bits can be individually set and/or + reset by writing to the GPIOx_BSRR or GPIOx_BRR + registers (x = A..F). + 15 + 1 + + + + + BSRR + BSRR + GPIO port bit set/reset + register + 0x18 + 0x20 + write-only + 0x00000000 + + + BS0 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 0 + 1 + + + BS1 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 1 + 1 + + + BS2 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 2 + 1 + + + BS3 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 3 + 1 + + + BS4 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 4 + 1 + + + BS5 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 5 + 1 + + + BS6 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 6 + 1 + + + BS7 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 7 + 1 + + + BS8 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 8 + 1 + + + BS9 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 9 + 1 + + + BS10 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 10 + 1 + + + BS11 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 11 + 1 + + + BS12 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 12 + 1 + + + BS13 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 13 + 1 + + + BS14 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 14 + 1 + + + BS15 + Port x set bit y (y= 0..15) These bits + are write-only. A read to these bits returns the + value 0x0000. + 15 + 1 + + + BR0 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 16 + 1 + + + BR1 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 17 + 1 + + + BR2 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 18 + 1 + + + BR3 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 19 + 1 + + + BR4 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 20 + 1 + + + BR5 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 21 + 1 + + + BR6 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 22 + 1 + + + BR7 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 23 + 1 + + + BR8 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 24 + 1 + + + BR9 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 25 + 1 + + + BR10 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 26 + 1 + + + BR11 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 27 + 1 + + + BR12 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 28 + 1 + + + BR13 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 29 + 1 + + + BR14 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 30 + 1 + + + BR15 + Port x reset bit y (y = 0..15) These + bits are write-only. A read to these bits returns the + value 0x0000. Note: If both BSx and BRx are set, BSx + has priority. + 31 + 1 + + + + + LCKR + LCKR + This register is used to lock the + configuration of the port bits when a correct write + sequence is applied to bit 16 (LCKK). The value of bits + [15:0] is used to lock the configuration of the GPIO. + During the write sequence, the value of LCKR[15:0] must + not change. When the LOCK sequence has been applied on a + port bit, the value of this port bit can no longer be + modified until the next MCU reset or peripheral reset.A + specific write sequence is used to write to the + GPIOx_LCKR register. Only word access (32-bit long) is + allowed during this locking sequence.Each lock bit + freezes a specific configuration register (control and + alternate function registers). + 0x1C + 0x20 + read-write + 0x00000000 + + + LCK0 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 0 + 1 + + + LCK1 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 1 + 1 + + + LCK2 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 2 + 1 + + + LCK3 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 3 + 1 + + + LCK4 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 4 + 1 + + + LCK5 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 5 + 1 + + + LCK6 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 6 + 1 + + + LCK7 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 7 + 1 + + + LCK8 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 8 + 1 + + + LCK9 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 9 + 1 + + + LCK10 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 10 + 1 + + + LCK11 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 11 + 1 + + + LCK12 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 12 + 1 + + + LCK13 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 13 + 1 + + + LCK14 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 14 + 1 + + + LCK15 + Port x lock bit y (y= 0..15) These bits + are read/write but can only be written when the LCKK + bit is 0. + 15 + 1 + + + LCKK + Lock key This bit can be read any time. + It can only be modified using the lock key write + sequence. LOCK key write sequence: WR LCKR[16] = 1 + + LCKR[15:0] WR LCKR[16] = 0 + LCKR[15:0] WR LCKR[16] = + 1 + LCKR[15:0] RD LCKR RD LCKR[16] = 1 (this read + operation is optional but it confirms that the lock + is active) Note: During the LOCK key write sequence, + the value of LCK[15:0] must not change. Any error in + the lock sequence aborts the lock. After the first + lock sequence on any bit of the port, any read access + on the LCKK bit will return 1 until the next MCU + reset or peripheral reset. + 16 + 1 + + + + + AFRL + AFRL + GPIO alternate function low + register + 0x20 + 0x20 + read-write + 0x00000000 + + + AFSEL0 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 0 + 4 + + + AFSEL1 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 4 + 4 + + + AFSEL2 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 8 + 4 + + + AFSEL3 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 12 + 4 + + + AFSEL4 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 16 + 4 + + + AFSEL5 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 20 + 4 + + + AFSEL6 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 24 + 4 + + + AFSEL7 + [3:0]: Alternate function selection for + port x pin y (y = 0..7) These bits are written by + software to configure alternate function I/Os AFSELy + selection: + 28 + 4 + + + + + AFRH + AFRH + GPIO alternate function high + register + 0x24 + 0x20 + read-write + 0x00000000 + + + AFSEL8 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 0 + 4 + + + AFSEL9 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 4 + 4 + + + AFSEL10 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 8 + 4 + + + AFSEL11 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 12 + 4 + + + AFSEL12 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 16 + 4 + + + AFSEL13 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 20 + 4 + + + AFSEL14 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 24 + 4 + + + AFSEL15 + [3:0]: Alternate function selection for + port x pin y (y = 8..15) These bits are written by + software to configure alternate function + I/Os + 28 + 4 + + + + + + + GPIOB + 0x58020400 + + + GPIOC + 0x58020800 + + + GPIOD + 0x58020C00 + + + GPIOE + 0x58021000 + + + GPIOF + 0x58021400 + + + GPIOG + 0x58021800 + + + GPIOH + 0x58021C00 + + + GPIOI + 0x58022000 + + + GPIOJ + 0x58022400 + + + GPIOK + 0x58022800 + + + JPEG + JPEG + JPEG + 0x52003000 + + 0x0 + 0x400 + registers + + + JPEG + JPEG global interrupt + 121 + + + + CONFR0 + CONFR0 + JPEG codec control register + 0x0 + 0x20 + write-only + 0x00000000 + + + START + Start This bit start or stop the + encoding or decoding process. Read this register + always return 0. + 0 + 1 + + + + + CONFR1 + CONFR1 + JPEG codec configuration register + 1 + 0x4 + 0x20 + read-write + 0x00000000 + + + NF + Number of color components This field + defines the number of color components minus + 1. + 0 + 2 + + + DE + Decoding Enable This bit selects the + coding or decoding process + 3 + 1 + + + COLORSPACE + Color Space This filed defines the + number of quantization tables minus 1 to insert in + the output stream. + 4 + 2 + + + NS + Number of components for Scan This field + defines the number of components minus 1 for scan + header marker segment. + 6 + 2 + + + HDR + Header Processing This bit enable the + header processing (generation/parsing). + 8 + 1 + + + YSIZE + Y Size This field defines the number of + lines in source image. + 16 + 16 + + + + + CONFR2 + CONFR2 + JPEG codec configuration register + 2 + 0x8 + 0x20 + read-write + 0x00000000 + + + NMCU + Number of MCU For encoding: this field + defines the number of MCU units minus 1 to encode. + For decoding: this field indicates the number of + complete MCU units minus 1 to be decoded (this field + is updated after the JPEG header parsing). If the + decoded image size has not a X or Y size multiple of + 8 or 16 (depending on the sub-sampling process), the + resulting incomplete or empty MCU must be added to + this value to get the total number of MCU + generated. + 0 + 26 + + + + + CONFR3 + CONFR3 + JPEG codec configuration register + 3 + 0xC + 0x20 + read-write + 0x00000000 + + + XSIZE + X size This field defines the number of + pixels per line. + 16 + 16 + + + + + CONFRN1 + CONFRN1 + JPEG codec configuration register + 4-7 + 0x10 + 0x20 + read-write + 0x00000000 + + + HD + Huffman DC Selects the Huffman table for + encoding the DC coefficients. + 0 + 1 + + + HA + Huffman AC Selects the Huffman table for + encoding the AC coefficients. + 1 + 1 + + + QT + Quantization Table Selects quantization + table associated with a color + component. + 2 + 2 + + + NB + Number of Block Number of data units + minus 1 that belong to a particular color in the + MCU. + 4 + 4 + + + VSF + Vertical Sampling Factor Vertical + sampling factor for component i. + 8 + 4 + + + HSF + Horizontal Sampling Factor Horizontal + sampling factor for component i. + 12 + 4 + + + + + CONFRN2 + CONFRN2 + JPEG codec configuration register + 4-7 + 0x14 + 0x20 + read-write + 0x00000000 + + + HD + Huffman DC Selects the Huffman table for + encoding the DC coefficients. + 0 + 1 + + + HA + Huffman AC Selects the Huffman table for + encoding the AC coefficients. + 1 + 1 + + + QT + Quantization Table Selects quantization + table associated with a color + component. + 2 + 2 + + + NB + Number of Block Number of data units + minus 1 that belong to a particular color in the + MCU. + 4 + 4 + + + VSF + Vertical Sampling Factor Vertical + sampling factor for component i. + 8 + 4 + + + HSF + Horizontal Sampling Factor Horizontal + sampling factor for component i. + 12 + 4 + + + + + CONFRN3 + CONFRN3 + JPEG codec configuration register + 4-7 + 0x18 + 0x20 + read-write + 0x00000000 + + + HD + Huffman DC Selects the Huffman table for + encoding the DC coefficients. + 0 + 1 + + + HA + Huffman AC Selects the Huffman table for + encoding the AC coefficients. + 1 + 1 + + + QT + Quantization Table Selects quantization + table associated with a color + component. + 2 + 2 + + + NB + Number of Block Number of data units + minus 1 that belong to a particular color in the + MCU. + 4 + 4 + + + VSF + Vertical Sampling Factor Vertical + sampling factor for component i. + 8 + 4 + + + HSF + Horizontal Sampling Factor Horizontal + sampling factor for component i. + 12 + 4 + + + + + CONFRN4 + CONFRN4 + JPEG codec configuration register + 4-7 + 0x1C + 0x20 + read-write + 0x00000000 + + + HD + Huffman DC Selects the Huffman table for + encoding the DC coefficients. + 0 + 1 + + + HA + Huffman AC Selects the Huffman table for + encoding the AC coefficients. + 1 + 1 + + + QT + Quantization Table Selects quantization + table associated with a color + component. + 2 + 2 + + + NB + Number of Block Number of data units + minus 1 that belong to a particular color in the + MCU. + 4 + 4 + + + VSF + Vertical Sampling Factor Vertical + sampling factor for component i. + 8 + 4 + + + HSF + Horizontal Sampling Factor Horizontal + sampling factor for component i. + 12 + 4 + + + + + CR + CR + JPEG control register + 0x30 + 0x20 + read-write + 0x00000000 + + + JCEN + JPEG Core Enable Enable the JPEG codec + Core. + 0 + 1 + + + IFTIE + Input FIFO Threshold Interrupt Enable + This bit enables the interrupt generation when input + FIFO reach the threshold. + 1 + 1 + + + IFNFIE + Input FIFO Not Full Interrupt Enable + This bit enables the interrupt generation when input + FIFO is not empty. + 2 + 1 + + + OFTIE + Output FIFO Threshold Interrupt Enable + This bit enables the interrupt generation when output + FIFO reach the threshold. + 3 + 1 + + + OFNEIE + Output FIFO Not Empty Interrupt Enable + This bit enables the interrupt generation when output + FIFO is not empty. + 4 + 1 + + + EOCIE + End of Conversion Interrupt Enable This + bit enables the interrupt generation on the end of + conversion. + 5 + 1 + + + HPDIE + Header Parsing Done Interrupt Enable + This bit enables the interrupt generation on the + Header Parsing Operation. + 6 + 1 + + + IDMAEN + Input DMA Enable Enable the DMA request + generation for the input FIFO. + 11 + 1 + + + ODMAEN + Output DMA Enable Enable the DMA request + generation for the output FIFO. + 12 + 1 + + + IFF + Input FIFO Flush This bit flush the + input FIFO. This bit is always read as + 0. + 13 + 1 + + + OFF + Output FIFO Flush This bit flush the + output FIFO. This bit is always read as + 0. + 14 + 1 + + + + + SR + SR + JPEG status register + 0x34 + 0x20 + read-only + 0x00000006 + + + IFTF + Input FIFO Threshold Flag This bit is + set when the input FIFO is not full and is bellow its + threshold. + 1 + 1 + + + IFNFF + Input FIFO Not Full Flag This bit is set + when the input FIFO is not full (a data can be + written). + 2 + 1 + + + OFTF + Output FIFO Threshold Flag This bit is + set when the output FIFO is not empty and has reach + its threshold. + 3 + 1 + + + OFNEF + Output FIFO Not Empty Flag This bit is + set when the output FIFO is not empty (a data is + available). + 4 + 1 + + + EOCF + End of Conversion Flag This bit is set + when the JPEG codec core has finished the encoding or + the decoding process and than last data has been sent + to the output FIFO. + 5 + 1 + + + HPDF + Header Parsing Done Flag This bit is set + in decode mode when the JPEG codec has finished the + parsing of the headers and the internal registers + have been updated. + 6 + 1 + + + COF + Codec Operation Flag This bit is set + when when a JPEG codec operation is on going + (encoding or decoding). + 7 + 1 + + + + + CFR + CFR + JPEG clear flag register + 0x38 + 0x20 + read-write + 0x00000000 + + + CEOCF + Clear End of Conversion Flag Writing 1 + clears the End of Conversion Flag of the JPEG Status + Register. + 5 + 1 + + + CHPDF + Clear Header Parsing Done Flag Writing 1 + clears the Header Parsing Done Flag of the JPEG + Status Register. + 6 + 1 + + + + + DIR + DIR + JPEG data input register + 0x40 + 0x20 + write-only + 0x00000000 + + + DATAIN + Data Input FIFO Input FIFO data + register. + 0 + 32 + + + + + DOR + DOR + JPEG data output register + 0x44 + 0x20 + read-only + 0x00000000 + + + DATAOUT + Data Output FIFO Output FIFO data + register. + 0 + 32 + + + + + + + MDMA + MDMA + MDMA + 0x52000000 + + 0x0 + 0x1000 + registers + + + MDMA + MDMA + 122 + + + + MDMA_GISR0 + MDMA_GISR0 + MDMA Global Interrupt/Status + Register + 0x0 + 0x20 + read-only + 0x00000000 + + + GIF0 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 0 + 1 + + + GIF1 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 1 + 1 + + + GIF2 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 2 + 1 + + + GIF3 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 3 + 1 + + + GIF4 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 4 + 1 + + + GIF5 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 5 + 1 + + + GIF6 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 6 + 1 + + + GIF7 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 7 + 1 + + + GIF8 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 8 + 1 + + + GIF9 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 9 + 1 + + + GIF10 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 10 + 1 + + + GIF11 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 11 + 1 + + + GIF12 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 12 + 1 + + + GIF13 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 13 + 1 + + + GIF14 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 14 + 1 + + + GIF15 + Channel x global interrupt flag (x=...) + This bit is set and reset by hardware. It is a + logical OR of all the Channel x interrupt flags + (CTCIFx, BTIFx, BRTIFx, TEIFx) which are enabled in + the interrupt mask register (CTCIEx, BTIEx, BRTIEx, + TEIEx) + 15 + 1 + + + + + MDMA_C0ISR + MDMA_C0ISR + MDMA channel x interrupt/status + register + 0x40 + 0x20 + read-only + 0x00000000 + + + TEIF0 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF0 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF0 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF0 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF0 + channel x buffer transfer + complete + 4 + 1 + + + CRQA0 + channel x request active + flag + 16 + 1 + + + + + MDMA_C0IFCR + MDMA_C0IFCR + MDMA channel x interrupt flag clear + register + 0x44 + 0x20 + write-only + 0x00000000 + + + CTEIF0 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF0 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF0 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF0 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF0 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C0ESR + MDMA_C0ESR + MDMA Channel x error status + register + 0x48 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C0CR + MDMA_C0CR + This register is used to control the + concerned channel. + 0x4C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C0TCR + MDMA_C0TCR + This register is used to configure the + concerned channel. + 0x50 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C0BNDTR + MDMA_C0BNDTR + MDMA Channel x block number of data + register + 0x54 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C0SAR + MDMA_C0SAR + MDMA channel x source address + register + 0x58 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C0DAR + MDMA_C0DAR + MDMA channel x destination address + register + 0x5C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C0BRUR + MDMA_C0BRUR + MDMA channel x Block Repeat address Update + register + 0x60 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C0LAR + MDMA_C0LAR + MDMA channel x Link Address + register + 0x64 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C0TBR + MDMA_C0TBR + MDMA channel x Trigger and Bus selection + Register + 0x68 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C0MAR + MDMA_C0MAR + MDMA channel x Mask address + register + 0x70 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C0MDR + MDMA_C0MDR + MDMA channel x Mask Data + register + 0x74 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C1ISR + MDMA_C1ISR + MDMA channel x interrupt/status + register + 0x80 + 0x20 + read-only + 0x00000000 + + + TEIF1 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF1 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF1 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF1 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF1 + channel x buffer transfer + complete + 4 + 1 + + + CRQA1 + channel x request active + flag + 16 + 1 + + + + + MDMA_C1IFCR + MDMA_C1IFCR + MDMA channel x interrupt flag clear + register + 0x84 + 0x20 + write-only + 0x00000000 + + + CTEIF1 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF1 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF1 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF1 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF1 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C1ESR + MDMA_C1ESR + MDMA Channel x error status + register + 0x88 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C1CR + MDMA_C1CR + This register is used to control the + concerned channel. + 0x8C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C1TCR + MDMA_C1TCR + This register is used to configure the + concerned channel. + 0x90 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C1BNDTR + MDMA_C1BNDTR + MDMA Channel x block number of data + register + 0x94 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C1SAR + MDMA_C1SAR + MDMA channel x source address + register + 0x98 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C1DAR + MDMA_C1DAR + MDMA channel x destination address + register + 0x9C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C1BRUR + MDMA_C1BRUR + MDMA channel x Block Repeat address Update + register + 0xA0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C1LAR + MDMA_C1LAR + MDMA channel x Link Address + register + 0xA4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C1TBR + MDMA_C1TBR + MDMA channel x Trigger and Bus selection + Register + 0xA8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C1MAR + MDMA_C1MAR + MDMA channel x Mask address + register + 0xB0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C1MDR + MDMA_C1MDR + MDMA channel x Mask Data + register + 0xB4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C2ISR + MDMA_C2ISR + MDMA channel x interrupt/status + register + 0xC0 + 0x20 + read-only + 0x00000000 + + + TEIF2 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF2 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF2 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF2 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF2 + channel x buffer transfer + complete + 4 + 1 + + + CRQA2 + channel x request active + flag + 16 + 1 + + + + + MDMA_C2IFCR + MDMA_C2IFCR + MDMA channel x interrupt flag clear + register + 0xC4 + 0x20 + write-only + 0x00000000 + + + CTEIF2 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF2 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF2 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF2 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF2 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C2ESR + MDMA_C2ESR + MDMA Channel x error status + register + 0xC8 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C2CR + MDMA_C2CR + This register is used to control the + concerned channel. + 0xCC + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C2TCR + MDMA_C2TCR + This register is used to configure the + concerned channel. + 0xD0 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C2BNDTR + MDMA_C2BNDTR + MDMA Channel x block number of data + register + 0xD4 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C2SAR + MDMA_C2SAR + MDMA channel x source address + register + 0xD8 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C2DAR + MDMA_C2DAR + MDMA channel x destination address + register + 0xDC + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C2BRUR + MDMA_C2BRUR + MDMA channel x Block Repeat address Update + register + 0xE0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C2LAR + MDMA_C2LAR + MDMA channel x Link Address + register + 0xE4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C2TBR + MDMA_C2TBR + MDMA channel x Trigger and Bus selection + Register + 0xE8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C2MAR + MDMA_C2MAR + MDMA channel x Mask address + register + 0xF0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C2MDR + MDMA_C2MDR + MDMA channel x Mask Data + register + 0xF4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C3ISR + MDMA_C3ISR + MDMA channel x interrupt/status + register + 0x100 + 0x20 + read-only + 0x00000000 + + + TEIF3 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF3 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF3 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF3 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF3 + channel x buffer transfer + complete + 4 + 1 + + + CRQA3 + channel x request active + flag + 16 + 1 + + + + + MDMA_C3IFCR + MDMA_C3IFCR + MDMA channel x interrupt flag clear + register + 0x104 + 0x20 + write-only + 0x00000000 + + + CTEIF3 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF3 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF3 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF3 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF3 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C3ESR + MDMA_C3ESR + MDMA Channel x error status + register + 0x108 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C3CR + MDMA_C3CR + This register is used to control the + concerned channel. + 0x10C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C3TCR + MDMA_C3TCR + This register is used to configure the + concerned channel. + 0x110 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C3BNDTR + MDMA_C3BNDTR + MDMA Channel x block number of data + register + 0x114 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C3SAR + MDMA_C3SAR + MDMA channel x source address + register + 0x118 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C3DAR + MDMA_C3DAR + MDMA channel x destination address + register + 0x11C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C3BRUR + MDMA_C3BRUR + MDMA channel x Block Repeat address Update + register + 0x120 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C3LAR + MDMA_C3LAR + MDMA channel x Link Address + register + 0x124 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C3TBR + MDMA_C3TBR + MDMA channel x Trigger and Bus selection + Register + 0x128 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C3MAR + MDMA_C3MAR + MDMA channel x Mask address + register + 0x130 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C3MDR + MDMA_C3MDR + MDMA channel x Mask Data + register + 0x134 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C4ISR + MDMA_C4ISR + MDMA channel x interrupt/status + register + 0x140 + 0x20 + read-only + 0x00000000 + + + TEIF4 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF4 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF4 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF4 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF4 + channel x buffer transfer + complete + 4 + 1 + + + CRQA4 + channel x request active + flag + 16 + 1 + + + + + MDMA_C4IFCR + MDMA_C4IFCR + MDMA channel x interrupt flag clear + register + 0x144 + 0x20 + write-only + 0x00000000 + + + CTEIF4 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF4 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF4 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF4 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF4 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C4ESR + MDMA_C4ESR + MDMA Channel x error status + register + 0x148 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C4CR + MDMA_C4CR + This register is used to control the + concerned channel. + 0x14C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C4TCR + MDMA_C4TCR + This register is used to configure the + concerned channel. + 0x150 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C4BNDTR + MDMA_C4BNDTR + MDMA Channel x block number of data + register + 0x154 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C4SAR + MDMA_C4SAR + MDMA channel x source address + register + 0x158 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C4DAR + MDMA_C4DAR + MDMA channel x destination address + register + 0x15C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C4BRUR + MDMA_C4BRUR + MDMA channel x Block Repeat address Update + register + 0x160 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C4LAR + MDMA_C4LAR + MDMA channel x Link Address + register + 0x164 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C4TBR + MDMA_C4TBR + MDMA channel x Trigger and Bus selection + Register + 0x168 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C4MAR + MDMA_C4MAR + MDMA channel x Mask address + register + 0x170 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C4MDR + MDMA_C4MDR + MDMA channel x Mask Data + register + 0x174 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C5ISR + MDMA_C5ISR + MDMA channel x interrupt/status + register + 0x180 + 0x20 + read-only + 0x00000000 + + + TEIF5 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF5 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF5 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF5 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF5 + channel x buffer transfer + complete + 4 + 1 + + + CRQA5 + channel x request active + flag + 16 + 1 + + + + + MDMA_C5IFCR + MDMA_C5IFCR + MDMA channel x interrupt flag clear + register + 0x184 + 0x20 + write-only + 0x00000000 + + + CTEIF5 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF5 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF5 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF5 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF5 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C5ESR + MDMA_C5ESR + MDMA Channel x error status + register + 0x188 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C5CR + MDMA_C5CR + This register is used to control the + concerned channel. + 0x18C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C5TCR + MDMA_C5TCR + This register is used to configure the + concerned channel. + 0x190 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C5BNDTR + MDMA_C5BNDTR + MDMA Channel x block number of data + register + 0x194 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C5SAR + MDMA_C5SAR + MDMA channel x source address + register + 0x198 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C5DAR + MDMA_C5DAR + MDMA channel x destination address + register + 0x19C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C5BRUR + MDMA_C5BRUR + MDMA channel x Block Repeat address Update + register + 0x1A0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C5LAR + MDMA_C5LAR + MDMA channel x Link Address + register + 0x1A4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C5TBR + MDMA_C5TBR + MDMA channel x Trigger and Bus selection + Register + 0x1A8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C5MAR + MDMA_C5MAR + MDMA channel x Mask address + register + 0x1B0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C5MDR + MDMA_C5MDR + MDMA channel x Mask Data + register + 0x1B4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C6ISR + MDMA_C6ISR + MDMA channel x interrupt/status + register + 0x1C0 + 0x20 + read-only + 0x00000000 + + + TEIF6 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF6 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF6 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF6 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF6 + channel x buffer transfer + complete + 4 + 1 + + + CRQA6 + channel x request active + flag + 16 + 1 + + + + + MDMA_C6IFCR + MDMA_C6IFCR + MDMA channel x interrupt flag clear + register + 0x1C4 + 0x20 + write-only + 0x00000000 + + + CTEIF6 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF6 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF6 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF6 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF6 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C6ESR + MDMA_C6ESR + MDMA Channel x error status + register + 0x1C8 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C6CR + MDMA_C6CR + This register is used to control the + concerned channel. + 0x1CC + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C6TCR + MDMA_C6TCR + This register is used to configure the + concerned channel. + 0x1D0 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C6BNDTR + MDMA_C6BNDTR + MDMA Channel x block number of data + register + 0x1D4 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0 + 20 + 12 + + + + + MDMA_C6SAR + MDMA_C6SAR + MDMA channel x source address + register + 0x1D8 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C6DAR + MDMA_C6DAR + MDMA channel x destination address + register + 0x1DC + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C6BRUR + MDMA_C6BRUR + MDMA channel x Block Repeat address Update + register + 0x1E0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C6LAR + MDMA_C6LAR + MDMA channel x Link Address + register + 0x1E4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C6TBR + MDMA_C6TBR + MDMA channel x Trigger and Bus selection + Register + 0x1E8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C6MAR + MDMA_C6MAR + MDMA channel x Mask address + register + 0x1F0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C6MDR + MDMA_C6MDR + MDMA channel x Mask Data + register + 0x1F4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C7ISR + MDMA_C7ISR + MDMA channel x interrupt/status + register + 0x200 + 0x20 + read-only + 0x00000000 + + + TEIF7 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF7 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF7 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF7 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF7 + channel x buffer transfer + complete + 4 + 1 + + + CRQA7 + channel x request active + flag + 16 + 1 + + + + + MDMA_C7IFCR + MDMA_C7IFCR + MDMA channel x interrupt flag clear + register + 0x204 + 0x20 + write-only + 0x00000000 + + + CTEIF7 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF7 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF7 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF7 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF7 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C7ESR + MDMA_C7ESR + MDMA Channel x error status + register + 0x208 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C7CR + MDMA_C7CR + This register is used to control the + concerned channel. + 0x20C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C7TCR + MDMA_C7TCR + This register is used to configure the + concerned channel. + 0x210 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C7BNDTR + MDMA_C7BNDTR + MDMA Channel x block number of data + register + 0x214 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C7SAR + MDMA_C7SAR + MDMA channel x source address + register + 0x218 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C7DAR + MDMA_C7DAR + MDMA channel x destination address + register + 0x21C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C7BRUR + MDMA_C7BRUR + MDMA channel x Block Repeat address Update + register + 0x220 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C7LAR + MDMA_C7LAR + MDMA channel x Link Address + register + 0x224 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C7TBR + MDMA_C7TBR + MDMA channel x Trigger and Bus selection + Register + 0x228 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C7MAR + MDMA_C7MAR + MDMA channel x Mask address + register + 0x230 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C7MDR + MDMA_C7MDR + MDMA channel x Mask Data + register + 0x234 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C8ISR + MDMA_C8ISR + MDMA channel x interrupt/status + register + 0x240 + 0x20 + read-only + 0x00000000 + + + TEIF8 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF8 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF8 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF8 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF8 + channel x buffer transfer + complete + 4 + 1 + + + CRQA8 + channel x request active + flag + 16 + 1 + + + + + MDMA_C8IFCR + MDMA_C8IFCR + MDMA channel x interrupt flag clear + register + 0x244 + 0x20 + write-only + 0x00000000 + + + CTEIF8 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF8 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF8 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF8 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF8 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C8ESR + MDMA_C8ESR + MDMA Channel x error status + register + 0x248 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C8CR + MDMA_C8CR + This register is used to control the + concerned channel. + 0x24C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C8TCR + MDMA_C8TCR + This register is used to configure the + concerned channel. + 0x250 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C8BNDTR + MDMA_C8BNDTR + MDMA Channel x block number of data + register + 0x254 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C8SAR + MDMA_C8SAR + MDMA channel x source address + register + 0x258 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C8DAR + MDMA_C8DAR + MDMA channel x destination address + register + 0x25C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C8BRUR + MDMA_C8BRUR + MDMA channel x Block Repeat address Update + register + 0x260 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C8LAR + MDMA_C8LAR + MDMA channel x Link Address + register + 0x264 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C8TBR + MDMA_C8TBR + MDMA channel x Trigger and Bus selection + Register + 0x268 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C8MAR + MDMA_C8MAR + MDMA channel x Mask address + register + 0x270 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C8MDR + MDMA_C8MDR + MDMA channel x Mask Data + register + 0x274 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C9ISR + MDMA_C9ISR + MDMA channel x interrupt/status + register + 0x280 + 0x20 + read-only + 0x00000000 + + + TEIF9 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF9 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF9 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF9 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF9 + channel x buffer transfer + complete + 4 + 1 + + + CRQA9 + channel x request active + flag + 16 + 1 + + + + + MDMA_C9IFCR + MDMA_C9IFCR + MDMA channel x interrupt flag clear + register + 0x284 + 0x20 + write-only + 0x00000000 + + + CTEIF9 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF9 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF9 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF9 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF9 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C9ESR + MDMA_C9ESR + MDMA Channel x error status + register + 0x288 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C9CR + MDMA_C9CR + This register is used to control the + concerned channel. + 0x28C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C9TCR + MDMA_C9TCR + This register is used to configure the + concerned channel. + 0x290 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C9BNDTR + MDMA_C9BNDTR + MDMA Channel x block number of data + register + 0x294 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C9SAR + MDMA_C9SAR + MDMA channel x source address + register + 0x298 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C9DAR + MDMA_C9DAR + MDMA channel x destination address + register + 0x29C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C9BRUR + MDMA_C9BRUR + MDMA channel x Block Repeat address Update + register + 0x2A0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C9LAR + MDMA_C9LAR + MDMA channel x Link Address + register + 0x2A4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C9TBR + MDMA_C9TBR + MDMA channel x Trigger and Bus selection + Register + 0x2A8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C9MAR + MDMA_C9MAR + MDMA channel x Mask address + register + 0x2B0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C9MDR + MDMA_C9MDR + MDMA channel x Mask Data + register + 0x2B4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C10ISR + MDMA_C10ISR + MDMA channel x interrupt/status + register + 0x2C0 + 0x20 + read-only + 0x00000000 + + + TEIF10 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF10 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF10 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF10 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF10 + channel x buffer transfer + complete + 4 + 1 + + + CRQA10 + channel x request active + flag + 16 + 1 + + + + + MDMA_C10IFCR + MDMA_C10IFCR + MDMA channel x interrupt flag clear + register + 0x2C4 + 0x20 + write-only + 0x00000000 + + + CTEIF10 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF10 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF10 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF10 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF10 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C10ESR + MDMA_C10ESR + MDMA Channel x error status + register + 0x2C8 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C10CR + MDMA_C10CR + This register is used to control the + concerned channel. + 0x2CC + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C10TCR + MDMA_C10TCR + This register is used to configure the + concerned channel. + 0x2D0 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C10BNDTR + MDMA_C10BNDTR + MDMA Channel x block number of data + register + 0x2D4 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C10SAR + MDMA_C10SAR + MDMA channel x source address + register + 0x2D8 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C10DAR + MDMA_C10DAR + MDMA channel x destination address + register + 0x2DC + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C10BRUR + MDMA_C10BRUR + MDMA channel x Block Repeat address Update + register + 0x2E0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C10LAR + MDMA_C10LAR + MDMA channel x Link Address + register + 0x2E4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C10TBR + MDMA_C10TBR + MDMA channel x Trigger and Bus selection + Register + 0x2E8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C10MAR + MDMA_C10MAR + MDMA channel x Mask address + register + 0x2F0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C10MDR + MDMA_C10MDR + MDMA channel x Mask Data + register + 0x2F4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C11ISR + MDMA_C11ISR + MDMA channel x interrupt/status + register + 0x300 + 0x20 + read-only + 0x00000000 + + + TEIF11 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF11 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF11 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF11 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF11 + channel x buffer transfer + complete + 4 + 1 + + + CRQA11 + channel x request active + flag + 16 + 1 + + + + + MDMA_C11IFCR + MDMA_C11IFCR + MDMA channel x interrupt flag clear + register + 0x304 + 0x20 + write-only + 0x00000000 + + + CTEIF11 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF11 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF11 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF11 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF11 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C11ESR + MDMA_C11ESR + MDMA Channel x error status + register + 0x308 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C11CR + MDMA_C11CR + This register is used to control the + concerned channel. + 0x30C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C11TCR + MDMA_C11TCR + This register is used to configure the + concerned channel. + 0x310 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C11BNDTR + MDMA_C11BNDTR + MDMA Channel x block number of data + register + 0x314 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C11SAR + MDMA_C11SAR + MDMA channel x source address + register + 0x318 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C11DAR + MDMA_C11DAR + MDMA channel x destination address + register + 0x31C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C11BRUR + MDMA_C11BRUR + MDMA channel x Block Repeat address Update + register + 0x320 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C11LAR + MDMA_C11LAR + MDMA channel x Link Address + register + 0x324 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C11TBR + MDMA_C11TBR + MDMA channel x Trigger and Bus selection + Register + 0x328 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C11MAR + MDMA_C11MAR + MDMA channel x Mask address + register + 0x330 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C11MDR + MDMA_C11MDR + MDMA channel x Mask Data + register + 0x334 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C12ISR + MDMA_C12ISR + MDMA channel x interrupt/status + register + 0x340 + 0x20 + read-only + 0x00000000 + + + TEIF12 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF12 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF12 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF12 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF12 + channel x buffer transfer + complete + 4 + 1 + + + CRQA12 + channel x request active + flag + 16 + 1 + + + + + MDMA_C12IFCR + MDMA_C12IFCR + MDMA channel x interrupt flag clear + register + 0x344 + 0x20 + write-only + 0x00000000 + + + CTEIF12 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF12 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF12 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF12 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF12 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C12ESR + MDMA_C12ESR + MDMA Channel x error status + register + 0x348 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C12CR + MDMA_C12CR + This register is used to control the + concerned channel. + 0x34C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C12TCR + MDMA_C12TCR + This register is used to configure the + concerned channel. + 0x350 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C12BNDTR + MDMA_C12BNDTR + MDMA Channel x block number of data + register + 0x354 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C12SAR + MDMA_C12SAR + MDMA channel x source address + register + 0x358 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C12DAR + MDMA_C12DAR + MDMA channel x destination address + register + 0x35C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C12BRUR + MDMA_C12BRUR + MDMA channel x Block Repeat address Update + register + 0x360 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C12LAR + MDMA_C12LAR + MDMA channel x Link Address + register + 0x364 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C12TBR + MDMA_C12TBR + MDMA channel x Trigger and Bus selection + Register + 0x368 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C12MAR + MDMA_C12MAR + MDMA channel x Mask address + register + 0x370 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C12MDR + MDMA_C12MDR + MDMA channel x Mask Data + register + 0x374 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C13ISR + MDMA_C13ISR + MDMA channel x interrupt/status + register + 0x380 + 0x20 + read-only + 0x00000000 + + + TEIF13 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF13 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF13 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF13 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF13 + channel x buffer transfer + complete + 4 + 1 + + + CRQA13 + channel x request active + flag + 16 + 1 + + + + + MDMA_C13IFCR + MDMA_C13IFCR + MDMA channel x interrupt flag clear + register + 0x384 + 0x20 + write-only + 0x00000000 + + + CTEIF13 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF13 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF13 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF13 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF13 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C13ESR + MDMA_C13ESR + MDMA Channel x error status + register + 0x388 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C13CR + MDMA_C13CR + This register is used to control the + concerned channel. + 0x38C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C13TCR + MDMA_C13TCR + This register is used to configure the + concerned channel. + 0x390 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C13BNDTR + MDMA_C13BNDTR + MDMA Channel x block number of data + register + 0x394 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C13SAR + MDMA_C13SAR + MDMA channel x source address + register + 0x398 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C13DAR + MDMA_C13DAR + MDMA channel x destination address + register + 0x39C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C13BRUR + MDMA_C13BRUR + MDMA channel x Block Repeat address Update + register + 0x3A0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C13LAR + MDMA_C13LAR + MDMA channel x Link Address + register + 0x3A4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C13TBR + MDMA_C13TBR + MDMA channel x Trigger and Bus selection + Register + 0x3A8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C13MAR + MDMA_C13MAR + MDMA channel x Mask address + register + 0x3B0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C13MDR + MDMA_C13MDR + MDMA channel x Mask Data + register + 0x3B4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C14ISR + MDMA_C14ISR + MDMA channel x interrupt/status + register + 0x3C0 + 0x20 + read-only + 0x00000000 + + + TEIF14 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF14 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF14 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF14 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF14 + channel x buffer transfer + complete + 4 + 1 + + + CRQA14 + channel x request active + flag + 16 + 1 + + + + + MDMA_C14IFCR + MDMA_C14IFCR + MDMA channel x interrupt flag clear + register + 0x3C4 + 0x20 + write-only + 0x00000000 + + + CTEIF14 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF14 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF14 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF14 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF14 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C14ESR + MDMA_C14ESR + MDMA Channel x error status + register + 0x3C8 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C14CR + MDMA_C14CR + This register is used to control the + concerned channel. + 0x3CC + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C14TCR + MDMA_C14TCR + This register is used to configure the + concerned channel. + 0x3D0 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C14BNDTR + MDMA_C14BNDTR + MDMA Channel x block number of data + register + 0x3D4 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C14SAR + MDMA_C14SAR + MDMA channel x source address + register + 0x3D8 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C14DAR + MDMA_C14DAR + MDMA channel x destination address + register + 0x3DC + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C14BRUR + MDMA_C14BRUR + MDMA channel x Block Repeat address Update + register + 0x3E0 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C14LAR + MDMA_C14LAR + MDMA channel x Link Address + register + 0x3E4 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C14TBR + MDMA_C14TBR + MDMA channel x Trigger and Bus selection + Register + 0x3E8 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C14MAR + MDMA_C14MAR + MDMA channel x Mask address + register + 0x3F0 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C14MDR + MDMA_C14MDR + MDMA channel x Mask Data + register + 0x3F4 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + MDMA_C15ISR + MDMA_C15ISR + MDMA channel x interrupt/status + register + 0x400 + 0x20 + read-only + 0x00000000 + + + TEIF15 + Channel x transfer error interrupt flag + This bit is set by hardware. It is cleared by + software writing 1 to the corresponding bit in the + DMA_IFCRy register. + 0 + 1 + + + CTCIF15 + Channel x Channel Transfer Complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. CTC is set when the + last block was transferred and the channel has been + automatically disabled. CTC is also set when the + channel is suspended, as a result of writing EN bit + to 0. + 1 + 1 + + + BRTIF15 + Channel x block repeat transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 2 + 1 + + + BTIF15 + Channel x block transfer complete + interrupt flag This bit is set by hardware. It is + cleared by software writing 1 to the corresponding + bit in the DMA_IFCRy register. + 3 + 1 + + + TCIF15 + channel x buffer transfer + complete + 4 + 1 + + + CRQA15 + channel x request active + flag + 16 + 1 + + + + + MDMA_C15IFCR + MDMA_C15IFCR + MDMA channel x interrupt flag clear + register + 0x404 + 0x20 + write-only + 0x00000000 + + + CTEIF15 + Channel x clear transfer error interrupt + flag Writing a 1 into this bit clears TEIFx in the + MDMA_ISRy register + 0 + 1 + + + CCTCIF15 + Clear Channel transfer complete + interrupt flag for channel x Writing a 1 into this + bit clears CTCIFx in the MDMA_ISRy + register + 1 + 1 + + + CBRTIF15 + Channel x clear block repeat transfer + complete interrupt flag Writing a 1 into this bit + clears BRTIFx in the MDMA_ISRy register + 2 + 1 + + + CBTIF15 + Channel x Clear block transfer complete + interrupt flag Writing a 1 into this bit clears BTIFx + in the MDMA_ISRy register + 3 + 1 + + + CLTCIF15 + CLear buffer Transfer Complete Interrupt + Flag for channel x Writing a 1 into this bit clears + TCIFx in the MDMA_ISRy register + 4 + 1 + + + + + MDMA_C15ESR + MDMA_C15ESR + MDMA Channel x error status + register + 0x408 + 0x20 + read-only + 0x00000000 + + + TEA + Transfer Error Address These bits are + set and cleared by HW, in case of an MDMA data + transfer error. It is used in conjunction with TED. + This field indicates the 7 LSBits of the address + which generated a transfer/access error. It may be + used by SW to retrieve the failing address, by adding + this value (truncated to the buffer transfer length + size) to the current SAR/DAR value. Note: The SAR/DAR + current value doesnt reflect this last address due to + the FIFO management system. The SAR/DAR are only + updated at the end of a (buffer) transfer (of TLEN+1 + bytes). Note: It is not set in case of a link data + error. + 0 + 7 + + + TED + Transfer Error Direction These bit is + set and cleared by HW, in case of an MDMA data + transfer error. + 7 + 1 + + + TELD + Transfer Error Link Data These bit is + set by HW, in case of a transfer error while reading + the block link data structure. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 8 + 1 + + + TEMD + Transfer Error Mask Data These bit is + set by HW, in case of a transfer error while writing + the Mask Data. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 9 + 1 + + + ASE + Address/Size Error These bit is set by + HW, when the programmed address is not aligned with + the data size. TED will indicate whether the problem + is on the source or destination. It is cleared by + software writing 1 to the CTEIFx bit in the DMA_IFCRy + register. + 10 + 1 + + + BSE + Block Size Error These bit is set by HW, + when the block size is not an integer multiple of the + data size either for source or destination. TED will + indicate whether the problem is on the source or + destination. It is cleared by software writing 1 to + the CTEIFx bit in the DMA_IFCRy + register. + 11 + 1 + + + + + MDMA_C15CR + MDMA_C15CR + This register is used to control the + concerned channel. + 0x40C + 0x20 + 0x00000000 + + + EN + channel enable + 0 + 1 + read-write + + + TEIE + Transfer error interrupt enable This bit + is set and cleared by software. + 1 + 1 + read-write + + + CTCIE + Channel Transfer Complete interrupt + enable This bit is set and cleared by + software. + 2 + 1 + read-write + + + BRTIE + Block Repeat transfer interrupt enable + This bit is set and cleared by + software. + 3 + 1 + read-write + + + BTIE + Block Transfer interrupt enable This bit + is set and cleared by software. + 4 + 1 + read-write + + + TCIE + buffer Transfer Complete interrupt + enable This bit is set and cleared by + software. + 5 + 1 + read-write + + + PL + Priority level These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0. + 6 + 2 + read-write + + + BEX + byte Endianness exchange + 12 + 1 + read-write + + + HEX + Half word Endianes + exchange + 13 + 1 + read-write + + + WEX + Word Endianness exchange + 14 + 1 + read-write + + + SWRQ + SW ReQuest Writing a 1 into this bit + sets the CRQAx in MDMA_ISRy register, activating the + request on Channel x Note: Either the whole CxCR + register or the 8-bit/16-bit register @ Address + offset: 0x4E + 0x40 chn may be used for SWRQ + activation. In case of a SW request, acknowledge is + not generated (neither HW signal, nor CxMAR write + access). + 16 + 1 + write-only + + + + + MDMA_C15TCR + MDMA_C15TCR + This register is used to configure the + concerned channel. + 0x410 + 0x20 + read-write + 0x00000000 + + + SINC + Source increment mode These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0 Note: When source is + AHB (SBUS=1), SINC = 00 is forbidden. In Linked List + Mode, at the end of a block (single or last block in + repeated block transfer mode), this register will be + loaded from memory (from address given by current + LAR[31:0] + 0x00). + 0 + 2 + + + DINC + Destination increment mode These bits + are set and cleared by software. These bits are + protected and can be written only if EN is 0 Note: + When destination is AHB (DBUS=1), DINC = 00 is + forbidden. + 2 + 2 + + + SSIZE + Source data size These bits are set and + cleared by software. These bits are protected and can + be written only if EN is 0 Note: If a value of 11 is + programmed for the TCM access/AHB port, a transfer + error will occur (TEIF bit set) If SINCOS &lt; + SSIZE and SINC &#8800; 00, the result will be + unpredictable. Note: SSIZE = 11 (double-word) is + forbidden when source is TCM/AHB bus + (SBUS=1). + 4 + 2 + + + DSIZE + Destination data size These bits are set + and cleared by software. These bits are protected and + can be written only if EN is 0. Note: If a value of + 11 is programmed for the TCM access/AHB port, a + transfer error will occur (TEIF bit set) If DINCOS + &lt; DSIZE and DINC &#8800; 00, the result + will be unpredictable. Note: DSIZE = 11 (double-word) + is forbidden when destination is TCM/AHB bus + (DBUS=1). + 6 + 2 + + + SINCOS + source increment offset + size + 8 + 2 + + + DINCOS + Destination increment + offset + 10 + 2 + + + SBURST + source burst transfer + configuration + 12 + 3 + + + DBURST + Destination burst transfer + configuration + 15 + 3 + + + TLEN + buffer transfer lengh + 18 + 7 + + + PKE + PacK Enable These bit is set and cleared + by software. If the Source Size is smaller than the + destination, it will be padded according to the PAM + value. If the Source data size is larger than the + destination one, it will be truncated. The alignment + will be done according to the PAM[0] value. This bit + is protected and can be written only if EN is + 0 + 25 + 1 + + + PAM + Padding/Alignement Mode These bits are + set and cleared by software. Case 1: Source data size + smaller than destination data size - 3 options are + valid. Case 2: Source data size larger than + destination data size. The remainder part is + discarded. When PKE = 1 or DSIZE=SSIZE, these bits + are ignored. These bits are protected and can be + written only if EN is 0 + 26 + 2 + + + TRGM + Trigger Mode These bits are set and + cleared by software. Note: If TRGM is 11 for the + current block, all the values loaded at the end of + the current block through the linked list mechanism + must keep the same value (TRGM=11) and the same SWRM + value, otherwise the result is undefined. These bits + are protected and can be written only if EN is + 0. + 28 + 2 + + + SWRM + SW Request Mode This bit is set and + cleared by software. If a HW or SW request is + currently active, the bit change will be delayed + until the current transfer is completed. If the CxMAR + contains a valid address, the CxMDR value will also + be written @ CxMAR address. This bit is protected and + can be written only if EN is 0. + 30 + 1 + + + BWM + Bufferable Write Mode This bit is set + and cleared by software. This bit is protected and + can be written only if EN is 0. Note: All MDMA + destination accesses are non-cacheable. + 31 + 1 + + + + + MDMA_C15BNDTR + MDMA_C15BNDTR + MDMA Channel x block number of data + register + 0x414 + 0x20 + read-write + 0x00000000 + + + BNDT + block number of data to + transfer + 0 + 17 + + + BRSUM + Block Repeat Source address Update Mode + These bits are protected and can be written only if + EN is 0. + 18 + 1 + + + BRDUM + Block Repeat Destination address Update + Mode These bits are protected and can be written only + if EN is 0. + 19 + 1 + + + BRC + Block Repeat Count This field contains + the number of repetitions of the current block (0 to + 4095). When the channel is enabled, this register is + read-only, indicating the remaining number of blocks, + excluding the current one. This register decrements + after each complete block transfer. Once the last + block transfer has completed, this register can + either stay at zero or be reloaded automatically from + memory (in Linked List mode - i.e. Link Address + valid). These bits are protected and can be written + only if EN is 0. + 20 + 12 + + + + + MDMA_C15SAR + MDMA_C15SAR + MDMA channel x source address + register + 0x418 + 0x20 + read-write + 0x00000000 + + + SAR + source adr base + 0 + 32 + + + + + MDMA_C15DAR + MDMA_C15DAR + MDMA channel x destination address + register + 0x41C + 0x20 + read-write + 0x00000000 + + + DAR + Destination adr base + 0 + 32 + + + + + MDMA_C15BRUR + MDMA_C15BRUR + MDMA channel x Block Repeat address Update + register + 0x420 + 0x20 + read-write + 0x00000000 + + + SUV + source adresse update + value + 0 + 16 + + + DUV + destination address update + 16 + 16 + + + + + MDMA_C15LAR + MDMA_C15LAR + MDMA channel x Link Address + register + 0x424 + 0x20 + read-write + 0x00000000 + + + LAR + Link address register + 0 + 32 + + + + + MDMA_C15TBR + MDMA_C15TBR + MDMA channel x Trigger and Bus selection + Register + 0x428 + 0x20 + read-write + 0x00000000 + + + TSEL + Trigger selection + 0 + 6 + + + SBUS + Source BUS select This bit is protected + and can be written only if EN is 0. + 16 + 1 + + + DBUS + Destination BUS slect This bit is + protected and can be written only if EN is + 0. + 17 + 1 + + + + + MDMA_C15MAR + MDMA_C15MAR + MDMA channel x Mask address + register + 0x430 + 0x20 + read-write + 0x00000000 + + + MAR + Mask address + 0 + 32 + + + + + MDMA_C15MDR + MDMA_C15MDR + MDMA channel x Mask Data + register + 0x434 + 0x20 + read-write + 0x00000000 + + + MDR + Mask data + 0 + 32 + + + + + + + QUADSPI + QUADSPI + QUADSPI + 0x52005000 + + 0x0 + 0x400 + registers + + + QUADSPI + QuadSPI global interrupt + 92 + + + + CR + CR + QUADSPI control register + 0x0 + 0x20 + read-write + 0x00000000 + + + EN + Enable Enable the QUADSPI. + 0 + 1 + + + ABORT + Abort request This bit aborts the + on-going command sequence. It is automatically reset + once the abort is complete. This bit stops the + current transfer. In polling mode or memory-mapped + mode, this bit also reset the APM bit or the DM + bit. + 1 + 1 + + + DMAEN + DMA enable In indirect mode, DMA can be + used to input or output data via the QUADSPI_DR + register. DMA transfers are initiated when the FIFO + threshold flag, FTF, is set. + 2 + 1 + + + TCEN + Timeout counter enable This bit is valid + only when memory-mapped mode (FMODE = 11) is + selected. Activating this bit causes the chip select + (nCS) to be released (and thus reduces consumption) + if there has not been an access after a certain + amount of time, where this time is defined by + TIMEOUT[15:0] (QUADSPI_LPTR). Enable the timeout + counter. By default, the QUADSPI never stops its + prefetch operation, keeping the previous read + operation active with nCS maintained low, even if no + access to the Flash memory occurs for a long time. + Since Flash memories tend to consume more when nCS is + held low, the application might want to activate the + timeout counter (TCEN = 1, QUADSPI_CR[3]) so that nCS + is released after a period of TIMEOUT[15:0] + (QUADSPI_LPTR) cycles have elapsed without an access + since when the FIFO becomes full with prefetch data. + This bit can be modified only when BUSY = + 0. + 3 + 1 + + + SSHIFT + Sample shift By default, the QUADSPI + samples data 1/2 of a CLK cycle after the data is + driven by the Flash memory. This bit allows the data + is to be sampled later in order to account for + external signal delays. Firmware must assure that + SSHIFT = 0 when in DDR mode (when DDRM = 1). This + field can be modified only when BUSY = + 0. + 4 + 1 + + + DFM + Dual-flash mode This bit activates + dual-flash mode, where two external Flash memories + are used simultaneously to double throughput and + capacity. This bit can be modified only when BUSY = + 0. + 6 + 1 + + + FSEL + Flash memory selection This bit selects + the Flash memory to be addressed in single flash mode + (when DFM = 0). This bit can be modified only when + BUSY = 0. This bit is ignored when DFM = + 1. + 7 + 1 + + + FTHRES + FIFO threshold level Defines, in + indirect mode, the threshold number of bytes in the + FIFO that will cause the FIFO threshold flag (FTF, + QUADSPI_SR[2]) to be set. In indirect write mode + (FMODE = 00): ... In indirect read mode (FMODE = 01): + ... If DMAEN = 1, then the DMA controller for the + corresponding channel must be disabled before + changing the FTHRES value. + 8 + 5 + + + TEIE + Transfer error interrupt enable This bit + enables the transfer error interrupt. + 16 + 1 + + + TCIE + Transfer complete interrupt enable This + bit enables the transfer complete + interrupt. + 17 + 1 + + + FTIE + FIFO threshold interrupt enable This bit + enables the FIFO threshold interrupt. + 18 + 1 + + + SMIE + Status match interrupt enable This bit + enables the status match interrupt. + 19 + 1 + + + TOIE + TimeOut interrupt enable This bit + enables the TimeOut interrupt. + 20 + 1 + + + APMS + Automatic poll mode stop This bit + determines if automatic polling is stopped after a + match. This bit can be modified only when BUSY = + 0. + 22 + 1 + + + PMM + Polling match mode This bit indicates + which method should be used for determining a match + during automatic polling mode. This bit can be + modified only when BUSY = 0. + 23 + 1 + + + PRESCALER + clock prescaler + 24 + 8 + + + + + DCR + DCR + QUADSPI device configuration + register + 0x4 + 0x20 + read-write + 0x00000000 + + + CKMODE + indicates the level that clk takes + between command + 0 + 1 + + + CSHT + Chip select high time CSHT+1 defines the + minimum number of CLK cycles which the chip select + (nCS) must remain high between commands issued to the + Flash memory. ... This field can be modified only + when BUSY = 0. + 8 + 3 + + + FSIZE + Flash memory size This field defines the + size of external memory using the following formula: + Number of bytes in Flash memory = 2[FSIZE+1] FSIZE+1 + is effectively the number of address bits required to + address the Flash memory. The Flash memory capacity + can be up to 4GB (addressed using 32 bits) in + indirect mode, but the addressable space in + memory-mapped mode is limited to 256MB. If DFM = 1, + FSIZE indicates the total capacity of the two Flash + memories together. This field can be modified only + when BUSY = 0. + 16 + 5 + + + + + SR + SR + QUADSPI status register + 0x8 + 0x20 + read-only + 0x00000000 + + + TEF + Transfer error flag This bit is set in + indirect mode when an invalid address is being + accessed in indirect mode. It is cleared by writing 1 + to CTEF. + 0 + 1 + + + TCF + Transfer complete flag This bit is set + in indirect mode when the programmed number of data + has been transferred or in any mode when the transfer + has been aborted.It is cleared by writing 1 to + CTCF. + 1 + 1 + + + FTF + FIFO threshold flag In indirect mode, + this bit is set when the FIFO threshold has been + reached, or if there is any data left in the FIFO + after reads from the Flash memory are complete. It is + cleared automatically as soon as threshold condition + is no longer true. In automatic polling mode this bit + is set every time the status register is read, and + the bit is cleared when the data register is + read. + 2 + 1 + + + SMF + Status match flag This bit is set in + automatic polling mode when the unmasked received + data matches the corresponding bits in the match + register (QUADSPI_PSMAR). It is cleared by writing 1 + to CSMF. + 3 + 1 + + + TOF + Timeout flag This bit is set when + timeout occurs. It is cleared by writing 1 to + CTOF. + 4 + 1 + + + BUSY + Busy This bit is set when an operation + is on going. This bit clears automatically when the + operation with the Flash memory is finished and the + FIFO is empty. + 5 + 1 + + + FLEVEL + FIFO level This field gives the number + of valid bytes which are being held in the FIFO. + FLEVEL = 0 when the FIFO is empty, and 16 when it is + full. In memory-mapped mode and in automatic status + polling mode, FLEVEL is zero. + 8 + 6 + + + + + FCR + FCR + QUADSPI flag clear register + 0xC + 0x20 + read-write + 0x00000000 + + + CTEF + Clear transfer error flag Writing 1 + clears the TEF flag in the QUADSPI_SR + register + 0 + 1 + + + CTCF + Clear transfer complete flag Writing 1 + clears the TCF flag in the QUADSPI_SR + register + 1 + 1 + + + CSMF + Clear status match flag Writing 1 clears + the SMF flag in the QUADSPI_SR register + 3 + 1 + + + CTOF + Clear timeout flag Writing 1 clears the + TOF flag in the QUADSPI_SR register + 4 + 1 + + + + + DLR + DLR + QUADSPI data length register + 0x10 + 0x20 + read-write + 0x00000000 + + + DL + Data length Number of data to be + retrieved (value+1) in indirect and status-polling + modes. A value no greater than 3 (indicating 4 bytes) + should be used for status-polling mode. All 1s in + indirect mode means undefined length, where QUADSPI + will continue until the end of memory, as defined by + FSIZE. 0x0000_0000: 1 byte is to be transferred + 0x0000_0001: 2 bytes are to be transferred + 0x0000_0002: 3 bytes are to be transferred + 0x0000_0003: 4 bytes are to be transferred ... + 0xFFFF_FFFD: 4,294,967,294 (4G-2) bytes are to be + transferred 0xFFFF_FFFE: 4,294,967,295 (4G-1) bytes + are to be transferred 0xFFFF_FFFF: undefined length + -- all bytes until the end of Flash memory (as + defined by FSIZE) are to be transferred. Continue + reading indefinitely if FSIZE = 0x1F. DL[0] is stuck + at 1 in dual-flash mode (DFM = 1) even when 0 is + written to this bit, thus assuring that each access + transfers an even number of bytes. This field has no + effect when in memory-mapped mode (FMODE = 10). This + field can be written only when BUSY = + 0. + 0 + 32 + + + + + CCR + CCR + QUADSPI communication configuration + register + 0x14 + 0x20 + read-write + 0x00000000 + + + INSTRUCTION + Instruction Instruction to be send to + the external SPI device. This field can be written + only when BUSY = 0. + 0 + 8 + + + IMODE + Instruction mode This field defines the + instruction phase mode of operation: This field can + be written only when BUSY = 0. + 8 + 2 + + + ADMODE + Address mode This field defines the + address phase mode of operation: This field can be + written only when BUSY = 0. + 10 + 2 + + + ADSIZE + Address size This bit defines address + size: This field can be written only when BUSY = + 0. + 12 + 2 + + + ABMODE + Alternate bytes mode This field defines + the alternate-bytes phase mode of operation: This + field can be written only when BUSY = + 0. + 14 + 2 + + + ABSIZE + Alternate bytes size This bit defines + alternate bytes size: This field can be written only + when BUSY = 0. + 16 + 2 + + + DCYC + Number of dummy cycles This field + defines the duration of the dummy phase. In both SDR + and DDR modes, it specifies a number of CLK cycles + (0-31). This field can be written only when BUSY = + 0. + 18 + 5 + + + DMODE + Data mode This field defines the data + phases mode of operation: This field also determines + the dummy phase mode of operation. This field can be + written only when BUSY = 0. + 24 + 2 + + + FMODE + Functional mode This field defines the + QUADSPI functional mode of operation. If DMAEN = 1 + already, then the DMA controller for the + corresponding channel must be disabled before + changing the FMODE value. This field can be written + only when BUSY = 0. + 26 + 2 + + + SIOO + Send instruction only once mode See + Section15.3.11: Sending the instruction only once on + page13. This bit has no effect when IMODE = 00. This + field can be written only when BUSY = + 0. + 28 + 1 + + + DHHC + DDR hold Delay the data output by 1/4 of + the QUADSPI output clock cycle in DDR mode: This + feature is only active in DDR mode. This field can be + written only when BUSY = 0. + 30 + 1 + + + DDRM + Double data rate mode This bit sets the + DDR mode for the address, alternate byte and data + phase: This field can be written only when BUSY = + 0. + 31 + 1 + + + + + AR + AR + QUADSPI address register + 0x18 + 0x20 + read-write + 0x00000000 + + + ADDRESS + [31 0]: Address Address to be send to + the external Flash memory Writes to this field are + ignored when BUSY = 0 or when FMODE = 11 + (memory-mapped mode). In dual flash mode, ADDRESS[0] + is automatically stuck to 0 as the address should + always be even + 0 + 32 + + + + + ABR + ABR + QUADSPI alternate bytes + registers + 0x1C + 0x20 + read-write + 0x00000000 + + + ALTERNATE + Alternate Bytes Optional data to be send + to the external SPI device right after the address. + This field can be written only when BUSY = + 0. + 0 + 32 + + + + + DR + DR + QUADSPI data register + 0x20 + 0x20 + read-write + 0x00000000 + + + DATA + Data Data to be sent/received to/from + the external SPI device. In indirect write mode, data + written to this register is stored on the FIFO before + it is sent to the Flash memory during the data phase. + If the FIFO is too full, a write operation is stalled + until the FIFO has enough space to accept the amount + of data being written. In indirect read mode, reading + this register gives (via the FIFO) the data which was + received from the Flash memory. If the FIFO does not + have as many bytes as requested by the read operation + and if BUSY=1, the read operation is stalled until + enough data is present or until the transfer is + complete, whichever happens first. In automatic + polling mode, this register contains the last data + read from the Flash memory (without masking). Word, + halfword, and byte accesses to this register are + supported. In indirect write mode, a byte write adds + 1 byte to the FIFO, a halfword write 2, and a word + write 4. Similarly, in indirect read mode, a byte + read removes 1 byte from the FIFO, a halfword read 2, + and a word read 4. Accesses in indirect mode must be + aligned to the bottom of this register: a byte read + must read DATA[7:0] and a halfword read must read + DATA[15:0]. + 0 + 32 + + + + + PSMKR + PSMKR + QUADSPI polling status mask + register + 0x24 + 0x20 + read-write + 0x00000000 + + + MASK + Status mask Mask to be applied to the + status bytes received in polling mode. For bit n: + This field can be written only when BUSY = + 0. + 0 + 32 + + + + + PSMAR + PSMAR + QUADSPI polling status match + register + 0x28 + 0x20 + read-write + 0x00000000 + + + MATCH + Status match Value to be compared with + the masked status register to get a match. This field + can be written only when BUSY = 0. + 0 + 32 + + + + + PIR + PIR + QUADSPI polling interval + register + 0x2C + 0x20 + read-write + 0x00000000 + + + INTERVAL + Polling interval Number of CLK cycles + between to read during automatic polling phases. This + field can be written only when BUSY = + 0. + 0 + 16 + + + + + LPTR + LPTR + QUADSPI low-power timeout + register + 0x30 + 0x20 + read-write + 0x00000000 + + + TIMEOUT + Timeout period After each access in + memory-mapped mode, the QUADSPI prefetches the + subsequent bytes and holds these bytes in the FIFO. + This field indicates how many CLK cycles the QUADSPI + waits after the FIFO becomes full until it raises + nCS, putting the Flash memory in a lower-consumption + state. This field can be written only when BUSY = + 0. + 0 + 16 + + + + + + + RNG + RNG + RNG + 0x48021800 + + 0x0 + 0x400 + registers + + + + CR + CR + RNG control register + 0x0 + 0x20 + read-write + 0x00000000 + + + RNGEN + Random number generator + enable + 2 + 1 + + + IE + Interrupt enable + 3 + 1 + + + CED + Clock error detection Note: The clock + error detection can be used only when ck_rc48 or + ck_pll1_q (ck_pll1_q = 48MHz) source is selected + otherwise, CED bit must be equal to 1. The clock + error detection cannot be enabled nor disabled on the + fly when RNG peripheral is enabled, to enable or + disable CED the RNG must be disabled. + 5 + 1 + + + + + SR + SR + RNG status register + 0x4 + 0x20 + 0x00000000 + + + DRDY + Data ready Note: If IE=1 in RNG_CR, an + interrupt is generated when DRDY=1. It can rise when + the peripheral is disabled. When the output buffer + becomes empty (after reading RNG_DR), this bit + returns to 0 until a new random value is + generated. + 0 + 1 + read-only + + + CECS + Clock error current status Note: This + bit is meaningless if CED (Clock error detection) bit + in RNG_CR is equal to 1. + 1 + 1 + read-only + + + SECS + Seed error current status ** More than + 64 consecutive bits at the same value (0 or 1) ** + More than 32 consecutive alternances of 0 and 1 + (0101010101...01) + 2 + 1 + read-only + + + CEIS + Clock error interrupt status This bit is + set at the same time as CECS. It is cleared by + writing it to 0. An interrupt is pending if IE = 1 in + the RNG_CR register. Note: This bit is meaningless if + CED (Clock error detection) bit in RNG_CR is equal to + 1. + 5 + 1 + read-write + + + SEIS + Seed error interrupt status This bit is + set at the same time as SECS. It is cleared by + writing it to 0. ** More than 64 consecutive bits at + the same value (0 or 1) ** More than 32 consecutive + alternances of 0 and 1 (0101010101...01) An interrupt + is pending if IE = 1 in the RNG_CR + register. + 6 + 1 + read-write + + + + + DR + DR + The RNG_DR register is a read-only register + that delivers a 32-bit random value when read. The + content of this register is valid when DRDY= 1, even if + RNGEN=0. + 0x8 + 0x20 + read-only + 0x00000000 + + + RNDATA + Random data 32-bit random data which are + valid when DRDY=1. + 0 + 32 + + + + + + + RTC + RTC + RTC + 0x58004000 + + 0x0 + 0x400 + registers + + + RTC_TAMP_STAMP_CSS_LSE + RTC tamper, timestamp + 2 + + + RTC_WKUP + RTC Wakeup interrupt + 3 + + + + RTC_TR + RTC_TR + The RTC_TR is the calendar time shadow + register. This register must be written in initialization + mode only. Refer to Calendar initialization and + configuration on page9 and Reading the calendar on + page10.This register is write protected. The write access + procedure is described in RTC register write protection + on page9. + 0x0 + 0x20 + read-write + 0x00000000 + + + SU + Second units in BCD format + 0 + 4 + + + ST + Second tens in BCD format + 4 + 3 + + + MNU + Minute units in BCD format + 8 + 4 + + + MNT + Minute tens in BCD format + 12 + 3 + + + HU + Hour units in BCD format + 16 + 4 + + + HT + Hour tens in BCD format + 20 + 2 + + + PM + AM/PM notation + 22 + 1 + + + + + RTC_DR + RTC_DR + The RTC_DR is the calendar date shadow + register. This register must be written in initialization + mode only. Refer to Calendar initialization and + configuration on page9 and Reading the calendar on + page10.This register is write protected. The write access + procedure is described in RTC register write protection + on page9. + 0x4 + 0x20 + read-write + 0x00002101 + + + DU + Date units in BCD format + 0 + 4 + + + DT + Date tens in BCD format + 4 + 2 + + + MU + Month units in BCD format + 8 + 4 + + + MT + Month tens in BCD format + 12 + 1 + + + WDU + Week day units + 13 + 3 + + + YU + Year units in BCD format + 16 + 4 + + + YT + Year tens in BCD format + 20 + 4 + + + + + RTC_CR + RTC_CR + RTC control register + 0x8 + 0x20 + 0x00000000 + + + WUCKSEL + Wakeup clock selection + 0 + 3 + read-write + + + TSEDGE + Time-stamp event active edge TSE must be + reset when TSEDGE is changed to avoid unwanted TSF + setting. + 3 + 1 + read-write + + + REFCKON + RTC_REFIN reference clock detection + enable (50 or 60Hz) Note: PREDIV_S must be + 0x00FF. + 4 + 1 + read-write + + + BYPSHAD + Bypass the shadow registers Note: If the + frequency of the APB clock is less than seven times + the frequency of RTCCLK, BYPSHAD must be set to + 1. + 5 + 1 + read-write + + + FMT + Hour format + 6 + 1 + read-write + + + ALRAE + Alarm A enable + 8 + 1 + read-write + + + ALRBE + Alarm B enable + 9 + 1 + read-write + + + WUTE + Wakeup timer enable + 10 + 1 + read-write + + + TSE + timestamp enable + 11 + 1 + read-write + + + ALRAIE + Alarm A interrupt enable + 12 + 1 + read-write + + + ALRBIE + Alarm B interrupt enable + 13 + 1 + read-write + + + WUTIE + Wakeup timer interrupt + enable + 14 + 1 + read-write + + + TSIE + Time-stamp interrupt + enable + 15 + 1 + read-write + + + ADD1H + Add 1 hour (summer time change) When + this bit is set outside initialization mode, 1 hour + is added to the calendar time. This bit is always + read as 0. + 16 + 1 + write-only + + + SUB1H + Subtract 1 hour (winter time change) + When this bit is set outside initialization mode, 1 + hour is subtracted to the calendar time if the + current hour is not 0. This bit is always read as 0. + Setting this bit has no effect when current hour is + 0. + 17 + 1 + write-only + + + BKP + Backup This bit can be written by the + user to memorize whether the daylight saving time + change has been performed or not. + 18 + 1 + read-write + + + COSEL + Calibration output selection When COE=1, + this bit selects which signal is output on RTC_CALIB. + These frequencies are valid for RTCCLK at 32.768 kHz + and prescalers at their default values (PREDIV_A=127 + and PREDIV_S=255). Refer to Section24.3.15: + Calibration clock output + 19 + 1 + read-write + + + POL + Output polarity This bit is used to + configure the polarity of RTC_ALARM + output + 20 + 1 + read-write + + + OSEL + Output selection These bits are used to + select the flag to be routed to RTC_ALARM + output + 21 + 2 + read-write + + + COE + Calibration output enable This bit + enables the RTC_CALIB output + 23 + 1 + read-write + + + ITSE + timestamp on internal event + enable + 24 + 1 + read-write + + + + + RTC_ISR + RTC_ISR + This register is write protected (except for + RTC_ISR[13:8] bits). The write access procedure is + described in RTC register write protection on + page9. + 0xC + 0x20 + 0x00000007 + + + ALRAWF + Alarm A write flag This bit is set by + hardware when Alarm A values can be changed, after + the ALRAE bit has been set to 0 in RTC_CR. It is + cleared by hardware in initialization + mode. + 0 + 1 + read-only + + + ALRBWF + Alarm B write flag This bit is set by + hardware when Alarm B values can be changed, after + the ALRBE bit has been set to 0 in RTC_CR. It is + cleared by hardware in initialization + mode. + 1 + 1 + read-only + + + WUTWF + Wakeup timer write flag This bit is set + by hardware up to 2 RTCCLK cycles after the WUTE bit + has been set to 0 in RTC_CR, and is cleared up to 2 + RTCCLK cycles after the WUTE bit has been set to 1. + The wakeup timer values can be changed when WUTE bit + is cleared and WUTWF is set. + 2 + 1 + read-only + + + SHPF + Shift operation pending This flag is set + by hardware as soon as a shift operation is initiated + by a write to the RTC_SHIFTR register. It is cleared + by hardware when the corresponding shift operation + has been executed. Writing to the SHPF bit has no + effect. + 3 + 1 + read-only + + + INITS + Initialization status flag This bit is + set by hardware when the calendar year field is + different from 0 (Backup domain reset + state). + 4 + 1 + read-only + + + RSF + Registers synchronization flag This bit + is set by hardware each time the calendar registers + are copied into the shadow registers (RTC_SSRx, + RTC_TRx and RTC_DRx). This bit is cleared by hardware + in initialization mode, while a shift operation is + pending (SHPF=1), or when in bypass shadow register + mode (BYPSHAD=1). This bit can also be cleared by + software. It is cleared either by software or by + hardware in initialization mode. + 5 + 1 + read-write + + + INITF + Initialization flag When this bit is set + to 1, the RTC is in initialization state, and the + time, date and prescaler registers can be + updated. + 6 + 1 + read-only + + + INIT + Initialization mode + 7 + 1 + read-write + + + ALRAF + Alarm A flag This flag is set by + hardware when the time/date registers (RTC_TR and + RTC_DR) match the Alarm A register (RTC_ALRMAR). This + flag is cleared by software by writing + 0. + 8 + 1 + read-write + + + ALRBF + Alarm B flag This flag is set by + hardware when the time/date registers (RTC_TR and + RTC_DR) match the Alarm B register (RTC_ALRMBR). This + flag is cleared by software by writing + 0. + 9 + 1 + read-write + + + WUTF + Wakeup timer flag This flag is set by + hardware when the wakeup auto-reload counter reaches + 0. This flag is cleared by software by writing 0. + This flag must be cleared by software at least 1.5 + RTCCLK periods before WUTF is set to 1 + again. + 10 + 1 + read-write + + + TSF + Time-stamp flag This flag is set by + hardware when a time-stamp event occurs. This flag is + cleared by software by writing 0. + 11 + 1 + read-write + + + TSOVF + Time-stamp overflow flag This flag is + set by hardware when a time-stamp event occurs while + TSF is already set. This flag is cleared by software + by writing 0. It is recommended to check and then + clear TSOVF only after clearing the TSF bit. + Otherwise, an overflow might not be noticed if a + time-stamp event occurs immediately before the TSF + bit is cleared. + 12 + 1 + read-write + + + TAMP1F + RTC_TAMP1 detection flag This flag is + set by hardware when a tamper detection event is + detected on the RTC_TAMP1 input. It is cleared by + software writing 0 + 13 + 1 + read-write + + + TAMP2F + RTC_TAMP2 detection flag This flag is + set by hardware when a tamper detection event is + detected on the RTC_TAMP2 input. It is cleared by + software writing 0 + 14 + 1 + read-write + + + TAMP3F + RTC_TAMP3 detection flag This flag is + set by hardware when a tamper detection event is + detected on the RTC_TAMP3 input. It is cleared by + software writing 0 + 15 + 1 + read-write + + + RECALPF + Recalibration pending Flag The RECALPF + status flag is automatically set to 1 when software + writes to the RTC_CALR register, indicating that the + RTC_CALR register is blocked. When the new + calibration settings are taken into account, this bit + returns to 0. Refer to Re-calibration + on-the-fly. + 16 + 1 + read-only + + + ITSF + Internal tTime-stamp flag + 17 + 1 + read-write + + + + + RTC_PRER + RTC_PRER + This register must be written in + initialization mode only. The initialization must be + performed in two separate write accesses. Refer to + Calendar initialization and configuration on page9.This + register is write protected. The write access procedure + is described in RTC register write protection on + page9. + 0x10 + 0x20 + read-write + 0x007F00FF + + + PREDIV_S + Synchronous prescaler factor This is the + synchronous division factor: ck_spre frequency = + ck_apre frequency/(PREDIV_S+1) + 0 + 15 + + + PREDIV_A + Asynchronous prescaler factor This is + the asynchronous division factor: ck_apre frequency = + RTCCLK frequency/(PREDIV_A+1) + 16 + 7 + + + + + RTC_WUTR + RTC_WUTR + This register can be written only when WUTWF + is set to 1 in RTC_ISR.This register is write protected. + The write access procedure is described in RTC register + write protection on page9. + 0x14 + 0x20 + read-write + 0x0000FFFF + + + WUT + Wakeup auto-reload value bits When the + wakeup timer is enabled (WUTE set to 1), the WUTF + flag is set every (WUT[15:0] + 1) ck_wut cycles. The + ck_wut period is selected through WUCKSEL[2:0] bits + of the RTC_CR register When WUCKSEL[2] = 1, the + wakeup timer becomes 17-bits and WUCKSEL[1] + effectively becomes WUT[16] the most-significant bit + to be reloaded into the timer. The first assertion of + WUTF occurs (WUT+1) ck_wut cycles after WUTE is set. + Setting WUT[15:0] to 0x0000 with WUCKSEL[2:0] =011 + (RTCCLK/2) is forbidden. + 0 + 16 + + + + + RTC_ALRMAR + RTC_ALRMAR + This register can be written only when + ALRAWF is set to 1 in RTC_ISR, or in initialization + mode.This register is write protected. The write access + procedure is described in RTC register write protection + on page9. + 0x1C + 0x20 + read-write + 0x00000000 + + + SU + Second units in BCD + format. + 0 + 4 + + + ST + Second tens in BCD format. + 4 + 3 + + + MSK1 + Alarm A seconds mask + 7 + 1 + + + MNU + Minute units in BCD + format. + 8 + 4 + + + MNT + Minute tens in BCD format. + 12 + 3 + + + MSK2 + Alarm A minutes mask + 15 + 1 + + + HU + Hour units in BCD format. + 16 + 4 + + + HT + Hour tens in BCD format. + 20 + 2 + + + PM + AM/PM notation + 22 + 1 + + + MSK3 + Alarm A hours mask + 23 + 1 + + + DU + Date units or day in BCD + format. + 24 + 4 + + + DT + Date tens in BCD format. + 28 + 2 + + + WDSEL + Week day selection + 30 + 1 + + + MSK4 + Alarm A date mask + 31 + 1 + + + + + RTC_ALRMBR + RTC_ALRMBR + This register can be written only when + ALRBWF is set to 1 in RTC_ISR, or in initialization + mode.This register is write protected. The write access + procedure is described in RTC register write protection + on page9. + 0x20 + 0x20 + read-write + 0x00000000 + + + SU + Second units in BCD format + 0 + 4 + + + ST + Second tens in BCD format + 4 + 3 + + + MSK1 + Alarm B seconds mask + 7 + 1 + + + MNU + Minute units in BCD format + 8 + 4 + + + MNT + Minute tens in BCD format + 12 + 3 + + + MSK2 + Alarm B minutes mask + 15 + 1 + + + HU + Hour units in BCD format + 16 + 4 + + + HT + Hour tens in BCD format + 20 + 2 + + + PM + AM/PM notation + 22 + 1 + + + MSK3 + Alarm B hours mask + 23 + 1 + + + DU + Date units or day in BCD + format + 24 + 4 + + + DT + Date tens in BCD format + 28 + 2 + + + WDSEL + Week day selection + 30 + 1 + + + MSK4 + Alarm B date mask + 31 + 1 + + + + + RTC_WPR + RTC_WPR + RTC write protection register + 0x24 + 0x20 + write-only + 0x00000000 + + + KEY + Write protection key This byte is + written by software. Reading this byte always returns + 0x00. Refer to RTC register write protection for a + description of how to unlock RTC register write + protection. + 0 + 8 + + + + + RTC_SSR + RTC_SSR + RTC sub second register + 0x28 + 0x20 + read-only + 0x00000000 + + + SS + Sub second value SS[15:0] is the value + in the synchronous prescaler counter. The fraction of + a second is given by the formula below: Second + fraction = (PREDIV_S - SS) / (PREDIV_S + 1) Note: SS + can be larger than PREDIV_S only after a shift + operation. In that case, the correct time/date is one + second less than as indicated by + RTC_TR/RTC_DR. + 0 + 16 + + + + + RTC_SHIFTR + RTC_SHIFTR + This register is write protected. The write + access procedure is described in RTC register write + protection on page9. + 0x2C + 0x20 + write-only + 0x00000000 + + + SUBFS + Subtract a fraction of a second These + bits are write only and is always read as zero. + Writing to this bit has no effect when a shift + operation is pending (when SHPF=1, in RTC_ISR). The + value which is written to SUBFS is added to the + synchronous prescaler counter. Since this counter + counts down, this operation effectively subtracts + from (delays) the clock by: Delay (seconds) = SUBFS / + (PREDIV_S + 1) A fraction of a second can effectively + be added to the clock (advancing the clock) when the + ADD1S function is used in conjunction with SUBFS, + effectively advancing the clock by: Advance (seconds) + = (1 - (SUBFS / (PREDIV_S + 1))). Note: Writing to + SUBFS causes RSF to be cleared. Software can then + wait until RSF=1 to be sure that the shadow registers + have been updated with the shifted + time. + 0 + 15 + + + ADD1S + Add one second This bit is write only + and is always read as zero. Writing to this bit has + no effect when a shift operation is pending (when + SHPF=1, in RTC_ISR). This function is intended to be + used with SUBFS (see description below) in order to + effectively add a fraction of a second to the clock + in an atomic operation. + 31 + 1 + + + + + RTC_TSTR + RTC_TSTR + The content of this register is valid only + when TSF is set to 1 in RTC_ISR. It is cleared when TSF + bit is reset. + 0x30 + 0x20 + read-only + 0x00000000 + + + SU + Second units in BCD + format. + 0 + 4 + + + ST + Second tens in BCD format. + 4 + 3 + + + MNU + Minute units in BCD + format. + 8 + 4 + + + MNT + Minute tens in BCD format. + 12 + 3 + + + HU + Hour units in BCD format. + 16 + 4 + + + HT + Hour tens in BCD format. + 20 + 2 + + + PM + AM/PM notation + 22 + 1 + + + + + RTC_TSDR + RTC_TSDR + The content of this register is valid only + when TSF is set to 1 in RTC_ISR. It is cleared when TSF + bit is reset. + 0x34 + 0x20 + read-only + 0x00000000 + + + DU + Date units in BCD format + 0 + 4 + + + DT + Date tens in BCD format + 4 + 2 + + + MU + Month units in BCD format + 8 + 4 + + + MT + Month tens in BCD format + 12 + 1 + + + WDU + Week day units + 13 + 3 + + + + + RTC_TSSSR + RTC_TSSSR + The content of this register is valid only + when RTC_ISR/TSF is set. It is cleared when the + RTC_ISR/TSF bit is reset. + 0x38 + 0x20 + read-only + 0x00000000 + + + SS + Sub second value SS[15:0] is the value + of the synchronous prescaler counter when the + timestamp event occurred. + 0 + 16 + + + + + RTC_CALR + RTC_CALR + This register is write protected. The write + access procedure is described in RTC register write + protection on page9. + 0x3C + 0x20 + read-write + 0x00000000 + + + CALM + Calibration minus The frequency of the + calendar is reduced by masking CALM out of 220 RTCCLK + pulses (32 seconds if the input frequency is 32768 + Hz). This decreases the frequency of the calendar + with a resolution of 0.9537 ppm. To increase the + frequency of the calendar, this feature should be + used in conjunction with CALP. See Section24.3.12: + RTC smooth digital calibration on + page13. + 0 + 9 + + + CALW16 + Use a 16-second calibration cycle period + When CALW16 is set to 1, the 16-second calibration + cycle period is selected.This bit must not be set to + 1 if CALW8=1. Note: CALM[0] is stuck at 0 when + CALW16= 1. Refer to Section24.3.12: RTC smooth + digital calibration. + 13 + 1 + + + CALW8 + Use an 8-second calibration cycle period + When CALW8 is set to 1, the 8-second calibration + cycle period is selected. Note: CALM[1:0] are stuck + at 00; when CALW8= 1. Refer to Section24.3.12: RTC + smooth digital calibration. + 14 + 1 + + + CALP + Increase frequency of RTC by 488.5 ppm + This feature is intended to be used in conjunction + with CALM, which lowers the frequency of the calendar + with a fine resolution. if the input frequency is + 32768 Hz, the number of RTCCLK pulses added during a + 32-second window is calculated as follows: (512 * + CALP) - CALM. Refer to Section24.3.12: RTC smooth + digital calibration. + 15 + 1 + + + + + RTC_TAMPCR + RTC_TAMPCR + RTC tamper and alternate function + configuration register + 0x40 + 0x20 + read-write + 0x00000000 + + + TAMP1E + RTC_TAMP1 input detection + enable + 0 + 1 + + + TAMP1TRG + Active level for RTC_TAMP1 input If + TAMPFLT != 00 if TAMPFLT = 00: + 1 + 1 + + + TAMPIE + Tamper interrupt enable + 2 + 1 + + + TAMP2E + RTC_TAMP2 input detection + enable + 3 + 1 + + + TAMP2TRG + Active level for RTC_TAMP2 input if + TAMPFLT != 00: if TAMPFLT = 00: + 4 + 1 + + + TAMP3E + RTC_TAMP3 detection enable + 5 + 1 + + + TAMP3TRG + Active level for RTC_TAMP3 input if + TAMPFLT != 00: if TAMPFLT = 00: + 6 + 1 + + + TAMPTS + Activate timestamp on tamper detection + event TAMPTS is valid even if TSE=0 in the RTC_CR + register. + 7 + 1 + + + TAMPFREQ + Tamper sampling frequency Determines the + frequency at which each of the RTC_TAMPx inputs are + sampled. + 8 + 3 + + + TAMPFLT + RTC_TAMPx filter count These bits + determines the number of consecutive samples at the + specified level (TAMP*TRG) needed to activate a + Tamper event. TAMPFLT is valid for each of the + RTC_TAMPx inputs. + 11 + 2 + + + TAMPPRCH + RTC_TAMPx precharge duration These bit + determines the duration of time during which the + pull-up/is activated before each sample. TAMPPRCH is + valid for each of the RTC_TAMPx inputs. + 13 + 2 + + + TAMPPUDIS + RTC_TAMPx pull-up disable This bit + determines if each of the RTC_TAMPx pins are + pre-charged before each sample. + 15 + 1 + + + TAMP1IE + Tamper 1 interrupt enable + 16 + 1 + + + TAMP1NOERASE + Tamper 1 no erase + 17 + 1 + + + TAMP1MF + Tamper 1 mask flag + 18 + 1 + + + TAMP2IE + Tamper 2 interrupt enable + 19 + 1 + + + TAMP2NOERASE + Tamper 2 no erase + 20 + 1 + + + TAMP2MF + Tamper 2 mask flag + 21 + 1 + + + TAMP3IE + Tamper 3 interrupt enable + 22 + 1 + + + TAMP3NOERASE + Tamper 3 no erase + 23 + 1 + + + TAMP3MF + Tamper 3 mask flag + 24 + 1 + + + + + RTC_ALRMASSR + RTC_ALRMASSR + This register can be written only when ALRAE + is reset in RTC_CR register, or in initialization + mode.This register is write protected. The write access + procedure is described in RTC register write protection + on page9 + 0x44 + 0x20 + read-write + 0x00000000 + + + SS + Sub seconds value This value is compared + with the contents of the synchronous prescaler + counter to determine if Alarm A is to be activated. + Only bits 0 up MASKSS-1 are compared. + 0 + 15 + + + MASKSS + Mask the most-significant bits starting + at this bit ... The overflow bits of the synchronous + counter (bits 15) is never compared. This bit can be + different from 0 only after a shift + operation. + 24 + 4 + + + + + RTC_ALRMBSSR + RTC_ALRMBSSR + This register can be written only when ALRBE + is reset in RTC_CR register, or in initialization + mode.This register is write protected.The write access + procedure is described in Section: RTC register write + protection. + 0x48 + 0x20 + read-write + 0x00000000 + + + SS + Sub seconds value This value is compared + with the contents of the synchronous prescaler + counter to determine if Alarm B is to be activated. + Only bits 0 up to MASKSS-1 are + compared. + 0 + 15 + + + MASKSS + Mask the most-significant bits starting + at this bit ... The overflow bits of the synchronous + counter (bits 15) is never compared. This bit can be + different from 0 only after a shift + operation. + 24 + 4 + + + + + RTC_BKP0R + RTC_BKP0R + RTC backup registers + 0x50 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP1R + RTC_BKP1R + RTC backup registers + 0x54 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP2R + RTC_BKP2R + RTC backup registers + 0x58 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP3R + RTC_BKP3R + RTC backup registers + 0x5C + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP4R + RTC_BKP4R + RTC backup registers + 0x60 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP5R + RTC_BKP5R + RTC backup registers + 0x64 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP6R + RTC_BKP6R + RTC backup registers + 0x68 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP7R + RTC_BKP7R + RTC backup registers + 0x6C + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP8R + RTC_BKP8R + RTC backup registers + 0x70 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP9R + RTC_BKP9R + RTC backup registers + 0x74 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP10R + RTC_BKP10R + RTC backup registers + 0x78 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP11R + RTC_BKP11R + RTC backup registers + 0x7C + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP12R + RTC_BKP12R + RTC backup registers + 0x80 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP13R + RTC_BKP13R + RTC backup registers + 0x84 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP14R + RTC_BKP14R + RTC backup registers + 0x88 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP15R + RTC_BKP15R + RTC backup registers + 0x8C + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_OR + RTC_OR + RTC option register + 0x4C + 0x20 + read-write + 0x00000000 + + + RTC_ALARM_TYPE + RTC_ALARM output type on + PC13 + 0 + 1 + + + RTC_OUT_RMP + RTC_OUT remap + 1 + 1 + + + + + RTC_BKP16R + RTC_BKP16R + RTC backup registers + 0x90 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP17R + RTC_BKP17R + RTC backup registers + 0x94 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP18R + RTC_BKP18R + RTC backup registers + 0x98 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP19R + RTC_BKP19R + RTC backup registers + 0x9C + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP20R + RTC_BKP20R + RTC backup registers + 0xA0 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP21R + RTC_BKP21R + RTC backup registers + 0xA4 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP22R + RTC_BKP22R + RTC backup registers + 0xA8 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP23R + RTC_BKP23R + RTC backup registers + 0xAC + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP24R + RTC_BKP24R + RTC backup registers + 0xB0 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP25R + RTC_BKP25R + RTC backup registers + 0xB4 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP26R + RTC_BKP26R + RTC backup registers + 0xB8 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP27R + RTC_BKP27R + RTC backup registers + 0xBC + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP28R + RTC_BKP28R + RTC backup registers + 0xC0 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP29R + RTC_BKP29R + RTC backup registers + 0xC4 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP30R + RTC_BKP30R + RTC backup registers + 0xC8 + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + RTC_BKP31R + RTC_BKP31R + RTC backup registers + 0xCC + 0x20 + read-write + 0x00000000 + + + BKP + The application can write or read data + to and from these registers. They are powered-on by + VBAT when VDD is switched off, so that they are not + reset by System reset, and their contents remain + valid when the device operates in low-power mode. + This register is reset on a tamper detection event, + as long as TAMPxF=1. or when the Flash readout + protection is disabled. + 0 + 32 + + + + + + + SAI4 + SAI + SAI + 0x58005400 + + 0x0 + 0x400 + registers + + + SAI4 + SAI4 global interrupt + 146 + + + + SAI_GCR + SAI_GCR + Global configuration register + 0x0 + 0x20 + read-write + 0x00000000 + + + SYNCOUT + Synchronization outputs These bits are + set and cleared by software. + 4 + 2 + + + SYNCIN + Synchronization inputs + 0 + 2 + + + + + SAI_ACR1 + SAI_ACR1 + Configuration register 1 + 0x4 + 0x20 + read-write + 0x00000040 + + + MODE + SAIx audio block mode + immediately + 0 + 2 + + + PRTCFG + Protocol configuration. These bits are + set and cleared by software. These bits have to be + configured when the audio block is + disabled. + 2 + 2 + + + DS + Data size. These bits are set and + cleared by software. These bits are ignored when the + SPDIF protocols are selected (bit PRTCFG[1:0]), + because the frame and the data size are fixed in such + case. When the companding mode is selected through + COMP[1:0] bits, DS[1:0] are ignored since the data + size is fixed to 8 bits by the algorithm. These bits + must be configured when the audio block is + disabled. + 5 + 3 + + + LSBFIRST + Least significant bit first. This bit is + set and cleared by software. It must be configured + when the audio block is disabled. This bit has no + meaning in AC97 audio protocol since AC97 data are + always transferred with the MSB first. This bit has + no meaning in SPDIF audio protocol since in SPDIF + data are always transferred with LSB + first. + 8 + 1 + + + CKSTR + Clock strobing edge. This bit is set and + cleared by software. It must be configured when the + audio block is disabled. This bit has no meaning in + SPDIF audio protocol. + 9 + 1 + + + SYNCEN + Synchronization enable. These bits are + set and cleared by software. They must be configured + when the audio sub-block is disabled. Note: The audio + sub-block should be configured as asynchronous when + SPDIF mode is enabled. + 10 + 2 + + + MONO + Mono mode. This bit is set and cleared + by software. It is meaningful only when the number of + slots is equal to 2. When the mono mode is selected, + slot 0 data are duplicated on slot 1 when the audio + block operates as a transmitter. In reception mode, + the slot1 is discarded and only the data received + from slot 0 are stored. Refer to Section: Mono/stereo + mode for more details. + 12 + 1 + + + OUTDRIV + Output drive. This bit is set and + cleared by software. Note: This bit has to be set + before enabling the audio block and after the audio + block configuration. + 13 + 1 + + + SAIXEN + Audio block enable where x is A or B. + This bit is set by software. To switch off the audio + block, the application software must program this bit + to 0 and poll the bit till it reads back 0, meaning + that the block is completely disabled. Before setting + this bit to 1, check that it is set to 0, otherwise + the enable command will not be taken into account. + This bit allows to control the state of SAIx audio + block. If it is disabled when an audio frame transfer + is ongoing, the ongoing transfer completes and the + cell is fully disabled at the end of this audio frame + transfer. Note: When SAIx block is configured in + master mode, the clock must be present on the input + of SAIx before setting SAIXEN bit. + 16 + 1 + + + DMAEN + DMA enable. This bit is set and cleared + by software. Note: Since the audio block defaults to + operate as a transmitter after reset, the MODE[1:0] + bits must be configured before setting DMAEN to avoid + a DMA request in receiver mode. + 17 + 1 + + + NOMCK + No divider + 19 + 1 + + + MCKDIV + Master clock divider. These bits are set + and cleared by software. These bits are meaningless + when the audio block operates in slave mode. They + have to be configured when the audio block is + disabled. Others: the master clock frequency is + calculated accordingly to the following + formula: + 20 + 4 + + + OSR + Oversampling ratio for master + clock + 26 + 1 + + + + + SAI_ACR2 + SAI_ACR2 + Configuration register 2 + 0x8 + 0x20 + 0x00000000 + + + FTH + FIFO threshold. This bit is set and + cleared by software. + 0 + 3 + read-write + + + FFLUSH + FIFO flush. This bit is set by software. + It is always read as 0. This bit should be configured + when the SAI is disabled. + 3 + 1 + write-only + + + TRIS + Tristate management on data line. This + bit is set and cleared by software. It is meaningful + only if the audio block is configured as a + transmitter. This bit is not used when the audio + block is configured in SPDIF mode. It should be + configured when SAI is disabled. Refer to Section: + Output data line management on an inactive slot for + more details. + 4 + 1 + read-write + + + MUTE + Mute. This bit is set and cleared by + software. It is meaningful only when the audio block + operates as a transmitter. The MUTE value is linked + to value of MUTEVAL if the number of slots is lower + or equal to 2, or equal to 0 if it is greater than 2. + Refer to Section: Mute mode for more details. Note: + This bit is meaningless and should not be used for + SPDIF audio blocks. + 5 + 1 + read-write + + + MUTEVAL + Mute value. This bit is set and cleared + by software.It must be written before enabling the + audio block: SAIXEN. This bit is meaningful only when + the audio block operates as a transmitter, the number + of slots is lower or equal to 2 and the MUTE bit is + set. If more slots are declared, the bit value sent + during the transmission in mute mode is equal to 0, + whatever the value of MUTEVAL. if the number of slot + is lower or equal to 2 and MUTEVAL = 1, the MUTE + value transmitted for each slot is the one sent + during the previous frame. Refer to Section: Mute + mode for more details. Note: This bit is meaningless + and should not be used for SPDIF audio + blocks. + 6 + 1 + read-write + + + MUTECNT + Mute counter. These bits are set and + cleared by software. They are used only in reception + mode. The value set in these bits is compared to the + number of consecutive mute frames detected in + reception. When the number of mute frames is equal to + this value, the flag MUTEDET will be set and an + interrupt will be generated if bit MUTEDETIE is set. + Refer to Section: Mute mode for more + details. + 7 + 6 + read-write + + + CPL + Complement bit. This bit is set and + cleared by software. It defines the type of + complement to be used for companding mode Note: This + bit has effect only when the companding mode is -Law + algorithm or A-Law algorithm. + 13 + 1 + read-write + + + COMP + Companding mode. These bits are set and + cleared by software. The -Law and the A-Law log are a + part of the CCITT G.711 recommendation, the type of + complement that will be used depends on CPL bit. The + data expansion or data compression are determined by + the state of bit MODE[0]. The data compression is + applied if the audio block is configured as a + transmitter. The data expansion is automatically + applied when the audio block is configured as a + receiver. Refer to Section: Companding mode for more + details. Note: Companding mode is applicable only + when TDM is selected. + 14 + 2 + read-write + + + + + SAI_AFRCR + SAI_AFRCR + This register has no meaning in AC97 and + SPDIF audio protocol + 0xC + 0x20 + 0x00000007 + + + FRL + Frame length. These bits are set and + cleared by software. They define the audio frame + length expressed in number of SCK clock cycles: the + number of bits in the frame is equal to FRL[7:0] + 1. + The minimum number of bits to transfer in an audio + frame must be equal to 8, otherwise the audio block + will behaves in an unexpected way. This is the case + when the data size is 8 bits and only one slot 0 is + defined in NBSLOT[4:0] of SAI_xSLOTR register + (NBSLOT[3:0] = 0000). In master mode, if the master + clock (available on MCLK_x pin) is used, the frame + length should be aligned with a number equal to a + power of 2, ranging from 8 to 256. When the master + clock is not used (NODIV = 1), it is recommended to + program the frame length to an value ranging from 8 + to 256. These bits are meaningless and are not used + in AC97 or SPDIF audio block + configuration. + 0 + 8 + read-write + + + FSALL + Frame synchronization active level + length. These bits are set and cleared by software. + They specify the length in number of bit clock (SCK) + + 1 (FSALL[6:0] + 1) of the active level of the FS + signal in the audio frame These bits are meaningless + and are not used in AC97 or SPDIF audio block + configuration. They must be configured when the audio + block is disabled. + 8 + 7 + read-write + + + FSDEF + Frame synchronization definition. This + bit is set and cleared by software. When the bit is + set, the number of slots defined in the SAI_xSLOTR + register has to be even. It means that half of this + number of slots will be dedicated to the left channel + and the other slots for the right channel (e.g: this + bit has to be set for I2S or MSB/LSB-justified + protocols...). This bit is meaningless and is not + used in AC97 or SPDIF audio block configuration. It + must be configured when the audio block is + disabled. + 16 + 1 + read-only + + + FSPOL + Frame synchronization polarity. This bit + is set and cleared by software. It is used to + configure the level of the start of frame on the FS + signal. It is meaningless and is not used in AC97 or + SPDIF audio block configuration. This bit must be + configured when the audio block is + disabled. + 17 + 1 + read-write + + + FSOFF + Frame synchronization offset. This bit + is set and cleared by software. It is meaningless and + is not used in AC97 or SPDIF audio block + configuration. This bit must be configured when the + audio block is disabled. + 18 + 1 + read-write + + + + + SAI_ASLOTR + SAI_ASLOTR + This register has no meaning in AC97 and + SPDIF audio protocol + 0x10 + 0x20 + read-write + 0x00000000 + + + FBOFF + First bit offset These bits are set and + cleared by software. The value set in this bitfield + defines the position of the first data transfer bit + in the slot. It represents an offset value. In + transmission mode, the bits outside the data field + are forced to 0. In reception mode, the extra + received bits are discarded. These bits must be set + when the audio block is disabled. They are ignored in + AC97 or SPDIF mode. + 0 + 5 + + + SLOTSZ + Slot size This bits is set and cleared + by software. The slot size must be higher or equal to + the data size. If this condition is not respected, + the behavior of the SAI will be undetermined. Refer + to Section: Output data line management on an + inactive slot for information on how to drive SD + line. These bits must be set when the audio block is + disabled. They are ignored in AC97 or SPDIF + mode. + 6 + 2 + + + NBSLOT + Number of slots in an audio frame. These + bits are set and cleared by software. The value set + in this bitfield represents the number of slots + 1 + in the audio frame (including the number of inactive + slots). The maximum number of slots is 16. The number + of slots should be even if FSDEF bit in the SAI_xFRCR + register is set. The number of slots must be + configured when the audio block is disabled. They are + ignored in AC97 or SPDIF mode. + 8 + 4 + + + SLOTEN + Slot enable. These bits are set and + cleared by software. Each SLOTEN bit corresponds to a + slot position from 0 to 15 (maximum 16 slots). The + slot must be enabled when the audio block is + disabled. They are ignored in AC97 or SPDIF + mode. + 16 + 16 + + + + + SAI_AIM + SAI_AIM + Interrupt mask register 2 + 0x14 + 0x20 + read-write + 0x00000000 + + + OVRUDRIE + Overrun/underrun interrupt enable. This + bit is set and cleared by software. When this bit is + set, an interrupt is generated if the OVRUDR bit in + the SAI_xSR register is set. + 0 + 1 + + + MUTEDETIE + Mute detection interrupt enable. This + bit is set and cleared by software. When this bit is + set, an interrupt is generated if the MUTEDET bit in + the SAI_xSR register is set. This bit has a meaning + only if the audio block is configured in receiver + mode. + 1 + 1 + + + WCKCFGIE + Wrong clock configuration interrupt + enable. This bit is set and cleared by software. This + bit is taken into account only if the audio block is + configured as a master (MODE[1] = 0) and NODIV = 0. + It generates an interrupt if the WCKCFG flag in the + SAI_xSR register is set. Note: This bit is used only + in TDM mode and is meaningless in other + modes. + 2 + 1 + + + FREQIE + FIFO request interrupt enable. This bit + is set and cleared by software. When this bit is set, + an interrupt is generated if the FREQ bit in the + SAI_xSR register is set. Since the audio block + defaults to operate as a transmitter after reset, the + MODE bit must be configured before setting FREQIE to + avoid a parasitic interruption in receiver + mode, + 3 + 1 + + + CNRDYIE + Codec not ready interrupt enable (AC97). + This bit is set and cleared by software. When the + interrupt is enabled, the audio block detects in the + slot 0 (tag0) of the AC97 frame if the Codec + connected to this line is ready or not. If it is not + ready, the CNRDY flag in the SAI_xSR register is set + and an interruption i generated. This bit has a + meaning only if the AC97 mode is selected through + PRTCFG[1:0] bits and the audio block is operates as a + receiver. + 4 + 1 + + + AFSDETIE + Anticipated frame synchronization + detection interrupt enable. This bit is set and + cleared by software. When this bit is set, an + interrupt will be generated if the AFSDET bit in the + SAI_xSR register is set. This bit is meaningless in + AC97, SPDIF mode or when the audio block operates as + a master. + 5 + 1 + + + LFSDETIE + Late frame synchronization detection + interrupt enable. This bit is set and cleared by + software. When this bit is set, an interrupt will be + generated if the LFSDET bit is set in the SAI_xSR + register. This bit is meaningless in AC97, SPDIF mode + or when the audio block operates as a + master. + 6 + 1 + + + + + SAI_ASR + SAI_ASR + Status register + 0x18 + 0x20 + read-only + 0x00000008 + + + OVRUDR + Overrun / underrun. This bit is read + only. The overrun and underrun conditions can occur + only when the audio block is configured as a receiver + and a transmitter, respectively. It can generate an + interrupt if OVRUDRIE bit is set in SAI_xIM register. + This flag is cleared when the software sets COVRUDR + bit in SAI_xCLRFR register. + 0 + 1 + + + MUTEDET + Mute detection. This bit is read only. + This flag is set if consecutive 0 values are received + in each slot of a given audio frame and for a + consecutive number of audio frames (set in the + MUTECNT bit in the SAI_xCR2 register). It can + generate an interrupt if MUTEDETIE bit is set in + SAI_xIM register. This flag is cleared when the + software sets bit CMUTEDET in the SAI_xCLRFR + register. + 1 + 1 + + + WCKCFG + Wrong clock configuration flag. This bit + is read only. This bit is used only when the audio + block operates in master mode (MODE[1] = 0) and NODIV + = 0. It can generate an interrupt if WCKCFGIE bit is + set in SAI_xIM register. This flag is cleared when + the software sets CWCKCFG bit in SAI_xCLRFR + register. + 2 + 1 + + + FREQ + FIFO request. This bit is read only. The + request depends on the audio block configuration: If + the block is configured in transmission mode, the + FIFO request is related to a write request operation + in the SAI_xDR. If the block configured in reception, + the FIFO request related to a read request operation + from the SAI_xDR. This flag can generate an interrupt + if FREQIE bit is set in SAI_xIM + register. + 3 + 1 + + + CNRDY + Codec not ready. This bit is read only. + This bit is used only when the AC97 audio protocol is + selected in the SAI_xCR1 register and configured in + receiver mode. It can generate an interrupt if + CNRDYIE bit is set in SAI_xIM register. This flag is + cleared when the software sets CCNRDY bit in + SAI_xCLRFR register. + 4 + 1 + + + AFSDET + Anticipated frame synchronization + detection. This bit is read only. This flag can be + set only if the audio block is configured in slave + mode. It is not used in AC97or SPDIF mode. It can + generate an interrupt if AFSDETIE bit is set in + SAI_xIM register. This flag is cleared when the + software sets CAFSDET bit in SAI_xCLRFR + register. + 5 + 1 + + + LFSDET + Late frame synchronization detection. + This bit is read only. This flag can be set only if + the audio block is configured in slave mode. It is + not used in AC97 or SPDIF mode. It can generate an + interrupt if LFSDETIE bit is set in the SAI_xIM + register. This flag is cleared when the software sets + bit CLFSDET in SAI_xCLRFR register + 6 + 1 + + + FLVL + FIFO level threshold. This bit is read + only. The FIFO level threshold flag is managed only + by hardware and its setting depends on SAI block + configuration (transmitter or receiver mode). If the + SAI block is configured as transmitter: If SAI block + is configured as receiver: + 16 + 3 + + + + + SAI_ACLRFR + SAI_ACLRFR + Clear flag register + 0x1C + 0x20 + write-only + 0x00000000 + + + COVRUDR + Clear overrun / underrun. This bit is + write only. Programming this bit to 1 clears the + OVRUDR flag in the SAI_xSR register. Reading this bit + always returns the value 0. + 0 + 1 + + + CMUTEDET + Mute detection flag. This bit is write + only. Programming this bit to 1 clears the MUTEDET + flag in the SAI_xSR register. Reading this bit always + returns the value 0. + 1 + 1 + + + CWCKCFG + Clear wrong clock configuration flag. + This bit is write only. Programming this bit to 1 + clears the WCKCFG flag in the SAI_xSR register. This + bit is used only when the audio block is set as + master (MODE[1] = 0) and NODIV = 0 in the SAI_xCR1 + register. Reading this bit always returns the value + 0. + 2 + 1 + + + CCNRDY + Clear Codec not ready flag. This bit is + write only. Programming this bit to 1 clears the + CNRDY flag in the SAI_xSR register. This bit is used + only when the AC97 audio protocol is selected in the + SAI_xCR1 register. Reading this bit always returns + the value 0. + 4 + 1 + + + CAFSDET + Clear anticipated frame synchronization + detection flag. This bit is write only. Programming + this bit to 1 clears the AFSDET flag in the SAI_xSR + register. It is not used in AC97or SPDIF mode. + Reading this bit always returns the value + 0. + 5 + 1 + + + CLFSDET + Clear late frame synchronization + detection flag. This bit is write only. Programming + this bit to 1 clears the LFSDET flag in the SAI_xSR + register. This bit is not used in AC97or SPDIF mode + Reading this bit always returns the value + 0. + 6 + 1 + + + + + SAI_ADR + SAI_ADR + Data register + 0x20 + 0x20 + read-write + 0x00000000 + + + DATA + Data A write to this register loads the + FIFO provided the FIFO is not full. A read from this + register empties the FIFO if the FIFO is not + empty. + 0 + 32 + + + + + SAI_BCR1 + SAI_BCR1 + Configuration register 1 + 0x24 + 0x20 + read-write + 0x00000040 + + + MODE + SAIx audio block mode + immediately + 0 + 2 + + + PRTCFG + Protocol configuration. These bits are + set and cleared by software. These bits have to be + configured when the audio block is + disabled. + 2 + 2 + + + DS + Data size. These bits are set and + cleared by software. These bits are ignored when the + SPDIF protocols are selected (bit PRTCFG[1:0]), + because the frame and the data size are fixed in such + case. When the companding mode is selected through + COMP[1:0] bits, DS[1:0] are ignored since the data + size is fixed to 8 bits by the algorithm. These bits + must be configured when the audio block is + disabled. + 5 + 3 + + + LSBFIRST + Least significant bit first. This bit is + set and cleared by software. It must be configured + when the audio block is disabled. This bit has no + meaning in AC97 audio protocol since AC97 data are + always transferred with the MSB first. This bit has + no meaning in SPDIF audio protocol since in SPDIF + data are always transferred with LSB + first. + 8 + 1 + + + CKSTR + Clock strobing edge. This bit is set and + cleared by software. It must be configured when the + audio block is disabled. This bit has no meaning in + SPDIF audio protocol. + 9 + 1 + + + SYNCEN + Synchronization enable. These bits are + set and cleared by software. They must be configured + when the audio sub-block is disabled. Note: The audio + sub-block should be configured as asynchronous when + SPDIF mode is enabled. + 10 + 2 + + + MONO + Mono mode. This bit is set and cleared + by software. It is meaningful only when the number of + slots is equal to 2. When the mono mode is selected, + slot 0 data are duplicated on slot 1 when the audio + block operates as a transmitter. In reception mode, + the slot1 is discarded and only the data received + from slot 0 are stored. Refer to Section: Mono/stereo + mode for more details. + 12 + 1 + + + OUTDRIV + Output drive. This bit is set and + cleared by software. Note: This bit has to be set + before enabling the audio block and after the audio + block configuration. + 13 + 1 + + + SAIXEN + Audio block enable where x is A or B. + This bit is set by software. To switch off the audio + block, the application software must program this bit + to 0 and poll the bit till it reads back 0, meaning + that the block is completely disabled. Before setting + this bit to 1, check that it is set to 0, otherwise + the enable command will not be taken into account. + This bit allows to control the state of SAIx audio + block. If it is disabled when an audio frame transfer + is ongoing, the ongoing transfer completes and the + cell is fully disabled at the end of this audio frame + transfer. Note: When SAIx block is configured in + master mode, the clock must be present on the input + of SAIx before setting SAIXEN bit. + 16 + 1 + + + DMAEN + DMA enable. This bit is set and cleared + by software. Note: Since the audio block defaults to + operate as a transmitter after reset, the MODE[1:0] + bits must be configured before setting DMAEN to avoid + a DMA request in receiver mode. + 17 + 1 + + + NOMCK + No divider + 19 + 1 + + + MCKDIV + Master clock divider. These bits are set + and cleared by software. These bits are meaningless + when the audio block operates in slave mode. They + have to be configured when the audio block is + disabled. Others: the master clock frequency is + calculated accordingly to the following + formula: + 20 + 4 + + + OSR + Oversampling ratio for master + clock + 26 + 1 + + + + + SAI_BCR2 + SAI_BCR2 + Configuration register 2 + 0x28 + 0x20 + 0x00000000 + + + FTH + FIFO threshold. This bit is set and + cleared by software. + 0 + 3 + read-write + + + FFLUSH + FIFO flush. This bit is set by software. + It is always read as 0. This bit should be configured + when the SAI is disabled. + 3 + 1 + write-only + + + TRIS + Tristate management on data line. This + bit is set and cleared by software. It is meaningful + only if the audio block is configured as a + transmitter. This bit is not used when the audio + block is configured in SPDIF mode. It should be + configured when SAI is disabled. Refer to Section: + Output data line management on an inactive slot for + more details. + 4 + 1 + read-write + + + MUTE + Mute. This bit is set and cleared by + software. It is meaningful only when the audio block + operates as a transmitter. The MUTE value is linked + to value of MUTEVAL if the number of slots is lower + or equal to 2, or equal to 0 if it is greater than 2. + Refer to Section: Mute mode for more details. Note: + This bit is meaningless and should not be used for + SPDIF audio blocks. + 5 + 1 + read-write + + + MUTEVAL + Mute value. This bit is set and cleared + by software.It must be written before enabling the + audio block: SAIXEN. This bit is meaningful only when + the audio block operates as a transmitter, the number + of slots is lower or equal to 2 and the MUTE bit is + set. If more slots are declared, the bit value sent + during the transmission in mute mode is equal to 0, + whatever the value of MUTEVAL. if the number of slot + is lower or equal to 2 and MUTEVAL = 1, the MUTE + value transmitted for each slot is the one sent + during the previous frame. Refer to Section: Mute + mode for more details. Note: This bit is meaningless + and should not be used for SPDIF audio + blocks. + 6 + 1 + read-write + + + MUTECNT + Mute counter. These bits are set and + cleared by software. They are used only in reception + mode. The value set in these bits is compared to the + number of consecutive mute frames detected in + reception. When the number of mute frames is equal to + this value, the flag MUTEDET will be set and an + interrupt will be generated if bit MUTEDETIE is set. + Refer to Section: Mute mode for more + details. + 7 + 6 + read-write + + + CPL + Complement bit. This bit is set and + cleared by software. It defines the type of + complement to be used for companding mode Note: This + bit has effect only when the companding mode is -Law + algorithm or A-Law algorithm. + 13 + 1 + read-write + + + COMP + Companding mode. These bits are set and + cleared by software. The -Law and the A-Law log are a + part of the CCITT G.711 recommendation, the type of + complement that will be used depends on CPL bit. The + data expansion or data compression are determined by + the state of bit MODE[0]. The data compression is + applied if the audio block is configured as a + transmitter. The data expansion is automatically + applied when the audio block is configured as a + receiver. Refer to Section: Companding mode for more + details. Note: Companding mode is applicable only + when TDM is selected. + 14 + 2 + read-write + + + + + SAI_BFRCR + SAI_BFRCR + This register has no meaning in AC97 and + SPDIF audio protocol + 0x2C + 0x20 + 0x00000007 + + + FRL + Frame length. These bits are set and + cleared by software. They define the audio frame + length expressed in number of SCK clock cycles: the + number of bits in the frame is equal to FRL[7:0] + 1. + The minimum number of bits to transfer in an audio + frame must be equal to 8, otherwise the audio block + will behaves in an unexpected way. This is the case + when the data size is 8 bits and only one slot 0 is + defined in NBSLOT[4:0] of SAI_xSLOTR register + (NBSLOT[3:0] = 0000). In master mode, if the master + clock (available on MCLK_x pin) is used, the frame + length should be aligned with a number equal to a + power of 2, ranging from 8 to 256. When the master + clock is not used (NODIV = 1), it is recommended to + program the frame length to an value ranging from 8 + to 256. These bits are meaningless and are not used + in AC97 or SPDIF audio block + configuration. + 0 + 8 + read-write + + + FSALL + Frame synchronization active level + length. These bits are set and cleared by software. + They specify the length in number of bit clock (SCK) + + 1 (FSALL[6:0] + 1) of the active level of the FS + signal in the audio frame These bits are meaningless + and are not used in AC97 or SPDIF audio block + configuration. They must be configured when the audio + block is disabled. + 8 + 7 + read-write + + + FSDEF + Frame synchronization definition. This + bit is set and cleared by software. When the bit is + set, the number of slots defined in the SAI_xSLOTR + register has to be even. It means that half of this + number of slots will be dedicated to the left channel + and the other slots for the right channel (e.g: this + bit has to be set for I2S or MSB/LSB-justified + protocols...). This bit is meaningless and is not + used in AC97 or SPDIF audio block configuration. It + must be configured when the audio block is + disabled. + 16 + 1 + read-only + + + FSPOL + Frame synchronization polarity. This bit + is set and cleared by software. It is used to + configure the level of the start of frame on the FS + signal. It is meaningless and is not used in AC97 or + SPDIF audio block configuration. This bit must be + configured when the audio block is + disabled. + 17 + 1 + read-write + + + FSOFF + Frame synchronization offset. This bit + is set and cleared by software. It is meaningless and + is not used in AC97 or SPDIF audio block + configuration. This bit must be configured when the + audio block is disabled. + 18 + 1 + read-write + + + + + SAI_BSLOTR + SAI_BSLOTR + This register has no meaning in AC97 and + SPDIF audio protocol + 0x30 + 0x20 + read-write + 0x00000000 + + + FBOFF + First bit offset These bits are set and + cleared by software. The value set in this bitfield + defines the position of the first data transfer bit + in the slot. It represents an offset value. In + transmission mode, the bits outside the data field + are forced to 0. In reception mode, the extra + received bits are discarded. These bits must be set + when the audio block is disabled. They are ignored in + AC97 or SPDIF mode. + 0 + 5 + + + SLOTSZ + Slot size This bits is set and cleared + by software. The slot size must be higher or equal to + the data size. If this condition is not respected, + the behavior of the SAI will be undetermined. Refer + to Section: Output data line management on an + inactive slot for information on how to drive SD + line. These bits must be set when the audio block is + disabled. They are ignored in AC97 or SPDIF + mode. + 6 + 2 + + + NBSLOT + Number of slots in an audio frame. These + bits are set and cleared by software. The value set + in this bitfield represents the number of slots + 1 + in the audio frame (including the number of inactive + slots). The maximum number of slots is 16. The number + of slots should be even if FSDEF bit in the SAI_xFRCR + register is set. The number of slots must be + configured when the audio block is disabled. They are + ignored in AC97 or SPDIF mode. + 8 + 4 + + + SLOTEN + Slot enable. These bits are set and + cleared by software. Each SLOTEN bit corresponds to a + slot position from 0 to 15 (maximum 16 slots). The + slot must be enabled when the audio block is + disabled. They are ignored in AC97 or SPDIF + mode. + 16 + 16 + + + + + SAI_BIM + SAI_BIM + Interrupt mask register 2 + 0x34 + 0x20 + read-write + 0x00000000 + + + OVRUDRIE + Overrun/underrun interrupt enable. This + bit is set and cleared by software. When this bit is + set, an interrupt is generated if the OVRUDR bit in + the SAI_xSR register is set. + 0 + 1 + + + MUTEDETIE + Mute detection interrupt enable. This + bit is set and cleared by software. When this bit is + set, an interrupt is generated if the MUTEDET bit in + the SAI_xSR register is set. This bit has a meaning + only if the audio block is configured in receiver + mode. + 1 + 1 + + + WCKCFGIE + Wrong clock configuration interrupt + enable. This bit is set and cleared by software. This + bit is taken into account only if the audio block is + configured as a master (MODE[1] = 0) and NODIV = 0. + It generates an interrupt if the WCKCFG flag in the + SAI_xSR register is set. Note: This bit is used only + in TDM mode and is meaningless in other + modes. + 2 + 1 + + + FREQIE + FIFO request interrupt enable. This bit + is set and cleared by software. When this bit is set, + an interrupt is generated if the FREQ bit in the + SAI_xSR register is set. Since the audio block + defaults to operate as a transmitter after reset, the + MODE bit must be configured before setting FREQIE to + avoid a parasitic interruption in receiver + mode, + 3 + 1 + + + CNRDYIE + Codec not ready interrupt enable (AC97). + This bit is set and cleared by software. When the + interrupt is enabled, the audio block detects in the + slot 0 (tag0) of the AC97 frame if the Codec + connected to this line is ready or not. If it is not + ready, the CNRDY flag in the SAI_xSR register is set + and an interruption i generated. This bit has a + meaning only if the AC97 mode is selected through + PRTCFG[1:0] bits and the audio block is operates as a + receiver. + 4 + 1 + + + AFSDETIE + Anticipated frame synchronization + detection interrupt enable. This bit is set and + cleared by software. When this bit is set, an + interrupt will be generated if the AFSDET bit in the + SAI_xSR register is set. This bit is meaningless in + AC97, SPDIF mode or when the audio block operates as + a master. + 5 + 1 + + + LFSDETIE + Late frame synchronization detection + interrupt enable. This bit is set and cleared by + software. When this bit is set, an interrupt will be + generated if the LFSDET bit is set in the SAI_xSR + register. This bit is meaningless in AC97, SPDIF mode + or when the audio block operates as a + master. + 6 + 1 + + + + + SAI_BSR + SAI_BSR + Status register + 0x38 + 0x20 + read-only + 0x00000008 + + + OVRUDR + Overrun / underrun. This bit is read + only. The overrun and underrun conditions can occur + only when the audio block is configured as a receiver + and a transmitter, respectively. It can generate an + interrupt if OVRUDRIE bit is set in SAI_xIM register. + This flag is cleared when the software sets COVRUDR + bit in SAI_xCLRFR register. + 0 + 1 + + + MUTEDET + Mute detection. This bit is read only. + This flag is set if consecutive 0 values are received + in each slot of a given audio frame and for a + consecutive number of audio frames (set in the + MUTECNT bit in the SAI_xCR2 register). It can + generate an interrupt if MUTEDETIE bit is set in + SAI_xIM register. This flag is cleared when the + software sets bit CMUTEDET in the SAI_xCLRFR + register. + 1 + 1 + + + WCKCFG + Wrong clock configuration flag. This bit + is read only. This bit is used only when the audio + block operates in master mode (MODE[1] = 0) and NODIV + = 0. It can generate an interrupt if WCKCFGIE bit is + set in SAI_xIM register. This flag is cleared when + the software sets CWCKCFG bit in SAI_xCLRFR + register. + 2 + 1 + + + FREQ + FIFO request. This bit is read only. The + request depends on the audio block configuration: If + the block is configured in transmission mode, the + FIFO request is related to a write request operation + in the SAI_xDR. If the block configured in reception, + the FIFO request related to a read request operation + from the SAI_xDR. This flag can generate an interrupt + if FREQIE bit is set in SAI_xIM + register. + 3 + 1 + + + CNRDY + Codec not ready. This bit is read only. + This bit is used only when the AC97 audio protocol is + selected in the SAI_xCR1 register and configured in + receiver mode. It can generate an interrupt if + CNRDYIE bit is set in SAI_xIM register. This flag is + cleared when the software sets CCNRDY bit in + SAI_xCLRFR register. + 4 + 1 + + + AFSDET + Anticipated frame synchronization + detection. This bit is read only. This flag can be + set only if the audio block is configured in slave + mode. It is not used in AC97or SPDIF mode. It can + generate an interrupt if AFSDETIE bit is set in + SAI_xIM register. This flag is cleared when the + software sets CAFSDET bit in SAI_xCLRFR + register. + 5 + 1 + + + LFSDET + Late frame synchronization detection. + This bit is read only. This flag can be set only if + the audio block is configured in slave mode. It is + not used in AC97 or SPDIF mode. It can generate an + interrupt if LFSDETIE bit is set in the SAI_xIM + register. This flag is cleared when the software sets + bit CLFSDET in SAI_xCLRFR register + 6 + 1 + + + FLVL + FIFO level threshold. This bit is read + only. The FIFO level threshold flag is managed only + by hardware and its setting depends on SAI block + configuration (transmitter or receiver mode). If the + SAI block is configured as transmitter: If SAI block + is configured as receiver: + 16 + 3 + + + + + SAI_BCLRFR + SAI_BCLRFR + Clear flag register + 0x3C + 0x20 + write-only + 0x00000000 + + + COVRUDR + Clear overrun / underrun. This bit is + write only. Programming this bit to 1 clears the + OVRUDR flag in the SAI_xSR register. Reading this bit + always returns the value 0. + 0 + 1 + + + CMUTEDET + Mute detection flag. This bit is write + only. Programming this bit to 1 clears the MUTEDET + flag in the SAI_xSR register. Reading this bit always + returns the value 0. + 1 + 1 + + + CWCKCFG + Clear wrong clock configuration flag. + This bit is write only. Programming this bit to 1 + clears the WCKCFG flag in the SAI_xSR register. This + bit is used only when the audio block is set as + master (MODE[1] = 0) and NODIV = 0 in the SAI_xCR1 + register. Reading this bit always returns the value + 0. + 2 + 1 + + + CCNRDY + Clear Codec not ready flag. This bit is + write only. Programming this bit to 1 clears the + CNRDY flag in the SAI_xSR register. This bit is used + only when the AC97 audio protocol is selected in the + SAI_xCR1 register. Reading this bit always returns + the value 0. + 4 + 1 + + + CAFSDET + Clear anticipated frame synchronization + detection flag. This bit is write only. Programming + this bit to 1 clears the AFSDET flag in the SAI_xSR + register. It is not used in AC97or SPDIF mode. + Reading this bit always returns the value + 0. + 5 + 1 + + + CLFSDET + Clear late frame synchronization + detection flag. This bit is write only. Programming + this bit to 1 clears the LFSDET flag in the SAI_xSR + register. This bit is not used in AC97or SPDIF mode + Reading this bit always returns the value + 0. + 6 + 1 + + + + + SAI_BDR + SAI_BDR + Data register + 0x40 + 0x20 + read-write + 0x00000000 + + + DATA + Data A write to this register loads the + FIFO provided the FIFO is not full. A read from this + register empties the FIFO if the FIFO is not + empty. + 0 + 32 + + + + + SAI_PDMCR + SAI_PDMCR + PDM control register + 0x44 + 0x20 + read-write + 0x00000000 + + + PDMEN + PDM enable + 0 + 1 + + + MICNBR + Number of microphones + 4 + 2 + + + CKEN1 + Clock enable of bitstream clock number + 1 + 8 + 1 + + + CKEN2 + Clock enable of bitstream clock number + 2 + 9 + 1 + + + CKEN3 + Clock enable of bitstream clock number + 3 + 10 + 1 + + + CKEN4 + Clock enable of bitstream clock number + 4 + 11 + 1 + + + + + SAI_PDMDLY + SAI_PDMDLY + PDM delay register + 0x48 + 0x20 + read-write + 0x00000000 + + + DLYM1L + Delay line adjust for first microphone + of pair 1 + 0 + 3 + + + DLYM1R + Delay line adjust for second microphone + of pair 1 + 4 + 3 + + + DLYM2L + Delay line for first microphone of pair + 2 + 8 + 3 + + + DLYM2R + Delay line for second microphone of pair + 2 + 12 + 3 + + + DLYM3L + Delay line for first microphone of pair + 3 + 16 + 3 + + + DLYM3R + Delay line for second microphone of pair + 3 + 20 + 3 + + + DLYM4L + Delay line for first microphone of pair + 4 + 24 + 3 + + + DLYM4R + Delay line for second microphone of pair + 4 + 28 + 3 + + + + + + + SAI1 + 0x40015800 + + SAI1 + SAI1 global interrupt + 87 + + + + SAI2 + 0x40015C00 + + SAI2 + SAI2 global interrupt + 91 + + + + SAI3 + 0x40016000 + + SAI3 + SAI3 global interrupt + 114 + + + + SDMMC1 + SDMMC1 + SDMMC + 0x52007000 + + 0x0 + 0x3FD + registers + + + SDMMC1 + SDMMC global interrupt + 49 + + + SDMMC + SDMMC global interrupt + 124 + + + + POWER + POWER + SDMMC power control register + 0x0 + 0x20 + read-write + 0x00000000 + + + PWRCTRL + SDMMC state control bits. These bits can + only be written when the SDMMC is not in the power-on + state (PWRCTRL?11). These bits are used to define the + functional state of the SDMMC signals: Any further + write will be ignored, PWRCTRL value will keep + 11. + 0 + 2 + + + VSWITCH + Voltage switch sequence start. This bit + is used to start the timing critical section of the + voltage switch sequence: + 2 + 1 + + + VSWITCHEN + Voltage switch procedure enable. This + bit can only be written by firmware when CPSM is + disabled (CPSMEN = 0). This bit is used to stop the + SDMMC_CK after the voltage switch command + response: + 3 + 1 + + + DIRPOL + Data and command direction signals + polarity selection. This bit can only be written when + the SDMMC is in the power-off state (PWRCTRL = + 00). + 4 + 1 + + + + + CLKCR + CLKCR + The SDMMC_CLKCR register controls the + SDMMC_CK output clock, the SDMMC_RX_CLK receive clock, + and the bus width. + 0x4 + 0x20 + read-write + 0x00000000 + + + CLKDIV + Clock divide factor This bit can only be + written when the CPSM and DPSM are not active + (CPSMACT = 0 and DPSMACT = 0). This field defines the + divide factor between the input clock (SDMMCCLK) and + the output clock (SDMMC_CK): SDMMC_CK frequency = + SDMMCCLK / [2 * CLKDIV]. 0xx: etc.. xxx: + etc.. + 0 + 10 + + + PWRSAV + Power saving configuration bit This bit + can only be written when the CPSM and DPSM are not + active (CPSMACT = 0 and DPSMACT = 0) For power + saving, the SDMMC_CK clock output can be disabled + when the bus is idle by setting PWRSAV: + 12 + 1 + + + WIDBUS + Wide bus mode enable bit This bit can + only be written when the CPSM and DPSM are not active + (CPSMACT = 0 and DPSMACT = 0) + 14 + 2 + + + NEGEDGE + SDMMC_CK dephasing selection bit for + data and Command. This bit can only be written when + the CPSM and DPSM are not active (CPSMACT = 0 and + DPSMACT = 0). When clock division = 1 (CLKDIV = 0), + this bit has no effect. Data and Command change on + SDMMC_CK falling edge. When clock division &gt;1 + (CLKDIV &gt; 0) &amp; DDR = 0: - SDMMC_CK + edge occurs on SDMMCCLK rising edge. When clock + division >1 (CLKDIV > 0) & DDR = 1: - Data + changed on the SDMMCCLK falling edge succeeding a + SDMMC_CK edge. - SDMMC_CK edge occurs on SDMMCCLK + rising edge. - Data changed on the SDMMC_CK falling + edge succeeding a SDMMC_CK edge. - SDMMC_CK edge + occurs on SDMMCCLK rising edge. + 16 + 1 + + + HWFC_EN + Hardware flow control enable This bit + can only be written when the CPSM and DPSM are not + active (CPSMACT = 0 and DPSMACT = 0) When Hardware + flow control is enabled, the meaning of the TXFIFOE + and RXFIFOF flags change, please see SDMMC status + register definition in Section56.8.11. + 17 + 1 + + + DDR + Data rate signaling selection This bit + can only be written when the CPSM and DPSM are not + active (CPSMACT = 0 and DPSMACT = 0) DDR rate shall + only be selected with 4-bit or 8-bit wide bus mode. + (WIDBUS &gt; 00). DDR = 1 has no effect when + WIDBUS = 00 (1-bit wide bus). DDR rate shall only be + selected with clock division &gt;1. (CLKDIV + &gt; 0) + 18 + 1 + + + BUSSPEED + Bus speed mode selection between DS, HS, + SDR12, SDR25 and SDR50, DDR50, SDR104. This bit can + only be written when the CPSM and DPSM are not active + (CPSMACT = 0 and DPSMACT = 0) + 19 + 1 + + + SELCLKRX + Receive clock selection. These bits can + only be written when the CPSM and DPSM are not active + (CPSMACT = 0 and DPSMACT = 0) + 20 + 2 + + + + + ARGR + ARGR + The SDMMC_ARGR register contains a 32-bit + command argument, which is sent to a card as part of a + command message. + 0x8 + 0x20 + read-write + 0x00000000 + + + CMDARG + Command argument. These bits can only be + written by firmware when CPSM is disabled (CPSMEN = + 0). Command argument sent to a card as part of a + command message. If a command contains an argument, + it must be loaded into this register before writing a + command to the command register. + 0 + 32 + + + + + CMDR + CMDR + The SDMMC_CMDR register contains the command + index and command type bits. The command index is sent to + a card as part of a command message. The command type + bits control the command path state machine + (CPSM). + 0xC + 0x20 + read-write + 0x00000000 + + + CMDINDEX + Command index. This bit can only be + written by firmware when CPSM is disabled (CPSMEN = + 0). The command index is sent to the card as part of + a command message. + 0 + 6 + + + CMDTRANS + The CPSM treats the command as a data + transfer command, stops the interrupt period, and + signals DataEnable to the DPSM This bit can only be + written by firmware when CPSM is disabled (CPSMEN = + 0). If this bit is set, the CPSM issues an end of + interrupt period and issues DataEnable signal to the + DPSM when the command is sent. + 6 + 1 + + + CMDSTOP + The CPSM treats the command as a Stop + Transmission command and signals Abort to the DPSM. + This bit can only be written by firmware when CPSM is + disabled (CPSMEN = 0). If this bit is set, the CPSM + issues the Abort signal to the DPSM when the command + is sent. + 7 + 1 + + + WAITRESP + Wait for response bits. This bit can + only be written by firmware when CPSM is disabled + (CPSMEN = 0). They are used to configure whether the + CPSM is to wait for a response, and if yes, which + kind of response. + 8 + 2 + + + WAITINT + CPSM waits for interrupt request. If + this bit is set, the CPSM disables command timeout + and waits for an card interrupt request (Response). + If this bit is cleared in the CPSM Wait state, will + cause the abort of the interrupt mode. + 10 + 1 + + + WAITPEND + CPSM Waits for end of data transfer + (CmdPend internal signal) from DPSM. This bit when + set, the CPSM waits for the end of data transfer + trigger before it starts sending a command. WAITPEND + is only taken into account when DTMODE = MMC stream + data transfer, WIDBUS = 1-bit wide bus mode, DPSMACT + = 1 and DTDIR = from host to card. + 11 + 1 + + + CPSMEN + Command path state machine (CPSM) Enable + bit This bit is written 1 by firmware, and cleared by + hardware when the CPSM enters the Idle state. If this + bit is set, the CPSM is enabled. When DTEN = 1, no + command will be transfered nor boot procedure will be + started. CPSMEN is cleared to 0. + 12 + 1 + + + DTHOLD + Hold new data block transmission and + reception in the DPSM. If this bit is set, the DPSM + will not move from the Wait_S state to the Send state + or from the Wait_R state to the Receive + state. + 13 + 1 + + + BOOTMODE + Select the boot mode procedure to be + used. This bit can only be written by firmware when + CPSM is disabled (CPSMEN = 0) + 14 + 1 + + + BOOTEN + Enable boot mode + procedure. + 15 + 1 + + + CMDSUSPEND + The CPSM treats the command as a Suspend + or Resume command and signals interrupt period + start/end. This bit can only be written by firmware + when CPSM is disabled (CPSMEN = 0). CMDSUSPEND = 1 + and CMDTRANS = 0 Suspend command, start interrupt + period when response bit BS=0. CMDSUSPEND = 1 and + CMDTRANS = 1 Resume command with data, end interrupt + period when response bit DF=1. + 16 + 1 + + + + + RESP1R + RESP1R + The SDMMC_RESP1/2/3/4R registers contain the + status of a card, which is part of the received + response. + 0x14 + 0x20 + read-only + 0x00000000 + + + CARDSTATUS1 + see Table 432 + 0 + 32 + + + + + RESP2R + RESP2R + The SDMMC_RESP1/2/3/4R registers contain the + status of a card, which is part of the received + response. + 0x18 + 0x20 + read-only + 0x00000000 + + + CARDSTATUS2 + see Table404. + 0 + 32 + + + + + RESP3R + RESP3R + The SDMMC_RESP1/2/3/4R registers contain the + status of a card, which is part of the received + response. + 0x1C + 0x20 + read-only + 0x00000000 + + + CARDSTATUS3 + see Table404. + 0 + 32 + + + + + RESP4R + RESP4R + The SDMMC_RESP1/2/3/4R registers contain the + status of a card, which is part of the received + response. + 0x20 + 0x20 + read-only + 0x00000000 + + + CARDSTATUS4 + see Table404. + 0 + 32 + + + + + DTIMER + DTIMER + The SDMMC_DTIMER register contains the data + timeout period, in card bus clock periods. A counter + loads the value from the SDMMC_DTIMER register, and + starts decrementing when the data path state machine + (DPSM) enters the Wait_R or Busy state. If the timer + reaches 0 while the DPSM is in either of these states, + the timeout status flag is set. + 0x24 + 0x20 + read-write + 0x00000000 + + + DATATIME + Data and R1b busy timeout period This + bit can only be written when the CPSM and DPSM are + not active (CPSMACT = 0 and DPSMACT = 0). Data and + R1b busy timeout period expressed in card bus clock + periods. + 0 + 32 + + + + + DLENR + DLENR + The SDMMC_DLENR register contains the number + of data bytes to be transferred. The value is loaded into + the data counter when data transfer starts. + 0x28 + 0x20 + read-write + 0x00000000 + + + DATALENGTH + Data length value This register can only + be written by firmware when DPSM is inactive (DPSMACT + = 0). Number of data bytes to be transferred. When + DDR = 1 DATALENGTH is truncated to a multiple of 2. + (The last odd byte is not transfered) When DATALENGTH + = 0 no data will be transfered, when requested by a + CPSMEN and CMDTRANS = 1 also no command will be + transfered. DTEN and CPSMEN are cleared to + 0. + 0 + 25 + + + + + DCTRL + DCTRL + The SDMMC_DCTRL register control the data + path state machine (DPSM). + 0x2C + 0x20 + read-write + 0x00000000 + + + DTEN + Data transfer enable bit This bit can + only be written by firmware when DPSM is inactive + (DPSMACT = 0). This bit is cleared by Hardware when + data transfer completes. This bit shall only be used + to transfer data when no associated data transfer + command is used, i.e. shall not be used with SD or + eMMC cards. + 0 + 1 + + + DTDIR + Data transfer direction selection This + bit can only be written by firmware when DPSM is + inactive (DPSMACT = 0). + 1 + 1 + + + DTMODE + Data transfer mode selection. This bit + can only be written by firmware when DPSM is inactive + (DPSMACT = 0). + 2 + 2 + + + DBLOCKSIZE + Data block size This bit can only be + written by firmware when DPSM is inactive (DPSMACT = + 0). Define the data block length when the block data + transfer mode is selected: When DATALENGTH is not a + multiple of DBLOCKSIZE, the transfered data is + truncated at a multiple of DBLOCKSIZE. (Any remain + data will not be transfered.) When DDR = 1, + DBLOCKSIZE = 0000 shall not be used. (No data will be + transfered) + 4 + 4 + + + RWSTART + Read wait start. If this bit is set, + read wait operation starts. + 8 + 1 + + + RWSTOP + Read wait stop This bit is written by + firmware and auto cleared by hardware when the DPSM + moves from the READ_WAIT state to the WAIT_R or IDLE + state. + 9 + 1 + + + RWMOD + Read wait mode. This bit can only be + written by firmware when DPSM is inactive (DPSMACT = + 0). + 10 + 1 + + + SDIOEN + SD I/O interrupt enable functions This + bit can only be written by firmware when DPSM is + inactive (DPSMACT = 0). If this bit is set, the DPSM + enables the SD I/O card specific interrupt + operation. + 11 + 1 + + + BOOTACKEN + Enable the reception of the boot + acknowledgment. This bit can only be written by + firmware when DPSM is inactive (DPSMACT = + 0). + 12 + 1 + + + FIFORST + FIFO reset, will flush any remaining + data. This bit can only be written by firmware when + IDMAEN= 0 and DPSM is active (DPSMACT = 1). This bit + will only take effect when a transfer error or + transfer hold occurs. + 13 + 1 + + + + + DCNTR + DCNTR + The SDMMC_DCNTR register loads the value + from the data length register (see SDMMC_DLENR) when the + DPSM moves from the Idle state to the Wait_R or Wait_S + state. As data is transferred, the counter decrements the + value until it reaches 0. The DPSM then moves to the Idle + state and when there has been no error, the data status + end flag (DATAEND) is set. + 0x30 + 0x20 + read-only + 0x00000000 + + + DATACOUNT + Data count value When read, the number + of remaining data bytes to be transferred is + returned. Write has no effect. + 0 + 25 + + + + + STAR + STAR + The SDMMC_STAR register is a read-only + register. It contains two types of flag:Static flags + (bits [29,21,11:0]): these bits remain asserted until + they are cleared by writing to the SDMMC interrupt Clear + register (see SDMMC_ICR)Dynamic flags (bits [20:12]): + these bits change state depending on the state of the + underlying logic (for example, FIFO full and empty flags + are asserted and de-asserted as data while written to the + FIFO) + 0x34 + 0x20 + read-only + 0x00000000 + + + CCRCFAIL + Command response received (CRC check + failed). Interrupt flag is cleared by writing + corresponding interrupt clear bit in + SDMMC_ICR. + 0 + 1 + + + DCRCFAIL + Data block sent/received (CRC check + failed). Interrupt flag is cleared by writing + corresponding interrupt clear bit in + SDMMC_ICR. + 1 + 1 + + + CTIMEOUT + Command response timeout. Interrupt flag + is cleared by writing corresponding interrupt clear + bit in SDMMC_ICR. The Command Timeout period has a + fixed value of 64 SDMMC_CK clock + periods. + 2 + 1 + + + DTIMEOUT + Data timeout. Interrupt flag is cleared + by writing corresponding interrupt clear bit in + SDMMC_ICR. + 3 + 1 + + + TXUNDERR + Transmit FIFO underrun error or IDMA + read transfer error. Interrupt flag is cleared by + writing corresponding interrupt clear bit in + SDMMC_ICR. + 4 + 1 + + + RXOVERR + Received FIFO overrun error or IDMA + write transfer error. Interrupt flag is cleared by + writing corresponding interrupt clear bit in + SDMMC_ICR. + 5 + 1 + + + CMDREND + Command response received (CRC check + passed, or no CRC). Interrupt flag is cleared by + writing corresponding interrupt clear bit in + SDMMC_ICR. + 6 + 1 + + + CMDSENT + Command sent (no response required). + Interrupt flag is cleared by writing corresponding + interrupt clear bit in SDMMC_ICR. + 7 + 1 + + + DATAEND + Data transfer ended correctly. (data + counter, DATACOUNT is zero and no errors occur). + Interrupt flag is cleared by writing corresponding + interrupt clear bit in SDMMC_ICR. + 8 + 1 + + + DHOLD + Data transfer Hold. Interrupt flag is + cleared by writing corresponding interrupt clear bit + in SDMMC_ICR. + 9 + 1 + + + DBCKEND + Data block sent/received. (CRC check + passed) and DPSM moves to the READWAIT state. + Interrupt flag is cleared by writing corresponding + interrupt clear bit in SDMMC_ICR. + 10 + 1 + + + DABORT + Data transfer aborted by CMD12. + Interrupt flag is cleared by writing corresponding + interrupt clear bit in SDMMC_ICR. + 11 + 1 + + + DPSMACT + Data path state machine active, i.e. not + in Idle state. This is a hardware status flag only, + does not generate an interrupt. + 12 + 1 + + + CPSMACT + Command path state machine active, i.e. + not in Idle state. This is a hardware status flag + only, does not generate an interrupt. + 13 + 1 + + + TXFIFOHE + Transmit FIFO half empty At least half + the number of words can be written into the FIFO. + This bit is cleared when the FIFO becomes half+1 + full. + 14 + 1 + + + RXFIFOHF + Receive FIFO half full There are at + least half the number of words in the FIFO. This bit + is cleared when the FIFO becomes half+1 + empty. + 15 + 1 + + + TXFIFOF + Transmit FIFO full This is a hardware + status flag only, does not generate an interrupt. + This bit is cleared when one FIFO location becomes + empty. + 16 + 1 + + + RXFIFOF + Receive FIFO full This bit is cleared + when one FIFO location becomes empty. + 17 + 1 + + + TXFIFOE + Transmit FIFO empty This bit is cleared + when one FIFO location becomes full. + 18 + 1 + + + RXFIFOE + Receive FIFO empty This is a hardware + status flag only, does not generate an interrupt. + This bit is cleared when one FIFO location becomes + full. + 19 + 1 + + + BUSYD0 + Inverted value of SDMMC_D0 line (Busy), + sampled at the end of a CMD response and a second + time 2 SDMMC_CK cycles after the CMD response. This + bit is reset to not busy when the SDMMCD0 line + changes from busy to not busy. This bit does not + signal busy due to data transfer. This is a hardware + status flag only, it does not generate an + interrupt. + 20 + 1 + + + BUSYD0END + end of SDMMC_D0 Busy following a CMD + response detected. This indicates only end of busy + following a CMD response. This bit does not signal + busy due to data transfer. Interrupt flag is cleared + by writing corresponding interrupt clear bit in + SDMMC_ICR. + 21 + 1 + + + SDIOIT + SDIO interrupt received. Interrupt flag + is cleared by writing corresponding interrupt clear + bit in SDMMC_ICR. + 22 + 1 + + + ACKFAIL + Boot acknowledgment received (boot + acknowledgment check fail). Interrupt flag is cleared + by writing corresponding interrupt clear bit in + SDMMC_ICR. + 23 + 1 + + + ACKTIMEOUT + Boot acknowledgment timeout. Interrupt + flag is cleared by writing corresponding interrupt + clear bit in SDMMC_ICR. + 24 + 1 + + + VSWEND + Voltage switch critical timing section + completion. Interrupt flag is cleared by writing + corresponding interrupt clear bit in + SDMMC_ICR. + 25 + 1 + + + CKSTOP + SDMMC_CK stopped in Voltage switch + procedure. Interrupt flag is cleared by writing + corresponding interrupt clear bit in + SDMMC_ICR. + 26 + 1 + + + IDMATE + IDMA transfer error. Interrupt flag is + cleared by writing corresponding interrupt clear bit + in SDMMC_ICR. + 27 + 1 + + + IDMABTC + IDMA buffer transfer complete. interrupt + flag is cleared by writing corresponding interrupt + clear bit in SDMMC_ICR. + 28 + 1 + + + + + ICR + ICR + The SDMMC_ICR register is a write-only + register. Writing a bit with 1 clears the corresponding + bit in the SDMMC_STAR status register. + 0x38 + 0x20 + read-write + 0x00000000 + + + CCRCFAILC + CCRCFAIL flag clear bit Set by software + to clear the CCRCFAIL flag. + 0 + 1 + + + DCRCFAILC + DCRCFAIL flag clear bit Set by software + to clear the DCRCFAIL flag. + 1 + 1 + + + CTIMEOUTC + CTIMEOUT flag clear bit Set by software + to clear the CTIMEOUT flag. + 2 + 1 + + + DTIMEOUTC + DTIMEOUT flag clear bit Set by software + to clear the DTIMEOUT flag. + 3 + 1 + + + TXUNDERRC + TXUNDERR flag clear bit Set by software + to clear TXUNDERR flag. + 4 + 1 + + + RXOVERRC + RXOVERR flag clear bit Set by software + to clear the RXOVERR flag. + 5 + 1 + + + CMDRENDC + CMDREND flag clear bit Set by software + to clear the CMDREND flag. + 6 + 1 + + + CMDSENTC + CMDSENT flag clear bit Set by software + to clear the CMDSENT flag. + 7 + 1 + + + DATAENDC + DATAEND flag clear bit Set by software + to clear the DATAEND flag. + 8 + 1 + + + DHOLDC + DHOLD flag clear bit Set by software to + clear the DHOLD flag. + 9 + 1 + + + DBCKENDC + DBCKEND flag clear bit Set by software + to clear the DBCKEND flag. + 10 + 1 + + + DABORTC + DABORT flag clear bit Set by software to + clear the DABORT flag. + 11 + 1 + + + BUSYD0ENDC + BUSYD0END flag clear bit Set by software + to clear the BUSYD0END flag. + 21 + 1 + + + SDIOITC + SDIOIT flag clear bit Set by software to + clear the SDIOIT flag. + 22 + 1 + + + ACKFAILC + ACKFAIL flag clear bit Set by software + to clear the ACKFAIL flag. + 23 + 1 + + + ACKTIMEOUTC + ACKTIMEOUT flag clear bit Set by + software to clear the ACKTIMEOUT flag. + 24 + 1 + + + VSWENDC + VSWEND flag clear bit Set by software to + clear the VSWEND flag. + 25 + 1 + + + CKSTOPC + CKSTOP flag clear bit Set by software to + clear the CKSTOP flag. + 26 + 1 + + + IDMATEC + IDMA transfer error clear bit Set by + software to clear the IDMATE flag. + 27 + 1 + + + IDMABTCC + IDMA buffer transfer complete clear bit + Set by software to clear the IDMABTC + flag. + 28 + 1 + + + + + MASKR + MASKR + The interrupt mask register determines which + status flags generate an interrupt request by setting the + corresponding bit to 1. + 0x3C + 0x20 + read-write + 0x00000000 + + + CCRCFAILIE + Command CRC fail interrupt enable Set + and cleared by software to enable/disable interrupt + caused by command CRC failure. + 0 + 1 + + + DCRCFAILIE + Data CRC fail interrupt enable Set and + cleared by software to enable/disable interrupt + caused by data CRC failure. + 1 + 1 + + + CTIMEOUTIE + Command timeout interrupt enable Set and + cleared by software to enable/disable interrupt + caused by command timeout. + 2 + 1 + + + DTIMEOUTIE + Data timeout interrupt enable Set and + cleared by software to enable/disable interrupt + caused by data timeout. + 3 + 1 + + + TXUNDERRIE + Tx FIFO underrun error interrupt enable + Set and cleared by software to enable/disable + interrupt caused by Tx FIFO underrun + error. + 4 + 1 + + + RXOVERRIE + Rx FIFO overrun error interrupt enable + Set and cleared by software to enable/disable + interrupt caused by Rx FIFO overrun + error. + 5 + 1 + + + CMDRENDIE + Command response received interrupt + enable Set and cleared by software to enable/disable + interrupt caused by receiving command + response. + 6 + 1 + + + CMDSENTIE + Command sent interrupt enable Set and + cleared by software to enable/disable interrupt + caused by sending command. + 7 + 1 + + + DATAENDIE + Data end interrupt enable Set and + cleared by software to enable/disable interrupt + caused by data end. + 8 + 1 + + + DHOLDIE + Data hold interrupt enable Set and + cleared by software to enable/disable the interrupt + generated when sending new data is hold in the DPSM + Wait_S state. + 9 + 1 + + + DBCKENDIE + Data block end interrupt enable Set and + cleared by software to enable/disable interrupt + caused by data block end. + 10 + 1 + + + DABORTIE + Data transfer aborted interrupt enable + Set and cleared by software to enable/disable + interrupt caused by a data transfer being + aborted. + 11 + 1 + + + TXFIFOHEIE + Tx FIFO half empty interrupt enable Set + and cleared by software to enable/disable interrupt + caused by Tx FIFO half empty. + 14 + 1 + + + RXFIFOHFIE + Rx FIFO half full interrupt enable Set + and cleared by software to enable/disable interrupt + caused by Rx FIFO half full. + 15 + 1 + + + RXFIFOFIE + Rx FIFO full interrupt enable Set and + cleared by software to enable/disable interrupt + caused by Rx FIFO full. + 17 + 1 + + + TXFIFOEIE + Tx FIFO empty interrupt enable Set and + cleared by software to enable/disable interrupt + caused by Tx FIFO empty. + 18 + 1 + + + BUSYD0ENDIE + BUSYD0END interrupt enable Set and + cleared by software to enable/disable the interrupt + generated when SDMMC_D0 signal changes from busy to + NOT busy following a CMD response. + 21 + 1 + + + SDIOITIE + SDIO mode interrupt received interrupt + enable Set and cleared by software to enable/disable + the interrupt generated when receiving the SDIO mode + interrupt. + 22 + 1 + + + ACKFAILIE + Acknowledgment Fail interrupt enable Set + and cleared by software to enable/disable interrupt + caused by acknowledgment Fail. + 23 + 1 + + + ACKTIMEOUTIE + Acknowledgment timeout interrupt enable + Set and cleared by software to enable/disable + interrupt caused by acknowledgment + timeout. + 24 + 1 + + + VSWENDIE + Voltage switch critical timing section + completion interrupt enable Set and cleared by + software to enable/disable the interrupt generated + when voltage switch critical timing section + completion. + 25 + 1 + + + CKSTOPIE + Voltage Switch clock stopped interrupt + enable Set and cleared by software to enable/disable + interrupt caused by Voltage Switch clock + stopped. + 26 + 1 + + + IDMABTCIE + IDMA buffer transfer complete interrupt + enable Set and cleared by software to enable/disable + the interrupt generated when the IDMA has transferred + all data belonging to a memory buffer. + 28 + 1 + + + + + ACKTIMER + ACKTIMER + The SDMMC_ACKTIMER register contains the + acknowledgment timeout period, in SDMMC_CK bus clock + periods. A counter loads the value from the + SDMMC_ACKTIMER register, and starts decrementing when the + data path state machine (DPSM) enters the Wait_Ack state. + If the timer reaches 0 while the DPSM is in this states, + the acknowledgment timeout status flag is + set. + 0x40 + 0x20 + read-write + 0x00000000 + + + ACKTIME + Boot acknowledgment timeout period This + bit can only be written by firmware when CPSM is + disabled (CPSMEN = 0). Boot acknowledgment timeout + period expressed in card bus clock + periods. + 0 + 25 + + + + + IDMACTRLR + IDMACTRLR + The receive and transmit FIFOs can be read + or written as 32-bit wide registers. The FIFOs contain 32 + entries on 32 sequential addresses. This allows the CPU + to use its load and store multiple operands to read + from/write to the FIFO. + 0x50 + 0x20 + read-write + 0x00000000 + + + IDMAEN + IDMA enable This bit can only be written + by firmware when DPSM is inactive (DPSMACT = + 0). + 0 + 1 + + + IDMABMODE + Buffer mode selection. This bit can only + be written by firmware when DPSM is inactive (DPSMACT + = 0). + 1 + 1 + + + IDMABACT + Double buffer mode active buffer + indication This bit can only be written by firmware + when DPSM is inactive (DPSMACT = 0). When IDMA is + enabled this bit is toggled by + hardware. + 2 + 1 + + + + + IDMABSIZER + IDMABSIZER + The SDMMC_IDMABSIZER register contains the + buffers size when in double buffer + configuration. + 0x54 + 0x20 + read-write + 0x00000000 + + + IDMABNDT + Number of transfers per buffer. This + 8-bit value shall be multiplied by 8 to get the size + of the buffer in 32-bit words and by 32 to get the + size of the buffer in bytes. Example: IDMABNDT = + 0x01: buffer size = 8 words = 32 bytes. These bits + can only be written by firmware when DPSM is inactive + (DPSMACT = 0). + 5 + 8 + + + + + IDMABASE0R + IDMABASE0R + The SDMMC_IDMABASE0R register contains the + memory buffer base address in single buffer configuration + and the buffer 0 base address in double buffer + configuration. + 0x58 + 0x20 + read-write + 0x00000000 + + + IDMABASE0 + Buffer 0 memory base address bits + [31:2], shall be word aligned (bit [1:0] are always 0 + and read only). This register can be written by + firmware when DPSM is inactive (DPSMACT = 0), and can + dynamically be written by firmware when DPSM active + (DPSMACT = 1) and memory buffer 0 is inactive + (IDMABACT = 1). + 0 + 32 + + + + + IDMABASE1R + IDMABASE1R + The SDMMC_IDMABASE1R register contains the + double buffer configuration second buffer memory base + address. + 0x5C + 0x20 + read-write + 0x00000000 + + + IDMABASE1 + Buffer 1 memory base address, shall be + word aligned (bit [1:0] are always 0 and read only). + This register can be written by firmware when DPSM is + inactive (DPSMACT = 0), and can dynamically be + written by firmware when DPSM active (DPSMACT = 1) + and memory buffer 1 is inactive (IDMABACT = + 0). + 0 + 32 + + + + + FIFOR + FIFOR + The receive and transmit FIFOs can be only + read or written as word (32-bit) wide registers. The + FIFOs contain 16 entries on sequential addresses. This + allows the CPU to use its load and store multiple + operands to read from/write to the FIFO.When accessing + SDMMC_FIFOR with half word or byte access an AHB bus + fault is generated. + 0x80 + 0x20 + read-write + 0x00000000 + + + FIFODATA + Receive and transmit FIFO data This + register can only be read or written by firmware when + the DPSM is active (DPSMACT=1). The FIFO data + occupies 16 entries of 32-bit words. + 0 + 32 + + + + + VER + VER + SDMMC IP version register + 0x3F4 + 0x20 + read-only + 0x00000010 + + + MINREV + IP minor revision number. + 0 + 4 + + + MAJREV + IP major revision number. + 4 + 4 + + + + + ID + ID + SDMMC IP identification + register + 0x3F8 + 0x20 + read-only + 0x00140022 + + + IP_ID + SDMMC IP identification. + 0 + 32 + + + + + RESPCMDR + RESPCMDR + SDMMC command response + register + 0x10 + 0x20 + read-only + 0xA3C5DD01 + + + RESPCMD + Response command index + 0 + 6 + + + + + + + SDMMC2 + 0x48022400 + + + VREFBUF + VREFBUF + VREFBUF + 0x58003C00 + + 0x0 + 0x400 + registers + + + + CSR + CSR + VREFBUF control and status + register + 0x0 + 0x20 + 0x00000002 + + + ENVR + Voltage reference buffer mode enable + This bit is used to enable the voltage reference + buffer mode. + 0 + 1 + read-write + + + HIZ + High impedance mode This bit controls + the analog switch to connect or not the VREF+ pin. + Refer to Table196: VREF buffer modes for the mode + descriptions depending on ENVR bit + configuration. + 1 + 1 + read-write + + + VRR + Voltage reference buffer + ready + 3 + 1 + read-only + + + VRS + Voltage reference scale These bits + select the value generated by the voltage reference + buffer. Other: Reserved + 4 + 3 + read-write + + + + + CCR + CCR + VREFBUF calibration control + register + 0x4 + 0x20 + read-write + 0x00000000 + + + TRIM + Trimming code These bits are + automatically initialized after reset with the + trimming value stored in the Flash memory during the + production test. Writing into these bits allows to + tune the internal reference buffer + voltage. + 0 + 6 + + + + + + + IWDG + IWDG + IWDG + 0x58004800 + + 0x0 + 0x400 + registers + + + + KR + KR + Key register + 0x0 + 0x20 + write-only + 0x00000000 + + + KEY + Key value (write only, read 0x0000) + These bits must be written by software at regular + intervals with the key value 0xAAAA, otherwise the + watchdog generates a reset when the counter reaches + 0. Writing the key value 0x5555 to enable access to + the IWDG_PR, IWDG_RLR and IWDG_WINR registers (see + Section23.3.6: Register access protection) Writing + the key value CCCCh starts the watchdog (except if + the hardware watchdog option is + selected) + 0 + 16 + + + + + PR + PR + Prescaler register + 0x4 + 0x20 + read-write + 0x00000000 + + + PR + Prescaler divider These bits are write + access protected see Section23.3.6: Register access + protection. They are written by software to select + the prescaler divider feeding the counter clock. PVU + bit of IWDG_SR must be reset in order to be able to + change the prescaler divider. Note: Reading this + register returns the prescaler value from the VDD + voltage domain. This value may not be up to + date/valid if a write operation to this register is + ongoing. For this reason the value read from this + register is valid only when the PVU bit in the + IWDG_SR register is reset. + 0 + 3 + + + + + RLR + RLR + Reload register + 0x8 + 0x20 + read-write + 0x00000FFF + + + RL + Watchdog counter reload value These bits + are write access protected see Section23.3.6. They + are written by software to define the value to be + loaded in the watchdog counter each time the value + 0xAAAA is written in the IWDG_KR register. The + watchdog counter counts down from this value. The + timeout period is a function of this value and the + clock prescaler. Refer to the datasheet for the + timeout information. The RVU bit in the IWDG_SR + register must be reset in order to be able to change + the reload value. Note: Reading this register returns + the reload value from the VDD voltage domain. This + value may not be up to date/valid if a write + operation to this register is ongoing on this + register. For this reason the value read from this + register is valid only when the RVU bit in the + IWDG_SR register is reset. + 0 + 12 + + + + + SR + SR + Status register + 0xC + 0x20 + read-only + 0x00000000 + + + PVU + Watchdog prescaler value update This bit + is set by hardware to indicate that an update of the + prescaler value is ongoing. It is reset by hardware + when the prescaler update operation is completed in + the VDD voltage domain (takes up to 5 RC 40 kHz + cycles). Prescaler value can be updated only when PVU + bit is reset. + 0 + 1 + + + RVU + Watchdog counter reload value update + This bit is set by hardware to indicate that an + update of the reload value is ongoing. It is reset by + hardware when the reload value update operation is + completed in the VDD voltage domain (takes up to 5 RC + 40 kHz cycles). Reload value can be updated only when + RVU bit is reset. + 1 + 1 + + + WVU + Watchdog counter window value update + This bit is set by hardware to indicate that an + update of the window value is ongoing. It is reset by + hardware when the reload value update operation is + completed in the VDD voltage domain (takes up to 5 RC + 40 kHz cycles). Window value can be updated only when + WVU bit is reset. This bit is generated only if + generic window = 1 + 2 + 1 + + + + + WINR + WINR + Window register + 0x10 + 0x20 + read-write + 0x00000FFF + + + WIN + Watchdog counter window value These bits + are write access protected see Section23.3.6. These + bits contain the high limit of the window value to be + compared to the downcounter. To prevent a reset, the + downcounter must be reloaded when its value is lower + than the window register value and greater than 0x0 + The WVU bit in the IWDG_SR register must be reset in + order to be able to change the reload value. Note: + Reading this register returns the reload value from + the VDD voltage domain. This value may not be valid + if a write operation to this register is ongoing. For + this reason the value read from this register is + valid only when the WVU bit in the IWDG_SR register + is reset. + 0 + 12 + + + + + + + WWDG + WWDG + WWDG + 0x50003000 + + 0x0 + 0x400 + registers + + + WWDG1 + Window Watchdog interrupt + 0 + + + WWDG1_RST + Window Watchdog interrupt + 143 + + + + CR + CR + Control register + 0x0 + 0x20 + read-write + 0x0000007F + + + T + 7-bit counter (MSB to LSB) These bits + contain the value of the watchdog counter. It is + decremented every (4096 x 2WDGTB[1:0]) PCLK cycles. A + reset is produced when it is decremented from 0x40 to + 0x3F (T6 becomes cleared). + 0 + 7 + + + WDGA + Activation bit This bit is set by + software and only cleared by hardware after a reset. + When WDGA=1, the watchdog can generate a + reset. + 7 + 1 + + + + + CFR + CFR + Configuration register + 0x4 + 0x20 + read-write + 0x0000007F + + + W + 7-bit window value These bits contain + the window value to be compared to the + downcounter. + 0 + 7 + + + WDGTB + Timer base The time base of the + prescaler can be modified as follows: + 11 + 2 + + + EWI + Early wakeup interrupt When set, an + interrupt occurs whenever the counter reaches the + value 0x40. This interrupt is only cleared by + hardware after a reset. + 9 + 1 + + + + + SR + SR + Status register + 0x8 + 0x20 + read-write + 0x00000000 + + + EWIF + Early wakeup interrupt flag This bit is + set by hardware when the counter has reached the + value 0x40. It must be cleared by software by writing + 0. A write of 1 has no effect. This bit is also set + if the interrupt is not enabled. + 0 + 1 + + + + + + + PWR + PWR + PWR + 0x58024800 + + 0x0 + 0x400 + registers + + + + CR1 + CR1 + PWR control register 1 + 0x0 + 0x20 + read-write + 0xF000C000 + + + LPDS + Low-power Deepsleep with SVOS3 (SVOS4 + and SVOS5 always use low-power, regardless of the + setting of this bit) + 0 + 1 + + + PVDE + Programmable voltage detector + enable + 4 + 1 + + + PLS + Programmable voltage detector level + selection These bits select the voltage threshold + detected by the PVD. Note: Refer to Section + Electrical characteristics of the product datasheet + for more details. + 5 + 3 + + + DBP + Disable backup domain write protection + In reset state, the RCC_BDCR register, the RTC + registers (including the backup registers), BREN and + MOEN bits in PWR_CR2 register, are protected against + parasitic write access. This bit must be set to + enable write access to these registers. + 8 + 1 + + + FLPS + Flash low-power mode in DStop mode This + bit allows to obtain the best trade-off between + low-power consumption and restart time when exiting + from DStop mode. When it is set, the Flash memory + enters low-power mode when D1 domain is in DStop + mode. + 9 + 1 + + + SVOS + System Stop mode voltage scaling + selection These bits control the VCORE voltage level + in system Stop mode, to obtain the best trade-off + between power consumption and + performance. + 14 + 2 + + + AVDEN + Peripheral voltage monitor on VDDA + enable + 16 + 1 + + + ALS + Analog voltage detector level selection + These bits select the voltage threshold detected by + the AVD. + 17 + 2 + + + + + CSR1 + CSR1 + PWR control status register 1 + 0x4 + 0x20 + read-only + 0x00004000 + + + PVDO + Programmable voltage detect output This + bit is set and cleared by hardware. It is valid only + if the PVD has been enabled by the PVDE bit. Note: + since the PVD is disabled in Standby mode, this bit + is equal to 0 after Standby or reset until the PVDE + bit is set. + 4 + 1 + + + ACTVOSRDY + Voltage levels ready bit for currently + used VOS and SDLEVEL This bit is set to 1 by hardware + when the voltage regulator and the SD converter are + both disabled and Bypass mode is selected in PWR + control register 3 (PWR_CR3). + 13 + 1 + + + ACTVOS + VOS currently applied for VCORE voltage + scaling selection. These bits reflect the last VOS + value applied to the PMU. + 14 + 2 + + + AVDO + Analog voltage detector output on VDDA + This bit is set and cleared by hardware. It is valid + only if AVD on VDDA is enabled by the AVDEN bit. + Note: Since the AVD is disabled in Standby mode, this + bit is equal to 0 after Standby or reset until the + AVDEN bit is set. + 16 + 1 + + + + + CR2 + CR2 + This register is not reset by wakeup from + Standby mode, RESET signal and VDD POR. It is only reset + by VSW POR and VSWRST reset. This register shall not be + accessed when VSWRST bit in RCC_BDCR register resets the + VSW domain.After reset, PWR_CR2 register is + write-protected. Prior to modifying its content, the DBP + bit in PWR_CR1 register must be set to disable the write + protection. + 0x8 + 0x20 + 0x00000000 + + + BREN + Backup regulator enable When set, the + Backup regulator (used to maintain the backup RAM + content in Standby and VBAT modes) is enabled. If + BREN is reset, the backup regulator is switched off. + The backup RAM can still be used in Run and Stop + modes. However, its content will be lost in Standby + and VBAT modes. If BREN is set, the application must + wait till the Backup Regulator Ready flag (BRRDY) is + set to indicate that the data written into the SRAM + will be maintained in Standby and VBAT + modes. + 0 + 1 + read-write + + + MONEN + VBAT and temperature monitoring enable + When set, the VBAT supply and temperature monitoring + is enabled. + 4 + 1 + read-write + + + BRRDY + Backup regulator ready This bit is set + by hardware to indicate that the Backup regulator is + ready. + 16 + 1 + read-only + + + VBATL + VBAT level monitoring versus low + threshold + 20 + 1 + read-only + + + VBATH + VBAT level monitoring versus high + threshold + 21 + 1 + read-only + + + TEMPL + Temperature level monitoring versus low + threshold + 22 + 1 + read-only + + + TEMPH + Temperature level monitoring versus high + threshold + 23 + 1 + read-only + + + + + CR3 + CR3 + Reset only by POR only, not reset by wakeup + from Standby mode and RESET pad. The lower byte of this + register is written once after POR and shall be written + before changing VOS level or ck_sys clock frequency. No + limitation applies to the upper bytes.Programming data + corresponding to an invalid combination of SDLEVEL, + SDEXTHP, SDEN, LDOEN and BYPASS bits (see Table9) will be + ignored: data will not be written, the written-once + mechanism will lock the register and any further write + access will be ignored. The default supply configuration + will be kept and the ACTVOSRDY bit in PWR control status + register 1 (PWR_CSR1) will go on indicating invalid + voltage levels. The system shall be power cycled before + writing a new value. + 0xC + 0x20 + 0x00000006 + + + BYPASS + Power management unit + bypass + 0 + 1 + read-write + + + LDOEN + Low drop-out regulator + enable + 1 + 1 + read-write + + + SCUEN + SD converter Enable + 2 + 1 + read-write + + + VBE + VBAT charging enable + 8 + 1 + read-write + + + VBRS + VBAT charging resistor + selection + 9 + 1 + read-write + + + USB33DEN + VDD33USB voltage level detector + enable. + 24 + 1 + read-write + + + USBREGEN + USB regulator enable. + 25 + 1 + read-write + + + USB33RDY + USB supply ready. + 26 + 1 + read-only + + + + + CPUCR + CPUCR + This register allows controlling CPU1 + power. + 0x10 + 0x20 + 0x00000000 + + + PDDS_D1 + D1 domain Power Down Deepsleep + selection. This bit allows CPU1 to define the + Deepsleep mode for D1 domain. + 0 + 1 + read-write + + + PDDS_D2 + D2 domain Power Down Deepsleep. This bit + allows CPU1 to define the Deepsleep mode for D2 + domain. + 1 + 1 + read-write + + + PDDS_D3 + System D3 domain Power Down Deepsleep. + This bit allows CPU1 to define the Deepsleep mode for + System D3 domain. + 2 + 1 + read-write + + + STOPF + STOP flag This bit is set by hardware + and cleared only by any reset or by setting the CPU1 + CSSF bit. + 5 + 1 + read-only + + + SBF + System Standby flag This bit is set by + hardware and cleared only by a POR (Power-on Reset) + or by setting the CPU1 CSSF bit + 6 + 1 + read-only + + + SBF_D1 + D1 domain DStandby flag This bit is set + by hardware and cleared by any system reset or by + setting the CPU1 CSSF bit. Once set, this bit can be + cleared only when the D1 domain is no longer in + DStandby mode. + 7 + 1 + read-only + + + SBF_D2 + D2 domain DStandby flag This bit is set + by hardware and cleared by any system reset or by + setting the CPU1 CSSF bit. Once set, this bit can be + cleared only when the D2 domain is no longer in + DStandby mode. + 8 + 1 + read-only + + + CSSF + Clear D1 domain CPU1 Standby, Stop and + HOLD flags (always read as 0) This bit is cleared to + 0 by hardware. + 9 + 1 + read-write + + + RUN_D3 + Keep system D3 domain in Run mode + regardless of the CPU sub-systems modes + 11 + 1 + read-write + + + + + D3CR + D3CR + This register allows controlling D3 domain + power.Following reset VOSRDY will be read 1 by + software + 0x18 + 0x20 + 0x00004000 + + + VOSRDY + VOS Ready bit for VCORE voltage scaling + output selection. This bit is set to 1 by hardware + when Bypass mode is selected in PWR control register + 3 (PWR_CR3). + 13 + 1 + read-only + + + VOS + Voltage scaling selection according to + performance These bits control the VCORE voltage + level and allow to obtains the best trade-off between + power consumption and performance: When increasing + the performance, the voltage scaling shall be changed + before increasing the system frequency. When + decreasing performance, the system frequency shall + first be decreased before changing the voltage + scaling. + 14 + 2 + read-write + + + + + WKUPCR + WKUPCR + reset only by system reset, not reset by + wakeup from Standby mode5 wait states are required when + writing this register (when clearing a WKUPF bit in + PWR_WKUPFR, the AHB write access will complete after the + WKUPF has been cleared). + 0x20 + 0x20 + read-write + 0x00000000 + + + WKUPC + Clear Wakeup pin flag for WKUP. These + bits are always read as 0. + 0 + 6 + + + + + WKUPFR + WKUPFR + reset only by system reset, not reset by + wakeup from Standby mode + 0x24 + 0x20 + read-write + 0x00000000 + + + WKUPF1 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 0 + 1 + + + WKUPF2 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 1 + 1 + + + WKUPF3 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 2 + 1 + + + WKUPF4 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 3 + 1 + + + WKUPF5 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 4 + 1 + + + WKUPF6 + Wakeup pin WKUPF flag. This bit is set + by hardware and cleared only by a Reset pin or by + setting the WKUPCn+1 bit in the PWR wakeup clear + register (PWR_WKUPCR). + 5 + 1 + + + + + WKUPEPR + WKUPEPR + Reset only by system reset, not reset by + wakeup from Standby mode + 0x28 + 0x20 + read-write + 0x00000000 + + + WKUPEN1 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 0 + 1 + + + WKUPEN2 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 1 + 1 + + + WKUPEN3 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 2 + 1 + + + WKUPEN4 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 3 + 1 + + + WKUPEN5 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 4 + 1 + + + WKUPEN6 + Enable Wakeup Pin WKUPn+1 Each bit is + set and cleared by software. Note: An additional + wakeup event is detected if WKUPn+1 pin is enabled + (by setting the WKUPENn+1 bit) when WKUPn+1 pin level + is already high when WKUPPn+1 selects rising edge, or + low when WKUPPn+1 selects falling edge. + 5 + 1 + + + WKUPP1 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 8 + 1 + + + WKUPP2 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 9 + 1 + + + WKUPP3 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 10 + 1 + + + WKUPP4 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 11 + 1 + + + WKUPP5 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 12 + 1 + + + WKUPP6 + Wakeup pin polarity bit for WKUPn-7 + These bits define the polarity used for event + detection on WKUPn-7 external wakeup + pin. + 13 + 1 + + + WKUPPUPD1 + Wakeup pin pull + configuration + 16 + 2 + + + WKUPPUPD2 + Wakeup pin pull + configuration + 18 + 2 + + + WKUPPUPD3 + Wakeup pin pull + configuration + 20 + 2 + + + WKUPPUPD4 + Wakeup pin pull + configuration + 22 + 2 + + + WKUPPUPD5 + Wakeup pin pull + configuration + 24 + 2 + + + WKUPPUPD6 + Wakeup pin pull configuration for + WKUP(truncate(n/2)-7) These bits define the I/O pad + pull configuration used when WKUPEN(truncate(n/2)-7) + = 1. The associated GPIO port pull configuration + shall be set to the same value or to 00. The Wakeup + pin pull configuration is kept in Standby + mode. + 26 + 2 + + + + + + + SPI1 + Serial peripheral interface + SPI + 0x40013000 + + 0x0 + 0x400 + registers + + + SPI1 + SPI1 global interrupt + 35 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + 0x00000000 + + + IOLOCK + Locking the AF configuration of + associated IOs + 16 + 1 + read-only + + + TCRCI + CRC calculation initialization pattern + control for transmitter + 15 + 1 + read-write + + + RCRCI + CRC calculation initialization pattern + control for receiver + 14 + 1 + read-write + + + CRC33_17 + 32-bit CRC polynomial + configuration + 13 + 1 + read-write + + + SSI + Internal SS signal input + level + 12 + 1 + read-write + + + HDDIR + Rx/Tx direction at Half-duplex + mode + 11 + 1 + read-write + + + CSUSP + Master SUSPend request + 10 + 1 + write-only + + + CSTART + Master transfer start + 9 + 1 + read-only + + + MASRX + Master automatic SUSP in Receive + mode + 8 + 1 + read-write + + + SPE + Serial Peripheral Enable + 0 + 1 + read-write + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + 0x00000000 + + + TSER + Number of data transfer extension to be + reload into TSIZE just when a previous + 16 + 16 + read-only + + + TSIZE + Number of data at current + transfer + 0 + 16 + read-write + + + + + CFG1 + CFG1 + configuration register 1 + 0x8 + 0x20 + read-write + 0x00070007 + + + MBR + Master baud rate + 28 + 3 + + + CRCEN + Hardware CRC computation + enable + 22 + 1 + + + CRCSIZE + Length of CRC frame to be transacted and + compared + 16 + 5 + + + TXDMAEN + Tx DMA stream enable + 15 + 1 + + + RXDMAEN + Rx DMA stream enable + 14 + 1 + + + UDRDET + Detection of underrun condition at slave + transmitter + 11 + 2 + + + UDRCFG + Behavior of slave transmitter at + underrun condition + 9 + 2 + + + FTHVL + threshold level + 5 + 4 + + + DSIZE + Number of bits in at single SPI data + frame + 0 + 5 + + + + + CFG2 + CFG2 + configuration register 2 + 0xC + 0x20 + read-write + 0x00000000 + + + AFCNTR + Alternate function GPIOs + control + 31 + 1 + + + SSOM + SS output management in master + mode + 30 + 1 + + + SSOE + SS output enable + 29 + 1 + + + SSIOP + SS input/output polarity + 28 + 1 + + + SSM + Software management of SS signal + input + 26 + 1 + + + CPOL + Clock polarity + 25 + 1 + + + CPHA + Clock phase + 24 + 1 + + + LSBFRST + Data frame format + 23 + 1 + + + MASTER + SPI Master + 22 + 1 + + + SP + Serial Protocol + 19 + 3 + + + COMM + SPI Communication Mode + 17 + 2 + + + IOSWP + Swap functionality of MISO and MOSI + pins + 15 + 1 + + + MIDI + Master Inter-Data Idleness + 4 + 4 + + + MSSI + Master SS Idleness + 0 + 4 + + + + + IER + IER + Interrupt Enable Register + 0x10 + 0x20 + 0x00000000 + + + TSERFIE + Additional number of transactions reload + interrupt enable + 10 + 1 + read-write + + + MODFIE + Mode Fault interrupt + enable + 9 + 1 + read-write + + + TIFREIE + TIFRE interrupt enable + 8 + 1 + read-write + + + CRCEIE + CRC Interrupt enable + 7 + 1 + read-write + + + OVRIE + OVR interrupt enable + 6 + 1 + read-write + + + UDRIE + UDR interrupt enable + 5 + 1 + read-write + + + TXTFIE + TXTFIE interrupt enable + 4 + 1 + read-write + + + EOTIE + EOT, SUSP and TXC interrupt + enable + 3 + 1 + read-write + + + DPXPIE + DXP interrupt enabled + 2 + 1 + read-only + + + TXPIE + TXP interrupt enable + 1 + 1 + read-only + + + RXPIE + RXP Interrupt Enable + 0 + 1 + read-write + + + + + SR + SR + Status Register + 0x14 + 0x20 + read-only + 0x00001002 + + + CTSIZE + Number of data frames remaining in + current TSIZE session + 16 + 16 + + + RXWNE + RxFIFO Word Not Empty + 15 + 1 + + + RXPLVL + RxFIFO Packing LeVeL + 13 + 2 + + + TXC + TxFIFO transmission + complete + 12 + 1 + + + SUSP + SUSPend + 11 + 1 + + + TSERF + Additional number of SPI data to be + transacted was reload + 10 + 1 + + + MODF + Mode Fault + 9 + 1 + + + TIFRE + TI frame format error + 8 + 1 + + + CRCE + CRC Error + 7 + 1 + + + OVR + Overrun + 6 + 1 + + + UDR + Underrun at slave transmission + mode + 5 + 1 + + + TXTF + Transmission Transfer + Filled + 4 + 1 + + + EOT + End Of Transfer + 3 + 1 + + + DXP + Duplex Packet + 2 + 1 + + + TXP + Tx-Packet space available + 1 + 1 + + + RXP + Rx-Packet available + 0 + 1 + + + + + IFCR + IFCR + Interrupt/Status Flags Clear + Register + 0x18 + 0x20 + write-only + 0x00000000 + + + SUSPC + SUSPend flag clear + 11 + 1 + + + TSERFC + TSERFC flag clear + 10 + 1 + + + MODFC + Mode Fault flag clear + 9 + 1 + + + TIFREC + TI frame format error flag + clear + 8 + 1 + + + CRCEC + CRC Error flag clear + 7 + 1 + + + OVRC + Overrun flag clear + 6 + 1 + + + UDRC + Underrun flag clear + 5 + 1 + + + TXTFC + Transmission Transfer Filled flag + clear + 4 + 1 + + + EOTC + End Of Transfer flag clear + 3 + 1 + + + + + TXDR + TXDR + Transmit Data Register + 0x20 + 0x20 + write-only + 0x00000000 + + + TXDR + Transmit data register + 0 + 32 + + + + + RXDR + RXDR + Receive Data Register + 0x30 + 0x20 + read-only + 0x00000000 + + + RXDR + Receive data register + 0 + 32 + + + + + CRCPOLY + CRCPOLY + Polynomial Register + 0x40 + 0x20 + read-write + 0x00000107 + + + CRCPOLY + CRC polynomial register + 0 + 32 + + + + + TXCRC + TXCRC + Transmitter CRC Register + 0x44 + 0x20 + read-write + 0x00000000 + + + TXCRC + CRC register for + transmitter + 0 + 32 + + + + + RXCRC + RXCRC + Receiver CRC Register + 0x48 + 0x20 + read-write + 0x00000000 + + + RXCRC + CRC register for receiver + 0 + 32 + + + + + UDRDR + UDRDR + Underrun Data Register + 0x4C + 0x20 + read-write + 0x00000000 + + + UDRDR + Data at slave underrun + condition + 0 + 32 + + + + + CGFR + CGFR + configuration register + 0x50 + 0x20 + read-write + 0x00000000 + + + MCKOE + Master clock output enable + 25 + 1 + + + ODD + Odd factor for the + prescaler + 24 + 1 + + + I2SDIV + I2S linear prescaler + 16 + 8 + + + DATFMT + Data format + 14 + 1 + + + WSINV + Fixed channel length in + SLAVE + 13 + 1 + + + FIXCH + Word select inversion + 12 + 1 + + + CKPOL + Serial audio clock + polarity + 11 + 1 + + + CHLEN + Channel length (number of bits per audio + channel) + 10 + 1 + + + DATLEN + Data length to be + transferred + 8 + 2 + + + PCMSYNC + PCM frame synchronization + 7 + 1 + + + I2SSTD + I2S standard selection + 4 + 2 + + + I2SCFG + I2S configuration mode + 1 + 3 + + + I2SMOD + I2S mode selection + 0 + 1 + + + + + + + SPI2 + 0x40003800 + + SPI2 + SPI2 global interrupt + 36 + + + + SPI3 + 0x40003C00 + + SPI3 + SPI3 global interrupt + 51 + + + + SPI4 + 0x40013400 + + SPI4 + SPI4 global interrupt + 84 + + + + SPI5 + 0x40015000 + + SPI5 + SPI5 global interrupt + 85 + + + + SPI6 + 0x58001400 + + SPI6 + SPI6 global interrupt + 86 + + + + LTDC + LCD-TFT Controller + LTDC + 0x50001000 + + 0x0 + 0x1000 + registers + + + LTDC + LCD-TFT global interrupt + 88 + + + LTDC_ER + LCD-TFT error interrupt + 89 + + + + SSCR + SSCR + Synchronization Size Configuration + Register + 0x8 + 0x20 + read-write + 0x00000000 + + + HSW + Horizontal Synchronization Width (in + units of pixel clock period) + 16 + 10 + + + VSH + Vertical Synchronization Height (in + units of horizontal scan line) + 0 + 11 + + + + + BPCR + BPCR + Back Porch Configuration + Register + 0xC + 0x20 + read-write + 0x00000000 + + + AHBP + Accumulated Horizontal back porch (in + units of pixel clock period) + 16 + 12 + + + AVBP + Accumulated Vertical back porch (in + units of horizontal scan line) + 0 + 11 + + + + + AWCR + AWCR + Active Width Configuration + Register + 0x10 + 0x20 + read-write + 0x00000000 + + + AAV + AAV + 16 + 12 + + + AAH + Accumulated Active Height (in units of + horizontal scan line) + 0 + 11 + + + + + TWCR + TWCR + Total Width Configuration + Register + 0x14 + 0x20 + read-write + 0x00000000 + + + TOTALW + Total Width (in units of pixel clock + period) + 16 + 12 + + + TOTALH + Total Height (in units of horizontal + scan line) + 0 + 11 + + + + + GCR + GCR + Global Control Register + 0x18 + 0x20 + 0x00002220 + + + HSPOL + Horizontal Synchronization + Polarity + 31 + 1 + read-write + + + VSPOL + Vertical Synchronization + Polarity + 30 + 1 + read-write + + + DEPOL + Data Enable Polarity + 29 + 1 + read-write + + + PCPOL + Pixel Clock Polarity + 28 + 1 + read-write + + + DEN + Dither Enable + 16 + 1 + read-write + + + DRW + Dither Red Width + 12 + 3 + read-only + + + DGW + Dither Green Width + 8 + 3 + read-only + + + DBW + Dither Blue Width + 4 + 3 + read-only + + + LTDCEN + LCD-TFT controller enable + bit + 0 + 1 + read-write + + + + + SRCR + SRCR + Shadow Reload Configuration + Register + 0x24 + 0x20 + read-write + 0x00000000 + + + VBR + Vertical Blanking Reload + 1 + 1 + + + IMR + Immediate Reload + 0 + 1 + + + + + BCCR + BCCR + Background Color Configuration + Register + 0x2C + 0x20 + read-write + 0x00000000 + + + BCBLUE + Background Color Blue + value + 0 + 8 + + + BCGREEN + Background Color Green + value + 8 + 8 + + + BCRED + Background Color Red value + 16 + 8 + + + + + IER + IER + Interrupt Enable Register + 0x34 + 0x20 + read-write + 0x00000000 + + + RRIE + Register Reload interrupt + enable + 3 + 1 + + + TERRIE + Transfer Error Interrupt + Enable + 2 + 1 + + + FUIE + FIFO Underrun Interrupt + Enable + 1 + 1 + + + LIE + Line Interrupt Enable + 0 + 1 + + + + + ISR + ISR + Interrupt Status Register + 0x38 + 0x20 + read-only + 0x00000000 + + + RRIF + Register Reload Interrupt + Flag + 3 + 1 + + + TERRIF + Transfer Error interrupt + flag + 2 + 1 + + + FUIF + FIFO Underrun Interrupt + flag + 1 + 1 + + + LIF + Line Interrupt flag + 0 + 1 + + + + + ICR + ICR + Interrupt Clear Register + 0x3C + 0x20 + write-only + 0x00000000 + + + CRRIF + Clears Register Reload Interrupt + Flag + 3 + 1 + + + CTERRIF + Clears the Transfer Error Interrupt + Flag + 2 + 1 + + + CFUIF + Clears the FIFO Underrun Interrupt + flag + 1 + 1 + + + CLIF + Clears the Line Interrupt + Flag + 0 + 1 + + + + + LIPCR + LIPCR + Line Interrupt Position Configuration + Register + 0x40 + 0x20 + read-write + 0x00000000 + + + LIPOS + Line Interrupt Position + 0 + 11 + + + + + CPSR + CPSR + Current Position Status + Register + 0x44 + 0x20 + read-only + 0x00000000 + + + CXPOS + Current X Position + 16 + 16 + + + CYPOS + Current Y Position + 0 + 16 + + + + + CDSR + CDSR + Current Display Status + Register + 0x48 + 0x20 + read-only + 0x0000000F + + + HSYNCS + Horizontal Synchronization display + Status + 3 + 1 + + + VSYNCS + Vertical Synchronization display + Status + 2 + 1 + + + HDES + Horizontal Data Enable display + Status + 1 + 1 + + + VDES + Vertical Data Enable display + Status + 0 + 1 + + + + + L1CR + L1CR + Layerx Control Register + 0x84 + 0x20 + read-write + 0x00000000 + + + CLUTEN + Color Look-Up Table Enable + 4 + 1 + + + COLKEN + Color Keying Enable + 1 + 1 + + + LEN + Layer Enable + 0 + 1 + + + + + L1WHPCR + L1WHPCR + Layerx Window Horizontal Position + Configuration Register + 0x88 + 0x20 + read-write + 0x00000000 + + + WHSPPOS + Window Horizontal Stop + Position + 16 + 12 + + + WHSTPOS + Window Horizontal Start + Position + 0 + 12 + + + + + L1WVPCR + L1WVPCR + Layerx Window Vertical Position + Configuration Register + 0x8C + 0x20 + read-write + 0x00000000 + + + WVSPPOS + Window Vertical Stop + Position + 16 + 11 + + + WVSTPOS + Window Vertical Start + Position + 0 + 11 + + + + + L1CKCR + L1CKCR + Layerx Color Keying Configuration + Register + 0x90 + 0x20 + read-write + 0x00000000 + + + CKRED + Color Key Red value + 16 + 8 + + + CKGREEN + Color Key Green value + 8 + 8 + + + CKBLUE + Color Key Blue value + 0 + 8 + + + + + L1PFCR + L1PFCR + Layerx Pixel Format Configuration + Register + 0x94 + 0x20 + read-write + 0x00000000 + + + PF + Pixel Format + 0 + 3 + + + + + L1CACR + L1CACR + Layerx Constant Alpha Configuration + Register + 0x98 + 0x20 + read-write + 0x00000000 + + + CONSTA + Constant Alpha + 0 + 8 + + + + + L1DCCR + L1DCCR + Layerx Default Color Configuration + Register + 0x9C + 0x20 + read-write + 0x00000000 + + + DCALPHA + Default Color Alpha + 24 + 8 + + + DCRED + Default Color Red + 16 + 8 + + + DCGREEN + Default Color Green + 8 + 8 + + + DCBLUE + Default Color Blue + 0 + 8 + + + + + L1BFCR + L1BFCR + Layerx Blending Factors Configuration + Register + 0xA0 + 0x20 + read-write + 0x00000607 + + + BF1 + Blending Factor 1 + 8 + 3 + + + BF2 + Blending Factor 2 + 0 + 3 + + + + + L1CFBAR + L1CFBAR + Layerx Color Frame Buffer Address + Register + 0xAC + 0x20 + read-write + 0x00000000 + + + CFBADD + Color Frame Buffer Start + Address + 0 + 32 + + + + + L1CFBLR + L1CFBLR + Layerx Color Frame Buffer Length + Register + 0xB0 + 0x20 + read-write + 0x00000000 + + + CFBP + Color Frame Buffer Pitch in + bytes + 16 + 13 + + + CFBLL + Color Frame Buffer Line + Length + 0 + 13 + + + + + L1CFBLNR + L1CFBLNR + Layerx ColorFrame Buffer Line Number + Register + 0xB4 + 0x20 + read-write + 0x00000000 + + + CFBLNBR + Frame Buffer Line Number + 0 + 11 + + + + + L1CLUTWR + L1CLUTWR + Layerx CLUT Write Register + 0xC4 + 0x20 + write-only + 0x00000000 + + + CLUTADD + CLUT Address + 24 + 8 + + + RED + Red value + 16 + 8 + + + GREEN + Green value + 8 + 8 + + + BLUE + Blue value + 0 + 8 + + + + + L2CR + L2CR + Layerx Control Register + 0x104 + 0x20 + read-write + 0x00000000 + + + CLUTEN + Color Look-Up Table Enable + 4 + 1 + + + COLKEN + Color Keying Enable + 1 + 1 + + + LEN + Layer Enable + 0 + 1 + + + + + L2WHPCR + L2WHPCR + Layerx Window Horizontal Position + Configuration Register + 0x108 + 0x20 + read-write + 0x00000000 + + + WHSPPOS + Window Horizontal Stop + Position + 16 + 12 + + + WHSTPOS + Window Horizontal Start + Position + 0 + 12 + + + + + L2WVPCR + L2WVPCR + Layerx Window Vertical Position + Configuration Register + 0x10C + 0x20 + read-write + 0x00000000 + + + WVSPPOS + Window Vertical Stop + Position + 16 + 11 + + + WVSTPOS + Window Vertical Start + Position + 0 + 11 + + + + + L2CKCR + L2CKCR + Layerx Color Keying Configuration + Register + 0x110 + 0x20 + read-write + 0x00000000 + + + CKRED + Color Key Red value + 16 + 8 + + + CKGREEN + Color Key Green value + 8 + 8 + + + CKBLUE + Color Key Blue value + 0 + 8 + + + + + L2PFCR + L2PFCR + Layerx Pixel Format Configuration + Register + 0x114 + 0x20 + read-write + 0x00000000 + + + PF + Pixel Format + 0 + 3 + + + + + L2CACR + L2CACR + Layerx Constant Alpha Configuration + Register + 0x118 + 0x20 + read-write + 0x00000000 + + + CONSTA + Constant Alpha + 0 + 8 + + + + + L2DCCR + L2DCCR + Layerx Default Color Configuration + Register + 0x11C + 0x20 + read-write + 0x00000000 + + + DCALPHA + Default Color Alpha + 24 + 8 + + + DCRED + Default Color Red + 16 + 8 + + + DCGREEN + Default Color Green + 8 + 8 + + + DCBLUE + Default Color Blue + 0 + 8 + + + + + L2BFCR + L2BFCR + Layerx Blending Factors Configuration + Register + 0x120 + 0x20 + read-write + 0x00000607 + + + BF1 + Blending Factor 1 + 8 + 3 + + + BF2 + Blending Factor 2 + 0 + 3 + + + + + L2CFBAR + L2CFBAR + Layerx Color Frame Buffer Address + Register + 0x12C + 0x20 + read-write + 0x00000000 + + + CFBADD + Color Frame Buffer Start + Address + 0 + 32 + + + + + L2CFBLR + L2CFBLR + Layerx Color Frame Buffer Length + Register + 0x130 + 0x20 + read-write + 0x00000000 + + + CFBP + Color Frame Buffer Pitch in + bytes + 16 + 13 + + + CFBLL + Color Frame Buffer Line + Length + 0 + 13 + + + + + L2CFBLNR + L2CFBLNR + Layerx ColorFrame Buffer Line Number + Register + 0x134 + 0x20 + read-write + 0x00000000 + + + CFBLNBR + Frame Buffer Line Number + 0 + 11 + + + + + L2CLUTWR + L2CLUTWR + Layerx CLUT Write Register + 0x144 + 0x20 + write-only + 0x00000000 + + + CLUTADD + CLUT Address + 24 + 8 + + + RED + Red value + 16 + 8 + + + GREEN + Green value + 8 + 8 + + + BLUE + Blue value + 0 + 8 + + + + + + + SPDIFRX + Receiver Interface + SPDIFRX + 0x40004000 + + 0x0 + 0x400 + registers + + + SPDIF + SPDIFRX global interrupt + 97 + + + + CR + CR + Control register + 0x0 + 0x20 + read-write + 0x00000000 + + + SPDIFRXEN + Peripheral Block Enable + 0 + 2 + + + RXDMAEN + Receiver DMA ENable for data + flow + 2 + 1 + + + RXSTEO + STerEO Mode + 3 + 1 + + + DRFMT + RX Data format + 4 + 2 + + + PMSK + Mask Parity error bit + 6 + 1 + + + VMSK + Mask of Validity bit + 7 + 1 + + + CUMSK + Mask of channel status and user + bits + 8 + 1 + + + PTMSK + Mask of Preamble Type bits + 9 + 1 + + + CBDMAEN + Control Buffer DMA ENable for control + flow + 10 + 1 + + + CHSEL + Channel Selection + 11 + 1 + + + NBTR + Maximum allowed re-tries during + synchronization phase + 12 + 2 + + + WFA + Wait For Activity + 14 + 1 + + + INSEL + input selection + 16 + 3 + + + CKSEN + Symbol Clock Enable + 20 + 1 + + + CKSBKPEN + Backup Symbol Clock Enable + 21 + 1 + + + + + IMR + IMR + Interrupt mask register + 0x4 + 0x20 + read-write + 0x00000000 + + + RXNEIE + RXNE interrupt enable + 0 + 1 + + + CSRNEIE + Control Buffer Ready Interrupt + Enable + 1 + 1 + + + PERRIE + Parity error interrupt + enable + 2 + 1 + + + OVRIE + Overrun error Interrupt + Enable + 3 + 1 + + + SBLKIE + Synchronization Block Detected Interrupt + Enable + 4 + 1 + + + SYNCDIE + Synchronization Done + 5 + 1 + + + IFEIE + Serial Interface Error Interrupt + Enable + 6 + 1 + + + + + SR + SR + Status register + 0x8 + 0x20 + read-only + 0x00000000 + + + RXNE + Read data register not + empty + 0 + 1 + + + CSRNE + Control Buffer register is not + empty + 1 + 1 + + + PERR + Parity error + 2 + 1 + + + OVR + Overrun error + 3 + 1 + + + SBD + Synchronization Block + Detected + 4 + 1 + + + SYNCD + Synchronization Done + 5 + 1 + + + FERR + Framing error + 6 + 1 + + + SERR + Synchronization error + 7 + 1 + + + TERR + Time-out error + 8 + 1 + + + WIDTH5 + Duration of 5 symbols counted with + SPDIF_CLK + 16 + 15 + + + + + IFCR + IFCR + Interrupt Flag Clear register + 0xC + 0x20 + write-only + 0x00000000 + + + PERRCF + Clears the Parity error + flag + 2 + 1 + + + OVRCF + Clears the Overrun error + flag + 3 + 1 + + + SBDCF + Clears the Synchronization Block + Detected flag + 4 + 1 + + + SYNCDCF + Clears the Synchronization Done + flag + 5 + 1 + + + + + DR_00 + DR_00 + Data input register + 0x10 + 0x20 + read-only + 0x00000000 + + + DR + Parity Error bit + 0 + 24 + + + PE + Parity Error bit + 24 + 1 + + + V + Validity bit + 25 + 1 + + + U + User bit + 26 + 1 + + + C + Channel Status bit + 27 + 1 + + + PT + Preamble Type + 28 + 2 + + + + + CSR + CSR + Channel Status register + 0x14 + 0x20 + read-only + 0x00000000 + + + USR + User data information + 0 + 16 + + + CS + Channel A status + information + 16 + 8 + + + SOB + Start Of Block + 24 + 1 + + + + + DIR + DIR + Debug Information register + 0x18 + 0x20 + read-only + 0x00000000 + + + THI + Threshold HIGH + 0 + 13 + + + TLO + Threshold LOW + 16 + 13 + + + + + VERR + VERR + SPDIFRX version register + 0x3F4 + 0x20 + read-only + 0x00000012 + + + MINREV + Minor revision + 0 + 4 + + + MAJREV + Major revision + 4 + 4 + + + + + IDR + IDR + SPDIFRX identification + register + 0x3F8 + 0x20 + read-only + 0x00130041 + + + ID + SPDIFRX identifier + 0 + 32 + + + + + SIDR + SIDR + SPDIFRX size identification + register + 0x3FC + 0x20 + read-only + 0xA3C5DD01 + + + SID + Size identification + 0 + 32 + + + + + DR_01 + DR_01 + Data input register + DR_00 + 0x10 + 0x20 + read-only + 0x00000000 + + + PE + Parity Error bit + 0 + 1 + + + V + Validity bit + 1 + 1 + + + U + User bit + 2 + 1 + + + C + Channel Status bit + 3 + 1 + + + PT + Preamble Type + 4 + 2 + + + DR + Data value + 8 + 24 + + + + + DR_10 + DR_10 + Data input register + DR_00 + 0x10 + 0x20 + read-only + 0x00000000 + + + DRNL1 + Data value + 0 + 16 + + + DRNL2 + Data value + 16 + 16 + + + + + + + ADC3 + Analog to Digital Converter + ADC + 0x58026000 + + 0x0 + 0xD1 + registers + + + ADC3 + ADC3 global interrupt + 127 + + + + ISR + ISR + ADC interrupt and status + register + 0x0 + 0x20 + read-write + 0x00000000 + + + JQOVF + ADC group injected contexts queue + overflow flag + 10 + 1 + + + AWD3 + ADC analog watchdog 3 flag + 9 + 1 + + + AWD2 + ADC analog watchdog 2 flag + 8 + 1 + + + AWD1 + ADC analog watchdog 1 flag + 7 + 1 + + + JEOS + ADC group injected end of sequence + conversions flag + 6 + 1 + + + JEOC + ADC group injected end of unitary + conversion flag + 5 + 1 + + + OVR + ADC group regular overrun + flag + 4 + 1 + + + EOS + ADC group regular end of sequence + conversions flag + 3 + 1 + + + EOC + ADC group regular end of unitary + conversion flag + 2 + 1 + + + EOSMP + ADC group regular end of sampling + flag + 1 + 1 + + + ADRDY + ADC ready flag + 0 + 1 + + + + + IER + IER + ADC interrupt enable register + 0x4 + 0x20 + read-write + 0x00000000 + + + JQOVFIE + ADC group injected contexts queue + overflow interrupt + 10 + 1 + + + AWD3IE + ADC analog watchdog 3 + interrupt + 9 + 1 + + + AWD2IE + ADC analog watchdog 2 + interrupt + 8 + 1 + + + AWD1IE + ADC analog watchdog 1 + interrupt + 7 + 1 + + + JEOSIE + ADC group injected end of sequence + conversions interrupt + 6 + 1 + + + JEOCIE + ADC group injected end of unitary + conversion interrupt + 5 + 1 + + + OVRIE + ADC group regular overrun + interrupt + 4 + 1 + + + EOSIE + ADC group regular end of sequence + conversions interrupt + 3 + 1 + + + EOCIE + ADC group regular end of unitary + conversion interrupt + 2 + 1 + + + EOSMPIE + ADC group regular end of sampling + interrupt + 1 + 1 + + + ADRDYIE + ADC ready interrupt + 0 + 1 + + + + + CR + CR + ADC control register + 0x8 + 0x20 + read-write + 0x00000000 + + + ADCAL + ADC calibration + 31 + 1 + + + ADCALDIF + ADC differential mode for + calibration + 30 + 1 + + + DEEPPWD + ADC deep power down enable + 29 + 1 + + + ADVREGEN + ADC voltage regulator + enable + 28 + 1 + + + LINCALRDYW6 + Linearity calibration ready Word + 6 + 27 + 1 + + + LINCALRDYW5 + Linearity calibration ready Word + 5 + 26 + 1 + + + LINCALRDYW4 + Linearity calibration ready Word + 4 + 25 + 1 + + + LINCALRDYW3 + Linearity calibration ready Word + 3 + 24 + 1 + + + LINCALRDYW2 + Linearity calibration ready Word + 2 + 23 + 1 + + + LINCALRDYW1 + Linearity calibration ready Word + 1 + 22 + 1 + + + ADCALLIN + Linearity calibration + 16 + 1 + + + BOOST + Boost mode control + 8 + 1 + + + JADSTP + ADC group injected conversion + stop + 5 + 1 + + + ADSTP + ADC group regular conversion + stop + 4 + 1 + + + JADSTART + ADC group injected conversion + start + 3 + 1 + + + ADSTART + ADC group regular conversion + start + 2 + 1 + + + ADDIS + ADC disable + 1 + 1 + + + ADEN + ADC enable + 0 + 1 + + + + + CFGR + CFGR + ADC configuration register 1 + 0xC + 0x20 + read-write + 0x00000000 + + + JQDIS + ADC group injected contexts queue + disable + 31 + 1 + + + AWDCH1CH + ADC analog watchdog 1 monitored channel + selection + 26 + 5 + + + JAUTO + ADC group injected automatic trigger + mode + 25 + 1 + + + JAWD1EN + ADC analog watchdog 1 enable on scope + ADC group injected + 24 + 1 + + + AWD1EN + ADC analog watchdog 1 enable on scope + ADC group regular + 23 + 1 + + + AWD1SGL + ADC analog watchdog 1 monitoring a + single channel or all channels + 22 + 1 + + + JQM + ADC group injected contexts queue + mode + 21 + 1 + + + JDISCEN + ADC group injected sequencer + discontinuous mode + 20 + 1 + + + DISCNUM + ADC group regular sequencer + discontinuous number of ranks + 17 + 3 + + + DISCEN + ADC group regular sequencer + discontinuous mode + 16 + 1 + + + AUTDLY + ADC low power auto wait + 14 + 1 + + + CONT + ADC group regular continuous conversion + mode + 13 + 1 + + + OVRMOD + ADC group regular overrun + configuration + 12 + 1 + + + EXTEN + ADC group regular external trigger + polarity + 10 + 2 + + + EXTSEL + ADC group regular external trigger + source + 5 + 5 + + + RES + ADC data resolution + 2 + 3 + + + DMNGT + ADC DMA transfer enable + 0 + 2 + + + + + CFGR2 + CFGR2 + ADC configuration register 2 + 0x10 + 0x20 + read-write + 0x00000000 + + + ROVSE + ADC oversampler enable on scope ADC + group regular + 0 + 1 + + + JOVSE + ADC oversampler enable on scope ADC + group injected + 1 + 1 + + + OVSS + ADC oversampling shift + 5 + 4 + + + TROVS + ADC oversampling discontinuous mode + (triggered mode) for ADC group regular + 9 + 1 + + + ROVSM + Regular Oversampling mode + 10 + 1 + + + RSHIFT1 + Right-shift data after Offset 1 + correction + 11 + 1 + + + RSHIFT2 + Right-shift data after Offset 2 + correction + 12 + 1 + + + RSHIFT3 + Right-shift data after Offset 3 + correction + 13 + 1 + + + RSHIFT4 + Right-shift data after Offset 4 + correction + 14 + 1 + + + OSR + Oversampling ratio + 16 + 10 + + + LSHIFT + Left shift factor + 28 + 4 + + + + + SMPR1 + SMPR1 + ADC sampling time register 1 + 0x14 + 0x20 + read-write + 0x00000000 + + + SMP9 + ADC channel 9 sampling time + selection + 27 + 3 + + + SMP8 + ADC channel 8 sampling time + selection + 24 + 3 + + + SMP7 + ADC channel 7 sampling time + selection + 21 + 3 + + + SMP6 + ADC channel 6 sampling time + selection + 18 + 3 + + + SMP5 + ADC channel 5 sampling time + selection + 15 + 3 + + + SMP4 + ADC channel 4 sampling time + selection + 12 + 3 + + + SMP3 + ADC channel 3 sampling time + selection + 9 + 3 + + + SMP2 + ADC channel 2 sampling time + selection + 6 + 3 + + + SMP1 + ADC channel 1 sampling time + selection + 3 + 3 + + + + + SMPR2 + SMPR2 + ADC sampling time register 2 + 0x18 + 0x20 + read-write + 0x00000000 + + + SMP19 + ADC channel 18 sampling time + selection + 27 + 3 + + + SMP18 + ADC channel 18 sampling time + selection + 24 + 3 + + + SMP17 + ADC channel 17 sampling time + selection + 21 + 3 + + + SMP16 + ADC channel 16 sampling time + selection + 18 + 3 + + + SMP15 + ADC channel 15 sampling time + selection + 15 + 3 + + + SMP14 + ADC channel 14 sampling time + selection + 12 + 3 + + + SMP13 + ADC channel 13 sampling time + selection + 9 + 3 + + + SMP12 + ADC channel 12 sampling time + selection + 6 + 3 + + + SMP11 + ADC channel 11 sampling time + selection + 3 + 3 + + + SMP10 + ADC channel 10 sampling time + selection + 0 + 3 + + + + + LTR1 + LTR1 + ADC analog watchdog 1 threshold + register + 0x20 + 0x20 + read-write + 0x0FFF0000 + + + LTR1 + ADC analog watchdog 1 threshold + low + 0 + 26 + + + + + LHTR1 + LHTR1 + ADC analog watchdog 2 threshold + register + 0x24 + 0x20 + read-write + 0x0FFF0000 + + + LHTR1 + ADC analog watchdog 2 threshold + low + 0 + 26 + + + + + SQR1 + SQR1 + ADC group regular sequencer ranks register + 1 + 0x30 + 0x20 + read-write + 0x00000000 + + + SQ4 + ADC group regular sequencer rank + 4 + 24 + 5 + + + SQ3 + ADC group regular sequencer rank + 3 + 18 + 5 + + + SQ2 + ADC group regular sequencer rank + 2 + 12 + 5 + + + SQ1 + ADC group regular sequencer rank + 1 + 6 + 5 + + + L3 + L3 + 0 + 4 + + + + + SQR2 + SQR2 + ADC group regular sequencer ranks register + 2 + 0x34 + 0x20 + read-write + 0x00000000 + + + SQ9 + ADC group regular sequencer rank + 9 + 24 + 5 + + + SQ8 + ADC group regular sequencer rank + 8 + 18 + 5 + + + SQ7 + ADC group regular sequencer rank + 7 + 12 + 5 + + + SQ6 + ADC group regular sequencer rank + 6 + 6 + 5 + + + SQ5 + ADC group regular sequencer rank + 5 + 0 + 5 + + + + + SQR3 + SQR3 + ADC group regular sequencer ranks register + 3 + 0x38 + 0x20 + read-write + 0x00000000 + + + SQ14 + ADC group regular sequencer rank + 14 + 24 + 5 + + + SQ13 + ADC group regular sequencer rank + 13 + 18 + 5 + + + SQ12 + ADC group regular sequencer rank + 12 + 12 + 5 + + + SQ11 + ADC group regular sequencer rank + 11 + 6 + 5 + + + SQ10 + ADC group regular sequencer rank + 10 + 0 + 5 + + + + + SQR4 + SQR4 + ADC group regular sequencer ranks register + 4 + 0x3C + 0x20 + read-write + 0x00000000 + + + SQ16 + ADC group regular sequencer rank + 16 + 6 + 5 + + + SQ15 + ADC group regular sequencer rank + 15 + 0 + 5 + + + + + DR + DR + ADC group regular conversion data + register + 0x40 + 0x20 + read-only + 0x00000000 + + + RDATA + ADC group regular conversion + data + 0 + 16 + + + + + JSQR + JSQR + ADC group injected sequencer + register + 0x4C + 0x20 + read-write + 0x00000000 + + + JSQ4 + ADC group injected sequencer rank + 4 + 27 + 5 + + + JSQ3 + ADC group injected sequencer rank + 3 + 21 + 5 + + + JSQ2 + ADC group injected sequencer rank + 2 + 15 + 5 + + + JSQ1 + ADC group injected sequencer rank + 1 + 9 + 5 + + + JEXTEN + ADC group injected external trigger + polarity + 7 + 2 + + + JEXTSEL + ADC group injected external trigger + source + 2 + 5 + + + JL + ADC group injected sequencer scan + length + 0 + 2 + + + + + OFR1 + OFR1 + ADC offset number 1 register + 0x60 + 0x20 + read-write + 0x00000000 + + + SSATE + ADC offset number 1 enable + 31 + 1 + + + OFFSET1_CH + ADC offset number 1 channel + selection + 26 + 5 + + + OFFSET1 + ADC offset number 1 offset + level + 0 + 26 + + + + + OFR2 + OFR2 + ADC offset number 2 register + 0x64 + 0x20 + read-write + 0x00000000 + + + SSATE + ADC offset number 1 enable + 31 + 1 + + + OFFSET1_CH + ADC offset number 1 channel + selection + 26 + 5 + + + OFFSET1 + ADC offset number 1 offset + level + 0 + 26 + + + + + OFR3 + OFR3 + ADC offset number 3 register + 0x68 + 0x20 + read-write + 0x00000000 + + + SSATE + ADC offset number 1 enable + 31 + 1 + + + OFFSET1_CH + ADC offset number 1 channel + selection + 26 + 5 + + + OFFSET1 + ADC offset number 1 offset + level + 0 + 26 + + + + + OFR4 + OFR4 + ADC offset number 4 register + 0x6C + 0x20 + read-write + 0x00000000 + + + SSATE + ADC offset number 1 enable + 31 + 1 + + + OFFSET1_CH + ADC offset number 1 channel + selection + 26 + 5 + + + OFFSET1 + ADC offset number 1 offset + level + 0 + 26 + + + + + JDR1 + JDR1 + ADC group injected sequencer rank 1 + register + 0x80 + 0x20 + read-only + 0x00000000 + + + JDATA1 + ADC group injected sequencer rank 1 + conversion data + 0 + 32 + + + + + JDR2 + JDR2 + ADC group injected sequencer rank 2 + register + 0x84 + 0x20 + read-only + 0x00000000 + + + JDATA2 + ADC group injected sequencer rank 2 + conversion data + 0 + 32 + + + + + JDR3 + JDR3 + ADC group injected sequencer rank 3 + register + 0x88 + 0x20 + read-only + 0x00000000 + + + JDATA3 + ADC group injected sequencer rank 3 + conversion data + 0 + 32 + + + + + JDR4 + JDR4 + ADC group injected sequencer rank 4 + register + 0x8C + 0x20 + read-only + 0x00000000 + + + JDATA4 + ADC group injected sequencer rank 4 + conversion data + 0 + 32 + + + + + AWD2CR + AWD2CR + ADC analog watchdog 2 configuration + register + 0xA0 + 0x20 + read-write + 0x00000000 + + + AWD2CH + ADC analog watchdog 2 monitored channel + selection + 0 + 20 + + + + + AWD3CR + AWD3CR + ADC analog watchdog 3 configuration + register + 0xA4 + 0x20 + read-write + 0x00000000 + + + AWD3CH + ADC analog watchdog 3 monitored channel + selection + 1 + 20 + + + + + DIFSEL + DIFSEL + ADC channel differential or single-ended + mode selection register + 0xC0 + 0x20 + read-write + 0x00000000 + + + DIFSEL + ADC channel differential or single-ended + mode for channel + 0 + 20 + + + + + CALFACT + CALFACT + ADC calibration factors + register + 0xC4 + 0x20 + read-write + 0x00000000 + + + CALFACT_D + ADC calibration factor in differential + mode + 16 + 11 + + + CALFACT_S + ADC calibration factor in single-ended + mode + 0 + 11 + + + + + PCSEL + PCSEL + ADC pre channel selection + register + 0x1C + 0x20 + read-write + 0x00000000 + + + PCSEL + Channel x (VINP[i]) pre + selection + 0 + 20 + + + + + LTR2 + LTR2 + ADC watchdog lower threshold register + 2 + 0xB0 + 0x20 + read-write + 0x00000000 + + + LTR2 + Analog watchdog 2 lower + threshold + 0 + 26 + + + + + HTR2 + HTR2 + ADC watchdog higher threshold register + 2 + 0xB4 + 0x20 + read-write + 0x00000000 + + + HTR2 + Analog watchdog 2 higher + threshold + 0 + 26 + + + + + LTR3 + LTR3 + ADC watchdog lower threshold register + 3 + 0xB8 + 0x20 + read-write + 0x00000000 + + + LTR3 + Analog watchdog 3 lower + threshold + 0 + 26 + + + + + HTR3 + HTR3 + ADC watchdog higher threshold register + 3 + 0xBC + 0x20 + read-write + 0x00000000 + + + HTR3 + Analog watchdog 3 higher + threshold + 0 + 26 + + + + + CALFACT2 + CALFACT2 + ADC Calibration Factor register + 2 + 0xC8 + 0x20 + read-write + 0x00000000 + + + LINCALFACT + Linearity Calibration + Factor + 0 + 30 + + + + + + + ADC1 + 0x40022000 + + + ADC2 + 0x40022100 + + + ADC3_Common + Analog-to-Digital Converter + ADC + 0x58026300 + + 0x0 + 0x100 + registers + + + + CSR + CSR + ADC Common status register + 0x0 + 0x20 + read-only + 0x00000000 + + + ADRDY_MST + Master ADC ready + 0 + 1 + + + EOSMP_MST + End of Sampling phase flag of the master + ADC + 1 + 1 + + + EOC_MST + End of regular conversion of the master + ADC + 2 + 1 + + + EOS_MST + End of regular sequence flag of the + master ADC + 3 + 1 + + + OVR_MST + Overrun flag of the master + ADC + 4 + 1 + + + JEOC_MST + End of injected conversion flag of the + master ADC + 5 + 1 + + + JEOS_MST + End of injected sequence flag of the + master ADC + 6 + 1 + + + AWD1_MST + Analog watchdog 1 flag of the master + ADC + 7 + 1 + + + AWD2_MST + Analog watchdog 2 flag of the master + ADC + 8 + 1 + + + AWD3_MST + Analog watchdog 3 flag of the master + ADC + 9 + 1 + + + JQOVF_MST + Injected Context Queue Overflow flag of + the master ADC + 10 + 1 + + + ADRDY_SLV + Slave ADC ready + 16 + 1 + + + EOSMP_SLV + End of Sampling phase flag of the slave + ADC + 17 + 1 + + + EOC_SLV + End of regular conversion of the slave + ADC + 18 + 1 + + + EOS_SLV + End of regular sequence flag of the + slave ADC + 19 + 1 + + + OVR_SLV + Overrun flag of the slave + ADC + 20 + 1 + + + JEOC_SLV + End of injected conversion flag of the + slave ADC + 21 + 1 + + + JEOS_SLV + End of injected sequence flag of the + slave ADC + 22 + 1 + + + AWD1_SLV + Analog watchdog 1 flag of the slave + ADC + 23 + 1 + + + AWD2_SLV + Analog watchdog 2 flag of the slave + ADC + 24 + 1 + + + AWD3_SLV + Analog watchdog 3 flag of the slave + ADC + 25 + 1 + + + JQOVF_SLV + Injected Context Queue Overflow flag of + the slave ADC + 26 + 1 + + + + + CCR + CCR + ADC common control register + 0x8 + 0x20 + read-write + 0x00000000 + + + DUAL + Dual ADC mode selection + 0 + 5 + + + DELAY + Delay between 2 sampling + phases + 8 + 4 + + + DAMDF + Dual ADC Mode Data Format + 14 + 2 + + + CKMODE + ADC clock mode + 16 + 2 + + + PRESC + ADC prescaler + 18 + 4 + + + VREFEN + VREFINT enable + 22 + 1 + + + VSENSEEN + Temperature sensor enable + 23 + 1 + + + VBATEN + VBAT enable + 24 + 1 + + + + + CDR + CDR + ADC common regular data register for dual + and triple modes + 0xC + 0x20 + read-only + 0x00000000 + + + RDATA_SLV + Regular data of the slave + ADC + 16 + 16 + + + RDATA_MST + Regular data of the master + ADC + 0 + 16 + + + + + CDR2 + CDR2 + ADC x common regular data register for + 32-bit dual mode + 0x10 + 0x20 + read-only + 0x00000000 + + + RDATA_ALT + Regular data of the master/slave + alternated ADCs + 0 + 32 + + + + + + + ADC12_Common + 0x40022300 + + ADC1_2 + ADC1 and ADC2 + 18 + + + + DMAMUX1 + DMAMUX + DMAMUX + 0x40020800 + + 0x0 + 0x400 + registers + + + DMAMUX1_OV + DMAMUX1 overrun interrupt + 102 + + + + C0CR + C0CR + DMAMux - DMA request line multiplexer + channel x control register + 0x0 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C1CR + C1CR + DMAMux - DMA request line multiplexer + channel x control register + 0x4 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C2CR + C2CR + DMAMux - DMA request line multiplexer + channel x control register + 0x8 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C3CR + C3CR + DMAMux - DMA request line multiplexer + channel x control register + 0xC + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C4CR + C4CR + DMAMux - DMA request line multiplexer + channel x control register + 0x10 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C5CR + C5CR + DMAMux - DMA request line multiplexer + channel x control register + 0x14 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C6CR + C6CR + DMAMux - DMA request line multiplexer + channel x control register + 0x18 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C7CR + C7CR + DMAMux - DMA request line multiplexer + channel x control register + 0x1C + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C8CR + C8CR + DMAMux - DMA request line multiplexer + channel x control register + 0x20 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C9CR + C9CR + DMAMux - DMA request line multiplexer + channel x control register + 0x24 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C10CR + C10CR + DMAMux - DMA request line multiplexer + channel x control register + 0x28 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C11CR + C11CR + DMAMux - DMA request line multiplexer + channel x control register + 0x2C + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C12CR + C12CR + DMAMux - DMA request line multiplexer + channel x control register + 0x30 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C13CR + C13CR + DMAMux - DMA request line multiplexer + channel x control register + 0x34 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C14CR + C14CR + DMAMux - DMA request line multiplexer + channel x control register + 0x38 + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + C15CR + C15CR + DMAMux - DMA request line multiplexer + channel x control register + 0x3C + 0x20 + read-write + 0x00000000 + + + DMAREQ_ID + Input DMA request line + selected + 0 + 8 + + + SOIE + Interrupt enable at synchronization + event overrun + 8 + 1 + + + EGE + Event generation + enable/disable + 9 + 1 + + + SE + Synchronous operating mode + enable/disable + 16 + 1 + + + SPOL + Synchronization event type selector + Defines the synchronization event on the selected + synchronization input: + 17 + 2 + + + NBREQ + Number of DMA requests to forward + Defines the number of DMA requests forwarded before + output event is generated. In synchronous mode, it + also defines the number of DMA requests to forward + after a synchronization event, then stop forwarding. + The actual number of DMA requests forwarded is + NBREQ+1. Note: This field can only be written when + both SE and EGE bits are reset. + 19 + 5 + + + SYNC_ID + Synchronization input + selected + 24 + 5 + + + + + RG0CR + RG0CR + DMAMux - DMA request generator channel x + control register + 0x100 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG1CR + RG1CR + DMAMux - DMA request generator channel x + control register + 0x104 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG2CR + RG2CR + DMAMux - DMA request generator channel x + control register + 0x108 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG3CR + RG3CR + DMAMux - DMA request generator channel x + control register + 0x10C + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG4CR + RG4CR + DMAMux - DMA request generator channel x + control register + 0x110 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG5CR + RG5CR + DMAMux - DMA request generator channel x + control register + 0x114 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG6CR + RG6CR + DMAMux - DMA request generator channel x + control register + 0x118 + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RG7CR + RG7CR + DMAMux - DMA request generator channel x + control register + 0x11C + 0x20 + read-write + 0x00000000 + + + SIG_ID + DMA request trigger input + selected + 0 + 5 + + + OIE + Interrupt enable at trigger event + overrun + 8 + 1 + + + GE + DMA request generator channel + enable/disable + 16 + 1 + + + GPOL + DMA request generator trigger event type + selection Defines the trigger event on the selected + DMA request trigger input + 17 + 2 + + + GNBREQ + Number of DMA requests to generate + Defines the number of DMA requests generated after a + trigger event, then stop generating. The actual + number of generated DMA requests is GNBREQ+1. Note: + This field can only be written when GE bit is + reset. + 19 + 5 + + + + + RGSR + RGSR + DMAMux - DMA request generator status + register + 0x140 + 0x20 + read-only + 0x00000000 + + + OF + Trigger event overrun flag The flag is + set when a trigger event occurs on DMA request + generator channel x, while the DMA request generator + counter value is lower than GNBREQ. The flag is + cleared by writing 1 to the corresponding COFx bit in + DMAMUX_RGCFR register. + 0 + 8 + + + + + RGCFR + RGCFR + DMAMux - DMA request generator clear flag + register + 0x144 + 0x20 + write-only + 0x00000000 + + + COF + Clear trigger event overrun flag Upon + setting, this bit clears the corresponding overrun + flag OFx in the DMAMUX_RGCSR register. + 0 + 8 + + + + + CSR + CSR + DMAMUX request line multiplexer interrupt + channel status register + 0x80 + 0x20 + read-only + 0x00000000 + + + SOF + Synchronization overrun event + flag + 0 + 16 + + + + + CFR + CFR + DMAMUX request line multiplexer interrupt + clear flag register + 0x84 + 0x20 + write-only + 0x00000000 + + + CSOF + Clear synchronization overrun event + flag + 0 + 16 + + + + + + + CRC + Cryptographic processor + CRC + 0x58024C00 + + 0x0 + 0x400 + registers + + + + DR + DR + Data register + 0x0 + 0x20 + read-write + 0xFFFFFFFF + + + DR + Data Register + 0 + 32 + + + + + IDR + IDR + Independent Data register + 0x4 + 0x20 + read-write + 0x00000000 + + + IDR + Independent Data register + 0 + 32 + + + + + CR + CR + Control register + 0x8 + 0x20 + 0x00000000 + + + RESET + RESET bit + 0 + 1 + write-only + + + POLYSIZE + Polynomial size + 3 + 2 + read-write + + + REV_IN + Reverse input data + 5 + 2 + read-write + + + REV_OUT + Reverse output data + 7 + 1 + read-write + + + + + INIT + INIT + Initial CRC value + 0xC + 0x20 + read-write + 0x00000000 + + + CRC_INIT + Programmable initial CRC + value + 0 + 32 + + + + + POL + POL + CRC polynomial + 0x10 + 0x20 + read-write + 0x00000000 + + + POL + Programmable polynomial + 0 + 32 + + + + + + + RCC + Reset and clock control + RCC + 0x58024400 + + 0x0 + 0x400 + registers + + + RCC + RCC global interrupt + 5 + + + + CR + CR + clock control register + 0x0 + 0x20 + read-write + 0x00000083 + + + HSION + Internal high-speed clock + enable + 0 + 1 + + + HSIKERON + High Speed Internal clock enable in Stop + mode + 1 + 1 + + + HSIRDY + HSI clock ready flag + 2 + 1 + + + HSIDIV + HSI clock divider + 3 + 2 + + + HSIDIVF + HSI divider flag + 5 + 1 + + + CSION + CSI clock enable + 7 + 1 + + + CSIRDY + CSI clock ready flag + 8 + 1 + + + CSIKERON + CSI clock enable in Stop + mode + 9 + 1 + + + RC48ON + RC48 clock enable + 12 + 1 + + + RC48RDY + RC48 clock ready flag + 13 + 1 + + + D1CKRDY + D1 domain clocks ready + flag + 14 + 1 + + + D2CKRDY + D2 domain clocks ready + flag + 15 + 1 + + + HSEON + HSE clock enable + 16 + 1 + + + HSERDY + HSE clock ready flag + 17 + 1 + + + HSEBYP + HSE clock bypass + 18 + 1 + + + HSECSSON + HSE Clock Security System + enable + 19 + 1 + + + PLL1ON + PLL1 enable + 24 + 1 + + + PLL1RDY + PLL1 clock ready flag + 25 + 1 + + + PLL2ON + PLL2 enable + 26 + 1 + + + PLL2RDY + PLL2 clock ready flag + 27 + 1 + + + PLL3ON + PLL3 enable + 28 + 1 + + + PLL3RDY + PLL3 clock ready flag + 29 + 1 + + + + + ICSCR + ICSCR + RCC Internal Clock Source Calibration + Register + 0x4 + 0x20 + 0x40000000 + + + HSICAL + HSI clock calibration + 0 + 12 + read-only + + + HSITRIM + HSI clock trimming + 12 + 6 + read-write + + + CSICAL + CSI clock calibration + 18 + 8 + read-only + + + CSITRIM + CSI clock trimming + 26 + 5 + read-write + + + + + CRRCR + CRRCR + RCC Clock Recovery RC Register + 0x8 + 0x20 + read-only + 0x00000000 + + + RC48CAL + Internal RC 48 MHz clock + calibration + 0 + 10 + + + + + CFGR + CFGR + RCC Clock Configuration + Register + 0x10 + 0x20 + read-write + 0x00000000 + + + SW + System clock switch + 0 + 3 + + + SWS + System clock switch status + 3 + 3 + + + STOPWUCK + System clock selection after a wake up + from system Stop + 6 + 1 + + + STOPKERWUCK + Kernel clock selection after a wake up + from system Stop + 7 + 1 + + + RTCPRE + HSE division factor for RTC + clock + 8 + 6 + + + HRTIMSEL + High Resolution Timer clock prescaler + selection + 14 + 1 + + + TIMPRE + Timers clocks prescaler + selection + 15 + 1 + + + MCO1PRE + MCO1 prescaler + 18 + 4 + + + MCO1SEL + Micro-controller clock output + 1 + 22 + 3 + + + MCO2PRE + MCO2 prescaler + 25 + 4 + + + MCO2SEL + Micro-controller clock output + 2 + 29 + 3 + + + + + D1CFGR + D1CFGR + RCC Domain 1 Clock Configuration + Register + 0x18 + 0x20 + read-write + 0x00000000 + + + HPRE + D1 domain AHB prescaler + 0 + 4 + + + D1PPRE + D1 domain APB3 prescaler + 4 + 3 + + + D1CPRE + D1 domain Core prescaler + 8 + 4 + + + + + D2CFGR + D2CFGR + RCC Domain 2 Clock Configuration + Register + 0x1C + 0x20 + read-write + 0x00000000 + + + D2PPRE1 + D2 domain APB1 prescaler + 4 + 3 + + + D2PPRE2 + D2 domain APB2 prescaler + 8 + 3 + + + + + D3CFGR + D3CFGR + RCC Domain 3 Clock Configuration + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + D3PPRE + D3 domain APB4 prescaler + 4 + 3 + + + + + PLLCKSELR + PLLCKSELR + RCC PLLs Clock Source Selection + Register + 0x28 + 0x20 + read-write + 0x02020200 + + + PLLSRC + DIVMx and PLLs clock source + selection + 0 + 2 + + + DIVM1 + Prescaler for PLL1 + 4 + 6 + + + DIVM2 + Prescaler for PLL2 + 12 + 6 + + + DIVM3 + Prescaler for PLL3 + 20 + 6 + + + + + PLLCFGR + PLLCFGR + RCC PLLs Configuration + Register + 0x2C + 0x20 + read-write + 0x01FF0000 + + + PLL1FRACEN + PLL1 fractional latch + enable + 0 + 1 + + + PLL1VCOSEL + PLL1 VCO selection + 1 + 1 + + + PLL1RGE + PLL1 input frequency range + 2 + 2 + + + PLL2FRACEN + PLL2 fractional latch + enable + 4 + 1 + + + PLL2VCOSEL + PLL2 VCO selection + 5 + 1 + + + PLL2RGE + PLL2 input frequency range + 6 + 2 + + + PLL3FRACEN + PLL3 fractional latch + enable + 8 + 1 + + + PLL3VCOSEL + PLL3 VCO selection + 9 + 1 + + + PLL3RGE + PLL3 input frequency range + 10 + 2 + + + DIVP1EN + PLL1 DIVP divider output + enable + 16 + 1 + + + DIVQ1EN + PLL1 DIVQ divider output + enable + 17 + 1 + + + DIVR1EN + PLL1 DIVR divider output + enable + 18 + 1 + + + DIVP2EN + PLL2 DIVP divider output + enable + 19 + 1 + + + DIVQ2EN + PLL2 DIVQ divider output + enable + 20 + 1 + + + DIVR2EN + PLL2 DIVR divider output + enable + 21 + 1 + + + DIVP3EN + PLL3 DIVP divider output + enable + 22 + 1 + + + DIVQ3EN + PLL3 DIVQ divider output + enable + 23 + 1 + + + DIVR3EN + PLL3 DIVR divider output + enable + 24 + 1 + + + + + PLL1DIVR + PLL1DIVR + RCC PLL1 Dividers Configuration + Register + 0x30 + 0x20 + read-write + 0x01010280 + + + DIVN1 + Multiplication factor for PLL1 + VCO + 0 + 9 + + + DIVP1 + PLL1 DIVP division factor + 9 + 7 + + + DIVQ1 + PLL1 DIVQ division factor + 16 + 7 + + + DIVR1 + PLL1 DIVR division factor + 24 + 7 + + + + + PLL1FRACR + PLL1FRACR + RCC PLL1 Fractional Divider + Register + 0x34 + 0x20 + read-write + 0x00000000 + + + FRACN1 + Fractional part of the multiplication + factor for PLL1 VCO + 3 + 13 + + + + + PLL2DIVR + PLL2DIVR + RCC PLL2 Dividers Configuration + Register + 0x38 + 0x20 + read-write + 0x01010280 + + + DIVN1 + Multiplication factor for PLL1 + VCO + 0 + 9 + + + DIVP1 + PLL1 DIVP division factor + 9 + 7 + + + DIVQ1 + PLL1 DIVQ division factor + 16 + 7 + + + DIVR1 + PLL1 DIVR division factor + 24 + 7 + + + + + PLL2FRACR + PLL2FRACR + RCC PLL2 Fractional Divider + Register + 0x3C + 0x20 + read-write + 0x00000000 + + + FRACN2 + Fractional part of the multiplication + factor for PLL VCO + 3 + 13 + + + + + PLL3DIVR + PLL3DIVR + RCC PLL3 Dividers Configuration + Register + 0x40 + 0x20 + read-write + 0x01010280 + + + DIVN3 + Multiplication factor for PLL1 + VCO + 0 + 9 + + + DIVP3 + PLL DIVP division factor + 9 + 7 + + + DIVQ3 + PLL DIVQ division factor + 16 + 7 + + + DIVR3 + PLL DIVR division factor + 24 + 7 + + + + + PLL3FRACR + PLL3FRACR + RCC PLL3 Fractional Divider + Register + 0x44 + 0x20 + read-write + 0x00000000 + + + FRACN3 + Fractional part of the multiplication + factor for PLL3 VCO + 3 + 13 + + + + + D1CCIPR + D1CCIPR + RCC Domain 1 Kernel Clock Configuration + Register + 0x4C + 0x20 + read-write + 0x00000000 + + + FMCSRC + FMC kernel clock source + selection + 0 + 2 + + + QSPISRC + QUADSPI kernel clock source + selection + 4 + 2 + + + SDMMCSRC + SDMMC kernel clock source + selection + 16 + 1 + + + CKPERSRC + per_ck clock source + selection + 28 + 2 + + + + + D2CCIP1R + D2CCIP1R + RCC Domain 2 Kernel Clock Configuration + Register + 0x50 + 0x20 + read-write + 0x00000000 + + + SAI1SRC + SAI1 and DFSDM1 kernel Aclk clock source + selection + 0 + 3 + + + SAI23SRC + SAI2 and SAI3 kernel clock source + selection + 6 + 3 + + + SPI123SRC + SPI/I2S1,2 and 3 kernel clock source + selection + 12 + 3 + + + SPI45SRC + SPI4 and 5 kernel clock source + selection + 16 + 3 + + + SPDIFSRC + SPDIFRX kernel clock source + selection + 20 + 2 + + + DFSDM1SRC + DFSDM1 kernel Clk clock source + selection + 24 + 1 + + + FDCANSRC + FDCAN kernel clock source + selection + 28 + 2 + + + SWPSRC + SWPMI kernel clock source + selection + 31 + 1 + + + + + D2CCIP2R + D2CCIP2R + RCC Domain 2 Kernel Clock Configuration + Register + 0x54 + 0x20 + read-write + 0x00000000 + + + USART234578SRC + USART2/3, UART4,5, 7/8 (APB1) kernel + clock source selection + 0 + 3 + + + USART16SRC + USART1 and 6 kernel clock source + selection + 3 + 3 + + + RNGSRC + RNG kernel clock source + selection + 8 + 2 + + + I2C123SRC + I2C1,2,3 kernel clock source + selection + 12 + 2 + + + USBSRC + USBOTG 1 and 2 kernel clock source + selection + 20 + 2 + + + CECSRC + HDMI-CEC kernel clock source + selection + 22 + 2 + + + LPTIM1SRC + LPTIM1 kernel clock source + selection + 28 + 3 + + + + + D3CCIPR + D3CCIPR + RCC Domain 3 Kernel Clock Configuration + Register + 0x58 + 0x20 + read-write + 0x00000000 + + + LPUART1SRC + LPUART1 kernel clock source + selection + 0 + 3 + + + I2C4SRC + I2C4 kernel clock source + selection + 8 + 2 + + + LPTIM2SRC + LPTIM2 kernel clock source + selection + 10 + 3 + + + LPTIM345SRC + LPTIM3,4,5 kernel clock source + selection + 13 + 3 + + + ADCSRC + SAR ADC kernel clock source + selection + 16 + 2 + + + SAI4ASRC + Sub-Block A of SAI4 kernel clock source + selection + 21 + 3 + + + SAI4BSRC + Sub-Block B of SAI4 kernel clock source + selection + 24 + 3 + + + SPI6SRC + SPI6 kernel clock source + selection + 28 + 3 + + + + + CIER + CIER + RCC Clock Source Interrupt Enable + Register + 0x60 + 0x20 + read-write + 0x00000000 + + + LSIRDYIE + LSI ready Interrupt Enable + 0 + 1 + + + LSERDYIE + LSE ready Interrupt Enable + 1 + 1 + + + HSIRDYIE + HSI ready Interrupt Enable + 2 + 1 + + + HSERDYIE + HSE ready Interrupt Enable + 3 + 1 + + + CSIRDYIE + CSI ready Interrupt Enable + 4 + 1 + + + RC48RDYIE + RC48 ready Interrupt + Enable + 5 + 1 + + + PLL1RDYIE + PLL1 ready Interrupt + Enable + 6 + 1 + + + PLL2RDYIE + PLL2 ready Interrupt + Enable + 7 + 1 + + + PLL3RDYIE + PLL3 ready Interrupt + Enable + 8 + 1 + + + LSECSSIE + LSE clock security system Interrupt + Enable + 9 + 1 + + + + + CIFR + CIFR + RCC Clock Source Interrupt Flag + Register + 0x64 + 0x20 + read-write + 0x00000000 + + + LSIRDYF + LSI ready Interrupt Flag + 0 + 1 + + + LSERDYF + LSE ready Interrupt Flag + 1 + 1 + + + HSIRDYF + HSI ready Interrupt Flag + 2 + 1 + + + HSERDYF + HSE ready Interrupt Flag + 3 + 1 + + + CSIRDY + CSI ready Interrupt Flag + 4 + 1 + + + RC48RDYF + RC48 ready Interrupt Flag + 5 + 1 + + + PLL1RDYF + PLL1 ready Interrupt Flag + 6 + 1 + + + PLL2RDYF + PLL2 ready Interrupt Flag + 7 + 1 + + + PLL3RDYF + PLL3 ready Interrupt Flag + 8 + 1 + + + LSECSSF + LSE clock security system Interrupt + Flag + 9 + 1 + + + HSECSSF + HSE clock security system Interrupt + Flag + 10 + 1 + + + + + CICR + CICR + RCC Clock Source Interrupt Clear + Register + 0x68 + 0x20 + read-write + 0x00000000 + + + LSIRDYC + LSI ready Interrupt Clear + 0 + 1 + + + LSERDYC + LSE ready Interrupt Clear + 1 + 1 + + + HSIRDYC + HSI ready Interrupt Clear + 2 + 1 + + + HSERDYC + HSE ready Interrupt Clear + 3 + 1 + + + HSE_ready_Interrupt_Clear + CSI ready Interrupt Clear + 4 + 1 + + + RC48RDYC + RC48 ready Interrupt Clear + 5 + 1 + + + PLL1RDYC + PLL1 ready Interrupt Clear + 6 + 1 + + + PLL2RDYC + PLL2 ready Interrupt Clear + 7 + 1 + + + PLL3RDYC + PLL3 ready Interrupt Clear + 8 + 1 + + + LSECSSC + LSE clock security system Interrupt + Clear + 9 + 1 + + + HSECSSC + HSE clock security system Interrupt + Clear + 10 + 1 + + + + + BDCR + BDCR + RCC Backup Domain Control + Register + 0x70 + 0x20 + read-write + 0x00000000 + + + LSEON + LSE oscillator enabled + 0 + 1 + + + LSERDY + LSE oscillator ready + 1 + 1 + + + LSEBYP + LSE oscillator bypass + 2 + 1 + + + LSEDRV + LSE oscillator driving + capability + 3 + 2 + + + LSECSSON + LSE clock security system + enable + 5 + 1 + + + LSECSSD + LSE clock security system failure + detection + 6 + 1 + + + RTCSRC + RTC clock source selection + 8 + 2 + + + RTCEN + RTC clock enable + 15 + 1 + + + VSWRST + VSwitch domain software + reset + 16 + 1 + + + + + CSR + CSR + RCC Clock Control and Status + Register + 0x74 + 0x20 + read-write + 0x00000000 + + + LSION + LSI oscillator enable + 0 + 1 + + + LSIRDY + LSI oscillator ready + 1 + 1 + + + + + AHB3RSTR + AHB3RSTR + RCC AHB3 Reset Register + 0x7C + 0x20 + read-write + 0x00000000 + + + MDMARST + MDMA block reset + 0 + 1 + + + DMA2DRST + DMA2D block reset + 4 + 1 + + + JPGDECRST + JPGDEC block reset + 5 + 1 + + + FMCRST + FMC block reset + 12 + 1 + + + QSPIRST + QUADSPI and QUADSPI delay block + reset + 14 + 1 + + + SDMMC1RST + SDMMC1 and SDMMC1 delay block + reset + 16 + 1 + + + CPURST + CPU reset + 31 + 1 + + + + + AHB1RSTR + AHB1RSTR + RCC AHB1 Peripheral Reset + Register + 0x80 + 0x20 + read-write + 0x00000000 + + + DMA1RST + DMA1 block reset + 0 + 1 + + + DMA2RST + DMA2 block reset + 1 + 1 + + + ADC12RST + ADC1&2 block reset + 5 + 1 + + + ETH1MACRST + ETH1MAC block reset + 15 + 1 + + + USB1OTGRST + USB1OTG block reset + 25 + 1 + + + USB2OTGRST + USB2OTG block reset + 27 + 1 + + + + + AHB2RSTR + AHB2RSTR + RCC AHB2 Peripheral Reset + Register + 0x84 + 0x20 + read-write + 0x00000000 + + + CAMITFRST + CAMITF block reset + 0 + 1 + + + CRYPTRST + Cryptography block reset + 4 + 1 + + + HASHRST + Hash block reset + 5 + 1 + + + RNGRST + Random Number Generator block + reset + 6 + 1 + + + SDMMC2RST + SDMMC2 and SDMMC2 Delay block + reset + 9 + 1 + + + + + AHB4RSTR + AHB4RSTR + RCC AHB4 Peripheral Reset + Register + 0x88 + 0x20 + read-write + 0x00000000 + + + GPIOARST + GPIO block reset + 0 + 1 + + + GPIOBRST + GPIO block reset + 1 + 1 + + + GPIOCRST + GPIO block reset + 2 + 1 + + + GPIODRST + GPIO block reset + 3 + 1 + + + GPIOERST + GPIO block reset + 4 + 1 + + + GPIOFRST + GPIO block reset + 5 + 1 + + + GPIOGRST + GPIO block reset + 6 + 1 + + + GPIOHRST + GPIO block reset + 7 + 1 + + + GPIOIRST + GPIO block reset + 8 + 1 + + + GPIOJRST + GPIO block reset + 9 + 1 + + + GPIOKRST + GPIO block reset + 10 + 1 + + + CRCRST + CRC block reset + 19 + 1 + + + BDMARST + BDMA block reset + 21 + 1 + + + ADC3RST + ADC3 block reset + 24 + 1 + + + HSEMRST + HSEM block reset + 25 + 1 + + + + + APB3RSTR + APB3RSTR + RCC APB3 Peripheral Reset + Register + 0x8C + 0x20 + read-write + 0x00000000 + + + LTDCRST + LTDC block reset + 3 + 1 + + + + + APB1LRSTR + APB1LRSTR + RCC APB1 Peripheral Reset + Register + 0x90 + 0x20 + read-write + 0x00000000 + + + TIM2RST + TIM block reset + 0 + 1 + + + TIM3RST + TIM block reset + 1 + 1 + + + TIM4RST + TIM block reset + 2 + 1 + + + TIM5RST + TIM block reset + 3 + 1 + + + TIM6RST + TIM block reset + 4 + 1 + + + TIM7RST + TIM block reset + 5 + 1 + + + TIM12RST + TIM block reset + 6 + 1 + + + TIM13RST + TIM block reset + 7 + 1 + + + TIM14RST + TIM block reset + 8 + 1 + + + LPTIM1RST + TIM block reset + 9 + 1 + + + SPI2RST + SPI2 block reset + 14 + 1 + + + SPI3RST + SPI3 block reset + 15 + 1 + + + SPDIFRXRST + SPDIFRX block reset + 16 + 1 + + + USART2RST + USART2 block reset + 17 + 1 + + + USART3RST + USART3 block reset + 18 + 1 + + + UART4RST + UART4 block reset + 19 + 1 + + + UART5RST + UART5 block reset + 20 + 1 + + + I2C1RST + I2C1 block reset + 21 + 1 + + + I2C2RST + I2C2 block reset + 22 + 1 + + + I2C3RST + I2C3 block reset + 23 + 1 + + + CECRST + HDMI-CEC block reset + 27 + 1 + + + DAC12RST + DAC1 and 2 Blocks Reset + 29 + 1 + + + USART7RST + USART7 block reset + 30 + 1 + + + USART8RST + USART8 block reset + 31 + 1 + + + + + APB1HRSTR + APB1HRSTR + RCC APB1 Peripheral Reset + Register + 0x94 + 0x20 + read-write + 0x00000000 + + + CRSRST + Clock Recovery System + reset + 1 + 1 + + + SWPRST + SWPMI block reset + 2 + 1 + + + OPAMPRST + OPAMP block reset + 4 + 1 + + + MDIOSRST + MDIOS block reset + 5 + 1 + + + FDCANRST + FDCAN block reset + 8 + 1 + + + + + APB2RSTR + APB2RSTR + RCC APB2 Peripheral Reset + Register + 0x98 + 0x20 + read-write + 0x00000000 + + + TIM1RST + TIM1 block reset + 0 + 1 + + + TIM8RST + TIM8 block reset + 1 + 1 + + + USART1RST + USART1 block reset + 4 + 1 + + + USART6RST + USART6 block reset + 5 + 1 + + + SPI1RST + SPI1 block reset + 12 + 1 + + + SPI4RST + SPI4 block reset + 13 + 1 + + + TIM15RST + TIM15 block reset + 16 + 1 + + + TIM16RST + TIM16 block reset + 17 + 1 + + + TIM17RST + TIM17 block reset + 18 + 1 + + + SPI5RST + SPI5 block reset + 20 + 1 + + + SAI1RST + SAI1 block reset + 22 + 1 + + + SAI2RST + SAI2 block reset + 23 + 1 + + + SAI3RST + SAI3 block reset + 24 + 1 + + + DFSDM1RST + DFSDM1 block reset + 28 + 1 + + + HRTIMRST + HRTIM block reset + 29 + 1 + + + + + APB4RSTR + APB4RSTR + RCC APB4 Peripheral Reset + Register + 0x9C + 0x20 + read-write + 0x00000000 + + + SYSCFGRST + SYSCFG block reset + 1 + 1 + + + LPUART1RST + LPUART1 block reset + 3 + 1 + + + SPI6RST + SPI6 block reset + 5 + 1 + + + I2C4RST + I2C4 block reset + 7 + 1 + + + LPTIM2RST + LPTIM2 block reset + 9 + 1 + + + LPTIM3RST + LPTIM3 block reset + 10 + 1 + + + LPTIM4RST + LPTIM4 block reset + 11 + 1 + + + LPTIM5RST + LPTIM5 block reset + 12 + 1 + + + COMP12RST + COMP12 Blocks Reset + 14 + 1 + + + VREFRST + VREF block reset + 15 + 1 + + + SAI4RST + SAI4 block reset + 21 + 1 + + + + + GCR + GCR + RCC Global Control Register + 0xA0 + 0x20 + read-write + 0x00000000 + + + WW1RSC + WWDG1 reset scope control + 0 + 1 + + + + + D3AMR + D3AMR + RCC D3 Autonomous mode + Register + 0xA8 + 0x20 + read-write + 0x00000000 + + + BDMAAMEN + BDMA and DMAMUX Autonomous mode + enable + 0 + 1 + + + LPUART1AMEN + LPUART1 Autonomous mode + enable + 3 + 1 + + + SPI6AMEN + SPI6 Autonomous mode + enable + 5 + 1 + + + I2C4AMEN + I2C4 Autonomous mode + enable + 7 + 1 + + + LPTIM2AMEN + LPTIM2 Autonomous mode + enable + 9 + 1 + + + LPTIM3AMEN + LPTIM3 Autonomous mode + enable + 10 + 1 + + + LPTIM4AMEN + LPTIM4 Autonomous mode + enable + 11 + 1 + + + LPTIM5AMEN + LPTIM5 Autonomous mode + enable + 12 + 1 + + + COMP12AMEN + COMP12 Autonomous mode + enable + 14 + 1 + + + VREFAMEN + VREF Autonomous mode + enable + 15 + 1 + + + RTCAMEN + RTC Autonomous mode enable + 16 + 1 + + + CRCAMEN + CRC Autonomous mode enable + 19 + 1 + + + SAI4AMEN + SAI4 Autonomous mode + enable + 21 + 1 + + + ADC3AMEN + ADC3 Autonomous mode + enable + 24 + 1 + + + BKPRAMAMEN + Backup RAM Autonomous mode + enable + 28 + 1 + + + SRAM4AMEN + SRAM4 Autonomous mode + enable + 29 + 1 + + + + + RSR + RSR + RCC Reset Status Register + 0xD0 + 0x20 + read-write + 0x00000000 + + + RMVF + Remove reset flag + 16 + 1 + + + CPURSTF + CPU reset flag + 17 + 1 + + + D1RSTF + D1 domain power switch reset + flag + 19 + 1 + + + D2RSTF + D2 domain power switch reset + flag + 20 + 1 + + + BORRSTF + BOR reset flag + 21 + 1 + + + PINRSTF + Pin reset flag (NRST) + 22 + 1 + + + PORRSTF + POR/PDR reset flag + 23 + 1 + + + SFTRSTF + System reset from CPU reset + flag + 24 + 1 + + + IWDG1RSTF + Independent Watchdog reset + flag + 26 + 1 + + + WWDG1RSTF + Window Watchdog reset flag + 28 + 1 + + + LPWRRSTF + Reset due to illegal D1 DStandby or CPU + CStop flag + 30 + 1 + + + + + C1_RSR + C1_RSR + RCC Reset Status Register + 0x130 + 0x20 + read-write + 0x00000000 + + + RMVF + Remove reset flag + 16 + 1 + + + CPURSTF + CPU reset flag + 17 + 1 + + + D1RSTF + D1 domain power switch reset + flag + 19 + 1 + + + D2RSTF + D2 domain power switch reset + flag + 20 + 1 + + + BORRSTF + BOR reset flag + 21 + 1 + + + PINRSTF + Pin reset flag (NRST) + 22 + 1 + + + PORRSTF + POR/PDR reset flag + 23 + 1 + + + SFTRSTF + System reset from CPU reset + flag + 24 + 1 + + + IWDG1RSTF + Independent Watchdog reset + flag + 26 + 1 + + + WWDG1RSTF + Window Watchdog reset flag + 28 + 1 + + + LPWRRSTF + Reset due to illegal D1 DStandby or CPU + CStop flag + 30 + 1 + + + + + C1_AHB3ENR + C1_AHB3ENR + RCC AHB3 Clock Register + 0x134 + 0x20 + read-write + 0x00000000 + + + MDMAEN + MDMA Peripheral Clock + Enable + 0 + 1 + + + DMA2DEN + DMA2D Peripheral Clock + Enable + 4 + 1 + + + JPGDECEN + JPGDEC Peripheral Clock + Enable + 5 + 1 + + + FMCEN + FMC Peripheral Clocks + Enable + 12 + 1 + + + QSPIEN + QUADSPI and QUADSPI Delay Clock + Enable + 14 + 1 + + + SDMMC1EN + SDMMC1 and SDMMC1 Delay Clock + Enable + 16 + 1 + + + + + AHB3ENR + AHB3ENR + RCC AHB3 Clock Register + 0xD4 + 0x20 + read-write + 0x00000000 + + + MDMAEN + MDMA Peripheral Clock + Enable + 0 + 1 + + + DMA2DEN + DMA2D Peripheral Clock + Enable + 4 + 1 + + + JPGDECEN + JPGDEC Peripheral Clock + Enable + 5 + 1 + + + FMCEN + FMC Peripheral Clocks + Enable + 12 + 1 + + + QSPIEN + QUADSPI and QUADSPI Delay Clock + Enable + 14 + 1 + + + SDMMC1EN + SDMMC1 and SDMMC1 Delay Clock + Enable + 16 + 1 + + + + + AHB1ENR + AHB1ENR + RCC AHB1 Clock Register + 0xD8 + 0x20 + read-write + 0x00000000 + + + DMA1EN + DMA1 Clock Enable + 0 + 1 + + + DMA2EN + DMA2 Clock Enable + 1 + 1 + + + ADC12EN + ADC1/2 Peripheral Clocks + Enable + 5 + 1 + + + ETH1MACEN + Ethernet MAC bus interface Clock + Enable + 15 + 1 + + + ETH1TXEN + Ethernet Transmission Clock + Enable + 16 + 1 + + + ETH1RXEN + Ethernet Reception Clock + Enable + 17 + 1 + + + USB2OTGHSULPIEN + Enable USB_PHY2 clocks + 18 + 1 + + + USB1OTGEN + USB1OTG Peripheral Clocks + Enable + 25 + 1 + + + USB1ULPIEN + USB_PHY1 Clocks Enable + 26 + 1 + + + USB2OTGEN + USB2OTG Peripheral Clocks + Enable + 27 + 1 + + + USB2ULPIEN + USB_PHY2 Clocks Enable + 28 + 1 + + + + + C1_AHB1ENR + C1_AHB1ENR + RCC AHB1 Clock Register + 0x138 + 0x20 + read-write + 0x00000000 + + + DMA1EN + DMA1 Clock Enable + 0 + 1 + + + DMA2EN + DMA2 Clock Enable + 1 + 1 + + + ADC12EN + ADC1/2 Peripheral Clocks + Enable + 5 + 1 + + + ETH1MACEN + Ethernet MAC bus interface Clock + Enable + 15 + 1 + + + ETH1TXEN + Ethernet Transmission Clock + Enable + 16 + 1 + + + ETH1RXEN + Ethernet Reception Clock + Enable + 17 + 1 + + + USB1OTGEN + USB1OTG Peripheral Clocks + Enable + 25 + 1 + + + USB1ULPIEN + USB_PHY1 Clocks Enable + 26 + 1 + + + USB2OTGEN + USB2OTG Peripheral Clocks + Enable + 27 + 1 + + + USB2ULPIEN + USB_PHY2 Clocks Enable + 28 + 1 + + + + + C1_AHB2ENR + C1_AHB2ENR + RCC AHB2 Clock Register + 0x13C + 0x20 + read-write + 0x00000000 + + + CAMITFEN + CAMITF peripheral clock + enable + 0 + 1 + + + CRYPTEN + CRYPT peripheral clock + enable + 4 + 1 + + + HASHEN + HASH peripheral clock + enable + 5 + 1 + + + RNGEN + RNG peripheral clocks + enable + 6 + 1 + + + SDMMC2EN + SDMMC2 and SDMMC2 delay clock + enable + 9 + 1 + + + SRAM1EN + SRAM1 block enable + 29 + 1 + + + SRAM2EN + SRAM2 block enable + 30 + 1 + + + SRAM3EN + SRAM3 block enable + 31 + 1 + + + + + AHB2ENR + AHB2ENR + RCC AHB2 Clock Register + 0xDC + 0x20 + read-write + 0x00000000 + + + CAMITFEN + CAMITF peripheral clock + enable + 0 + 1 + + + CRYPTEN + CRYPT peripheral clock + enable + 4 + 1 + + + HASHEN + HASH peripheral clock + enable + 5 + 1 + + + RNGEN + RNG peripheral clocks + enable + 6 + 1 + + + SDMMC2EN + SDMMC2 and SDMMC2 delay clock + enable + 9 + 1 + + + SRAM1EN + SRAM1 block enable + 29 + 1 + + + SRAM2EN + SRAM2 block enable + 30 + 1 + + + SRAM3EN + SRAM3 block enable + 31 + 1 + + + + + AHB4ENR + AHB4ENR + RCC AHB4 Clock Register + 0xE0 + 0x20 + read-write + 0x00000000 + + + GPIOAEN + 0GPIO peripheral clock + enable + 0 + 1 + + + GPIOBEN + 0GPIO peripheral clock + enable + 1 + 1 + + + GPIOCEN + 0GPIO peripheral clock + enable + 2 + 1 + + + GPIODEN + 0GPIO peripheral clock + enable + 3 + 1 + + + GPIOEEN + 0GPIO peripheral clock + enable + 4 + 1 + + + GPIOFEN + 0GPIO peripheral clock + enable + 5 + 1 + + + GPIOGEN + 0GPIO peripheral clock + enable + 6 + 1 + + + GPIOHEN + 0GPIO peripheral clock + enable + 7 + 1 + + + GPIOIEN + 0GPIO peripheral clock + enable + 8 + 1 + + + GPIOJEN + 0GPIO peripheral clock + enable + 9 + 1 + + + GPIOKEN + 0GPIO peripheral clock + enable + 10 + 1 + + + CRCEN + CRC peripheral clock + enable + 19 + 1 + + + BDMAEN + BDMA and DMAMUX2 Clock + Enable + 21 + 1 + + + ADC3EN + ADC3 Peripheral Clocks + Enable + 24 + 1 + + + HSEMEN + HSEM peripheral clock + enable + 25 + 1 + + + BKPRAMEN + Backup RAM Clock Enable + 28 + 1 + + + + + C1_AHB4ENR + C1_AHB4ENR + RCC AHB4 Clock Register + 0x140 + 0x20 + read-write + 0x00000000 + + + GPIOAEN + 0GPIO peripheral clock + enable + 0 + 1 + + + GPIOBEN + 0GPIO peripheral clock + enable + 1 + 1 + + + GPIOCEN + 0GPIO peripheral clock + enable + 2 + 1 + + + GPIODEN + 0GPIO peripheral clock + enable + 3 + 1 + + + GPIOEEN + 0GPIO peripheral clock + enable + 4 + 1 + + + GPIOFEN + 0GPIO peripheral clock + enable + 5 + 1 + + + GPIOGEN + 0GPIO peripheral clock + enable + 6 + 1 + + + GPIOHEN + 0GPIO peripheral clock + enable + 7 + 1 + + + GPIOIEN + 0GPIO peripheral clock + enable + 8 + 1 + + + GPIOJEN + 0GPIO peripheral clock + enable + 9 + 1 + + + GPIOKEN + 0GPIO peripheral clock + enable + 10 + 1 + + + CRCEN + CRC peripheral clock + enable + 19 + 1 + + + BDMAEN + BDMA and DMAMUX2 Clock + Enable + 21 + 1 + + + ADC3EN + ADC3 Peripheral Clocks + Enable + 24 + 1 + + + HSEMEN + HSEM peripheral clock + enable + 25 + 1 + + + BKPRAMEN + Backup RAM Clock Enable + 28 + 1 + + + + + C1_APB3ENR + C1_APB3ENR + RCC APB3 Clock Register + 0x144 + 0x20 + read-write + 0x00000000 + + + LTDCEN + LTDC peripheral clock + enable + 3 + 1 + + + WWDG1EN + WWDG1 Clock Enable + 6 + 1 + + + + + APB3ENR + APB3ENR + RCC APB3 Clock Register + 0xE4 + 0x20 + read-write + 0x00000000 + + + LTDCEN + LTDC peripheral clock + enable + 3 + 1 + + + WWDG1EN + WWDG1 Clock Enable + 6 + 1 + + + + + APB1LENR + APB1LENR + RCC APB1 Clock Register + 0xE8 + 0x20 + read-write + 0x00000000 + + + TIM2EN + TIM peripheral clock + enable + 0 + 1 + + + TIM3EN + TIM peripheral clock + enable + 1 + 1 + + + TIM4EN + TIM peripheral clock + enable + 2 + 1 + + + TIM5EN + TIM peripheral clock + enable + 3 + 1 + + + TIM6EN + TIM peripheral clock + enable + 4 + 1 + + + TIM7EN + TIM peripheral clock + enable + 5 + 1 + + + TIM12EN + TIM peripheral clock + enable + 6 + 1 + + + TIM13EN + TIM peripheral clock + enable + 7 + 1 + + + TIM14EN + TIM peripheral clock + enable + 8 + 1 + + + LPTIM1EN + LPTIM1 Peripheral Clocks + Enable + 9 + 1 + + + SPI2EN + SPI2 Peripheral Clocks + Enable + 14 + 1 + + + SPI3EN + SPI3 Peripheral Clocks + Enable + 15 + 1 + + + SPDIFRXEN + SPDIFRX Peripheral Clocks + Enable + 16 + 1 + + + USART2EN + USART2 Peripheral Clocks + Enable + 17 + 1 + + + USART3EN + USART3 Peripheral Clocks + Enable + 18 + 1 + + + UART4EN + UART4 Peripheral Clocks + Enable + 19 + 1 + + + UART5EN + UART5 Peripheral Clocks + Enable + 20 + 1 + + + I2C1EN + I2C1 Peripheral Clocks + Enable + 21 + 1 + + + I2C2EN + I2C2 Peripheral Clocks + Enable + 22 + 1 + + + I2C3EN + I2C3 Peripheral Clocks + Enable + 23 + 1 + + + CECEN + HDMI-CEC peripheral clock + enable + 27 + 1 + + + DAC12EN + DAC1&2 peripheral clock + enable + 29 + 1 + + + USART7EN + USART7 Peripheral Clocks + Enable + 30 + 1 + + + USART8EN + USART8 Peripheral Clocks + Enable + 31 + 1 + + + + + C1_APB1LENR + C1_APB1LENR + RCC APB1 Clock Register + 0x148 + 0x20 + read-write + 0x00000000 + + + TIM2EN + TIM peripheral clock + enable + 0 + 1 + + + TIM3EN + TIM peripheral clock + enable + 1 + 1 + + + TIM4EN + TIM peripheral clock + enable + 2 + 1 + + + TIM5EN + TIM peripheral clock + enable + 3 + 1 + + + TIM6EN + TIM peripheral clock + enable + 4 + 1 + + + TIM7EN + TIM peripheral clock + enable + 5 + 1 + + + TIM12EN + TIM peripheral clock + enable + 6 + 1 + + + TIM13EN + TIM peripheral clock + enable + 7 + 1 + + + TIM14EN + TIM peripheral clock + enable + 8 + 1 + + + LPTIM1EN + LPTIM1 Peripheral Clocks + Enable + 9 + 1 + + + SPI2EN + SPI2 Peripheral Clocks + Enable + 14 + 1 + + + SPI3EN + SPI3 Peripheral Clocks + Enable + 15 + 1 + + + SPDIFRXEN + SPDIFRX Peripheral Clocks + Enable + 16 + 1 + + + USART2EN + USART2 Peripheral Clocks + Enable + 17 + 1 + + + USART3EN + USART3 Peripheral Clocks + Enable + 18 + 1 + + + UART4EN + UART4 Peripheral Clocks + Enable + 19 + 1 + + + UART5EN + UART5 Peripheral Clocks + Enable + 20 + 1 + + + I2C1EN + I2C1 Peripheral Clocks + Enable + 21 + 1 + + + I2C2EN + I2C2 Peripheral Clocks + Enable + 22 + 1 + + + I2C3EN + I2C3 Peripheral Clocks + Enable + 23 + 1 + + + HDMICECEN + HDMI-CEC peripheral clock + enable + 27 + 1 + + + DAC12EN + DAC1&2 peripheral clock + enable + 29 + 1 + + + USART7EN + USART7 Peripheral Clocks + Enable + 30 + 1 + + + USART8EN + USART8 Peripheral Clocks + Enable + 31 + 1 + + + + + APB1HENR + APB1HENR + RCC APB1 Clock Register + 0xEC + 0x20 + read-write + 0x00000000 + + + CRSEN + Clock Recovery System peripheral clock + enable + 1 + 1 + + + SWPEN + SWPMI Peripheral Clocks + Enable + 2 + 1 + + + OPAMPEN + OPAMP peripheral clock + enable + 4 + 1 + + + MDIOSEN + MDIOS peripheral clock + enable + 5 + 1 + + + FDCANEN + FDCAN Peripheral Clocks + Enable + 8 + 1 + + + + + C1_APB1HENR + C1_APB1HENR + RCC APB1 Clock Register + 0x14C + 0x20 + read-write + 0x00000000 + + + CRSEN + Clock Recovery System peripheral clock + enable + 1 + 1 + + + SWPEN + SWPMI Peripheral Clocks + Enable + 2 + 1 + + + OPAMPEN + OPAMP peripheral clock + enable + 4 + 1 + + + MDIOSEN + MDIOS peripheral clock + enable + 5 + 1 + + + FDCANEN + FDCAN Peripheral Clocks + Enable + 8 + 1 + + + + + C1_APB2ENR + C1_APB2ENR + RCC APB2 Clock Register + 0x150 + 0x20 + read-write + 0x00000000 + + + TIM1EN + TIM1 peripheral clock + enable + 0 + 1 + + + TIM8EN + TIM8 peripheral clock + enable + 1 + 1 + + + USART1EN + USART1 Peripheral Clocks + Enable + 4 + 1 + + + USART6EN + USART6 Peripheral Clocks + Enable + 5 + 1 + + + SPI1EN + SPI1 Peripheral Clocks + Enable + 12 + 1 + + + SPI4EN + SPI4 Peripheral Clocks + Enable + 13 + 1 + + + TIM16EN + TIM16 peripheral clock + enable + 17 + 1 + + + TIM15EN + TIM15 peripheral clock + enable + 16 + 1 + + + TIM17EN + TIM17 peripheral clock + enable + 18 + 1 + + + SPI5EN + SPI5 Peripheral Clocks + Enable + 20 + 1 + + + SAI1EN + SAI1 Peripheral Clocks + Enable + 22 + 1 + + + SAI2EN + SAI2 Peripheral Clocks + Enable + 23 + 1 + + + SAI3EN + SAI3 Peripheral Clocks + Enable + 24 + 1 + + + DFSDM1EN + DFSDM1 Peripheral Clocks + Enable + 28 + 1 + + + HRTIMEN + HRTIM peripheral clock + enable + 29 + 1 + + + + + APB2ENR + APB2ENR + RCC APB2 Clock Register + 0xF0 + 0x20 + read-write + 0x00000000 + + + TIM1EN + TIM1 peripheral clock + enable + 0 + 1 + + + TIM8EN + TIM8 peripheral clock + enable + 1 + 1 + + + USART1EN + USART1 Peripheral Clocks + Enable + 4 + 1 + + + USART6EN + USART6 Peripheral Clocks + Enable + 5 + 1 + + + SPI1EN + SPI1 Peripheral Clocks + Enable + 12 + 1 + + + SPI4EN + SPI4 Peripheral Clocks + Enable + 13 + 1 + + + TIM16EN + TIM16 peripheral clock + enable + 17 + 1 + + + TIM15EN + TIM15 peripheral clock + enable + 16 + 1 + + + TIM17EN + TIM17 peripheral clock + enable + 18 + 1 + + + SPI5EN + SPI5 Peripheral Clocks + Enable + 20 + 1 + + + SAI1EN + SAI1 Peripheral Clocks + Enable + 22 + 1 + + + SAI2EN + SAI2 Peripheral Clocks + Enable + 23 + 1 + + + SAI3EN + SAI3 Peripheral Clocks + Enable + 24 + 1 + + + DFSDM1EN + DFSDM1 Peripheral Clocks + Enable + 28 + 1 + + + HRTIMEN + HRTIM peripheral clock + enable + 29 + 1 + + + + + APB4ENR + APB4ENR + RCC APB4 Clock Register + 0xF4 + 0x20 + read-write + 0x00000000 + + + SYSCFGEN + SYSCFG peripheral clock + enable + 1 + 1 + + + LPUART1EN + LPUART1 Peripheral Clocks + Enable + 3 + 1 + + + SPI6EN + SPI6 Peripheral Clocks + Enable + 5 + 1 + + + I2C4EN + I2C4 Peripheral Clocks + Enable + 7 + 1 + + + LPTIM2EN + LPTIM2 Peripheral Clocks + Enable + 9 + 1 + + + LPTIM3EN + LPTIM3 Peripheral Clocks + Enable + 10 + 1 + + + LPTIM4EN + LPTIM4 Peripheral Clocks + Enable + 11 + 1 + + + LPTIM5EN + LPTIM5 Peripheral Clocks + Enable + 12 + 1 + + + COMP12EN + COMP1/2 peripheral clock + enable + 14 + 1 + + + VREFEN + VREF peripheral clock + enable + 15 + 1 + + + RTCAPBEN + RTC APB Clock Enable + 16 + 1 + + + SAI4EN + SAI4 Peripheral Clocks + Enable + 21 + 1 + + + + + C1_APB4ENR + C1_APB4ENR + RCC APB4 Clock Register + 0x154 + 0x20 + read-write + 0x00000000 + + + SYSCFGEN + SYSCFG peripheral clock + enable + 1 + 1 + + + LPUART1EN + LPUART1 Peripheral Clocks + Enable + 3 + 1 + + + SPI6EN + SPI6 Peripheral Clocks + Enable + 5 + 1 + + + I2C4EN + I2C4 Peripheral Clocks + Enable + 7 + 1 + + + LPTIM2EN + LPTIM2 Peripheral Clocks + Enable + 9 + 1 + + + LPTIM3EN + LPTIM3 Peripheral Clocks + Enable + 10 + 1 + + + LPTIM4EN + LPTIM4 Peripheral Clocks + Enable + 11 + 1 + + + LPTIM5EN + LPTIM5 Peripheral Clocks + Enable + 12 + 1 + + + COMP12EN + COMP1/2 peripheral clock + enable + 14 + 1 + + + VREFEN + VREF peripheral clock + enable + 15 + 1 + + + RTCAPBEN + RTC APB Clock Enable + 16 + 1 + + + SAI4EN + SAI4 Peripheral Clocks + Enable + 21 + 1 + + + + + C1_AHB3LPENR + C1_AHB3LPENR + RCC AHB3 Sleep Clock Register + 0x15C + 0x20 + read-write + 0x00000000 + + + MDMALPEN + MDMA Clock Enable During CSleep + Mode + 0 + 1 + + + DMA2DLPEN + DMA2D Clock Enable During CSleep + Mode + 4 + 1 + + + JPGDECLPEN + JPGDEC Clock Enable During CSleep + Mode + 5 + 1 + + + FLITFLPEN + FLITF Clock Enable During CSleep + Mode + 8 + 1 + + + FMCLPEN + FMC Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + QSPILPEN + QUADSPI and QUADSPI Delay Clock Enable + During CSleep Mode + 14 + 1 + + + SDMMC1LPEN + SDMMC1 and SDMMC1 Delay Clock Enable + During CSleep Mode + 16 + 1 + + + D1DTCM1LPEN + D1DTCM1 Block Clock Enable During CSleep + mode + 28 + 1 + + + DTCM2LPEN + D1 DTCM2 Block Clock Enable During + CSleep mode + 29 + 1 + + + ITCMLPEN + D1ITCM Block Clock Enable During CSleep + mode + 30 + 1 + + + AXISRAMLPEN + AXISRAM Block Clock Enable During CSleep + mode + 31 + 1 + + + + + AHB3LPENR + AHB3LPENR + RCC AHB3 Sleep Clock Register + 0xFC + 0x20 + read-write + 0x00000000 + + + MDMALPEN + MDMA Clock Enable During CSleep + Mode + 0 + 1 + + + DMA2DLPEN + DMA2D Clock Enable During CSleep + Mode + 4 + 1 + + + JPGDECLPEN + JPGDEC Clock Enable During CSleep + Mode + 5 + 1 + + + FLASHLPEN + FLITF Clock Enable During CSleep + Mode + 8 + 1 + + + FMCLPEN + FMC Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + QSPILPEN + QUADSPI and QUADSPI Delay Clock Enable + During CSleep Mode + 14 + 1 + + + SDMMC1LPEN + SDMMC1 and SDMMC1 Delay Clock Enable + During CSleep Mode + 16 + 1 + + + D1DTCM1LPEN + D1DTCM1 Block Clock Enable During CSleep + mode + 28 + 1 + + + DTCM2LPEN + D1 DTCM2 Block Clock Enable During + CSleep mode + 29 + 1 + + + ITCMLPEN + D1ITCM Block Clock Enable During CSleep + mode + 30 + 1 + + + AXISRAMLPEN + AXISRAM Block Clock Enable During CSleep + mode + 31 + 1 + + + + + AHB1LPENR + AHB1LPENR + RCC AHB1 Sleep Clock Register + 0x100 + 0x20 + read-write + 0x00000000 + + + DMA1LPEN + DMA1 Clock Enable During CSleep + Mode + 0 + 1 + + + DMA2LPEN + DMA2 Clock Enable During CSleep + Mode + 1 + 1 + + + ADC12LPEN + ADC1/2 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + ETH1MACLPEN + Ethernet MAC bus interface Clock Enable + During CSleep Mode + 15 + 1 + + + ETH1TXLPEN + Ethernet Transmission Clock Enable + During CSleep Mode + 16 + 1 + + + ETH1RXLPEN + Ethernet Reception Clock Enable During + CSleep Mode + 17 + 1 + + + USB1OTGHSLPEN + USB1OTG peripheral clock enable during + CSleep mode + 25 + 1 + + + USB1OTGHSULPILPEN + USB_PHY1 clock enable during CSleep + mode + 26 + 1 + + + USB2OTGHSLPEN + USB2OTG peripheral clock enable during + CSleep mode + 27 + 1 + + + USB2OTGHSULPILPEN + USB_PHY2 clocks enable during CSleep + mode + 28 + 1 + + + + + C1_AHB1LPENR + C1_AHB1LPENR + RCC AHB1 Sleep Clock Register + 0x160 + 0x20 + read-write + 0x00000000 + + + DMA1LPEN + DMA1 Clock Enable During CSleep + Mode + 0 + 1 + + + DMA2LPEN + DMA2 Clock Enable During CSleep + Mode + 1 + 1 + + + ADC12LPEN + ADC1/2 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + ETH1MACLPEN + Ethernet MAC bus interface Clock Enable + During CSleep Mode + 15 + 1 + + + ETH1TXLPEN + Ethernet Transmission Clock Enable + During CSleep Mode + 16 + 1 + + + ETH1RXLPEN + Ethernet Reception Clock Enable During + CSleep Mode + 17 + 1 + + + USB1OTGLPEN + USB1OTG peripheral clock enable during + CSleep mode + 25 + 1 + + + USB1ULPILPEN + USB_PHY1 clock enable during CSleep + mode + 26 + 1 + + + USB2OTGLPEN + USB2OTG peripheral clock enable during + CSleep mode + 27 + 1 + + + USB2ULPILPEN + USB_PHY2 clocks enable during CSleep + mode + 28 + 1 + + + + + C1_AHB2LPENR + C1_AHB2LPENR + RCC AHB2 Sleep Clock Register + 0x164 + 0x20 + read-write + 0x00000000 + + + CAMITFLPEN + CAMITF peripheral clock enable during + CSleep mode + 0 + 1 + + + CRYPTLPEN + CRYPT peripheral clock enable during + CSleep mode + 4 + 1 + + + HASHLPEN + HASH peripheral clock enable during + CSleep mode + 5 + 1 + + + SDMMC2LPEN + SDMMC2 and SDMMC2 Delay Clock Enable + During CSleep Mode + 9 + 1 + + + RNGLPEN + RNG peripheral clock enable during + CSleep mode + 6 + 1 + + + SRAM1LPEN + SRAM1 Clock Enable During CSleep + Mode + 29 + 1 + + + SRAM2LPEN + SRAM2 Clock Enable During CSleep + Mode + 30 + 1 + + + SRAM3LPEN + SRAM3 Clock Enable During CSleep + Mode + 31 + 1 + + + + + AHB2LPENR + AHB2LPENR + RCC AHB2 Sleep Clock Register + 0x104 + 0x20 + read-write + 0x00000000 + + + CAMITFLPEN + CAMITF peripheral clock enable during + CSleep mode + 0 + 1 + + + CRYPTLPEN + CRYPT peripheral clock enable during + CSleep mode + 4 + 1 + + + HASHLPEN + HASH peripheral clock enable during + CSleep mode + 5 + 1 + + + SDMMC2LPEN + SDMMC2 and SDMMC2 Delay Clock Enable + During CSleep Mode + 9 + 1 + + + RNGLPEN + RNG peripheral clock enable during + CSleep mode + 6 + 1 + + + SRAM1LPEN + SRAM1 Clock Enable During CSleep + Mode + 29 + 1 + + + SRAM2LPEN + SRAM2 Clock Enable During CSleep + Mode + 30 + 1 + + + SRAM3LPEN + SRAM3 Clock Enable During CSleep + Mode + 31 + 1 + + + + + AHB4LPENR + AHB4LPENR + RCC AHB4 Sleep Clock Register + 0x108 + 0x20 + read-write + 0x00000000 + + + GPIOALPEN + GPIO peripheral clock enable during + CSleep mode + 0 + 1 + + + GPIOBLPEN + GPIO peripheral clock enable during + CSleep mode + 1 + 1 + + + GPIOCLPEN + GPIO peripheral clock enable during + CSleep mode + 2 + 1 + + + GPIODLPEN + GPIO peripheral clock enable during + CSleep mode + 3 + 1 + + + GPIOELPEN + GPIO peripheral clock enable during + CSleep mode + 4 + 1 + + + GPIOFLPEN + GPIO peripheral clock enable during + CSleep mode + 5 + 1 + + + GPIOGLPEN + GPIO peripheral clock enable during + CSleep mode + 6 + 1 + + + GPIOHLPEN + GPIO peripheral clock enable during + CSleep mode + 7 + 1 + + + GPIOILPEN + GPIO peripheral clock enable during + CSleep mode + 8 + 1 + + + GPIOJLPEN + GPIO peripheral clock enable during + CSleep mode + 9 + 1 + + + GPIOKLPEN + GPIO peripheral clock enable during + CSleep mode + 10 + 1 + + + CRCLPEN + CRC peripheral clock enable during + CSleep mode + 19 + 1 + + + BDMALPEN + BDMA Clock Enable During CSleep + Mode + 21 + 1 + + + ADC3LPEN + ADC3 Peripheral Clocks Enable During + CSleep Mode + 24 + 1 + + + BKPRAMLPEN + Backup RAM Clock Enable During CSleep + Mode + 28 + 1 + + + SRAM4LPEN + SRAM4 Clock Enable During CSleep + Mode + 29 + 1 + + + + + C1_AHB4LPENR + C1_AHB4LPENR + RCC AHB4 Sleep Clock Register + 0x168 + 0x20 + read-write + 0x00000000 + + + GPIOALPEN + GPIO peripheral clock enable during + CSleep mode + 0 + 1 + + + GPIOBLPEN + GPIO peripheral clock enable during + CSleep mode + 1 + 1 + + + GPIOCLPEN + GPIO peripheral clock enable during + CSleep mode + 2 + 1 + + + GPIODLPEN + GPIO peripheral clock enable during + CSleep mode + 3 + 1 + + + GPIOELPEN + GPIO peripheral clock enable during + CSleep mode + 4 + 1 + + + GPIOFLPEN + GPIO peripheral clock enable during + CSleep mode + 5 + 1 + + + GPIOGLPEN + GPIO peripheral clock enable during + CSleep mode + 6 + 1 + + + GPIOHLPEN + GPIO peripheral clock enable during + CSleep mode + 7 + 1 + + + GPIOILPEN + GPIO peripheral clock enable during + CSleep mode + 8 + 1 + + + GPIOJLPEN + GPIO peripheral clock enable during + CSleep mode + 9 + 1 + + + GPIOKLPEN + GPIO peripheral clock enable during + CSleep mode + 10 + 1 + + + CRCLPEN + CRC peripheral clock enable during + CSleep mode + 19 + 1 + + + BDMALPEN + BDMA Clock Enable During CSleep + Mode + 21 + 1 + + + ADC3LPEN + ADC3 Peripheral Clocks Enable During + CSleep Mode + 24 + 1 + + + BKPRAMLPEN + Backup RAM Clock Enable During CSleep + Mode + 28 + 1 + + + SRAM4LPEN + SRAM4 Clock Enable During CSleep + Mode + 29 + 1 + + + + + C1_APB3LPENR + C1_APB3LPENR + RCC APB3 Sleep Clock Register + 0x16C + 0x20 + read-write + 0x00000000 + + + LTDCLPEN + LTDC peripheral clock enable during + CSleep mode + 3 + 1 + + + WWDG1LPEN + WWDG1 Clock Enable During CSleep + Mode + 6 + 1 + + + + + APB3LPENR + APB3LPENR + RCC APB3 Sleep Clock Register + 0x10C + 0x20 + read-write + 0x00000000 + + + LTDCLPEN + LTDC peripheral clock enable during + CSleep mode + 3 + 1 + + + WWDG1LPEN + WWDG1 Clock Enable During CSleep + Mode + 6 + 1 + + + + + APB1LLPENR + APB1LLPENR + RCC APB1 Low Sleep Clock + Register + 0x110 + 0x20 + read-write + 0x00000000 + + + TIM2LPEN + TIM2 peripheral clock enable during + CSleep mode + 0 + 1 + + + TIM3LPEN + TIM3 peripheral clock enable during + CSleep mode + 1 + 1 + + + TIM4LPEN + TIM4 peripheral clock enable during + CSleep mode + 2 + 1 + + + TIM5LPEN + TIM5 peripheral clock enable during + CSleep mode + 3 + 1 + + + TIM6LPEN + TIM6 peripheral clock enable during + CSleep mode + 4 + 1 + + + TIM7LPEN + TIM7 peripheral clock enable during + CSleep mode + 5 + 1 + + + TIM12LPEN + TIM12 peripheral clock enable during + CSleep mode + 6 + 1 + + + TIM13LPEN + TIM13 peripheral clock enable during + CSleep mode + 7 + 1 + + + TIM14LPEN + TIM14 peripheral clock enable during + CSleep mode + 8 + 1 + + + LPTIM1LPEN + LPTIM1 Peripheral Clocks Enable During + CSleep Mode + 9 + 1 + + + SPI2LPEN + SPI2 Peripheral Clocks Enable During + CSleep Mode + 14 + 1 + + + SPI3LPEN + SPI3 Peripheral Clocks Enable During + CSleep Mode + 15 + 1 + + + SPDIFRXLPEN + SPDIFRX Peripheral Clocks Enable During + CSleep Mode + 16 + 1 + + + USART2LPEN + USART2 Peripheral Clocks Enable During + CSleep Mode + 17 + 1 + + + USART3LPEN + USART3 Peripheral Clocks Enable During + CSleep Mode + 18 + 1 + + + UART4LPEN + UART4 Peripheral Clocks Enable During + CSleep Mode + 19 + 1 + + + UART5LPEN + UART5 Peripheral Clocks Enable During + CSleep Mode + 20 + 1 + + + I2C1LPEN + I2C1 Peripheral Clocks Enable During + CSleep Mode + 21 + 1 + + + I2C2LPEN + I2C2 Peripheral Clocks Enable During + CSleep Mode + 22 + 1 + + + I2C3LPEN + I2C3 Peripheral Clocks Enable During + CSleep Mode + 23 + 1 + + + HDMICECLPEN + HDMI-CEC Peripheral Clocks Enable During + CSleep Mode + 27 + 1 + + + DAC12LPEN + DAC1/2 peripheral clock enable during + CSleep mode + 29 + 1 + + + USART7LPEN + USART7 Peripheral Clocks Enable During + CSleep Mode + 30 + 1 + + + USART8LPEN + USART8 Peripheral Clocks Enable During + CSleep Mode + 31 + 1 + + + + + C1_APB1LLPENR + C1_APB1LLPENR + RCC APB1 Low Sleep Clock + Register + 0x170 + 0x20 + read-write + 0x00000000 + + + TIM2LPEN + TIM2 peripheral clock enable during + CSleep mode + 0 + 1 + + + TIM3LPEN + TIM3 peripheral clock enable during + CSleep mode + 1 + 1 + + + TIM4LPEN + TIM4 peripheral clock enable during + CSleep mode + 2 + 1 + + + TIM5LPEN + TIM5 peripheral clock enable during + CSleep mode + 3 + 1 + + + TIM6LPEN + TIM6 peripheral clock enable during + CSleep mode + 4 + 1 + + + TIM7LPEN + TIM7 peripheral clock enable during + CSleep mode + 5 + 1 + + + TIM12LPEN + TIM12 peripheral clock enable during + CSleep mode + 6 + 1 + + + TIM13LPEN + TIM13 peripheral clock enable during + CSleep mode + 7 + 1 + + + TIM14LPEN + TIM14 peripheral clock enable during + CSleep mode + 8 + 1 + + + LPTIM1LPEN + LPTIM1 Peripheral Clocks Enable During + CSleep Mode + 9 + 1 + + + SPI2LPEN + SPI2 Peripheral Clocks Enable During + CSleep Mode + 14 + 1 + + + SPI3LPEN + SPI3 Peripheral Clocks Enable During + CSleep Mode + 15 + 1 + + + SPDIFRXLPEN + SPDIFRX Peripheral Clocks Enable During + CSleep Mode + 16 + 1 + + + USART2LPEN + USART2 Peripheral Clocks Enable During + CSleep Mode + 17 + 1 + + + USART3LPEN + USART3 Peripheral Clocks Enable During + CSleep Mode + 18 + 1 + + + UART4LPEN + UART4 Peripheral Clocks Enable During + CSleep Mode + 19 + 1 + + + UART5LPEN + UART5 Peripheral Clocks Enable During + CSleep Mode + 20 + 1 + + + I2C1LPEN + I2C1 Peripheral Clocks Enable During + CSleep Mode + 21 + 1 + + + I2C2LPEN + I2C2 Peripheral Clocks Enable During + CSleep Mode + 22 + 1 + + + I2C3LPEN + I2C3 Peripheral Clocks Enable During + CSleep Mode + 23 + 1 + + + HDMICECLPEN + HDMI-CEC Peripheral Clocks Enable During + CSleep Mode + 27 + 1 + + + DAC12LPEN + DAC1/2 peripheral clock enable during + CSleep mode + 29 + 1 + + + USART7LPEN + USART7 Peripheral Clocks Enable During + CSleep Mode + 30 + 1 + + + USART8LPEN + USART8 Peripheral Clocks Enable During + CSleep Mode + 31 + 1 + + + + + C1_APB1HLPENR + C1_APB1HLPENR + RCC APB1 High Sleep Clock + Register + 0x174 + 0x20 + read-write + 0x00000000 + + + CRSLPEN + Clock Recovery System peripheral clock + enable during CSleep mode + 1 + 1 + + + SWPLPEN + SWPMI Peripheral Clocks Enable During + CSleep Mode + 2 + 1 + + + OPAMPLPEN + OPAMP peripheral clock enable during + CSleep mode + 4 + 1 + + + MDIOSLPEN + MDIOS peripheral clock enable during + CSleep mode + 5 + 1 + + + FDCANLPEN + FDCAN Peripheral Clocks Enable During + CSleep Mode + 8 + 1 + + + + + APB1HLPENR + APB1HLPENR + RCC APB1 High Sleep Clock + Register + 0x114 + 0x20 + read-write + 0x00000000 + + + CRSLPEN + Clock Recovery System peripheral clock + enable during CSleep mode + 1 + 1 + + + SWPLPEN + SWPMI Peripheral Clocks Enable During + CSleep Mode + 2 + 1 + + + OPAMPLPEN + OPAMP peripheral clock enable during + CSleep mode + 4 + 1 + + + MDIOSLPEN + MDIOS peripheral clock enable during + CSleep mode + 5 + 1 + + + FDCANLPEN + FDCAN Peripheral Clocks Enable During + CSleep Mode + 8 + 1 + + + + + APB2LPENR + APB2LPENR + RCC APB2 Sleep Clock Register + 0x118 + 0x20 + read-write + 0x00000000 + + + TIM1LPEN + TIM1 peripheral clock enable during + CSleep mode + 0 + 1 + + + TIM8LPEN + TIM8 peripheral clock enable during + CSleep mode + 1 + 1 + + + USART1LPEN + USART1 Peripheral Clocks Enable During + CSleep Mode + 4 + 1 + + + USART6LPEN + USART6 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + SPI1LPEN + SPI1 Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + SPI4LPEN + SPI4 Peripheral Clocks Enable During + CSleep Mode + 13 + 1 + + + TIM15LPEN + TIM15 peripheral clock enable during + CSleep mode + 16 + 1 + + + TIM16LPEN + TIM16 peripheral clock enable during + CSleep mode + 17 + 1 + + + TIM17LPEN + TIM17 peripheral clock enable during + CSleep mode + 18 + 1 + + + SPI5LPEN + SPI5 Peripheral Clocks Enable During + CSleep Mode + 20 + 1 + + + SAI1LPEN + SAI1 Peripheral Clocks Enable During + CSleep Mode + 22 + 1 + + + SAI2LPEN + SAI2 Peripheral Clocks Enable During + CSleep Mode + 23 + 1 + + + SAI3LPEN + SAI3 Peripheral Clocks Enable During + CSleep Mode + 24 + 1 + + + DFSDM1LPEN + DFSDM1 Peripheral Clocks Enable During + CSleep Mode + 28 + 1 + + + HRTIMLPEN + HRTIM peripheral clock enable during + CSleep mode + 29 + 1 + + + + + C1_APB2LPENR + C1_APB2LPENR + RCC APB2 Sleep Clock Register + 0x178 + 0x20 + read-write + 0x00000000 + + + TIM1LPEN + TIM1 peripheral clock enable during + CSleep mode + 0 + 1 + + + TIM8LPEN + TIM8 peripheral clock enable during + CSleep mode + 1 + 1 + + + USART1LPEN + USART1 Peripheral Clocks Enable During + CSleep Mode + 4 + 1 + + + USART6LPEN + USART6 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + SPI1LPEN + SPI1 Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + SPI4LPEN + SPI4 Peripheral Clocks Enable During + CSleep Mode + 13 + 1 + + + TIM15LPEN + TIM15 peripheral clock enable during + CSleep mode + 16 + 1 + + + TIM16LPEN + TIM16 peripheral clock enable during + CSleep mode + 17 + 1 + + + TIM17LPEN + TIM17 peripheral clock enable during + CSleep mode + 18 + 1 + + + SPI5LPEN + SPI5 Peripheral Clocks Enable During + CSleep Mode + 20 + 1 + + + SAI1LPEN + SAI1 Peripheral Clocks Enable During + CSleep Mode + 22 + 1 + + + SAI2LPEN + SAI2 Peripheral Clocks Enable During + CSleep Mode + 23 + 1 + + + SAI3LPEN + SAI3 Peripheral Clocks Enable During + CSleep Mode + 24 + 1 + + + DFSDM1LPEN + DFSDM1 Peripheral Clocks Enable During + CSleep Mode + 28 + 1 + + + HRTIMLPEN + HRTIM peripheral clock enable during + CSleep mode + 29 + 1 + + + + + C1_APB4LPENR + C1_APB4LPENR + RCC APB4 Sleep Clock Register + 0x17C + 0x20 + read-write + 0x00000000 + + + SYSCFGLPEN + SYSCFG peripheral clock enable during + CSleep mode + 1 + 1 + + + LPUART1LPEN + LPUART1 Peripheral Clocks Enable During + CSleep Mode + 3 + 1 + + + SPI6LPEN + SPI6 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + I2C4LPEN + I2C4 Peripheral Clocks Enable During + CSleep Mode + 7 + 1 + + + LPTIM2LPEN + LPTIM2 Peripheral Clocks Enable During + CSleep Mode + 9 + 1 + + + LPTIM3LPEN + LPTIM3 Peripheral Clocks Enable During + CSleep Mode + 10 + 1 + + + LPTIM4LPEN + LPTIM4 Peripheral Clocks Enable During + CSleep Mode + 11 + 1 + + + LPTIM5LPEN + LPTIM5 Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + COMP12LPEN + COMP1/2 peripheral clock enable during + CSleep mode + 14 + 1 + + + VREFLPEN + VREF peripheral clock enable during + CSleep mode + 15 + 1 + + + RTCAPBLPEN + RTC APB Clock Enable During CSleep + Mode + 16 + 1 + + + SAI4LPEN + SAI4 Peripheral Clocks Enable During + CSleep Mode + 21 + 1 + + + + + APB4LPENR + APB4LPENR + RCC APB4 Sleep Clock Register + 0x11C + 0x20 + read-write + 0x00000000 + + + SYSCFGLPEN + SYSCFG peripheral clock enable during + CSleep mode + 1 + 1 + + + LPUART1LPEN + LPUART1 Peripheral Clocks Enable During + CSleep Mode + 3 + 1 + + + SPI6LPEN + SPI6 Peripheral Clocks Enable During + CSleep Mode + 5 + 1 + + + I2C4LPEN + I2C4 Peripheral Clocks Enable During + CSleep Mode + 7 + 1 + + + LPTIM2LPEN + LPTIM2 Peripheral Clocks Enable During + CSleep Mode + 9 + 1 + + + LPTIM3LPEN + LPTIM3 Peripheral Clocks Enable During + CSleep Mode + 10 + 1 + + + LPTIM4LPEN + LPTIM4 Peripheral Clocks Enable During + CSleep Mode + 11 + 1 + + + LPTIM5LPEN + LPTIM5 Peripheral Clocks Enable During + CSleep Mode + 12 + 1 + + + COMP12LPEN + COMP1/2 peripheral clock enable during + CSleep mode + 14 + 1 + + + VREFLPEN + VREF peripheral clock enable during + CSleep mode + 15 + 1 + + + RTCAPBLPEN + RTC APB Clock Enable During CSleep + Mode + 16 + 1 + + + SAI4LPEN + SAI4 Peripheral Clocks Enable During + CSleep Mode + 21 + 1 + + + + + + + LPTIM1 + Low power timer + LPTIM + 0x40002400 + + 0x0 + 0x400 + registers + + + LPTIM1 + LPTIM1 global interrupt + 93 + + + + ISR + ISR + Interrupt and Status Register + 0x0 + 0x20 + read-only + 0x00000000 + + + DOWN + Counter direction change up to + down + 6 + 1 + + + UP + Counter direction change down to + up + 5 + 1 + + + ARROK + Autoreload register update + OK + 4 + 1 + + + CMPOK + Compare register update OK + 3 + 1 + + + EXTTRIG + External trigger edge + event + 2 + 1 + + + ARRM + Autoreload match + 1 + 1 + + + CMPM + Compare match + 0 + 1 + + + + + ICR + ICR + Interrupt Clear Register + 0x4 + 0x20 + write-only + 0x00000000 + + + DOWNCF + Direction change to down Clear + Flag + 6 + 1 + + + UPCF + Direction change to UP Clear + Flag + 5 + 1 + + + ARROKCF + Autoreload register update OK Clear + Flag + 4 + 1 + + + CMPOKCF + Compare register update OK Clear + Flag + 3 + 1 + + + EXTTRIGCF + External trigger valid edge Clear + Flag + 2 + 1 + + + ARRMCF + Autoreload match Clear + Flag + 1 + 1 + + + CMPMCF + compare match Clear Flag + 0 + 1 + + + + + IER + IER + Interrupt Enable Register + 0x8 + 0x20 + read-write + 0x00000000 + + + DOWNIE + Direction change to down Interrupt + Enable + 6 + 1 + + + UPIE + Direction change to UP Interrupt + Enable + 5 + 1 + + + ARROKIE + Autoreload register update OK Interrupt + Enable + 4 + 1 + + + CMPOKIE + Compare register update OK Interrupt + Enable + 3 + 1 + + + EXTTRIGIE + External trigger valid edge Interrupt + Enable + 2 + 1 + + + ARRMIE + Autoreload match Interrupt + Enable + 1 + 1 + + + CMPMIE + Compare match Interrupt + Enable + 0 + 1 + + + + + CFGR + CFGR + Configuration Register + 0xC + 0x20 + read-write + 0x00000000 + + + ENC + Encoder mode enable + 24 + 1 + + + COUNTMODE + counter mode enabled + 23 + 1 + + + PRELOAD + Registers update mode + 22 + 1 + + + WAVPOL + Waveform shape polarity + 21 + 1 + + + WAVE + Waveform shape + 20 + 1 + + + TIMOUT + Timeout enable + 19 + 1 + + + TRIGEN + Trigger enable and + polarity + 17 + 2 + + + TRIGSEL + Trigger selector + 13 + 3 + + + PRESC + Clock prescaler + 9 + 3 + + + TRGFLT + Configurable digital filter for + trigger + 6 + 2 + + + CKFLT + Configurable digital filter for external + clock + 3 + 2 + + + CKPOL + Clock Polarity + 1 + 2 + + + CKSEL + Clock selector + 0 + 1 + + + + + CR + CR + Control Register + 0x10 + 0x20 + read-write + 0x00000000 + + + ENABLE + LPTIM Enable + 0 + 1 + + + SNGSTRT + LPTIM start in single mode + 1 + 1 + + + CNTSTRT + Timer start in continuous + mode + 2 + 1 + + + COUNTRST + Counter reset + 3 + 1 + + + RSTARE + Reset after read enable + 4 + 1 + + + + + CMP + CMP + Compare Register + 0x14 + 0x20 + read-write + 0x00000000 + + + CMP + Compare value + 0 + 16 + + + + + ARR + ARR + Autoreload Register + 0x18 + 0x20 + read-write + 0x00000001 + + + ARR + Auto reload value + 0 + 16 + + + + + CNT + CNT + Counter Register + 0x1C + 0x20 + read-only + 0x00000000 + + + CNT + Counter value + 0 + 16 + + + + + CFGR2 + CFGR2 + LPTIM configuration register 2 + 0x24 + 0x20 + read-write + 0x00000000 + + + IN1SEL + LPTIM Input 1 selection + 0 + 2 + + + IN2SEL + LPTIM Input 2 selection + 4 + 2 + + + + + + + LPTIM2 + 0x58002400 + + LPTIM2 + LPTIM2 timer interrupt + 138 + + + + LPTIM3 + Low power timer + LPTIM + 0x58002800 + + 0x0 + 0x400 + registers + + + LPTIM3 + LPTIM2 timer interrupt + 139 + + + + ISR + ISR + Interrupt and Status Register + 0x0 + 0x20 + read-only + 0x00000000 + + + DOWN + Counter direction change up to + down + 6 + 1 + + + UP + Counter direction change down to + up + 5 + 1 + + + ARROK + Autoreload register update + OK + 4 + 1 + + + CMPOK + Compare register update OK + 3 + 1 + + + EXTTRIG + External trigger edge + event + 2 + 1 + + + ARRM + Autoreload match + 1 + 1 + + + CMPM + Compare match + 0 + 1 + + + + + ICR + ICR + Interrupt Clear Register + 0x4 + 0x20 + write-only + 0x00000000 + + + DOWNCF + Direction change to down Clear + Flag + 6 + 1 + + + UPCF + Direction change to UP Clear + Flag + 5 + 1 + + + ARROKCF + Autoreload register update OK Clear + Flag + 4 + 1 + + + CMPOKCF + Compare register update OK Clear + Flag + 3 + 1 + + + EXTTRIGCF + External trigger valid edge Clear + Flag + 2 + 1 + + + ARRMCF + Autoreload match Clear + Flag + 1 + 1 + + + CMPMCF + compare match Clear Flag + 0 + 1 + + + + + IER + IER + Interrupt Enable Register + 0x8 + 0x20 + read-write + 0x00000000 + + + DOWNIE + Direction change to down Interrupt + Enable + 6 + 1 + + + UPIE + Direction change to UP Interrupt + Enable + 5 + 1 + + + ARROKIE + Autoreload register update OK Interrupt + Enable + 4 + 1 + + + CMPOKIE + Compare register update OK Interrupt + Enable + 3 + 1 + + + EXTTRIGIE + External trigger valid edge Interrupt + Enable + 2 + 1 + + + ARRMIE + Autoreload match Interrupt + Enable + 1 + 1 + + + CMPMIE + Compare match Interrupt + Enable + 0 + 1 + + + + + CFGR + CFGR + Configuration Register + 0xC + 0x20 + read-write + 0x00000000 + + + ENC + Encoder mode enable + 24 + 1 + + + COUNTMODE + counter mode enabled + 23 + 1 + + + PRELOAD + Registers update mode + 22 + 1 + + + WAVPOL + Waveform shape polarity + 21 + 1 + + + WAVE + Waveform shape + 20 + 1 + + + TIMOUT + Timeout enable + 19 + 1 + + + TRIGEN + Trigger enable and + polarity + 17 + 2 + + + TRIGSEL + Trigger selector + 13 + 3 + + + PRESC + Clock prescaler + 9 + 3 + + + TRGFLT + Configurable digital filter for + trigger + 6 + 2 + + + CKFLT + Configurable digital filter for external + clock + 3 + 2 + + + CKPOL + Clock Polarity + 1 + 2 + + + CKSEL + Clock selector + 0 + 1 + + + + + CR + CR + Control Register + 0x10 + 0x20 + read-write + 0x00000000 + + + ENABLE + LPTIM Enable + 0 + 1 + + + SNGSTRT + LPTIM start in single mode + 1 + 1 + + + CNTSTRT + Timer start in continuous + mode + 2 + 1 + + + COUNTRST + Counter reset + 3 + 1 + + + RSTARE + Reset after read enable + 4 + 1 + + + + + CMP + CMP + Compare Register + 0x14 + 0x20 + read-write + 0x00000000 + + + CMP + Compare value + 0 + 16 + + + + + ARR + ARR + Autoreload Register + 0x18 + 0x20 + read-write + 0x00000001 + + + ARR + Auto reload value + 0 + 16 + + + + + CNT + CNT + Counter Register + 0x1C + 0x20 + read-only + 0x00000000 + + + CNT + Counter value + 0 + 16 + + + + + CFGR2 + CFGR2 + LPTIM configuration register 2 + 0x24 + 0x20 + read-write + 0x00000000 + + + IN1SEL + LPTIM Input 1 selection + 0 + 2 + + + + + + + LPTIM4 + 0x58002C00 + + ETH_WKUP + Ethernet wakeup through EXTI + 62 + + + LPTIM4 + LPTIM2 timer interrupt + 140 + + + + LPTIM5 + 0x58003000 + + LPTIM5 + LPTIM2 timer interrupt + 141 + + + + LPUART1 + LPUART1 + LPUART + 0x58000C00 + + 0x0 + 0x400 + registers + + + LPUART + LPUART global interrupt + 142 + + + + CR1 + CR1 + Control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + RXFFIE + RXFIFO Full interrupt + enable + 31 + 1 + + + TXFEIE + TXFIFO empty interrupt + enable + 30 + 1 + + + FIFOEN + FIFO mode enable + 29 + 1 + + + M1 + Word length + 28 + 1 + + + DEAT + Driver Enable assertion + time + 21 + 5 + + + DEDT + Driver Enable deassertion + time + 16 + 5 + + + CMIE + Character match interrupt + enable + 14 + 1 + + + MME + Mute mode enable + 13 + 1 + + + M0 + Word length + 12 + 1 + + + WAKE + Receiver wakeup method + 11 + 1 + + + PCE + Parity control enable + 10 + 1 + + + PS + Parity selection + 9 + 1 + + + PEIE + PE interrupt enable + 8 + 1 + + + TXEIE + interrupt enable + 7 + 1 + + + TCIE + Transmission complete interrupt + enable + 6 + 1 + + + RXNEIE + RXNE interrupt enable + 5 + 1 + + + IDLEIE + IDLE interrupt enable + 4 + 1 + + + TE + Transmitter enable + 3 + 1 + + + RE + Receiver enable + 2 + 1 + + + UESM + USART enable in Stop mode + 1 + 1 + + + UE + USART enable + 0 + 1 + + + + + CR2 + CR2 + Control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + ADD + Address of the USART node + 24 + 8 + + + MSBFIRST + Most significant bit first + 19 + 1 + + + DATAINV + Binary data inversion + 18 + 1 + + + TXINV + TX pin active level + inversion + 17 + 1 + + + RXINV + RX pin active level + inversion + 16 + 1 + + + SWAP + Swap TX/RX pins + 15 + 1 + + + STOP + STOP bits + 12 + 2 + + + ADDM7 + 7-bit Address Detection/4-bit Address + Detection + 4 + 1 + + + + + CR3 + CR3 + Control register 3 + 0x8 + 0x20 + read-write + 0x0000 + + + TXFTCFG + TXFIFO threshold + configuration + 29 + 3 + + + RXFTIE + RXFIFO threshold interrupt + enable + 28 + 1 + + + RXFTCFG + Receive FIFO threshold + configuration + 25 + 3 + + + TXFTIE + TXFIFO threshold interrupt + enable + 23 + 1 + + + WUFIE + Wakeup from Stop mode interrupt + enable + 22 + 1 + + + WUS + Wakeup from Stop mode interrupt flag + selection + 20 + 2 + + + DEP + Driver enable polarity + selection + 15 + 1 + + + DEM + Driver enable mode + 14 + 1 + + + DDRE + DMA Disable on Reception + Error + 13 + 1 + + + OVRDIS + Overrun Disable + 12 + 1 + + + CTSIE + CTS interrupt enable + 10 + 1 + + + CTSE + CTS enable + 9 + 1 + + + RTSE + RTS enable + 8 + 1 + + + DMAT + DMA enable transmitter + 7 + 1 + + + DMAR + DMA enable receiver + 6 + 1 + + + HDSEL + Half-duplex selection + 3 + 1 + + + EIE + Error interrupt enable + 0 + 1 + + + + + BRR + BRR + Baud rate register + 0xC + 0x20 + read-write + 0x0000 + + + BRR + BRR + 0 + 20 + + + + + GTPR + GTPR + Guard time and prescaler + register + 0x10 + 0x20 + read-write + 0x0000 + + + GT + Guard time value + 8 + 8 + + + PSC + Prescaler value + 0 + 8 + + + + + RTOR + RTOR + Receiver timeout register + 0x14 + 0x20 + read-write + 0x0000 + + + BLEN + Block Length + 24 + 8 + + + RTO + Receiver timeout value + 0 + 24 + + + + + RQR + RQR + Request register + 0x18 + 0x20 + write-only + 0x0000 + + + TXFRQ + Transmit data flush + request + 4 + 1 + + + RXFRQ + Receive data flush request + 3 + 1 + + + MMRQ + Mute mode request + 2 + 1 + + + SBKRQ + Send break request + 1 + 1 + + + ABRRQ + Auto baud rate request + 0 + 1 + + + + + ISR + ISR + Interrupt & status + register + 0x1C + 0x20 + read-only + 0x00C0 + + + TXFT + TXFIFO threshold flag + 27 + 1 + + + RXFT + RXFIFO threshold flag + 26 + 1 + + + RXFF + RXFIFO Full + 24 + 1 + + + TXFE + TXFIFO Empty + 23 + 1 + + + REACK + REACK + 22 + 1 + + + TEACK + TEACK + 21 + 1 + + + WUF + WUF + 20 + 1 + + + RWU + RWU + 19 + 1 + + + SBKF + SBKF + 18 + 1 + + + CMF + CMF + 17 + 1 + + + BUSY + BUSY + 16 + 1 + + + CTS + CTS + 10 + 1 + + + CTSIF + CTSIF + 9 + 1 + + + TXE + TXE + 7 + 1 + + + TC + TC + 6 + 1 + + + RXNE + RXNE + 5 + 1 + + + IDLE + IDLE + 4 + 1 + + + ORE + ORE + 3 + 1 + + + NE + NE + 2 + 1 + + + FE + FE + 1 + 1 + + + PE + PE + 0 + 1 + + + + + ICR + ICR + Interrupt flag clear register + 0x20 + 0x20 + write-only + 0x0000 + + + WUCF + Wakeup from Stop mode clear + flag + 20 + 1 + + + CMCF + Character match clear flag + 17 + 1 + + + CTSCF + CTS clear flag + 9 + 1 + + + TCCF + Transmission complete clear + flag + 6 + 1 + + + IDLECF + Idle line detected clear + flag + 4 + 1 + + + ORECF + Overrun error clear flag + 3 + 1 + + + NCF + Noise detected clear flag + 2 + 1 + + + FECF + Framing error clear flag + 1 + 1 + + + PECF + Parity error clear flag + 0 + 1 + + + + + RDR + RDR + Receive data register + 0x24 + 0x20 + read-only + 0x0000 + + + RDR + Receive data value + 0 + 9 + + + + + TDR + TDR + Transmit data register + 0x28 + 0x20 + read-write + 0x0000 + + + TDR + Transmit data value + 0 + 9 + + + + + PRESC + PRESC + Prescaler register + 0x2C + 0x20 + read-write + 0x0000 + + + PRESCALER + Clock prescaler + 0 + 4 + + + + + + + SYSCFG + System configuration controller + SYSCFG + 0x58000400 + + 0x0 + 0x400 + registers + + + + PMCR + PMCR + peripheral mode configuration + register + 0x4 + 0x20 + read-write + 0x00000000 + + + I2C1FMP + I2C1 Fm+ + 0 + 1 + + + I2C2FMP + I2C2 Fm+ + 1 + 1 + + + I2C3FMP + I2C3 Fm+ + 2 + 1 + + + I2C4FMP + I2C4 Fm+ + 3 + 1 + + + PB6FMP + PB(6) Fm+ + 4 + 1 + + + PB7FMP + PB(7) Fast Mode Plus + 5 + 1 + + + PB8FMP + PB(8) Fast Mode Plus + 6 + 1 + + + PB9FMP + PB(9) Fm+ + 7 + 1 + + + BOOSTE + Booster Enable + 8 + 1 + + + BOOSTVDDSEL + Analog switch supply voltage selection + 9 + 1 + + + EPIS + Ethernet PHY Interface + Selection + 21 + 3 + + + PA0SO + PA0 Switch Open + 24 + 1 + + + PA1SO + PA1 Switch Open + 25 + 1 + + + PC2SO + PC2 Switch Open + 26 + 1 + + + PC3SO + PC3 Switch Open + 27 + 1 + + + + + EXTICR1 + EXTICR1 + external interrupt configuration register + 1 + 0x8 + 0x20 + read-write + 0x0000 + + + EXTI3 + EXTI x configuration (x = 0 to + 3) + 12 + 4 + + + EXTI2 + EXTI x configuration (x = 0 to + 3) + 8 + 4 + + + EXTI1 + EXTI x configuration (x = 0 to + 3) + 4 + 4 + + + EXTI0 + EXTI x configuration (x = 0 to + 3) + 0 + 4 + + + + + EXTICR2 + EXTICR2 + external interrupt configuration register + 2 + 0xC + 0x20 + read-write + 0x0000 + + + EXTI7 + EXTI x configuration (x = 4 to + 7) + 12 + 4 + + + EXTI6 + EXTI x configuration (x = 4 to + 7) + 8 + 4 + + + EXTI5 + EXTI x configuration (x = 4 to + 7) + 4 + 4 + + + EXTI4 + EXTI x configuration (x = 4 to + 7) + 0 + 4 + + + + + EXTICR3 + EXTICR3 + external interrupt configuration register + 3 + 0x10 + 0x20 + read-write + 0x0000 + + + EXTI11 + EXTI x configuration (x = 8 to + 11) + 12 + 4 + + + EXTI10 + EXTI10 + 8 + 4 + + + EXTI9 + EXTI x configuration (x = 8 to + 11) + 4 + 4 + + + EXTI8 + EXTI x configuration (x = 8 to + 11) + 0 + 4 + + + + + EXTICR4 + EXTICR4 + external interrupt configuration register + 4 + 0x14 + 0x20 + read-write + 0x0000 + + + EXTI15 + EXTI x configuration (x = 12 to + 15) + 12 + 4 + + + EXTI14 + EXTI x configuration (x = 12 to + 15) + 8 + 4 + + + EXTI13 + EXTI x configuration (x = 12 to + 15) + 4 + 4 + + + EXTI12 + EXTI x configuration (x = 12 to + 15) + 0 + 4 + + + + + CCCSR + CCCSR + compensation cell control/status + register + 0x20 + 0x20 + read-write + 0x00000000 + + + EN + enable + 0 + 1 + + + CS + Code selection + 1 + 1 + + + READY + Compensation cell ready + flag + 8 + 1 + + + HSLV + High-speed at low-voltage + 16 + 1 + + + + + CCVR + CCVR + SYSCFG compensation cell value + register + 0x24 + 0x20 + read-only + 0x00000000 + + + NCV + NMOS compensation value + 0 + 4 + + + PCV + PMOS compensation value + 4 + 4 + + + + + CCCR + CCCR + SYSCFG compensation cell code + register + 0x28 + 0x20 + read-write + 0x00000000 + + + NCC + NMOS compensation code + 0 + 4 + + + PCC + PMOS compensation code + 4 + 4 + + + + + PWRCR + PWRCR + SYSCFG power control register + 0x2C + 0x20 + read-write + 0x00000000 + + + ODEN + Overdrive enable + 0 + 4 + + + + + + PKGR + PKGR + SYSCFG package register + 0x124 + 0x20 + read-only + 0x00000000 + + + PKG + Package + 0 + 4 + + + + + UR0 + UR0 + SYSCFG user register 0 + 0x300 + 0x20 + read-only + 0x00000000 + + + BKS + Bank Swap + 0 + 1 + + + RDP + Readout protection + 16 + 8 + + + + + UR2 + UR2 + SYSCFG user register 2 + 0x308 + 0x20 + read-write + 0x00000000 + + + BORH + BOR_LVL Brownout Reset Threshold + Level + 0 + 2 + + + BOOT_ADD0 + Boot Address 0 + 16 + 16 + + + + + UR3 + UR3 + SYSCFG user register 3 + 0x30C + 0x20 + read-write + 0x00000000 + + + BOOT_ADD1 + Boot Address 1 + 16 + 16 + + + + + UR4 + UR4 + SYSCFG user register 4 + 0x310 + 0x20 + read-only + 0x00000000 + + + MEPAD_1 + Mass Erase Protected Area Disabled for + bank 1 + 16 + 1 + + + + + UR5 + UR5 + SYSCFG user register 5 + 0x314 + 0x20 + read-only + 0x00000000 + + + MESAD_1 + Mass erase secured area disabled for + bank 1 + 0 + 1 + + + WRPN_1 + Write protection for flash bank + 1 + 16 + 8 + + + + + UR6 + UR6 + SYSCFG user register 6 + 0x318 + 0x20 + read-only + 0x00000000 + + + PA_BEG_1 + Protected area start address for bank + 1 + 0 + 12 + + + PA_END_1 + Protected area end address for bank + 1 + 16 + 12 + + + + + UR7 + UR7 + SYSCFG user register 7 + 0x31C + 0x20 + read-only + 0x00000000 + + + SA_BEG_1 + Secured area start address for bank + 1 + 0 + 12 + + + SA_END_1 + Secured area end address for bank + 1 + 16 + 12 + + + + + UR8 + UR8 + SYSCFG user register 8 + 0x320 + 0x20 + read-only + 0x00000000 + + + MEPAD_2 + Mass erase protected area disabled for + bank 2 + 0 + 1 + + + MESAD_2 + Mass erase secured area disabled for + bank 2 + 16 + 1 + + + + + UR9 + UR9 + SYSCFG user register 9 + 0x324 + 0x20 + read-only + 0x00000000 + + + WRPN_2 + Write protection for flash bank + 2 + 0 + 8 + + + PA_BEG_2 + Protected area start address for bank + 2 + 16 + 12 + + + + + UR10 + UR10 + SYSCFG user register 10 + 0x328 + 0x20 + read-only + 0x00000000 + + + PA_END_2 + Protected area end address for bank + 2 + 0 + 12 + + + SA_BEG_2 + Secured area start address for bank + 2 + 16 + 12 + + + + + UR11 + UR11 + SYSCFG user register 11 + 0x32C + 0x20 + read-only + 0x00000000 + + + SA_END_2 + Secured area end address for bank + 2 + 0 + 12 + + + IWDG1M + Independent Watchdog 1 + mode + 16 + 1 + + + + + UR12 + UR12 + SYSCFG user register 12 + 0x330 + 0x20 + read-only + 0x00000000 + + + SECURE + Secure mode + 16 + 1 + + + + + UR13 + UR13 + SYSCFG user register 13 + 0x334 + 0x20 + read-only + 0x00000000 + + + SDRS + Secured DTCM RAM Size + 0 + 2 + + + D1SBRST + D1 Standby reset + 16 + 1 + + + + + UR14 + UR14 + SYSCFG user register 14 + 0x338 + 0x20 + read-write + 0x00000000 + + + D1STPRST + D1 Stop Reset + 0 + 1 + + + + + UR15 + UR15 + SYSCFG user register 15 + 0x33C + 0x20 + read-only + 0x00000000 + + + FZIWDGSTB + Freeze independent watchdog in Standby + mode + 16 + 1 + + + + + UR16 + UR16 + SYSCFG user register 16 + 0x340 + 0x20 + read-only + 0x00000000 + + + FZIWDGSTP + Freeze independent watchdog in Stop + mode + 0 + 1 + + + PKP + Private key programmed + 16 + 1 + + + + + UR17 + UR17 + SYSCFG user register 17 + 0x344 + 0x20 + read-only + 0x00000000 + + + IO_HSLV + I/O high speed / low + voltage + 0 + 1 + + + + + + + EXTI + External interrupt/event + controller + EXTI + 0x58000000 + + 0x0 + 0x400 + registers + + + PVD_PVM + PVD through EXTI line + 1 + + + EXTI0 + EXTI Line 0 interrupt + 6 + + + EXTI1 + EXTI Line 1 interrupt + 7 + + + EXTI2 + EXTI Line 2 interrupt + 8 + + + EXTI3 + EXTI Line 3interrupt + 9 + + + EXTI4 + EXTI Line 4interrupt + 10 + + + EXTI9_5 + EXTI Line[9:5] interrupts + 23 + + + EXTI15_10 + EXTI Line[15:10] interrupts + 40 + + + RTC_ALARM + RTC alarms (A and B) + 41 + + + + RTSR1 + RTSR1 + EXTI rising trigger selection + register + 0x0 + 0x20 + read-write + 0x00000000 + + + TR0 + Rising trigger event configuration bit + of Configurable Event input + 0 + 1 + + + TR1 + Rising trigger event configuration bit + of Configurable Event input + 1 + 1 + + + TR2 + Rising trigger event configuration bit + of Configurable Event input + 2 + 1 + + + TR3 + Rising trigger event configuration bit + of Configurable Event input + 3 + 1 + + + TR4 + Rising trigger event configuration bit + of Configurable Event input + 4 + 1 + + + TR5 + Rising trigger event configuration bit + of Configurable Event input + 5 + 1 + + + TR6 + Rising trigger event configuration bit + of Configurable Event input + 6 + 1 + + + TR7 + Rising trigger event configuration bit + of Configurable Event input + 7 + 1 + + + TR8 + Rising trigger event configuration bit + of Configurable Event input + 8 + 1 + + + TR9 + Rising trigger event configuration bit + of Configurable Event input + 9 + 1 + + + TR10 + Rising trigger event configuration bit + of Configurable Event input + 10 + 1 + + + TR11 + Rising trigger event configuration bit + of Configurable Event input + 11 + 1 + + + TR12 + Rising trigger event configuration bit + of Configurable Event input + 12 + 1 + + + TR13 + Rising trigger event configuration bit + of Configurable Event input + 13 + 1 + + + TR14 + Rising trigger event configuration bit + of Configurable Event input + 14 + 1 + + + TR15 + Rising trigger event configuration bit + of Configurable Event input + 15 + 1 + + + TR16 + Rising trigger event configuration bit + of Configurable Event input + 16 + 1 + + + TR17 + Rising trigger event configuration bit + of Configurable Event input + 17 + 1 + + + TR18 + Rising trigger event configuration bit + of Configurable Event input + 18 + 1 + + + TR19 + Rising trigger event configuration bit + of Configurable Event input + 19 + 1 + + + TR20 + Rising trigger event configuration bit + of Configurable Event input + 20 + 1 + + + TR21 + Rising trigger event configuration bit + of Configurable Event input + 21 + 1 + + + + + FTSR1 + FTSR1 + EXTI falling trigger selection + register + 0x4 + 0x20 + read-write + 0x00000000 + + + TR0 + Rising trigger event configuration bit + of Configurable Event input + 0 + 1 + + + TR1 + Rising trigger event configuration bit + of Configurable Event input + 1 + 1 + + + TR2 + Rising trigger event configuration bit + of Configurable Event input + 2 + 1 + + + TR3 + Rising trigger event configuration bit + of Configurable Event input + 3 + 1 + + + TR4 + Rising trigger event configuration bit + of Configurable Event input + 4 + 1 + + + TR5 + Rising trigger event configuration bit + of Configurable Event input + 5 + 1 + + + TR6 + Rising trigger event configuration bit + of Configurable Event input + 6 + 1 + + + TR7 + Rising trigger event configuration bit + of Configurable Event input + 7 + 1 + + + TR8 + Rising trigger event configuration bit + of Configurable Event input + 8 + 1 + + + TR9 + Rising trigger event configuration bit + of Configurable Event input + 9 + 1 + + + TR10 + Rising trigger event configuration bit + of Configurable Event input + 10 + 1 + + + TR11 + Rising trigger event configuration bit + of Configurable Event input + 11 + 1 + + + TR12 + Rising trigger event configuration bit + of Configurable Event input + 12 + 1 + + + TR13 + Rising trigger event configuration bit + of Configurable Event input + 13 + 1 + + + TR14 + Rising trigger event configuration bit + of Configurable Event input + 14 + 1 + + + TR15 + Rising trigger event configuration bit + of Configurable Event input + 15 + 1 + + + TR16 + Rising trigger event configuration bit + of Configurable Event input + 16 + 1 + + + TR17 + Rising trigger event configuration bit + of Configurable Event input + 17 + 1 + + + TR18 + Rising trigger event configuration bit + of Configurable Event input + 18 + 1 + + + TR19 + Rising trigger event configuration bit + of Configurable Event input + 19 + 1 + + + TR20 + Rising trigger event configuration bit + of Configurable Event input + 20 + 1 + + + TR21 + Rising trigger event configuration bit + of Configurable Event input + 21 + 1 + + + + + SWIER1 + SWIER1 + EXTI software interrupt event + register + 0x8 + 0x20 + read-write + 0x00000000 + + + SWIER0 + Rising trigger event configuration bit + of Configurable Event input + 0 + 1 + + + SWIER1 + Rising trigger event configuration bit + of Configurable Event input + 1 + 1 + + + SWIER2 + Rising trigger event configuration bit + of Configurable Event input + 2 + 1 + + + SWIER3 + Rising trigger event configuration bit + of Configurable Event input + 3 + 1 + + + SWIER4 + Rising trigger event configuration bit + of Configurable Event input + 4 + 1 + + + SWIER5 + Rising trigger event configuration bit + of Configurable Event input + 5 + 1 + + + SWIER6 + Rising trigger event configuration bit + of Configurable Event input + 6 + 1 + + + SWIER7 + Rising trigger event configuration bit + of Configurable Event input + 7 + 1 + + + SWIER8 + Rising trigger event configuration bit + of Configurable Event input + 8 + 1 + + + SWIER9 + Rising trigger event configuration bit + of Configurable Event input + 9 + 1 + + + SWIER10 + Rising trigger event configuration bit + of Configurable Event input + 10 + 1 + + + SWIER11 + Rising trigger event configuration bit + of Configurable Event input + 11 + 1 + + + SWIER12 + Rising trigger event configuration bit + of Configurable Event input + 12 + 1 + + + SWIER13 + Rising trigger event configuration bit + of Configurable Event input + 13 + 1 + + + SWIER14 + Rising trigger event configuration bit + of Configurable Event input + 14 + 1 + + + SWIER15 + Rising trigger event configuration bit + of Configurable Event input + 15 + 1 + + + SWIER16 + Rising trigger event configuration bit + of Configurable Event input + 16 + 1 + + + SWIER17 + Rising trigger event configuration bit + of Configurable Event input + 17 + 1 + + + SWIER18 + Rising trigger event configuration bit + of Configurable Event input + 18 + 1 + + + SWIER19 + Rising trigger event configuration bit + of Configurable Event input + 19 + 1 + + + SWIER20 + Rising trigger event configuration bit + of Configurable Event input + 20 + 1 + + + SWIER21 + Rising trigger event configuration bit + of Configurable Event input + 21 + 1 + + + + + D3PMR1 + D3PMR1 + EXTI D3 pending mask register + 0xC + 0x20 + read-write + 0x00000000 + + + MR0 + Rising trigger event configuration bit + of Configurable Event input + 0 + 1 + + + MR1 + Rising trigger event configuration bit + of Configurable Event input + 1 + 1 + + + MR2 + Rising trigger event configuration bit + of Configurable Event input + 2 + 1 + + + MR3 + Rising trigger event configuration bit + of Configurable Event input + 3 + 1 + + + MR4 + Rising trigger event configuration bit + of Configurable Event input + 4 + 1 + + + MR5 + Rising trigger event configuration bit + of Configurable Event input + 5 + 1 + + + MR6 + Rising trigger event configuration bit + of Configurable Event input + 6 + 1 + + + MR7 + Rising trigger event configuration bit + of Configurable Event input + 7 + 1 + + + MR8 + Rising trigger event configuration bit + of Configurable Event input + 8 + 1 + + + MR9 + Rising trigger event configuration bit + of Configurable Event input + 9 + 1 + + + MR10 + Rising trigger event configuration bit + of Configurable Event input + 10 + 1 + + + MR11 + Rising trigger event configuration bit + of Configurable Event input + 11 + 1 + + + MR12 + Rising trigger event configuration bit + of Configurable Event input + 12 + 1 + + + MR13 + Rising trigger event configuration bit + of Configurable Event input + 13 + 1 + + + MR14 + Rising trigger event configuration bit + of Configurable Event input + 14 + 1 + + + MR15 + Rising trigger event configuration bit + of Configurable Event input + 15 + 1 + + + MR19 + Rising trigger event configuration bit + of Configurable Event input + 19 + 1 + + + MR20 + Rising trigger event configuration bit + of Configurable Event input + 20 + 1 + + + MR21 + Rising trigger event configuration bit + of Configurable Event input + 21 + 1 + + + MR25 + Rising trigger event configuration bit + of Configurable Event input + 25 + 1 + + + + + D3PCR1L + D3PCR1L + EXTI D3 pending clear selection register + low + 0x10 + 0x20 + read-write + 0x00000000 + + + PCS0 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 0 + 2 + + + PCS1 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 2 + 2 + + + PCS2 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 4 + 2 + + + PCS3 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 6 + 2 + + + PCS4 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 8 + 2 + + + PCS5 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 10 + 2 + + + PCS6 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 12 + 2 + + + PCS7 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 14 + 2 + + + PCS8 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 16 + 2 + + + PCS9 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 18 + 2 + + + PCS10 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 20 + 2 + + + PCS11 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 22 + 2 + + + PCS12 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 24 + 2 + + + PCS13 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 26 + 2 + + + PCS14 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 28 + 2 + + + PCS15 + D3 Pending request clear input signal + selection on Event input x = truncate + (n/2) + 30 + 2 + + + + + D3PCR1H + D3PCR1H + EXTI D3 pending clear selection register + high + 0x14 + 0x20 + read-write + 0x00000000 + + + PCS19 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+32)/2) + 6 + 2 + + + PCS20 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+32)/2) + 8 + 2 + + + PCS21 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+32)/2) + 10 + 2 + + + PCS25 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+32)/2) + 18 + 2 + + + + + RTSR2 + RTSR2 + EXTI rising trigger selection + register + 0x20 + 0x20 + read-write + 0x00000000 + + + TR49 + Rising trigger event configuration bit + of Configurable Event input x+32 + 17 + 1 + + + TR51 + Rising trigger event configuration bit + of Configurable Event input x+32 + 19 + 1 + + + + + FTSR2 + FTSR2 + EXTI falling trigger selection + register + 0x24 + 0x20 + read-write + 0x00000000 + + + TR49 + Falling trigger event configuration bit + of Configurable Event input x+32 + 17 + 1 + + + TR51 + Falling trigger event configuration bit + of Configurable Event input x+32 + 19 + 1 + + + + + SWIER2 + SWIER2 + EXTI software interrupt event + register + 0x28 + 0x20 + read-write + 0x00000000 + + + SWIER49 + Software interrupt on line + x+32 + 17 + 1 + + + SWIER51 + Software interrupt on line + x+32 + 19 + 1 + + + + + D3PMR2 + D3PMR2 + EXTI D3 pending mask register + 0x2C + 0x20 + read-write + 0x00000000 + + + MR34 + D3 Pending Mask on Event input + x+32 + 2 + 1 + + + MR35 + D3 Pending Mask on Event input + x+32 + 3 + 1 + + + MR41 + D3 Pending Mask on Event input + x+32 + 9 + 1 + + + MR48 + D3 Pending Mask on Event input + x+32 + 16 + 1 + + + MR49 + D3 Pending Mask on Event input + x+32 + 17 + 1 + + + MR50 + D3 Pending Mask on Event input + x+32 + 18 + 1 + + + MR51 + D3 Pending Mask on Event input + x+32 + 19 + 1 + + + MR52 + D3 Pending Mask on Event input + x+32 + 20 + 1 + + + MR53 + D3 Pending Mask on Event input + x+32 + 21 + 1 + + + + + D3PCR2L + D3PCR2L + EXTI D3 pending clear selection register + low + 0x30 + 0x20 + read-write + 0x00000000 + + + PCS35 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+64)/2) + 6 + 2 + + + PCS34 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+64)/2) + 4 + 2 + + + PCS41 + D3 Pending request clear input signal + selection on Event input x = truncate + ((n+64)/2) + 18 + 2 + + + + + D3PCR2H + D3PCR2H + EXTI D3 pending clear selection register + high + 0x34 + 0x20 + read-write + 0x00000000 + + + PCS48 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 0 + 2 + + + PCS49 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 2 + 2 + + + PCS50 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 4 + 2 + + + PCS51 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 6 + 2 + + + PCS52 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 8 + 2 + + + PCS53 + Pending request clear input signal + selection on Event input x= truncate + ((n+96)/2) + 10 + 2 + + + + + RTSR3 + RTSR3 + EXTI rising trigger selection + register + 0x40 + 0x20 + read-write + 0x00000000 + + + TR82 + Rising trigger event configuration bit + of Configurable Event input x+64 + 18 + 1 + + + TR84 + Rising trigger event configuration bit + of Configurable Event input x+64 + 20 + 1 + + + TR85 + Rising trigger event configuration bit + of Configurable Event input x+64 + 21 + 1 + + + TR86 + Rising trigger event configuration bit + of Configurable Event input x+64 + 22 + 1 + + + + + FTSR3 + FTSR3 + EXTI falling trigger selection + register + 0x44 + 0x20 + read-write + 0x00000000 + + + TR82 + Falling trigger event configuration bit + of Configurable Event input x+64 + 18 + 1 + + + TR84 + Falling trigger event configuration bit + of Configurable Event input x+64 + 20 + 1 + + + TR85 + Falling trigger event configuration bit + of Configurable Event input x+64 + 21 + 1 + + + TR86 + Falling trigger event configuration bit + of Configurable Event input x+64 + 22 + 1 + + + + + SWIER3 + SWIER3 + EXTI software interrupt event + register + 0x48 + 0x20 + read-write + 0x00000000 + + + SWIER82 + Software interrupt on line + x+64 + 18 + 1 + + + SWIER84 + Software interrupt on line + x+64 + 20 + 1 + + + SWIER85 + Software interrupt on line + x+64 + 21 + 1 + + + SWIER86 + Software interrupt on line + x+64 + 22 + 1 + + + + + D3PMR3 + D3PMR3 + EXTI D3 pending mask register + 0x4C + 0x20 + read-write + 0x00000000 + + + MR88 + D3 Pending Mask on Event input + x+64 + 24 + 1 + + + + + D3PCR3H + D3PCR3H + EXTI D3 pending clear selection register + high + 0x54 + 0x20 + read-write + 0x00000000 + + + PCS88 + D3 Pending request clear input signal + selection on Event input x= truncate + N+160/2 + 18 + 2 + + + + + CPUIMR1 + CPUIMR1 + EXTI interrupt mask register + 0x80 + 0x20 + read-write + 0xFFC00000 + + + MR0 + Rising trigger event configuration bit + of Configurable Event input + 0 + 1 + + + MR1 + Rising trigger event configuration bit + of Configurable Event input + 1 + 1 + + + MR2 + Rising trigger event configuration bit + of Configurable Event input + 2 + 1 + + + MR3 + Rising trigger event configuration bit + of Configurable Event input + 3 + 1 + + + MR4 + Rising trigger event configuration bit + of Configurable Event input + 4 + 1 + + + MR5 + Rising trigger event configuration bit + of Configurable Event input + 5 + 1 + + + MR6 + Rising trigger event configuration bit + of Configurable Event input + 6 + 1 + + + MR7 + Rising trigger event configuration bit + of Configurable Event input + 7 + 1 + + + MR8 + Rising trigger event configuration bit + of Configurable Event input + 8 + 1 + + + MR9 + Rising trigger event configuration bit + of Configurable Event input + 9 + 1 + + + MR10 + Rising trigger event configuration bit + of Configurable Event input + 10 + 1 + + + MR11 + Rising trigger event configuration bit + of Configurable Event input + 11 + 1 + + + MR12 + Rising trigger event configuration bit + of Configurable Event input + 12 + 1 + + + MR13 + Rising trigger event configuration bit + of Configurable Event input + 13 + 1 + + + MR14 + Rising trigger event configuration bit + of Configurable Event input + 14 + 1 + + + MR15 + Rising trigger event configuration bit + of Configurable Event input + 15 + 1 + + + MR16 + Rising trigger event configuration bit + of Configurable Event input + 16 + 1 + + + MR17 + Rising trigger event configuration bit + of Configurable Event input + 17 + 1 + + + MR18 + Rising trigger event configuration bit + of Configurable Event input + 18 + 1 + + + MR19 + Rising trigger event configuration bit + of Configurable Event input + 19 + 1 + + + MR20 + Rising trigger event configuration bit + of Configurable Event input + 20 + 1 + + + MR21 + Rising trigger event configuration bit + of Configurable Event input + 21 + 1 + + + MR22 + Rising trigger event configuration bit + of Configurable Event input + 22 + 1 + + + MR23 + Rising trigger event configuration bit + of Configurable Event input + 23 + 1 + + + MR24 + Rising trigger event configuration bit + of Configurable Event input + 24 + 1 + + + MR25 + Rising trigger event configuration bit + of Configurable Event input + 25 + 1 + + + MR26 + Rising trigger event configuration bit + of Configurable Event input + 26 + 1 + + + MR27 + Rising trigger event configuration bit + of Configurable Event input + 27 + 1 + + + MR28 + Rising trigger event configuration bit + of Configurable Event input + 28 + 1 + + + MR29 + Rising trigger event configuration bit + of Configurable Event input + 29 + 1 + + + MR30 + Rising trigger event configuration bit + of Configurable Event input + 30 + 1 + + + MR31 + Rising trigger event configuration bit + of Configurable Event input + 31 + 1 + + + + + CPUEMR1 + CPUEMR1 + EXTI event mask register + 0x84 + 0x20 + read-write + 0x00000000 + + + MR0 + CPU Event mask on Event input + x + 0 + 1 + + + MR1 + CPU Event mask on Event input + x + 1 + 1 + + + MR2 + CPU Event mask on Event input + x + 2 + 1 + + + MR3 + CPU Event mask on Event input + x + 3 + 1 + + + MR4 + CPU Event mask on Event input + x + 4 + 1 + + + MR5 + CPU Event mask on Event input + x + 5 + 1 + + + MR6 + CPU Event mask on Event input + x + 6 + 1 + + + MR7 + CPU Event mask on Event input + x + 7 + 1 + + + MR8 + CPU Event mask on Event input + x + 8 + 1 + + + MR9 + CPU Event mask on Event input + x + 9 + 1 + + + MR10 + CPU Event mask on Event input + x + 10 + 1 + + + MR11 + CPU Event mask on Event input + x + 11 + 1 + + + MR12 + CPU Event mask on Event input + x + 12 + 1 + + + MR13 + CPU Event mask on Event input + x + 13 + 1 + + + MR14 + CPU Event mask on Event input + x + 14 + 1 + + + MR15 + CPU Event mask on Event input + x + 15 + 1 + + + MR16 + CPU Event mask on Event input + x + 16 + 1 + + + MR17 + CPU Event mask on Event input + x + 17 + 1 + + + MR18 + CPU Event mask on Event input + x + 18 + 1 + + + MR19 + CPU Event mask on Event input + x + 19 + 1 + + + MR20 + CPU Event mask on Event input + x + 20 + 1 + + + MR21 + CPU Event mask on Event input + x + 21 + 1 + + + MR22 + CPU Event mask on Event input + x + 22 + 1 + + + MR23 + CPU Event mask on Event input + x + 23 + 1 + + + MR24 + CPU Event mask on Event input + x + 24 + 1 + + + MR25 + CPU Event mask on Event input + x + 25 + 1 + + + MR26 + CPU Event mask on Event input + x + 26 + 1 + + + MR27 + CPU Event mask on Event input + x + 27 + 1 + + + MR28 + CPU Event mask on Event input + x + 28 + 1 + + + MR29 + CPU Event mask on Event input + x + 29 + 1 + + + MR30 + CPU Event mask on Event input + x + 30 + 1 + + + MR31 + CPU Event mask on Event input + x + 31 + 1 + + + + + CPUPR1 + CPUPR1 + EXTI pending register + 0x88 + 0x20 + read-write + 0x00000000 + + + PR0 + CPU Event mask on Event input + x + 0 + 1 + + + PR1 + CPU Event mask on Event input + x + 1 + 1 + + + PR2 + CPU Event mask on Event input + x + 2 + 1 + + + PR3 + CPU Event mask on Event input + x + 3 + 1 + + + PR4 + CPU Event mask on Event input + x + 4 + 1 + + + PR5 + CPU Event mask on Event input + x + 5 + 1 + + + PR6 + CPU Event mask on Event input + x + 6 + 1 + + + PR7 + CPU Event mask on Event input + x + 7 + 1 + + + PR8 + CPU Event mask on Event input + x + 8 + 1 + + + PR9 + CPU Event mask on Event input + x + 9 + 1 + + + PR10 + CPU Event mask on Event input + x + 10 + 1 + + + PR11 + CPU Event mask on Event input + x + 11 + 1 + + + PR12 + CPU Event mask on Event input + x + 12 + 1 + + + PR13 + CPU Event mask on Event input + x + 13 + 1 + + + PR14 + CPU Event mask on Event input + x + 14 + 1 + + + PR15 + CPU Event mask on Event input + x + 15 + 1 + + + PR16 + CPU Event mask on Event input + x + 16 + 1 + + + PR17 + CPU Event mask on Event input + x + 17 + 1 + + + PR18 + CPU Event mask on Event input + x + 18 + 1 + + + PR19 + CPU Event mask on Event input + x + 19 + 1 + + + PR20 + CPU Event mask on Event input + x + 20 + 1 + + + PR21 + CPU Event mask on Event input + x + 21 + 1 + + + + + CPUIMR2 + CPUIMR2 + EXTI interrupt mask register + 0x90 + 0x20 + read-write + 0x00000000 + + + MR0 + CPU Interrupt Mask on Direct Event input + x+32 + 0 + 1 + + + MR1 + CPU Interrupt Mask on Direct Event input + x+32 + 1 + 1 + + + MR2 + CPU Interrupt Mask on Direct Event input + x+32 + 2 + 1 + + + MR3 + CPU Interrupt Mask on Direct Event input + x+32 + 3 + 1 + + + MR4 + CPU Interrupt Mask on Direct Event input + x+32 + 4 + 1 + + + MR5 + CPU Interrupt Mask on Direct Event input + x+32 + 5 + 1 + + + MR6 + CPU Interrupt Mask on Direct Event input + x+32 + 6 + 1 + + + MR7 + CPU Interrupt Mask on Direct Event input + x+32 + 7 + 1 + + + MR8 + CPU Interrupt Mask on Direct Event input + x+32 + 8 + 1 + + + MR9 + CPU Interrupt Mask on Direct Event input + x+32 + 9 + 1 + + + MR10 + CPU Interrupt Mask on Direct Event input + x+32 + 10 + 1 + + + MR11 + CPU Interrupt Mask on Direct Event input + x+32 + 11 + 1 + + + MR12 + CPU Interrupt Mask on Direct Event input + x+32 + 12 + 1 + + + MR14 + CPU Interrupt Mask on Direct Event input + x+32 + 14 + 1 + + + MR15 + CPU Interrupt Mask on Direct Event input + x+32 + 15 + 1 + + + MR16 + CPU Interrupt Mask on Direct Event input + x+32 + 16 + 1 + + + MR17 + CPU Interrupt Mask on Direct Event input + x+32 + 17 + 1 + + + MR18 + CPU Interrupt Mask on Direct Event input + x+32 + 18 + 1 + + + MR19 + CPU Interrupt Mask on Direct Event input + x+32 + 19 + 1 + + + MR20 + CPU Interrupt Mask on Direct Event input + x+32 + 20 + 1 + + + MR21 + CPU Interrupt Mask on Direct Event input + x+32 + 21 + 1 + + + MR22 + CPU Interrupt Mask on Direct Event input + x+32 + 22 + 1 + + + MR23 + CPU Interrupt Mask on Direct Event input + x+32 + 23 + 1 + + + MR24 + CPU Interrupt Mask on Direct Event input + x+32 + 24 + 1 + + + MR25 + CPU Interrupt Mask on Direct Event input + x+32 + 25 + 1 + + + MR26 + CPU Interrupt Mask on Direct Event input + x+32 + 26 + 1 + + + MR27 + CPU Interrupt Mask on Direct Event input + x+32 + 27 + 1 + + + MR28 + CPU Interrupt Mask on Direct Event input + x+32 + 28 + 1 + + + MR29 + CPU Interrupt Mask on Direct Event input + x+32 + 29 + 1 + + + MR30 + CPU Interrupt Mask on Direct Event input + x+32 + 30 + 1 + + + MR31 + CPU Interrupt Mask on Direct Event input + x+32 + 31 + 1 + + + + + CPUEMR2 + CPUEMR2 + EXTI event mask register + 0x94 + 0x20 + read-write + 0x00000000 + + + MR32 + CPU Interrupt Mask on Direct Event input + x+32 + 0 + 1 + + + MR33 + CPU Interrupt Mask on Direct Event input + x+32 + 1 + 1 + + + MR34 + CPU Interrupt Mask on Direct Event input + x+32 + 2 + 1 + + + MR35 + CPU Interrupt Mask on Direct Event input + x+32 + 3 + 1 + + + MR36 + CPU Interrupt Mask on Direct Event input + x+32 + 4 + 1 + + + MR37 + CPU Interrupt Mask on Direct Event input + x+32 + 5 + 1 + + + MR38 + CPU Interrupt Mask on Direct Event input + x+32 + 6 + 1 + + + MR39 + CPU Interrupt Mask on Direct Event input + x+32 + 7 + 1 + + + MR40 + CPU Interrupt Mask on Direct Event input + x+32 + 8 + 1 + + + MR41 + CPU Interrupt Mask on Direct Event input + x+32 + 9 + 1 + + + MR42 + CPU Interrupt Mask on Direct Event input + x+32 + 10 + 1 + + + MR43 + CPU Interrupt Mask on Direct Event input + x+32 + 11 + 1 + + + MR44 + CPU Interrupt Mask on Direct Event input + x+32 + 12 + 1 + + + MR46 + CPU Interrupt Mask on Direct Event input + x+32 + 14 + 1 + + + MR47 + CPU Interrupt Mask on Direct Event input + x+32 + 15 + 1 + + + MR48 + CPU Interrupt Mask on Direct Event input + x+32 + 16 + 1 + + + MR49 + CPU Interrupt Mask on Direct Event input + x+32 + 17 + 1 + + + MR50 + CPU Interrupt Mask on Direct Event input + x+32 + 18 + 1 + + + MR51 + CPU Interrupt Mask on Direct Event input + x+32 + 19 + 1 + + + MR52 + CPU Interrupt Mask on Direct Event input + x+32 + 20 + 1 + + + MR53 + CPU Interrupt Mask on Direct Event input + x+32 + 21 + 1 + + + MR54 + CPU Interrupt Mask on Direct Event input + x+32 + 22 + 1 + + + MR55 + CPU Interrupt Mask on Direct Event input + x+32 + 23 + 1 + + + MR56 + CPU Interrupt Mask on Direct Event input + x+32 + 24 + 1 + + + MR57 + CPU Interrupt Mask on Direct Event input + x+32 + 25 + 1 + + + MR58 + CPU Interrupt Mask on Direct Event input + x+32 + 26 + 1 + + + MR59 + CPU Interrupt Mask on Direct Event input + x+32 + 27 + 1 + + + MR60 + CPU Interrupt Mask on Direct Event input + x+32 + 28 + 1 + + + MR61 + CPU Interrupt Mask on Direct Event input + x+32 + 29 + 1 + + + MR62 + CPU Interrupt Mask on Direct Event input + x+32 + 30 + 1 + + + MR63 + CPU Interrupt Mask on Direct Event input + x+32 + 31 + 1 + + + + + CPUPR2 + CPUPR2 + EXTI pending register + 0x98 + 0x20 + read-only + 0x00000000 + + + PR49 + Configurable event inputs x+32 Pending + bit + 17 + 1 + + + PR51 + Configurable event inputs x+32 Pending + bit + 19 + 1 + + + + + CPUIMR3 + CPUIMR3 + EXTI interrupt mask register + 0xA0 + 0x20 + read-only + 0x00000000 + + + MR64 + CPU Interrupt Mask on Direct Event input + x+64 + 0 + 1 + + + MR65 + CPU Interrupt Mask on Direct Event input + x+64 + 1 + 1 + + + MR66 + CPU Interrupt Mask on Direct Event input + x+64 + 2 + 1 + + + MR67 + CPU Interrupt Mask on Direct Event input + x+64 + 3 + 1 + + + MR68 + CPU Interrupt Mask on Direct Event input + x+64 + 4 + 1 + + + MR69 + CPU Interrupt Mask on Direct Event input + x+64 + 5 + 1 + + + MR70 + CPU Interrupt Mask on Direct Event input + x+64 + 6 + 1 + + + MR71 + CPU Interrupt Mask on Direct Event input + x+64 + 7 + 1 + + + MR72 + CPU Interrupt Mask on Direct Event input + x+64 + 8 + 1 + + + MR73 + CPU Interrupt Mask on Direct Event input + x+64 + 9 + 1 + + + MR74 + CPU Interrupt Mask on Direct Event input + x+64 + 10 + 1 + + + MR75 + CPU Interrupt Mask on Direct Event input + x+64 + 11 + 1 + + + MR76 + CPU Interrupt Mask on Direct Event input + x+64 + 12 + 1 + + + MR77 + CPU Interrupt Mask on Direct Event input + x+64 + 13 + 1 + + + MR78 + CPU Interrupt Mask on Direct Event input + x+64 + 14 + 1 + + + MR79 + CPU Interrupt Mask on Direct Event input + x+64 + 15 + 1 + + + MR80 + CPU Interrupt Mask on Direct Event input + x+64 + 16 + 1 + + + MR82 + CPU Interrupt Mask on Direct Event input + x+64 + 18 + 1 + + + MR84 + CPU Interrupt Mask on Direct Event input + x+64 + 20 + 1 + + + MR85 + CPU Interrupt Mask on Direct Event input + x+64 + 21 + 1 + + + MR86 + CPU Interrupt Mask on Direct Event input + x+64 + 22 + 1 + + + MR87 + CPU Interrupt Mask on Direct Event input + x+64 + 23 + 1 + + + MR88 + CPU Interrupt Mask on Direct Event input + x+64 + 24 + 1 + + + + + CPUEMR3 + CPUEMR3 + EXTI event mask register + 0xA4 + 0x20 + read-only + 0x00000000 + + + MR64 + CPU Event mask on Event input + x+64 + 0 + 1 + + + MR65 + CPU Event mask on Event input + x+64 + 1 + 1 + + + MR66 + CPU Event mask on Event input + x+64 + 2 + 1 + + + MR67 + CPU Event mask on Event input + x+64 + 3 + 1 + + + MR68 + CPU Event mask on Event input + x+64 + 4 + 1 + + + MR69 + CPU Event mask on Event input + x+64 + 5 + 1 + + + MR70 + CPU Event mask on Event input + x+64 + 6 + 1 + + + MR71 + CPU Event mask on Event input + x+64 + 7 + 1 + + + MR72 + CPU Event mask on Event input + x+64 + 8 + 1 + + + MR73 + CPU Event mask on Event input + x+64 + 9 + 1 + + + MR74 + CPU Event mask on Event input + x+64 + 10 + 1 + + + MR75 + CPU Event mask on Event input + x+64 + 11 + 1 + + + MR76 + CPU Event mask on Event input + x+64 + 12 + 1 + + + MR77 + CPU Event mask on Event input + x+64 + 13 + 1 + + + MR78 + CPU Event mask on Event input + x+64 + 14 + 1 + + + MR79 + CPU Event mask on Event input + x+64 + 15 + 1 + + + MR80 + CPU Event mask on Event input + x+64 + 16 + 1 + + + MR82 + CPU Event mask on Event input + x+64 + 18 + 1 + + + MR84 + CPU Event mask on Event input + x+64 + 20 + 1 + + + MR85 + CPU Event mask on Event input + x+64 + 21 + 1 + + + MR86 + CPU Event mask on Event input + x+64 + 22 + 1 + + + MR87 + CPU Event mask on Event input + x+64 + 23 + 1 + + + MR88 + CPU Event mask on Event input + x+64 + 24 + 1 + + + + + CPUPR3 + CPUPR3 + EXTI pending register + 0xA8 + 0x20 + read-only + 0x00000000 + + + PR82 + Configurable event inputs x+64 Pending + bit + 18 + 1 + + + PR84 + Configurable event inputs x+64 Pending + bit + 20 + 1 + + + PR85 + Configurable event inputs x+64 Pending + bit + 21 + 1 + + + PR86 + Configurable event inputs x+64 Pending + bit + 22 + 1 + + + + + + + DELAY_Block_SDMMC1 + DELAY_Block_SDMMC1 + DLYB + 0x52008000 + + 0x0 + 0x1000 + registers + + + WKUP + WKUP1 to WKUP6 pins + 149 + + + + CR + CR + DLYB control register + 0x0 + 0x20 + read-write + 0x00000000 + + + DEN + Delay block enable bit + 0 + 1 + + + SEN + Sampler length enable bit + 1 + 1 + + + + + CFGR + CFGR + DLYB configuration register + 0x4 + 0x20 + read-write + 0x00000000 + + + SEL + Select the phase for the Output + clock + 0 + 4 + + + UNIT + Delay Defines the delay of a Unit delay + cell + 8 + 7 + + + LNG + Delay line length value + 16 + 12 + + + LNGF + Length valid flag + 31 + 1 + + + + + + + DELAY_Block_QUADSPI + 0x52006000 + + + DELAY_Block_SDMMC2 + 0x48022800 + + + Flash + Flash + Flash + 0x52002000 + + 0x0 + 0x1000 + registers + + + FLASH + Flash memory + 4 + + + + ACR + ACR + Access control register + 0x0 + 0x20 + read-write + 0x00000600 + + + LATENCY + Read latency + 0 + 3 + + + WRHIGHFREQ + Flash signal delay + 4 + 2 + + + + + ACR_ + ACR_ + Access control register + 0x100 + 0x20 + read-write + 0x00000000 + + + LATENCY + Read latency + 0 + 3 + + + WRHIGHFREQ + Flash signal delay + 4 + 2 + + + + + KEYR1 + KEYR1 + FLASH key register for bank 1 + 0x4 + 0x20 + read-write + 0x00000000 + + + KEYR1 + Bank 1 access configuration unlock + key + 0 + 32 + + + + + OPTKEYR + OPTKEYR + FLASH option key register + 0x8 + 0x20 + read-write + 0x00000000 + + + OPTKEYR + Unlock key option bytes + 0 + 32 + + + + + OPTKEYR_ + OPTKEYR_ + FLASH option key register + 0x108 + 0x20 + read-write + 0x00000000 + + + OPTKEYR + Unlock key option bytes + 0 + 32 + + + + + CR1 + CR1 + FLASH control register for bank + 1 + 0xC + 0x20 + read-write + 0x00000000 + + + LOCK1 + Bank 1 configuration lock + bit + 0 + 1 + + + PG1 + Bank 1 program enable bit + 1 + 1 + + + SER1 + Bank 1 sector erase + request + 2 + 1 + + + BER1 + Bank 1 erase request + 3 + 1 + + + PSIZE1 + Bank 1 program size + 4 + 2 + + + FW1 + Bank 1 write forcing control + bit + 6 + 1 + + + START1 + Bank 1 bank or sector erase start + control bit + 7 + 1 + + + SNB1 + Bank 1 sector erase selection + number + 8 + 3 + + + CRC_EN + Bank 1 CRC control bit + 15 + 1 + + + EOPIE1 + Bank 1 end-of-program interrupt control + bit + 16 + 1 + + + WRPERRIE1 + Bank 1 write protection error interrupt + enable bit + 17 + 1 + + + PGSERRIE1 + Bank 1 programming sequence error + interrupt enable bit + 18 + 1 + + + STRBERRIE1 + Bank 1 strobe error interrupt enable + bit + 19 + 1 + + + INCERRIE1 + Bank 1 inconsistency error interrupt + enable bit + 21 + 1 + + + OPERRIE1 + Bank 1 write/erase error interrupt + enable bit + 22 + 1 + + + RDPERRIE1 + Bank 1 read protection error interrupt + enable bit + 23 + 1 + + + RDSERRIE1 + Bank 1 secure error interrupt enable + bit + 24 + 1 + + + SNECCERRIE1 + Bank 1 ECC single correction error + interrupt enable bit + 25 + 1 + + + DBECCERRIE1 + Bank 1 ECC double detection error + interrupt enable bit + 26 + 1 + + + CRCENDIE1 + Bank 1 end of CRC calculation interrupt + enable bit + 27 + 1 + + + + + SR1 + SR1 + FLASH status register for bank + 1 + 0x10 + 0x20 + read-write + 0x00000000 + + + BSY1 + Bank 1 ongoing program + flag + 0 + 1 + + + WBNE1 + Bank 1 write buffer not empty + flag + 1 + 1 + + + QW1 + Bank 1 wait queue flag + 2 + 1 + + + CRC_BUSY1 + Bank 1 CRC busy flag + 3 + 1 + + + EOP1 + Bank 1 end-of-program flag + 16 + 1 + + + WRPERR1 + Bank 1 write protection error + flag + 17 + 1 + + + PGSERR1 + Bank 1 programming sequence error + flag + 18 + 1 + + + STRBERR1 + Bank 1 strobe error flag + 19 + 1 + + + INCERR1 + Bank 1 inconsistency error + flag + 21 + 1 + + + OPERR1 + Bank 1 write/erase error + flag + 22 + 1 + + + RDPERR1 + Bank 1 read protection error + flag + 23 + 1 + + + RDSERR1 + Bank 1 secure error flag + 24 + 1 + + + SNECCERR11 + Bank 1 single correction error + flag + 25 + 1 + + + DBECCERR1 + Bank 1 ECC double detection error + flag + 26 + 1 + + + CRCEND1 + Bank 1 CRC-complete flag + 27 + 1 + + + + + CCR1 + CCR1 + FLASH clear control register for bank + 1 + 0x14 + 0x20 + read-write + 0x00000000 + + + CLR_EOP1 + Bank 1 EOP1 flag clear bit + 16 + 1 + + + CLR_WRPERR1 + Bank 1 WRPERR1 flag clear + bit + 17 + 1 + + + CLR_PGSERR1 + Bank 1 PGSERR1 flag clear + bi + 18 + 1 + + + CLR_STRBERR1 + Bank 1 STRBERR1 flag clear + bit + 19 + 1 + + + CLR_INCERR1 + Bank 1 INCERR1 flag clear + bit + 21 + 1 + + + CLR_OPERR1 + Bank 1 OPERR1 flag clear + bit + 22 + 1 + + + CLR_RDPERR1 + Bank 1 RDPERR1 flag clear + bit + 23 + 1 + + + CLR_RDSERR1 + Bank 1 RDSERR1 flag clear + bit + 24 + 1 + + + CLR_SNECCERR1 + Bank 1 SNECCERR1 flag clear + bit + 25 + 1 + + + CLR_DBECCERR1 + Bank 1 DBECCERR1 flag clear + bit + 26 + 1 + + + CLR_CRCEND1 + Bank 1 CRCEND1 flag clear + bit + 27 + 1 + + + + + OPTCR + OPTCR + FLASH option control register + 0x18 + 0x20 + read-write + 0x00000000 + + + OPTLOCK + FLASH_OPTCR lock option configuration + bit + 0 + 1 + + + OPTSTART + Option byte start change option + configuration bit + 1 + 1 + + + MER + Flash mass erase enable + bit + 4 + 1 + + + OPTCHANGEERRIE + Option byte change error interrupt + enable bit + 30 + 1 + + + SWAP_BANK + Bank swapping configuration + bit + 31 + 1 + + + + + OPTCR_ + OPTCR_ + FLASH option control register + 0x118 + 0x20 + read-write + 0x00000000 + + + OPTLOCK + FLASH_OPTCR lock option configuration + bit + 0 + 1 + + + OPTSTART + Option byte start change option + configuration bit + 1 + 1 + + + MER + Flash mass erase enable + bit + 4 + 1 + + + OPTCHANGEERRIE + Option byte change error interrupt + enable bit + 30 + 1 + + + SWAP_BANK + Bank swapping configuration + bit + 31 + 1 + + + + + OPTSR_CUR_ + OPTSR_CUR_ + FLASH option status register + 0x11C + 0x20 + read-write + 0x00000000 + + + OPT_BUSY + Option byte change ongoing + flag + 0 + 1 + + + BOR_LEV + Brownout level option status + bit + 2 + 2 + + + IWDG1_HW + IWDG1 control option status + bit + 4 + 1 + + + nRST_STOP_D1 + D1 DStop entry reset option status + bit + 6 + 1 + + + nRST_STBY_D1 + D1 DStandby entry reset option status + bit + 7 + 1 + + + RDP + Readout protection level option status + byte + 8 + 8 + + + FZ_IWDG_STOP + IWDG Stop mode freeze option status + bit + 17 + 1 + + + FZ_IWDG_SDBY + IWDG Standby mode freeze option status + bit + 18 + 1 + + + ST_RAM_SIZE + DTCM RAM size option + status + 19 + 2 + + + SECURITY + Security enable option status + bit + 21 + 1 + + + RSS1 + User option bit 1 + 26 + 1 + + + PERSO_OK + Device personalization status + bit + 28 + 1 + + + IO_HSLV + I/O high-speed at low-voltage status bit + (PRODUCT_BELOW_25V) + 29 + 1 + + + OPTCHANGEERR + Option byte change error + flag + 30 + 1 + + + SWAP_BANK_OPT + Bank swapping option status + bit + 31 + 1 + + + + + OPTSR_CUR + OPTSR_CUR + FLASH option status register + 0x1C + 0x20 + read-write + 0x00000000 + + + OPT_BUSY + Option byte change ongoing + flag + 0 + 1 + + + BOR_LEV + Brownout level option status + bit + 2 + 2 + + + IWDG1_HW + IWDG1 control option status + bit + 4 + 1 + + + nRST_STOP_D1 + D1 DStop entry reset option status + bit + 6 + 1 + + + nRST_STBY_D1 + D1 DStandby entry reset option status + bit + 7 + 1 + + + RDP + Readout protection level option status + byte + 8 + 8 + + + FZ_IWDG_STOP + IWDG Stop mode freeze option status + bit + 17 + 1 + + + FZ_IWDG_SDBY + IWDG Standby mode freeze option status + bit + 18 + 1 + + + ST_RAM_SIZE + DTCM RAM size option + status + 19 + 2 + + + SECURITY + Security enable option status + bit + 21 + 1 + + + RSS1 + User option bit 1 + 26 + 1 + + + PERSO_OK + Device personalization status + bit + 28 + 1 + + + IO_HSLV + I/O high-speed at low-voltage status bit + (PRODUCT_BELOW_25V) + 29 + 1 + + + OPTCHANGEERR + Option byte change error + flag + 30 + 1 + + + SWAP_BANK_OPT + Bank swapping option status + bit + 31 + 1 + + + + + OPTSR_PRG + OPTSR_PRG + FLASH option status register + 0x20 + 0x20 + read-write + 0x00000000 + + + BOR_LEV + BOR reset level option configuration + bits + 2 + 2 + + + IWDG1_HW + IWDG1 option configuration + bit + 4 + 1 + + + nRST_STOP_D1 + Option byte erase after D1 DStop option + configuration bit + 6 + 1 + + + nRST_STBY_D1 + Option byte erase after D1 DStandby + option configuration bit + 7 + 1 + + + RDP + Readout protection level option + configuration byte + 8 + 8 + + + FZ_IWDG_STOP + IWDG Stop mode freeze option + configuration bit + 17 + 1 + + + FZ_IWDG_SDBY + IWDG Standby mode freeze option + configuration bit + 18 + 1 + + + ST_RAM_SIZE + DTCM size select option configuration + bits + 19 + 2 + + + SECURITY + Security option configuration + bit + 21 + 1 + + + RSS1 + User option configuration bit + 1 + 26 + 1 + + + RSS2 + User option configuration bit + 2 + 27 + 1 + + + IO_HSLV + I/O high-speed at low-voltage + (PRODUCT_BELOW_25V) + 29 + 1 + + + SWAP_BANK_OPT + Bank swapping option configuration + bit + 31 + 1 + + + + + OPTSR_PRG_ + OPTSR_PRG_ + FLASH option status register + 0x120 + 0x20 + read-write + 0x00000000 + + + BOR_LEV + BOR reset level option configuration + bits + 2 + 2 + + + IWDG1_HW + IWDG1 option configuration + bit + 4 + 1 + + + nRST_STOP_D1 + Option byte erase after D1 DStop option + configuration bit + 6 + 1 + + + nRST_STBY_D1 + Option byte erase after D1 DStandby + option configuration bit + 7 + 1 + + + RDP + Readout protection level option + configuration byte + 8 + 8 + + + FZ_IWDG_STOP + IWDG Stop mode freeze option + configuration bit + 17 + 1 + + + FZ_IWDG_SDBY + IWDG Standby mode freeze option + configuration bit + 18 + 1 + + + ST_RAM_SIZE + DTCM size select option configuration + bits + 19 + 2 + + + SECURITY + Security option configuration + bit + 21 + 1 + + + RSS1 + User option configuration bit + 1 + 26 + 1 + + + RSS2 + User option configuration bit + 2 + 27 + 1 + + + IO_HSLV + I/O high-speed at low-voltage + (PRODUCT_BELOW_25V) + 29 + 1 + + + SWAP_BANK_OPT + Bank swapping option configuration + bit + 31 + 1 + + + + + OPTCCR_ + OPTCCR_ + FLASH option clear control + register + 0x124 + 0x20 + write-only + 0x00000000 + + + CLR_OPTCHANGEERR + OPTCHANGEERR reset bit + 30 + 1 + + + + + OPTCCR + OPTCCR + FLASH option clear control + register + 0x24 + 0x20 + write-only + 0x00000000 + + + CLR_OPTCHANGEERR + OPTCHANGEERR reset bit + 30 + 1 + + + + + PRAR_CUR1 + PRAR_CUR1 + FLASH protection address for bank + 1 + 0x28 + 0x20 + read-only + 0x00000000 + + + PROT_AREA_START1 + Bank 1 lowest PCROP protected + address + 0 + 12 + + + PROT_AREA_END1 + Bank 1 highest PCROP protected + address + 16 + 12 + + + DMEP1 + Bank 1 PCROP protected erase enable + option status bit + 31 + 1 + + + + + PRAR_PRG1 + PRAR_PRG1 + FLASH protection address for bank + 1 + 0x2C + 0x20 + read-write + 0x00000000 + + + PROT_AREA_START1 + Bank 1 lowest PCROP protected address + configuration + 0 + 12 + + + PROT_AREA_END1 + Bank 1 highest PCROP protected address + configuration + 16 + 12 + + + DMEP1 + Bank 1 PCROP protected erase enable + option configuration bit + 31 + 1 + + + + + SCAR_CUR1 + SCAR_CUR1 + FLASH secure address for bank + 1 + 0x30 + 0x20 + read-write + 0x00000000 + + + SEC_AREA_START1 + Bank 1 lowest secure protected + address + 0 + 12 + + + SEC_AREA_END1 + Bank 1 highest secure protected + address + 16 + 12 + + + DMES1 + Bank 1 secure protected erase enable + option status bit + 31 + 1 + + + + + SCAR_PRG1 + SCAR_PRG1 + FLASH secure address for bank + 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + SEC_AREA_START1 + Bank 1 lowest secure protected address + configuration + 0 + 12 + + + SEC_AREA_END1 + Bank 1 highest secure protected address + configuration + 16 + 12 + + + DMES1 + Bank 1 secure protected erase enable + option configuration bit + 31 + 1 + + + + + WPSN_CUR1R + WPSN_CUR1R + FLASH write sector protection for bank + 1 + 0x38 + 0x20 + read-only + 0x00000000 + + + WRPSn1 + Bank 1 sector write protection option + status byte + 0 + 8 + + + + + WPSN_PRG1R + WPSN_PRG1R + FLASH write sector protection for bank + 1 + 0x3C + 0x20 + read-write + 0x00000000 + + + WRPSn1 + Bank 1 sector write protection + configuration byte + 0 + 8 + + + + + BOOT_CURR + BOOT_CURR + FLASH register with boot + address + 0x40 + 0x20 + read-only + 0x00000000 + + + BOOT_ADD0 + Boot address 0 + 0 + 16 + + + BOOT_ADD1 + Boot address 1 + 16 + 16 + + + + + BOOT_PRGR + BOOT_PRGR + FLASH register with boot + address + 0x44 + 0x20 + read-only + 0x00000000 + + + BOOT_ADD0 + Boot address 0 + 0 + 16 + + + BOOT_ADD1 + Boot address 1 + 16 + 16 + + + + + CRCCR1 + CRCCR1 + FLASH CRC control register for bank + 1 + 0x50 + 0x20 + read-write + 0x00000000 + + + CRC_SECT + Bank 1 CRC sector number + 0 + 3 + + + ALL_BANK + Bank 1 CRC select bit + 7 + 1 + + + CRC_BY_SECT + Bank 1 CRC sector mode select + bit + 8 + 1 + + + ADD_SECT + Bank 1 CRC sector select + bit + 9 + 1 + + + CLEAN_SECT + Bank 1 CRC sector list clear + bit + 10 + 1 + + + START_CRC + Bank 1 CRC start bit + 16 + 1 + + + CLEAN_CRC + Bank 1 CRC clear bit + 17 + 1 + + + CRC_BURST + Bank 1 CRC burst size + 20 + 2 + + + + + CRCSADD1R + CRCSADD1R + FLASH CRC start address register for bank + 1 + 0x54 + 0x20 + read-write + 0x00000000 + + + CRC_START_ADDR + CRC start address on bank + 1 + 0 + 32 + + + + + CRCEADD1R + CRCEADD1R + FLASH CRC end address register for bank + 1 + 0x58 + 0x20 + read-write + 0x00000000 + + + CRC_END_ADDR + CRC end address on bank 1 + 0 + 32 + + + + + CRCDATAR + CRCDATAR + FLASH CRC data register + 0x5C + 0x20 + read-write + 0x00000000 + + + CRC_DATA + CRC result + 0 + 32 + + + + + ECC_FA1R + ECC_FA1R + FLASH ECC fail address for bank + 1 + 0x60 + 0x20 + read-only + 0x00000000 + + + FAIL_ECC_ADDR1 + Bank 1 ECC error address + 0 + 15 + + + + + KEYR2 + KEYR2 + FLASH key register for bank 2 + 0x104 + 0x20 + read-only + 0x00000000 + + + KEYR2 + Bank 2 access configuration unlock + key + 0 + 32 + + + + + CR2 + CR2 + FLASH control register for bank + 2 + 0x10C + 0x20 + read-write + 0x00000000 + + + LOCK2 + Bank 2 configuration lock + bit + 0 + 1 + + + PG2 + Bank 2 program enable bit + 1 + 1 + + + SER2 + Bank 2 sector erase + request + 2 + 1 + + + BER2 + Bank 2 erase request + 3 + 1 + + + PSIZE2 + Bank 2 program size + 4 + 2 + + + FW2 + Bank 2 write forcing control + bit + 6 + 1 + + + START2 + Bank 2 bank or sector erase start + control bit + 7 + 1 + + + SNB2 + Bank 2 sector erase selection + number + 8 + 3 + + + CRC_EN + Bank 2 CRC control bit + 15 + 1 + + + EOPIE2 + Bank 2 end-of-program interrupt control + bit + 16 + 1 + + + WRPERRIE2 + Bank 2 write protection error interrupt + enable bit + 17 + 1 + + + PGSERRIE2 + Bank 2 programming sequence error + interrupt enable bit + 18 + 1 + + + STRBERRIE2 + Bank 2 strobe error interrupt enable + bit + 19 + 1 + + + INCERRIE2 + Bank 2 inconsistency error interrupt + enable bit + 21 + 1 + + + OPERRIE2 + Bank 2 write/erase error interrupt + enable bit + 22 + 1 + + + RDPERRIE2 + Bank 2 read protection error interrupt + enable bit + 23 + 1 + + + RDSERRIE2 + Bank 2 secure error interrupt enable + bit + 24 + 1 + + + SNECCERRIE2 + Bank 2 ECC single correction error + interrupt enable bit + 25 + 1 + + + DBECCERRIE2 + Bank 2 ECC double detection error + interrupt enable bit + 26 + 1 + + + CRCENDIE2 + Bank 2 end of CRC calculation interrupt + enable bit + 27 + 1 + + + + + SR2 + SR2 + FLASH status register for bank + 2 + 0x110 + 0x20 + read-write + 0x00000000 + + + BSY2 + Bank 2 ongoing program + flag + 0 + 1 + + + WBNE2 + Bank 2 write buffer not empty + flag + 1 + 1 + + + QW2 + Bank 2 wait queue flag + 2 + 1 + + + CRC_BUSY2 + Bank 2 CRC busy flag + 3 + 1 + + + EOP2 + Bank 2 end-of-program flag + 16 + 1 + + + WRPERR2 + Bank 2 write protection error + flag + 17 + 1 + + + PGSERR2 + Bank 2 programming sequence error + flag + 18 + 1 + + + STRBERR2 + Bank 2 strobe error flag + 19 + 1 + + + INCERR2 + Bank 2 inconsistency error + flag + 21 + 1 + + + OPERR2 + Bank 2 write/erase error + flag + 22 + 1 + + + RDPERR2 + Bank 2 read protection error + flag + 23 + 1 + + + RDSERR2 + Bank 2 secure error flag + 24 + 1 + + + SNECCERR2 + Bank 2 single correction error + flag + 25 + 1 + + + DBECCERR2 + Bank 2 ECC double detection error + flag + 26 + 1 + + + CRCEND2 + Bank 2 CRC-complete flag + 27 + 1 + + + + + CCR2 + CCR2 + FLASH clear control register for bank + 2 + 0x114 + 0x20 + read-write + 0x00000000 + + + CLR_EOP2 + Bank 1 EOP1 flag clear bit + 16 + 1 + + + CLR_WRPERR2 + Bank 2 WRPERR1 flag clear + bit + 17 + 1 + + + CLR_PGSERR2 + Bank 2 PGSERR1 flag clear + bi + 18 + 1 + + + CLR_STRBERR2 + Bank 2 STRBERR1 flag clear + bit + 19 + 1 + + + CLR_INCERR2 + Bank 2 INCERR1 flag clear + bit + 21 + 1 + + + CLR_OPERR2 + Bank 2 OPERR1 flag clear + bit + 22 + 1 + + + CLR_RDPERR2 + Bank 2 RDPERR1 flag clear + bit + 23 + 1 + + + CLR_RDSERR1 + Bank 1 RDSERR1 flag clear + bit + 24 + 1 + + + CLR_SNECCERR2 + Bank 2 SNECCERR1 flag clear + bit + 25 + 1 + + + CLR_DBECCERR1 + Bank 1 DBECCERR1 flag clear + bit + 26 + 1 + + + CLR_CRCEND2 + Bank 2 CRCEND1 flag clear + bit + 27 + 1 + + + + + PRAR_CUR2 + PRAR_CUR2 + FLASH protection address for bank + 1 + 0x128 + 0x20 + read-only + 0x00000000 + + + PROT_AREA_START2 + Bank 2 lowest PCROP protected + address + 0 + 12 + + + PROT_AREA_END2 + Bank 2 highest PCROP protected + address + 16 + 12 + + + DMEP2 + Bank 2 PCROP protected erase enable + option status bit + 31 + 1 + + + + + PRAR_PRG2 + PRAR_PRG2 + FLASH protection address for bank + 2 + PRAR_PRG1 + 0x2C + 0x20 + read-write + 0x00000000 + + + PROT_AREA_START2 + Bank 2 lowest PCROP protected address + configuration + 0 + 12 + + + PROT_AREA_END2 + Bank 2 highest PCROP protected address + configuration + 16 + 12 + + + DMEP2 + Bank 2 PCROP protected erase enable + option configuration bit + 31 + 1 + + + + + SCAR_CUR2 + SCAR_CUR2 + FLASH secure address for bank + 2 + 0x130 + 0x20 + read-write + 0x00000000 + + + SEC_AREA_START2 + Bank 2 lowest secure protected + address + 0 + 12 + + + SEC_AREA_END2 + Bank 2 highest secure protected + address + 16 + 12 + + + DMES2 + Bank 2 secure protected erase enable + option status bit + 31 + 1 + + + + + SCAR_PRG2 + SCAR_PRG2 + FLASH secure address for bank + 2 + 0x134 + 0x20 + read-write + 0x00000000 + + + SEC_AREA_START2 + Bank 2 lowest secure protected address + configuration + 0 + 12 + + + SEC_AREA_END2 + Bank 2 highest secure protected address + configuration + 16 + 12 + + + DMES2 + Bank 2 secure protected erase enable + option configuration bit + 31 + 1 + + + + + WPSN_CUR2R + WPSN_CUR2R + FLASH write sector protection for bank + 2 + 0x138 + 0x20 + read-only + 0x00000000 + + + WRPSn2 + Bank 2 sector write protection option + status byte + 0 + 8 + + + + + WPSN_PRG2R + WPSN_PRG2R + FLASH write sector protection for bank + 2 + 0x13C + 0x20 + read-write + 0x00000000 + + + WRPSn2 + Bank 2 sector write protection + configuration byte + 0 + 8 + + + + + CRCCR2 + CRCCR2 + FLASH CRC control register for bank + 1 + 0x150 + 0x20 + read-write + 0x00000000 + + + CRC_SECT + Bank 2 CRC sector number + 0 + 3 + + + ALL_BANK + Bank 2 CRC select bit + 7 + 1 + + + CRC_BY_SECT + Bank 2 CRC sector mode select + bit + 8 + 1 + + + ADD_SECT + Bank 2 CRC sector select + bit + 9 + 1 + + + CLEAN_SECT + Bank 2 CRC sector list clear + bit + 10 + 1 + + + START_CRC + Bank 2 CRC start bit + 16 + 1 + + + CLEAN_CRC + Bank 2 CRC clear bit + 17 + 1 + + + CRC_BURST + Bank 2 CRC burst size + 20 + 2 + + + + + CRCSADD2R + CRCSADD2R + FLASH CRC start address register for bank + 2 + 0x154 + 0x20 + read-write + 0x00000000 + + + CRC_START_ADDR + CRC start address on bank + 2 + 0 + 32 + + + + + CRCEADD2R + CRCEADD2R + FLASH CRC end address register for bank + 2 + 0x158 + 0x20 + read-write + 0x00000000 + + + CRC_END_ADDR + CRC end address on bank 2 + 0 + 32 + + + + + ECC_FA2R + ECC_FA2R + FLASH ECC fail address for bank + 2 + 0x160 + 0x20 + read-only + 0x00000000 + + + FAIL_ECC_ADDR2 + Bank 2 ECC error address + 0 + 15 + + + + + + + AXI + AXI interconnect registers + AXI + 0x51000000 + + 0x0 + 0x100000 + registers + + + + AXI_PERIPH_ID_4 + AXI_PERIPH_ID_4 + AXI interconnect - peripheral ID4 + register + 0x1FD0 + 0x20 + read-only + 0x00000004 + + + JEP106CON + JEP106 continuation code + 0 + 4 + + + KCOUNT4 + Register file size + 4 + 4 + + + + + AXI_PERIPH_ID_0 + AXI_PERIPH_ID_0 + AXI interconnect - peripheral ID0 + register + 0x1FE0 + 0x20 + read-only + 0x00000004 + + + PARTNUM + Peripheral part number bits 0 to + 7 + 0 + 8 + + + + + AXI_PERIPH_ID_1 + AXI_PERIPH_ID_1 + AXI interconnect - peripheral ID1 + register + 0x1FE4 + 0x20 + read-only + 0x00000004 + + + PARTNUM + Peripheral part number bits 8 to + 11 + 0 + 4 + + + JEP106I + JEP106 identity bits 0 to + 3 + 4 + 4 + + + + + AXI_PERIPH_ID_2 + AXI_PERIPH_ID_2 + AXI interconnect - peripheral ID2 + register + 0x1FE8 + 0x20 + read-only + 0x00000004 + + + JEP106ID + JEP106 Identity bits 4 to + 6 + 0 + 3 + + + JEDEC + JEP106 code flag + 3 + 1 + + + REVISION + Peripheral revision number + 4 + 4 + + + + + AXI_PERIPH_ID_3 + AXI_PERIPH_ID_3 + AXI interconnect - peripheral ID3 + register + 0x1FEC + 0x20 + read-only + 0x00000004 + + + CUST_MOD_NUM + Customer modification + 0 + 4 + + + REV_AND + Customer version + 4 + 4 + + + + + AXI_COMP_ID_0 + AXI_COMP_ID_0 + AXI interconnect - component ID0 + register + 0x1FF0 + 0x20 + read-only + 0x00000004 + + + PREAMBLE + Preamble bits 0 to 7 + 0 + 8 + + + + + AXI_COMP_ID_1 + AXI_COMP_ID_1 + AXI interconnect - component ID1 + register + 0x1FF4 + 0x20 + read-only + 0x00000004 + + + PREAMBLE + Preamble bits 8 to 11 + 0 + 4 + + + CLASS + Component class + 4 + 4 + + + + + AXI_COMP_ID_2 + AXI_COMP_ID_2 + AXI interconnect - component ID2 + register + 0x1FF8 + 0x20 + read-only + 0x00000004 + + + PREAMBLE + Preamble bits 12 to 19 + 0 + 8 + + + + + AXI_COMP_ID_3 + AXI_COMP_ID_3 + AXI interconnect - component ID3 + register + 0x1FFC + 0x20 + read-only + 0x00000004 + + + PREAMBLE + Preamble bits 20 to 27 + 0 + 8 + + + + + AXI_TARG1_FN_MOD_ISS_BM + AXI_TARG1_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x2008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG2_FN_MOD_ISS_BM + AXI_TARG2_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x3008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG3_FN_MOD_ISS_BM + AXI_TARG3_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x4008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG4_FN_MOD_ISS_BM + AXI_TARG4_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x5008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG5_FN_MOD_ISS_BM + AXI_TARG5_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x6008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG6_FN_MOD_ISS_BM + AXI_TARG6_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x7008 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG7_FN_MOD_ISS_BM + AXI_TARG7_FN_MOD_ISS_BM + AXI interconnect - TARG x bus matrix issuing + functionality register + 0x800C + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + READ_ISS_OVERRIDE + 0 + 1 + + + WRITE_ISS_OVERRIDE + Switch matrix write issuing override for + target + 1 + 1 + + + + + AXI_TARG1_FN_MOD2 + AXI_TARG1_FN_MOD2 + AXI interconnect - TARG x bus matrix + functionality 2 register + 0x2024 + 0x20 + read-write + 0x00000004 + + + BYPASS_MERGE + Disable packing of beats to match the + output data width + 0 + 1 + + + + + AXI_TARG2_FN_MOD2 + AXI_TARG2_FN_MOD2 + AXI interconnect - TARG x bus matrix + functionality 2 register + 0x3024 + 0x20 + read-write + 0x00000004 + + + BYPASS_MERGE + Disable packing of beats to match the + output data width + 0 + 1 + + + + + AXI_TARG7_FN_MOD2 + AXI_TARG7_FN_MOD2 + AXI interconnect - TARG x bus matrix + functionality 2 register + 0x8024 + 0x20 + read-write + 0x00000004 + + + BYPASS_MERGE + Disable packing of beats to match the + output data width + 0 + 1 + + + + + AXI_TARG1_FN_MOD_LB + AXI_TARG1_FN_MOD_LB + AXI interconnect - TARG x long burst + functionality modification + 0x202C + 0x20 + read-write + 0x00000004 + + + FN_MOD_LB + Controls burst breaking of long + bursts + 0 + 1 + + + + + AXI_TARG2_FN_MOD_LB + AXI_TARG2_FN_MOD_LB + AXI interconnect - TARG x long burst + functionality modification + 0x302C + 0x20 + read-write + 0x00000004 + + + FN_MOD_LB + Controls burst breaking of long + bursts + 0 + 1 + + + + + AXI_TARG1_FN_MOD + AXI_TARG1_FN_MOD + AXI interconnect - TARG x long burst + functionality modification + 0x2108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override AMIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override AMIB write issuing + capability + 1 + 1 + + + + + AXI_TARG2_FN_MOD + AXI_TARG2_FN_MOD + AXI interconnect - TARG x long burst + functionality modification + 0x3108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override AMIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override AMIB write issuing + capability + 1 + 1 + + + + + AXI_TARG7_FN_MOD + AXI_TARG7_FN_MOD + AXI interconnect - TARG x long burst + functionality modification + 0x8108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override AMIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override AMIB write issuing + capability + 1 + 1 + + + + + AXI_INI1_FN_MOD2 + AXI_INI1_FN_MOD2 + AXI interconnect - INI x functionality + modification 2 register + 0x42024 + 0x20 + read-write + 0x00000004 + + + BYPASS_MERGE + Disables alteration of transactions by + the up-sizer unless required by the + protocol + 0 + 1 + + + + + AXI_INI3_FN_MOD2 + AXI_INI3_FN_MOD2 + AXI interconnect - INI x functionality + modification 2 register + 0x44024 + 0x20 + read-write + 0x00000004 + + + BYPASS_MERGE + Disables alteration of transactions by + the up-sizer unless required by the + protocol + 0 + 1 + + + + + AXI_INI1_FN_MOD_AHB + AXI_INI1_FN_MOD_AHB + AXI interconnect - INI x AHB functionality + modification register + 0x42028 + 0x20 + read-write + 0x00000004 + + + RD_INC_OVERRIDE + Converts all AHB-Lite write transactions + to a series of single beat AXI + 0 + 1 + + + WR_INC_OVERRIDE + Converts all AHB-Lite read transactions + to a series of single beat AXI + 1 + 1 + + + + + AXI_INI3_FN_MOD_AHB + AXI_INI3_FN_MOD_AHB + AXI interconnect - INI x AHB functionality + modification register + 0x44028 + 0x20 + read-write + 0x00000004 + + + RD_INC_OVERRIDE + Converts all AHB-Lite write transactions + to a series of single beat AXI + 0 + 1 + + + WR_INC_OVERRIDE + Converts all AHB-Lite read transactions + to a series of single beat AXI + 1 + 1 + + + + + AXI_INI1_READ_QOS + AXI_INI1_READ_QOS + AXI interconnect - INI x read QoS + register + 0x42100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI2_READ_QOS + AXI_INI2_READ_QOS + AXI interconnect - INI x read QoS + register + 0x43100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI3_READ_QOS + AXI_INI3_READ_QOS + AXI interconnect - INI x read QoS + register + 0x44100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI4_READ_QOS + AXI_INI4_READ_QOS + AXI interconnect - INI x read QoS + register + 0x45100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI5_READ_QOS + AXI_INI5_READ_QOS + AXI interconnect - INI x read QoS + register + 0x46100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI6_READ_QOS + AXI_INI6_READ_QOS + AXI interconnect - INI x read QoS + register + 0x47100 + 0x20 + read-write + 0x00000004 + + + AR_QOS + Read channel QoS setting + 0 + 4 + + + + + AXI_INI1_WRITE_QOS + AXI_INI1_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x42104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI2_WRITE_QOS + AXI_INI2_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x43104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI3_WRITE_QOS + AXI_INI3_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x44104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI4_WRITE_QOS + AXI_INI4_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x45104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI5_WRITE_QOS + AXI_INI5_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x46104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI6_WRITE_QOS + AXI_INI6_WRITE_QOS + AXI interconnect - INI x write QoS + register + 0x47104 + 0x20 + read-write + 0x00000004 + + + AW_QOS + Write channel QoS setting + 0 + 4 + + + + + AXI_INI1_FN_MOD + AXI_INI1_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x42108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + AXI_INI2_FN_MOD + AXI_INI2_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x43108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + AXI_INI3_FN_MOD + AXI_INI3_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x44108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + AXI_INI4_FN_MOD + AXI_INI4_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x45108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + AXI_INI5_FN_MOD + AXI_INI5_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x46108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + AXI_INI6_FN_MOD + AXI_INI6_FN_MOD + AXI interconnect - INI x issuing + functionality modification register + 0x47108 + 0x20 + read-write + 0x00000004 + + + READ_ISS_OVERRIDE + Override ASIB read issuing + capability + 0 + 1 + + + WRITE_ISS_OVERRIDE + Override ASIB write issuing + capability + 1 + 1 + + + + + + + + + DCMI + Digital camera interface + DCMI + 0x48020000 + + 0x0 + 0x400 + registers + + + DCMI + DCMI global interrupt + 78 + + + + CR + CR + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + OELS + Odd/Even Line Select (Line Select + Start) + 20 + 1 + + + LSM + Line Select mode + 19 + 1 + + + OEBS + Odd/Even Byte Select (Byte Select + Start) + 18 + 1 + + + BSM + Byte Select mode + 16 + 2 + + + ENABLE + DCMI enable + 14 + 1 + + + EDM + Extended data mode + 10 + 2 + + + FCRC + Frame capture rate control + 8 + 2 + + + VSPOL + Vertical synchronization + polarity + 7 + 1 + + + HSPOL + Horizontal synchronization + polarity + 6 + 1 + + + PCKPOL + Pixel clock polarity + 5 + 1 + + + ESS + Embedded synchronization + select + 4 + 1 + + + JPEG + JPEG format + 3 + 1 + + + CROP + Crop feature + 2 + 1 + + + CM + Capture mode + 1 + 1 + + + CAPTURE + Capture enable + 0 + 1 + + + + + SR + SR + status register + 0x4 + 0x20 + read-only + 0x0000 + + + FNE + FIFO not empty + 2 + 1 + + + VSYNC + VSYNC + 1 + 1 + + + HSYNC + HSYNC + 0 + 1 + + + + + RIS + RIS + raw interrupt status register + 0x8 + 0x20 + read-only + 0x0000 + + + LINE_RIS + Line raw interrupt status + 4 + 1 + + + VSYNC_RIS + VSYNC raw interrupt status + 3 + 1 + + + ERR_RIS + Synchronization error raw interrupt + status + 2 + 1 + + + OVR_RIS + Overrun raw interrupt + status + 1 + 1 + + + FRAME_RIS + Capture complete raw interrupt + status + 0 + 1 + + + + + IER + IER + interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + LINE_IE + Line interrupt enable + 4 + 1 + + + VSYNC_IE + VSYNC interrupt enable + 3 + 1 + + + ERR_IE + Synchronization error interrupt + enable + 2 + 1 + + + OVR_IE + Overrun interrupt enable + 1 + 1 + + + FRAME_IE + Capture complete interrupt + enable + 0 + 1 + + + + + MIS + MIS + masked interrupt status + register + 0x10 + 0x20 + read-only + 0x0000 + + + LINE_MIS + Line masked interrupt + status + 4 + 1 + + + VSYNC_MIS + VSYNC masked interrupt + status + 3 + 1 + + + ERR_MIS + Synchronization error masked interrupt + status + 2 + 1 + + + OVR_MIS + Overrun masked interrupt + status + 1 + 1 + + + FRAME_MIS + Capture complete masked interrupt + status + 0 + 1 + + + + + ICR + ICR + interrupt clear register + 0x14 + 0x20 + write-only + 0x0000 + + + LINE_ISC + line interrupt status + clear + 4 + 1 + + + VSYNC_ISC + Vertical synch interrupt status + clear + 3 + 1 + + + ERR_ISC + Synchronization error interrupt status + clear + 2 + 1 + + + OVR_ISC + Overrun interrupt status + clear + 1 + 1 + + + FRAME_ISC + Capture complete interrupt status + clear + 0 + 1 + + + + + ESCR + ESCR + embedded synchronization code + register + 0x18 + 0x20 + read-write + 0x0000 + + + FEC + Frame end delimiter code + 24 + 8 + + + LEC + Line end delimiter code + 16 + 8 + + + LSC + Line start delimiter code + 8 + 8 + + + FSC + Frame start delimiter code + 0 + 8 + + + + + ESUR + ESUR + embedded synchronization unmask + register + 0x1C + 0x20 + read-write + 0x0000 + + + FEU + Frame end delimiter unmask + 24 + 8 + + + LEU + Line end delimiter unmask + 16 + 8 + + + LSU + Line start delimiter + unmask + 8 + 8 + + + FSU + Frame start delimiter + unmask + 0 + 8 + + + + + CWSTRT + CWSTRT + crop window start + 0x20 + 0x20 + read-write + 0x0000 + + + VST + Vertical start line count + 16 + 13 + + + HOFFCNT + Horizontal offset count + 0 + 14 + + + + + CWSIZE + CWSIZE + crop window size + 0x24 + 0x20 + read-write + 0x0000 + + + VLINE + Vertical line count + 16 + 14 + + + CAPCNT + Capture count + 0 + 14 + + + + + DR + DR + data register + 0x28 + 0x20 + read-only + 0x0000 + + + Byte3 + Data byte 3 + 24 + 8 + + + Byte2 + Data byte 2 + 16 + 8 + + + Byte1 + Data byte 1 + 8 + 8 + + + Byte0 + Data byte 0 + 0 + 8 + + + + + + + OTG1_HS_GLOBAL + USB 1 on the go high speed + USB_OTG_HS + 0x40040000 + + 0x0 + 0x400 + registers + + + + OTG_HS_GOTGCTL + OTG_HS_GOTGCTL + OTG_HS control and status + register + 0x0 + 32 + 0x00000800 + + + SRQSCS + Session request success + 0 + 1 + read-only + + + SRQ + Session request + 1 + 1 + read-write + + + HNGSCS + Host negotiation success + 8 + 1 + read-only + + + HNPRQ + HNP request + 9 + 1 + read-write + + + HSHNPEN + Host set HNP enable + 10 + 1 + read-write + + + DHNPEN + Device HNP enabled + 11 + 1 + read-write + + + CIDSTS + Connector ID status + 16 + 1 + read-only + + + DBCT + Long/short debounce time + 17 + 1 + read-only + + + ASVLD + A-session valid + 18 + 1 + read-only + + + BSVLD + B-session valid + 19 + 1 + read-only + + + EHEN + Embedded host enable + 12 + 1 + read-write + + + + + OTG_HS_GOTGINT + OTG_HS_GOTGINT + OTG_HS interrupt register + 0x4 + 32 + read-write + 0x0 + + + SEDET + Session end detected + 2 + 1 + + + SRSSCHG + Session request success status + change + 8 + 1 + + + HNSSCHG + Host negotiation success status + change + 9 + 1 + + + HNGDET + Host negotiation detected + 17 + 1 + + + ADTOCHG + A-device timeout change + 18 + 1 + + + DBCDNE + Debounce done + 19 + 1 + + + IDCHNG + ID input pin changed + 20 + 1 + + + + + OTG_HS_GAHBCFG + OTG_HS_GAHBCFG + OTG_HS AHB configuration + register + 0x8 + 32 + read-write + 0x0 + + + GINT + Global interrupt mask + 0 + 1 + + + HBSTLEN + Burst length/type + 1 + 4 + + + DMAEN + DMA enable + 5 + 1 + + + TXFELVL + TxFIFO empty level + 7 + 1 + + + PTXFELVL + Periodic TxFIFO empty + level + 8 + 1 + + + + + OTG_HS_GUSBCFG + OTG_HS_GUSBCFG + OTG_HS USB configuration + register + 0xC + 32 + 0x00000A00 + + + TOCAL + FS timeout calibration + 0 + 3 + read-write + + + PHYSEL + USB 2.0 high-speed ULPI PHY or USB 1.1 + full-speed serial transceiver select + 6 + 1 + write-only + + + SRPCAP + SRP-capable + 8 + 1 + read-write + + + HNPCAP + HNP-capable + 9 + 1 + read-write + + + TRDT + USB turnaround time + 10 + 4 + read-write + + + PHYLPCS + PHY Low-power clock select + 15 + 1 + read-write + + + ULPIFSLS + ULPI FS/LS select + 17 + 1 + read-write + + + ULPIAR + ULPI Auto-resume + 18 + 1 + read-write + + + ULPICSM + ULPI Clock SuspendM + 19 + 1 + read-write + + + ULPIEVBUSD + ULPI External VBUS Drive + 20 + 1 + read-write + + + ULPIEVBUSI + ULPI external VBUS + indicator + 21 + 1 + read-write + + + TSDPS + TermSel DLine pulsing + selection + 22 + 1 + read-write + + + PCCI + Indicator complement + 23 + 1 + read-write + + + PTCI + Indicator pass through + 24 + 1 + read-write + + + ULPIIPD + ULPI interface protect + disable + 25 + 1 + read-write + + + FHMOD + Forced host mode + 29 + 1 + read-write + + + FDMOD + Forced peripheral mode + 30 + 1 + read-write + + + + + OTG_HS_GRSTCTL + OTG_HS_GRSTCTL + OTG_HS reset register + 0x10 + 32 + 0x20000000 + + + CSRST + Core soft reset + 0 + 1 + read-write + + + HSRST + HCLK soft reset + 1 + 1 + read-write + + + FCRST + Host frame counter reset + 2 + 1 + read-write + + + RXFFLSH + RxFIFO flush + 4 + 1 + read-write + + + TXFFLSH + TxFIFO flush + 5 + 1 + read-write + + + TXFNUM + TxFIFO number + 6 + 5 + read-write + + + AHBIDL + AHB master idle + 31 + 1 + read-only + + + DMAREQ + DMA request signal enabled for USB OTG + HS + 30 + 1 + read-only + + + + + OTG_HS_GINTSTS + OTG_HS_GINTSTS + OTG_HS core interrupt register + 0x14 + 32 + 0x04000020 + + + CMOD + Current mode of operation + 0 + 1 + read-only + + + MMIS + Mode mismatch interrupt + 1 + 1 + read-write + + + OTGINT + OTG interrupt + 2 + 1 + read-only + + + SOF + Start of frame + 3 + 1 + read-write + + + RXFLVL + RxFIFO nonempty + 4 + 1 + read-only + + + NPTXFE + Nonperiodic TxFIFO empty + 5 + 1 + read-only + + + GINAKEFF + Global IN nonperiodic NAK + effective + 6 + 1 + read-only + + + BOUTNAKEFF + Global OUT NAK effective + 7 + 1 + read-only + + + ESUSP + Early suspend + 10 + 1 + read-write + + + USBSUSP + USB suspend + 11 + 1 + read-write + + + USBRST + USB reset + 12 + 1 + read-write + + + ENUMDNE + Enumeration done + 13 + 1 + read-write + + + ISOODRP + Isochronous OUT packet dropped + interrupt + 14 + 1 + read-write + + + EOPF + End of periodic frame + interrupt + 15 + 1 + read-write + + + IEPINT + IN endpoint interrupt + 18 + 1 + read-only + + + OEPINT + OUT endpoint interrupt + 19 + 1 + read-only + + + IISOIXFR + Incomplete isochronous IN + transfer + 20 + 1 + read-write + + + PXFR_INCOMPISOOUT + Incomplete periodic + transfer + 21 + 1 + read-write + + + DATAFSUSP + Data fetch suspended + 22 + 1 + read-write + + + HPRTINT + Host port interrupt + 24 + 1 + read-only + + + HCINT + Host channels interrupt + 25 + 1 + read-only + + + PTXFE + Periodic TxFIFO empty + 26 + 1 + read-only + + + CIDSCHG + Connector ID status change + 28 + 1 + read-write + + + DISCINT + Disconnect detected + interrupt + 29 + 1 + read-write + + + SRQINT + Session request/new session detected + interrupt + 30 + 1 + read-write + + + WKUINT + Resume/remote wakeup detected + interrupt + 31 + 1 + read-write + + + + + OTG_HS_GINTMSK + OTG_HS_GINTMSK + OTG_HS interrupt mask register + 0x18 + 32 + 0x0 + + + MMISM + Mode mismatch interrupt + mask + 1 + 1 + read-write + + + OTGINT + OTG interrupt mask + 2 + 1 + read-write + + + SOFM + Start of frame mask + 3 + 1 + read-write + + + RXFLVLM + Receive FIFO nonempty mask + 4 + 1 + read-write + + + NPTXFEM + Nonperiodic TxFIFO empty + mask + 5 + 1 + read-write + + + GINAKEFFM + Global nonperiodic IN NAK effective + mask + 6 + 1 + read-write + + + GONAKEFFM + Global OUT NAK effective + mask + 7 + 1 + read-write + + + ESUSPM + Early suspend mask + 10 + 1 + read-write + + + USBSUSPM + USB suspend mask + 11 + 1 + read-write + + + USBRST + USB reset mask + 12 + 1 + read-write + + + ENUMDNEM + Enumeration done mask + 13 + 1 + read-write + + + ISOODRPM + Isochronous OUT packet dropped interrupt + mask + 14 + 1 + read-write + + + EOPFM + End of periodic frame interrupt + mask + 15 + 1 + read-write + + + IEPINT + IN endpoints interrupt + mask + 18 + 1 + read-write + + + OEPINT + OUT endpoints interrupt + mask + 19 + 1 + read-write + + + IISOIXFRM + Incomplete isochronous IN transfer + mask + 20 + 1 + read-write + + + PXFRM_IISOOXFRM + Incomplete periodic transfer + mask + 21 + 1 + read-write + + + FSUSPM + Data fetch suspended mask + 22 + 1 + read-write + + + PRTIM + Host port interrupt mask + 24 + 1 + read-only + + + HCIM + Host channels interrupt + mask + 25 + 1 + read-write + + + PTXFEM + Periodic TxFIFO empty mask + 26 + 1 + read-write + + + CIDSCHGM + Connector ID status change + mask + 28 + 1 + read-write + + + DISCINT + Disconnect detected interrupt + mask + 29 + 1 + read-write + + + SRQIM + Session request/new session detected + interrupt mask + 30 + 1 + read-write + + + WUIM + Resume/remote wakeup detected interrupt + mask + 31 + 1 + read-write + + + RSTDE + Reset detected interrupt + mask + 23 + 1 + read-write + + + LPMINTM + LPM interrupt mask + 27 + 1 + read-write + + + + + OTG_HS_GRXSTSR_Host + OTG_HS_GRXSTSR_Host + OTG_HS Receive status debug read register + (host mode) + 0x1C + 32 + read-only + 0x0 + + + CHNUM + Channel number + 0 + 4 + + + BCNT + Byte count + 4 + 11 + + + DPID + Data PID + 15 + 2 + + + PKTSTS + Packet status + 17 + 4 + + + + + OTG_HS_GRXSTSP_Host + OTG_HS_GRXSTSP_Host + OTG_HS status read and pop register (host + mode) + 0x20 + 32 + read-only + 0x0 + + + CHNUM + Channel number + 0 + 4 + + + BCNT + Byte count + 4 + 11 + + + DPID + Data PID + 15 + 2 + + + PKTSTS + Packet status + 17 + 4 + + + + + OTG_HS_GRXFSIZ + OTG_HS_GRXFSIZ + OTG_HS Receive FIFO size + register + 0x24 + 32 + read-write + 0x00000200 + + + RXFD + RxFIFO depth + 0 + 16 + + + + + OTG_HS_HNPTXFSIZ_Host + OTG_HS_HNPTXFSIZ_Host + OTG_HS nonperiodic transmit FIFO size + register (host mode) + 0x28 + 32 + read-write + 0x00000200 + + + NPTXFSA + Nonperiodic transmit RAM start + address + 0 + 16 + + + NPTXFD + Nonperiodic TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF0_Device + OTG_HS_DIEPTXF0_Device + Endpoint 0 transmit FIFO size (peripheral + mode) + OTG_HS_HNPTXFSIZ_Host + 0x28 + 32 + read-write + 0x00000200 + + + TX0FSA + Endpoint 0 transmit RAM start + address + 0 + 16 + + + TX0FD + Endpoint 0 TxFIFO depth + 16 + 16 + + + + + OTG_HS_GNPTXSTS + OTG_HS_GNPTXSTS + OTG_HS nonperiodic transmit FIFO/queue + status register + 0x2C + 32 + read-only + 0x00080200 + + + NPTXFSAV + Nonperiodic TxFIFO space + available + 0 + 16 + + + NPTQXSAV + Nonperiodic transmit request queue space + available + 16 + 8 + + + NPTXQTOP + Top of the nonperiodic transmit request + queue + 24 + 7 + + + + + OTG_HS_GCCFG + OTG_HS_GCCFG + OTG_HS general core configuration + register + 0x38 + 32 + read-write + 0x0 + + + PWRDWN + Power down + 16 + 1 + + + BCDEN + Battery charging detector (BCD) + enable + 17 + 1 + + + DCDEN + Data contact detection (DCD) mode + enable + 18 + 1 + + + PDEN + Primary detection (PD) mode + enable + 19 + 1 + + + SDEN + Secondary detection (SD) mode + enable + 20 + 1 + + + VBDEN + USB VBUS detection enable + 21 + 1 + + + DCDET + Data contact detection (DCD) + status + 0 + 1 + + + PDET + Primary detection (PD) + status + 1 + 1 + + + SDET + Secondary detection (SD) + status + 2 + 1 + + + PS2DET + DM pull-up detection + status + 3 + 1 + + + + + OTG_HS_CID + OTG_HS_CID + OTG_HS core ID register + 0x3C + 32 + read-write + 0x00001200 + + + PRODUCT_ID + Product ID field + 0 + 32 + + + + + OTG_HS_HPTXFSIZ + OTG_HS_HPTXFSIZ + OTG_HS Host periodic transmit FIFO size + register + 0x100 + 32 + read-write + 0x02000600 + + + PTXSA + Host periodic TxFIFO start + address + 0 + 16 + + + PTXFD + Host periodic TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF1 + OTG_HS_DIEPTXF1 + OTG_HS device IN endpoint transmit FIFO size + register + 0x104 + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF2 + OTG_HS_DIEPTXF2 + OTG_HS device IN endpoint transmit FIFO size + register + 0x108 + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF3 + OTG_HS_DIEPTXF3 + OTG_HS device IN endpoint transmit FIFO size + register + 0x11C + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF4 + OTG_HS_DIEPTXF4 + OTG_HS device IN endpoint transmit FIFO size + register + 0x120 + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF5 + OTG_HS_DIEPTXF5 + OTG_HS device IN endpoint transmit FIFO size + register + 0x124 + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF6 + OTG_HS_DIEPTXF6 + OTG_HS device IN endpoint transmit FIFO size + register + 0x128 + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_DIEPTXF7 + OTG_HS_DIEPTXF7 + OTG_HS device IN endpoint transmit FIFO size + register + 0x12C + 32 + read-write + 0x02000400 + + + INEPTXSA + IN endpoint FIFOx transmit RAM start + address + 0 + 16 + + + INEPTXFD + IN endpoint TxFIFO depth + 16 + 16 + + + + + OTG_HS_GRXSTSR_Device + OTG_HS_GRXSTSR_Device + OTG_HS Receive status debug read register + (peripheral mode mode) + OTG_HS_GRXSTSR_Host + 0x1C + 32 + read-only + 0x0 + + + EPNUM + Endpoint number + 0 + 4 + + + BCNT + Byte count + 4 + 11 + + + DPID + Data PID + 15 + 2 + + + PKTSTS + Packet status + 17 + 4 + + + FRMNUM + Frame number + 21 + 4 + + + + + OTG_HS_GRXSTSP_Device + OTG_HS_GRXSTSP_Device + OTG_HS status read and pop register + (peripheral mode) + OTG_HS_GRXSTSP_Host + 0x20 + 32 + read-only + 0x0 + + + EPNUM + Endpoint number + 0 + 4 + + + BCNT + Byte count + 4 + 11 + + + DPID + Data PID + 15 + 2 + + + PKTSTS + Packet status + 17 + 4 + + + FRMNUM + Frame number + 21 + 4 + + + + + OTG_HS_GLPMCFG + OTG_HS_GLPMCFG + OTG core LPM configuration + register + 0x54 + 32 + 0x0 + + + LPMEN + LPM support enable + 0 + 1 + read-write + + + LPMACK + LPM token acknowledge + enable + 1 + 1 + read-write + + + BESL + Best effort service + latency + 2 + 4 + read-only + + + REMWAKE + bRemoteWake value + 6 + 1 + read-only + + + L1SSEN + L1 Shallow Sleep enable + 7 + 1 + read-write + + + BESLTHRS + BESL threshold + 8 + 4 + read-write + + + L1DSEN + L1 deep sleep enable + 12 + 1 + read-write + + + LPMRST + LPM response + 13 + 2 + read-only + + + SLPSTS + Port sleep status + 15 + 1 + read-only + + + L1RSMOK + Sleep State Resume OK + 16 + 1 + read-only + + + LPMCHIDX + LPM Channel Index + 17 + 4 + read-write + + + LPMRCNT + LPM retry count + 21 + 3 + read-write + + + SNDLPM + Send LPM transaction + 24 + 1 + read-write + + + LPMRCNTSTS + LPM retry count status + 25 + 3 + read-only + + + ENBESL + Enable best effort service + latency + 28 + 1 + read-write + + + + + + + OTG2_HS_GLOBAL + 0x40080000 + + OTG_HS_EP1_OUT + OTG_HS out global interrupt + 74 + + + OTG_HS_EP1_IN + OTG_HS in global interrupt + 75 + + + OTG_HS_WKUP + OTG_HS wakeup interrupt + 76 + + + OTG_HS + OTG_HS global interrupt + 77 + + + OTG_FS_EP1_OUT + OTG_FS out global interrupt + 98 + + + OTG_FS_EP1_IN + OTG_FS in global interrupt + 99 + + + OTG_FS_WKUP + OTG_FS wakeup + 100 + + + + OTG1_HS_HOST + USB 1 on the go high speed + USB_OTG_HS + 0x40040400 + + 0x0 + 0x400 + registers + + + OTG_FS + OTG_FS global interrupt + 101 + + + + OTG_HS_HCFG + OTG_HS_HCFG + OTG_HS host configuration + register + 0x0 + 32 + 0x0 + + + FSLSPCS + FS/LS PHY clock select + 0 + 2 + read-write + + + FSLSS + FS- and LS-only support + 2 + 1 + read-only + + + + + OTG_HS_HFIR + OTG_HS_HFIR + OTG_HS Host frame interval + register + 0x4 + 32 + read-write + 0x0000EA60 + + + FRIVL + Frame interval + 0 + 16 + + + + + OTG_HS_HFNUM + OTG_HS_HFNUM + OTG_HS host frame number/frame time + remaining register + 0x8 + 32 + read-only + 0x00003FFF + + + FRNUM + Frame number + 0 + 16 + + + FTREM + Frame time remaining + 16 + 16 + + + + + OTG_HS_HPTXSTS + OTG_HS_HPTXSTS + OTG_HS_Host periodic transmit FIFO/queue + status register + 0x10 + 32 + 0x00080100 + + + PTXFSAVL + Periodic transmit data FIFO space + available + 0 + 16 + read-write + + + PTXQSAV + Periodic transmit request queue space + available + 16 + 8 + read-only + + + PTXQTOP + Top of the periodic transmit request + queue + 24 + 8 + read-only + + + + + OTG_HS_HAINT + OTG_HS_HAINT + OTG_HS Host all channels interrupt + register + 0x14 + 32 + read-only + 0x0 + + + HAINT + Channel interrupts + 0 + 16 + + + + + OTG_HS_HAINTMSK + OTG_HS_HAINTMSK + OTG_HS host all channels interrupt mask + register + 0x18 + 32 + read-write + 0x0 + + + HAINTM + Channel interrupt mask + 0 + 16 + + + + + OTG_HS_HPRT + OTG_HS_HPRT + OTG_HS host port control and status + register + 0x40 + 32 + 0x0 + + + PCSTS + Port connect status + 0 + 1 + read-only + + + PCDET + Port connect detected + 1 + 1 + read-write + + + PENA + Port enable + 2 + 1 + read-write + + + PENCHNG + Port enable/disable change + 3 + 1 + read-write + + + POCA + Port overcurrent active + 4 + 1 + read-only + + + POCCHNG + Port overcurrent change + 5 + 1 + read-write + + + PRES + Port resume + 6 + 1 + read-write + + + PSUSP + Port suspend + 7 + 1 + read-write + + + PRST + Port reset + 8 + 1 + read-write + + + PLSTS + Port line status + 10 + 2 + read-only + + + PPWR + Port power + 12 + 1 + read-write + + + PTCTL + Port test control + 13 + 4 + read-write + + + PSPD + Port speed + 17 + 2 + read-only + + + + + OTG_HS_HCCHAR0 + OTG_HS_HCCHAR0 + OTG_HS host channel-0 characteristics + register + 0x100 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR1 + OTG_HS_HCCHAR1 + OTG_HS host channel-1 characteristics + register + 0x120 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR2 + OTG_HS_HCCHAR2 + OTG_HS host channel-2 characteristics + register + 0x140 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR3 + OTG_HS_HCCHAR3 + OTG_HS host channel-3 characteristics + register + 0x160 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR4 + OTG_HS_HCCHAR4 + OTG_HS host channel-4 characteristics + register + 0x180 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR5 + OTG_HS_HCCHAR5 + OTG_HS host channel-5 characteristics + register + 0x1A0 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR6 + OTG_HS_HCCHAR6 + OTG_HS host channel-6 characteristics + register + 0x1C0 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR7 + OTG_HS_HCCHAR7 + OTG_HS host channel-7 characteristics + register + 0x1E0 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR8 + OTG_HS_HCCHAR8 + OTG_HS host channel-8 characteristics + register + 0x200 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR9 + OTG_HS_HCCHAR9 + OTG_HS host channel-9 characteristics + register + 0x220 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR10 + OTG_HS_HCCHAR10 + OTG_HS host channel-10 characteristics + register + 0x240 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCCHAR11 + OTG_HS_HCCHAR11 + OTG_HS host channel-11 characteristics + register + 0x260 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCSPLT0 + OTG_HS_HCSPLT0 + OTG_HS host channel-0 split control + register + 0x104 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT1 + OTG_HS_HCSPLT1 + OTG_HS host channel-1 split control + register + 0x124 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT2 + OTG_HS_HCSPLT2 + OTG_HS host channel-2 split control + register + 0x144 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT3 + OTG_HS_HCSPLT3 + OTG_HS host channel-3 split control + register + 0x164 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT4 + OTG_HS_HCSPLT4 + OTG_HS host channel-4 split control + register + 0x184 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT5 + OTG_HS_HCSPLT5 + OTG_HS host channel-5 split control + register + 0x1A4 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT6 + OTG_HS_HCSPLT6 + OTG_HS host channel-6 split control + register + 0x1C4 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT7 + OTG_HS_HCSPLT7 + OTG_HS host channel-7 split control + register + 0x1E4 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT8 + OTG_HS_HCSPLT8 + OTG_HS host channel-8 split control + register + 0x204 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT9 + OTG_HS_HCSPLT9 + OTG_HS host channel-9 split control + register + 0x224 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT10 + OTG_HS_HCSPLT10 + OTG_HS host channel-10 split control + register + 0x244 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCSPLT11 + OTG_HS_HCSPLT11 + OTG_HS host channel-11 split control + register + 0x264 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCINT0 + OTG_HS_HCINT0 + OTG_HS host channel-11 interrupt + register + 0x108 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT1 + OTG_HS_HCINT1 + OTG_HS host channel-1 interrupt + register + 0x128 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT2 + OTG_HS_HCINT2 + OTG_HS host channel-2 interrupt + register + 0x148 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT3 + OTG_HS_HCINT3 + OTG_HS host channel-3 interrupt + register + 0x168 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT4 + OTG_HS_HCINT4 + OTG_HS host channel-4 interrupt + register + 0x188 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT5 + OTG_HS_HCINT5 + OTG_HS host channel-5 interrupt + register + 0x1A8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT6 + OTG_HS_HCINT6 + OTG_HS host channel-6 interrupt + register + 0x1C8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT7 + OTG_HS_HCINT7 + OTG_HS host channel-7 interrupt + register + 0x1E8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT8 + OTG_HS_HCINT8 + OTG_HS host channel-8 interrupt + register + 0x208 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT9 + OTG_HS_HCINT9 + OTG_HS host channel-9 interrupt + register + 0x228 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT10 + OTG_HS_HCINT10 + OTG_HS host channel-10 interrupt + register + 0x248 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINT11 + OTG_HS_HCINT11 + OTG_HS host channel-11 interrupt + register + 0x268 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINTMSK0 + OTG_HS_HCINTMSK0 + OTG_HS host channel-11 interrupt mask + register + 0x10C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK1 + OTG_HS_HCINTMSK1 + OTG_HS host channel-1 interrupt mask + register + 0x12C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK2 + OTG_HS_HCINTMSK2 + OTG_HS host channel-2 interrupt mask + register + 0x14C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK3 + OTG_HS_HCINTMSK3 + OTG_HS host channel-3 interrupt mask + register + 0x16C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK4 + OTG_HS_HCINTMSK4 + OTG_HS host channel-4 interrupt mask + register + 0x18C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK5 + OTG_HS_HCINTMSK5 + OTG_HS host channel-5 interrupt mask + register + 0x1AC + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK6 + OTG_HS_HCINTMSK6 + OTG_HS host channel-6 interrupt mask + register + 0x1CC + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK7 + OTG_HS_HCINTMSK7 + OTG_HS host channel-7 interrupt mask + register + 0x1EC + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK8 + OTG_HS_HCINTMSK8 + OTG_HS host channel-8 interrupt mask + register + 0x20C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK9 + OTG_HS_HCINTMSK9 + OTG_HS host channel-9 interrupt mask + register + 0x22C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK10 + OTG_HS_HCINTMSK10 + OTG_HS host channel-10 interrupt mask + register + 0x24C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCINTMSK11 + OTG_HS_HCINTMSK11 + OTG_HS host channel-11 interrupt mask + register + 0x26C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + response received interrupt + mask + 6 + 1 + + + TXERRM + Transaction error mask + 7 + 1 + + + BBERRM + Babble error mask + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCTSIZ0 + OTG_HS_HCTSIZ0 + OTG_HS host channel-11 transfer size + register + 0x110 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ1 + OTG_HS_HCTSIZ1 + OTG_HS host channel-1 transfer size + register + 0x130 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ2 + OTG_HS_HCTSIZ2 + OTG_HS host channel-2 transfer size + register + 0x150 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ3 + OTG_HS_HCTSIZ3 + OTG_HS host channel-3 transfer size + register + 0x170 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ4 + OTG_HS_HCTSIZ4 + OTG_HS host channel-4 transfer size + register + 0x190 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ5 + OTG_HS_HCTSIZ5 + OTG_HS host channel-5 transfer size + register + 0x1B0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ6 + OTG_HS_HCTSIZ6 + OTG_HS host channel-6 transfer size + register + 0x1D0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ7 + OTG_HS_HCTSIZ7 + OTG_HS host channel-7 transfer size + register + 0x1F0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ8 + OTG_HS_HCTSIZ8 + OTG_HS host channel-8 transfer size + register + 0x210 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ9 + OTG_HS_HCTSIZ9 + OTG_HS host channel-9 transfer size + register + 0x230 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ10 + OTG_HS_HCTSIZ10 + OTG_HS host channel-10 transfer size + register + 0x250 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCTSIZ11 + OTG_HS_HCTSIZ11 + OTG_HS host channel-11 transfer size + register + 0x270 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCDMA0 + OTG_HS_HCDMA0 + OTG_HS host channel-0 DMA address + register + 0x114 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA1 + OTG_HS_HCDMA1 + OTG_HS host channel-1 DMA address + register + 0x134 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA2 + OTG_HS_HCDMA2 + OTG_HS host channel-2 DMA address + register + 0x154 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA3 + OTG_HS_HCDMA3 + OTG_HS host channel-3 DMA address + register + 0x174 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA4 + OTG_HS_HCDMA4 + OTG_HS host channel-4 DMA address + register + 0x194 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA5 + OTG_HS_HCDMA5 + OTG_HS host channel-5 DMA address + register + 0x1B4 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA6 + OTG_HS_HCDMA6 + OTG_HS host channel-6 DMA address + register + 0x1D4 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA7 + OTG_HS_HCDMA7 + OTG_HS host channel-7 DMA address + register + 0x1F4 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA8 + OTG_HS_HCDMA8 + OTG_HS host channel-8 DMA address + register + 0x214 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA9 + OTG_HS_HCDMA9 + OTG_HS host channel-9 DMA address + register + 0x234 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA10 + OTG_HS_HCDMA10 + OTG_HS host channel-10 DMA address + register + 0x254 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCDMA11 + OTG_HS_HCDMA11 + OTG_HS host channel-11 DMA address + register + 0x274 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCCHAR12 + OTG_HS_HCCHAR12 + OTG_HS host channel-12 characteristics + register + 0x278 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCSPLT12 + OTG_HS_HCSPLT12 + OTG_HS host channel-12 split control + register + 0x27C + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCINT12 + OTG_HS_HCINT12 + OTG_HS host channel-12 interrupt + register + 0x280 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINTMSK12 + OTG_HS_HCINTMSK12 + OTG_HS host channel-12 interrupt mask + register + 0x284 + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERRM + Transaction error + 7 + 1 + + + BBERRM + Babble error + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCTSIZ12 + OTG_HS_HCTSIZ12 + OTG_HS host channel-12 transfer size + register + 0x288 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCDMA12 + OTG_HS_HCDMA12 + OTG_HS host channel-12 DMA address + register + 0x28C + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCCHAR13 + OTG_HS_HCCHAR13 + OTG_HS host channel-13 characteristics + register + 0x290 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCSPLT13 + OTG_HS_HCSPLT13 + OTG_HS host channel-13 split control + register + 0x294 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCINT13 + OTG_HS_HCINT13 + OTG_HS host channel-13 interrupt + register + 0x298 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINTMSK13 + OTG_HS_HCINTMSK13 + OTG_HS host channel-13 interrupt mask + register + 0x29C + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALLM response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERRM + Transaction error + 7 + 1 + + + BBERRM + Babble error + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCTSIZ13 + OTG_HS_HCTSIZ13 + OTG_HS host channel-13 transfer size + register + 0x2A0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCDMA13 + OTG_HS_HCDMA13 + OTG_HS host channel-13 DMA address + register + 0x2A4 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCCHAR14 + OTG_HS_HCCHAR14 + OTG_HS host channel-14 characteristics + register + 0x2A8 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCSPLT14 + OTG_HS_HCSPLT14 + OTG_HS host channel-14 split control + register + 0x2AC + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCINT14 + OTG_HS_HCINT14 + OTG_HS host channel-14 interrupt + register + 0x2B0 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINTMSK14 + OTG_HS_HCINTMSK14 + OTG_HS host channel-14 interrupt mask + register + 0x2B4 + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALLM + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAKM response received interrupt + mask + 4 + 1 + + + ACKM + ACKM response received/transmitted + interrupt mask + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERRM + Transaction error + 7 + 1 + + + BBERRM + Babble error + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCTSIZ14 + OTG_HS_HCTSIZ14 + OTG_HS host channel-14 transfer size + register + 0x2B8 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCDMA14 + OTG_HS_HCDMA14 + OTG_HS host channel-14 DMA address + register + 0x2BC + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_HCCHAR15 + OTG_HS_HCCHAR15 + OTG_HS host channel-15 characteristics + register + 0x2C0 + 32 + read-write + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + + + EPNUM + Endpoint number + 11 + 4 + + + EPDIR + Endpoint direction + 15 + 1 + + + LSDEV + Low-speed device + 17 + 1 + + + EPTYP + Endpoint type + 18 + 2 + + + MC + Multi Count (MC) / Error Count + (EC) + 20 + 2 + + + DAD + Device address + 22 + 7 + + + ODDFRM + Odd frame + 29 + 1 + + + CHDIS + Channel disable + 30 + 1 + + + CHENA + Channel enable + 31 + 1 + + + + + OTG_HS_HCSPLT15 + OTG_HS_HCSPLT15 + OTG_HS host channel-15 split control + register + 0x2C4 + 32 + read-write + 0x0 + + + PRTADDR + Port address + 0 + 7 + + + HUBADDR + Hub address + 7 + 7 + + + XACTPOS + XACTPOS + 14 + 2 + + + COMPLSPLT + Do complete split + 16 + 1 + + + SPLITEN + Split enable + 31 + 1 + + + + + OTG_HS_HCINT15 + OTG_HS_HCINT15 + OTG_HS host channel-15 interrupt + register + 0x2C8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + 0 + 1 + + + CHH + Channel halted + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received + interrupt + 3 + 1 + + + NAK + NAK response received + interrupt + 4 + 1 + + + ACK + ACK response received/transmitted + interrupt + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERR + Transaction error + 7 + 1 + + + BBERR + Babble error + 8 + 1 + + + FRMOR + Frame overrun + 9 + 1 + + + DTERR + Data toggle error + 10 + 1 + + + + + OTG_HS_HCINTMSK15 + OTG_HS_HCINTMSK15 + OTG_HS host channel-15 interrupt mask + register + 0x2CC + 32 + read-write + 0x0 + + + XFRCM + Transfer completed mask + 0 + 1 + + + CHHM + Channel halted mask + 1 + 1 + + + AHBERR + AHB error + 2 + 1 + + + STALL + STALL response received interrupt + mask + 3 + 1 + + + NAKM + NAK response received interrupt + mask + 4 + 1 + + + ACKM + ACK response received/transmitted + interrupt mask + 5 + 1 + + + NYET + Response received + interrupt + 6 + 1 + + + TXERRM + Transaction error + 7 + 1 + + + BBERRM + Babble error + 8 + 1 + + + FRMORM + Frame overrun mask + 9 + 1 + + + DTERRM + Data toggle error mask + 10 + 1 + + + + + OTG_HS_HCTSIZ15 + OTG_HS_HCTSIZ15 + OTG_HS host channel-15 transfer size + register + 0x2D0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + DPID + Data PID + 29 + 2 + + + + + OTG_HS_HCDMA15 + OTG_HS_HCDMA15 + OTG_HS host channel-15 DMA address + register + 0x2D4 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + + + OTG2_HS_HOST + 0x40080400 + + + OTG1_HS_DEVICE + USB 1 on the go high speed + USB_OTG_HS + 0x40040800 + + 0x0 + 0x400 + registers + + + + OTG_HS_DCFG + OTG_HS_DCFG + OTG_HS device configuration + register + 0x0 + 32 + read-write + 0x02200000 + + + DSPD + Device speed + 0 + 2 + + + NZLSOHSK + Nonzero-length status OUT + handshake + 2 + 1 + + + DAD + Device address + 4 + 7 + + + PFIVL + Periodic (micro)frame + interval + 11 + 2 + + + PERSCHIVL + Periodic scheduling + interval + 24 + 2 + + + + + OTG_HS_DCTL + OTG_HS_DCTL + OTG_HS device control register + 0x4 + 32 + 0x0 + + + RWUSIG + Remote wakeup signaling + 0 + 1 + read-write + + + SDIS + Soft disconnect + 1 + 1 + read-write + + + GINSTS + Global IN NAK status + 2 + 1 + read-only + + + GONSTS + Global OUT NAK status + 3 + 1 + read-only + + + TCTL + Test control + 4 + 3 + read-write + + + SGINAK + Set global IN NAK + 7 + 1 + write-only + + + CGINAK + Clear global IN NAK + 8 + 1 + write-only + + + SGONAK + Set global OUT NAK + 9 + 1 + write-only + + + CGONAK + Clear global OUT NAK + 10 + 1 + write-only + + + POPRGDNE + Power-on programming done + 11 + 1 + read-write + + + + + OTG_HS_DSTS + OTG_HS_DSTS + OTG_HS device status register + 0x8 + 32 + read-only + 0x00000010 + + + SUSPSTS + Suspend status + 0 + 1 + + + ENUMSPD + Enumerated speed + 1 + 2 + + + EERR + Erratic error + 3 + 1 + + + FNSOF + Frame number of the received + SOF + 8 + 14 + + + + + OTG_HS_DIEPMSK + OTG_HS_DIEPMSK + OTG_HS device IN endpoint common interrupt + mask register + 0x10 + 32 + read-write + 0x0 + + + XFRCM + Transfer completed interrupt + mask + 0 + 1 + + + EPDM + Endpoint disabled interrupt + mask + 1 + 1 + + + TOM + Timeout condition mask (nonisochronous + endpoints) + 3 + 1 + + + ITTXFEMSK + IN token received when TxFIFO empty + mask + 4 + 1 + + + INEPNMM + IN token received with EP mismatch + mask + 5 + 1 + + + INEPNEM + IN endpoint NAK effective + mask + 6 + 1 + + + TXFURM + FIFO underrun mask + 8 + 1 + + + BIM + BNA interrupt mask + 9 + 1 + + + + + OTG_HS_DOEPMSK + OTG_HS_DOEPMSK + OTG_HS device OUT endpoint common interrupt + mask register + 0x14 + 32 + read-write + 0x0 + + + XFRCM + Transfer completed interrupt + mask + 0 + 1 + + + EPDM + Endpoint disabled interrupt + mask + 1 + 1 + + + STUPM + SETUP phase done mask + 3 + 1 + + + OTEPDM + OUT token received when endpoint + disabled mask + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets received + mask + 6 + 1 + + + OPEM + OUT packet error mask + 8 + 1 + + + BOIM + BNA interrupt mask + 9 + 1 + + + + + OTG_HS_DAINT + OTG_HS_DAINT + OTG_HS device all endpoints interrupt + register + 0x18 + 32 + read-only + 0x0 + + + IEPINT + IN endpoint interrupt bits + 0 + 16 + + + OEPINT + OUT endpoint interrupt + bits + 16 + 16 + + + + + OTG_HS_DAINTMSK + OTG_HS_DAINTMSK + OTG_HS all endpoints interrupt mask + register + 0x1C + 32 + read-write + 0x0 + + + IEPM + IN EP interrupt mask bits + 0 + 16 + + + OEPM + OUT EP interrupt mask bits + 16 + 16 + + + + + OTG_HS_DVBUSDIS + OTG_HS_DVBUSDIS + OTG_HS device VBUS discharge time + register + 0x28 + 32 + read-write + 0x000017D7 + + + VBUSDT + Device VBUS discharge time + 0 + 16 + + + + + OTG_HS_DVBUSPULSE + OTG_HS_DVBUSPULSE + OTG_HS device VBUS pulsing time + register + 0x2C + 32 + read-write + 0x000005B8 + + + DVBUSP + Device VBUS pulsing time + 0 + 12 + + + + + OTG_HS_DTHRCTL + OTG_HS_DTHRCTL + OTG_HS Device threshold control + register + 0x30 + 32 + read-write + 0x0 + + + NONISOTHREN + Nonisochronous IN endpoints threshold + enable + 0 + 1 + + + ISOTHREN + ISO IN endpoint threshold + enable + 1 + 1 + + + TXTHRLEN + Transmit threshold length + 2 + 9 + + + RXTHREN + Receive threshold enable + 16 + 1 + + + RXTHRLEN + Receive threshold length + 17 + 9 + + + ARPEN + Arbiter parking enable + 27 + 1 + + + + + OTG_HS_DIEPEMPMSK + OTG_HS_DIEPEMPMSK + OTG_HS device IN endpoint FIFO empty + interrupt mask register + 0x34 + 32 + read-write + 0x0 + + + INEPTXFEM + IN EP Tx FIFO empty interrupt mask + bits + 0 + 16 + + + + + OTG_HS_DEACHINT + OTG_HS_DEACHINT + OTG_HS device each endpoint interrupt + register + 0x38 + 32 + read-write + 0x0 + + + IEP1INT + IN endpoint 1interrupt bit + 1 + 1 + + + OEP1INT + OUT endpoint 1 interrupt + bit + 17 + 1 + + + + + OTG_HS_DEACHINTMSK + OTG_HS_DEACHINTMSK + OTG_HS device each endpoint interrupt + register mask + 0x3C + 32 + read-write + 0x0 + + + IEP1INTM + IN Endpoint 1 interrupt mask + bit + 1 + 1 + + + OEP1INTM + OUT Endpoint 1 interrupt mask + bit + 17 + 1 + + + + + OTG_HS_DIEPCTL0 + OTG_HS_DIEPCTL0 + OTG device endpoint-0 control + register + 0x100 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL1 + OTG_HS_DIEPCTL1 + OTG device endpoint-1 control + register + 0x120 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL2 + OTG_HS_DIEPCTL2 + OTG device endpoint-2 control + register + 0x140 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL3 + OTG_HS_DIEPCTL3 + OTG device endpoint-3 control + register + 0x160 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL4 + OTG_HS_DIEPCTL4 + OTG device endpoint-4 control + register + 0x180 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL5 + OTG_HS_DIEPCTL5 + OTG device endpoint-5 control + register + 0x1A0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL6 + OTG_HS_DIEPCTL6 + OTG device endpoint-6 control + register + 0x1C0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPCTL7 + OTG_HS_DIEPCTL7 + OTG device endpoint-7 control + register + 0x1E0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even/odd frame + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + TXFNUM + TxFIFO number + 22 + 4 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DIEPINT0 + OTG_HS_DIEPINT0 + OTG device endpoint-0 interrupt + register + 0x108 + 32 + 0x00000080 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT1 + OTG_HS_DIEPINT1 + OTG device endpoint-1 interrupt + register + 0x128 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT2 + OTG_HS_DIEPINT2 + OTG device endpoint-2 interrupt + register + 0x148 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT3 + OTG_HS_DIEPINT3 + OTG device endpoint-3 interrupt + register + 0x168 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT4 + OTG_HS_DIEPINT4 + OTG device endpoint-4 interrupt + register + 0x188 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT5 + OTG_HS_DIEPINT5 + OTG device endpoint-5 interrupt + register + 0x1A8 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT6 + OTG_HS_DIEPINT6 + OTG device endpoint-6 interrupt + register + 0x1C8 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPINT7 + OTG_HS_DIEPINT7 + OTG device endpoint-7 interrupt + register + 0x1E8 + 32 + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + read-write + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + read-write + + + TOC + Timeout condition + 3 + 1 + read-write + + + ITTXFE + IN token received when TxFIFO is + empty + 4 + 1 + read-write + + + INEPNE + IN endpoint NAK effective + 6 + 1 + read-write + + + TXFE + Transmit FIFO empty + 7 + 1 + read-only + + + TXFIFOUDRN + Transmit Fifo Underrun + 8 + 1 + read-write + + + BNA + Buffer not available + interrupt + 9 + 1 + read-write + + + PKTDRPSTS + Packet dropped status + 11 + 1 + read-write + + + BERR + Babble error interrupt + 12 + 1 + read-write + + + NAK + NAK interrupt + 13 + 1 + read-write + + + + + OTG_HS_DIEPTSIZ0 + OTG_HS_DIEPTSIZ0 + OTG_HS device IN endpoint 0 transfer size + register + 0x110 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 7 + + + PKTCNT + Packet count + 19 + 2 + + + + + OTG_HS_DIEPDMA1 + OTG_HS_DIEPDMA1 + OTG_HS device endpoint-1 DMA address + register + 0x114 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_DIEPDMA2 + OTG_HS_DIEPDMA2 + OTG_HS device endpoint-2 DMA address + register + 0x134 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_DIEPDMA3 + OTG_HS_DIEPDMA3 + OTG_HS device endpoint-3 DMA address + register + 0x154 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_DIEPDMA4 + OTG_HS_DIEPDMA4 + OTG_HS device endpoint-4 DMA address + register + 0x174 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_DIEPDMA5 + OTG_HS_DIEPDMA5 + OTG_HS device endpoint-5 DMA address + register + 0x194 + 32 + read-write + 0x0 + + + DMAADDR + DMA address + 0 + 32 + + + + + OTG_HS_DTXFSTS0 + OTG_HS_DTXFSTS0 + OTG_HS device IN endpoint transmit FIFO + status register + 0x118 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DTXFSTS1 + OTG_HS_DTXFSTS1 + OTG_HS device IN endpoint transmit FIFO + status register + 0x138 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DTXFSTS2 + OTG_HS_DTXFSTS2 + OTG_HS device IN endpoint transmit FIFO + status register + 0x158 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DTXFSTS3 + OTG_HS_DTXFSTS3 + OTG_HS device IN endpoint transmit FIFO + status register + 0x178 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DTXFSTS4 + OTG_HS_DTXFSTS4 + OTG_HS device IN endpoint transmit FIFO + status register + 0x198 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DTXFSTS5 + OTG_HS_DTXFSTS5 + OTG_HS device IN endpoint transmit FIFO + status register + 0x1B8 + 32 + read-only + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DIEPTSIZ1 + OTG_HS_DIEPTSIZ1 + OTG_HS device endpoint transfer size + register + 0x130 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DIEPTSIZ2 + OTG_HS_DIEPTSIZ2 + OTG_HS device endpoint transfer size + register + 0x150 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DIEPTSIZ3 + OTG_HS_DIEPTSIZ3 + OTG_HS device endpoint transfer size + register + 0x170 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DIEPTSIZ4 + OTG_HS_DIEPTSIZ4 + OTG_HS device endpoint transfer size + register + 0x190 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DIEPTSIZ5 + OTG_HS_DIEPTSIZ5 + OTG_HS device endpoint transfer size + register + 0x1B0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DOEPCTL0 + OTG_HS_DOEPCTL0 + OTG_HS device control OUT endpoint 0 control + register + 0x300 + 32 + 0x00008000 + + + MPSIZ + Maximum packet size + 0 + 2 + read-only + + + USBAEP + USB active endpoint + 15 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-only + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-only + + + EPENA + Endpoint enable + 31 + 1 + write-only + + + + + OTG_HS_DOEPCTL1 + OTG_HS_DOEPCTL1 + OTG device endpoint-1 control + register + 0x320 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPCTL2 + OTG_HS_DOEPCTL2 + OTG device endpoint-2 control + register + 0x340 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPCTL3 + OTG_HS_DOEPCTL3 + OTG device endpoint-3 control + register + 0x360 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPINT0 + OTG_HS_DOEPINT0 + OTG_HS device endpoint-0 interrupt + register + 0x308 + 32 + read-write + 0x00000080 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT1 + OTG_HS_DOEPINT1 + OTG_HS device endpoint-1 interrupt + register + 0x328 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT2 + OTG_HS_DOEPINT2 + OTG_HS device endpoint-2 interrupt + register + 0x348 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT3 + OTG_HS_DOEPINT3 + OTG_HS device endpoint-3 interrupt + register + 0x368 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT4 + OTG_HS_DOEPINT4 + OTG_HS device endpoint-4 interrupt + register + 0x388 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT5 + OTG_HS_DOEPINT5 + OTG_HS device endpoint-5 interrupt + register + 0x3A8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT6 + OTG_HS_DOEPINT6 + OTG_HS device endpoint-6 interrupt + register + 0x3C8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPINT7 + OTG_HS_DOEPINT7 + OTG_HS device endpoint-7 interrupt + register + 0x3E8 + 32 + read-write + 0x0 + + + XFRC + Transfer completed + interrupt + 0 + 1 + + + EPDISD + Endpoint disabled + interrupt + 1 + 1 + + + STUP + SETUP phase done + 3 + 1 + + + OTEPDIS + OUT token received when endpoint + disabled + 4 + 1 + + + B2BSTUP + Back-to-back SETUP packets + received + 6 + 1 + + + NYET + NYET interrupt + 14 + 1 + + + + + OTG_HS_DOEPTSIZ0 + OTG_HS_DOEPTSIZ0 + OTG_HS device endpoint-0 transfer size + register + 0x310 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 7 + + + PKTCNT + Packet count + 19 + 1 + + + STUPCNT + SETUP packet count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ1 + OTG_HS_DOEPTSIZ1 + OTG_HS device endpoint-1 transfer size + register + 0x330 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ2 + OTG_HS_DOEPTSIZ2 + OTG_HS device endpoint-2 transfer size + register + 0x350 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ3 + OTG_HS_DOEPTSIZ3 + OTG_HS device endpoint-3 transfer size + register + 0x370 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ4 + OTG_HS_DOEPTSIZ4 + OTG_HS device endpoint-4 transfer size + register + 0x390 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DIEPTSIZ6 + OTG_HS_DIEPTSIZ6 + OTG_HS device endpoint transfer size + register + OTG_HS_DIEPCTL5 + 0x1A0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DTXFSTS6 + OTG_HS_DTXFSTS6 + OTG_HS device IN endpoint transmit FIFO + status register + 0x1A4 + 32 + read-write + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DIEPTSIZ7 + OTG_HS_DIEPTSIZ7 + OTG_HS device endpoint transfer size + register + OTG_HS_DIEPINT5 + 0x1A8 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + MCNT + Multi count + 29 + 2 + + + + + OTG_HS_DTXFSTS7 + OTG_HS_DTXFSTS7 + OTG_HS device IN endpoint transmit FIFO + status register + 0x1AC + 32 + read-write + 0x0 + + + INEPTFSAV + IN endpoint TxFIFO space + avail + 0 + 16 + + + + + OTG_HS_DOEPCTL4 + OTG_HS_DOEPCTL4 + OTG device endpoint-4 control + register + 0x380 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPCTL5 + OTG_HS_DOEPCTL5 + OTG device endpoint-5 control + register + 0x3A0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPCTL6 + OTG_HS_DOEPCTL6 + OTG device endpoint-6 control + register + 0x3C0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPCTL7 + OTG_HS_DOEPCTL7 + OTG device endpoint-7 control + register + 0x3E0 + 32 + 0x0 + + + MPSIZ + Maximum packet size + 0 + 11 + read-write + + + USBAEP + USB active endpoint + 15 + 1 + read-write + + + EONUM_DPID + Even odd frame/Endpoint data + PID + 16 + 1 + read-only + + + NAKSTS + NAK status + 17 + 1 + read-only + + + EPTYP + Endpoint type + 18 + 2 + read-write + + + SNPM + Snoop mode + 20 + 1 + read-write + + + Stall + STALL handshake + 21 + 1 + read-write + + + CNAK + Clear NAK + 26 + 1 + write-only + + + SNAK + Set NAK + 27 + 1 + write-only + + + SD0PID_SEVNFRM + Set DATA0 PID/Set even + frame + 28 + 1 + write-only + + + SODDFRM + Set odd frame + 29 + 1 + write-only + + + EPDIS + Endpoint disable + 30 + 1 + read-write + + + EPENA + Endpoint enable + 31 + 1 + read-write + + + + + OTG_HS_DOEPTSIZ5 + OTG_HS_DOEPTSIZ5 + OTG_HS device endpoint-5 transfer size + register + 0x3B0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ6 + OTG_HS_DOEPTSIZ6 + OTG_HS device endpoint-6 transfer size + register + 0x3D0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + OTG_HS_DOEPTSIZ7 + OTG_HS_DOEPTSIZ7 + OTG_HS device endpoint-7 transfer size + register + 0x3F0 + 32 + read-write + 0x0 + + + XFRSIZ + Transfer size + 0 + 19 + + + PKTCNT + Packet count + 19 + 10 + + + RXDPID_STUPCNT + Received data PID/SETUP packet + count + 29 + 2 + + + + + + + OTG2_HS_DEVICE + 0x40080800 + + + OTG1_HS_PWRCLK + USB 1 on the go high speed + USB_OTG_HS + 0x40040E00 + + 0x0 + 0x3F200 + registers + + + + OTG_HS_PCGCR + OTG_HS_PCGCR + Power and clock gating control + register + 0x0 + 32 + read-write + 0x0 + + + STPPCLK + Stop PHY clock + 0 + 1 + + + GATEHCLK + Gate HCLK + 1 + 1 + + + PHYSUSP + PHY suspended + 4 + 1 + + + + + + + OTG2_HS_PWRCLK + 0x40080E00 + + + Ethernet_DMA + Ethernet: DMA mode register (DMA) + Ethernet + 0x40029000 + + 0x0 + 0x400 + registers + + + + DMAMR + DMAMR + DMA mode register + 0x0 + 0x20 + 0x00000000 + + + SWR + Software Reset + 0 + 1 + read-write + + + DA + DMA Tx or Rx Arbitration + Scheme + 1 + 1 + read-only + + + TXPR + Transmit priority + 11 + 1 + read-only + + + PR + Priority ratio + 12 + 3 + read-only + + + INTM + Interrupt Mode + 16 + 1 + read-write + + + + + DMASBMR + DMASBMR + System bus mode register + 0x04 + 0x20 + 0x01010000 + + + FB + Fixed Burst Length + 0 + 1 + read-write + + + AAL + Address-Aligned Beats + 12 + 1 + read-write + + + MB + Mixed Burst + 14 + 1 + read-only + + + RB + Rebuild INCRx Burst + 15 + 1 + read-only + + + + + DMAISR + DMAISR + Interrupt status register + 0x08 + 0x20 + read-only + 0x00000000 + + + DC0IS + DMA Channel Interrupt + Status + 0 + 1 + + + MTLIS + MTL Interrupt Status + 16 + 1 + + + MACIS + MAC Interrupt Status + 17 + 1 + + + + + DMADSR + DMADSR + Debug status register + 0x0C + 0x20 + read-only + 0x00000000 + + + AXWHSTS + AHB Master Write Channel + 0 + 1 + + + RPS0 + DMA Channel Receive Process + State + 8 + 4 + + + TPS0 + DMA Channel Transmit Process + State + 12 + 4 + + + + + DMACCR + DMACCR + Channel control register + 0x100 + 0x20 + read-write + 0x00000000 + + + MSS + Maximum Segment Size + 0 + 14 + + + PBLX8 + 8xPBL mode + 16 + 1 + + + DSL + Descriptor Skip Length + 18 + 3 + + + + + DMACTxCR + DMACTxCR + Channel transmit control + register + 0x104 + 0x20 + read-write + 0x00000000 + + + ST + Start or Stop Transmission + Command + 0 + 1 + + + OSF + Operate on Second Packet + 4 + 1 + + + TSE + TCP Segmentation Enabled + 12 + 1 + + + TXPBL + Transmit Programmable Burst + Length + 16 + 6 + + + + + DMACRxCR + DMACRxCR + Channel receive control + register + 0x108 + 0x20 + read-write + 0x00000000 + + + SR + Start or Stop Receive + Command + 0 + 1 + + + RBSZ + Receive Buffer size + 1 + 14 + + + RXPBL + RXPBL + 16 + 6 + + + RPF + DMA Rx Channel Packet + Flush + 31 + 1 + + + + + DMACTxDLAR + DMACTxDLAR + Channel Tx descriptor list address + register + 0x114 + 0x20 + read-write + 0x00000000 + + + TDESLA + Start of Transmit List + 2 + 30 + + + + + DMACRxDLAR + DMACRxDLAR + Channel Rx descriptor list address + register + 0x11C + 0x20 + read-write + 0x00000000 + + + RDESLA + Start of Receive List + 2 + 30 + + + + + DMACTxDTPR + DMACTxDTPR + Channel Tx descriptor tail pointer + register + 0x120 + 0x20 + read-write + 0x00000000 + + + TDT + Transmit Descriptor Tail + Pointer + 2 + 30 + + + + + DMACRxDTPR + DMACRxDTPR + Channel Rx descriptor tail pointer + register + 0x128 + 0x20 + read-write + 0x00000000 + + + RDT + Receive Descriptor Tail + Pointer + 2 + 30 + + + + + DMACTxRLR + DMACTxRLR + Channel Tx descriptor ring length + register + 0x12C + 0x20 + read-write + 0x00000000 + + + TDRL + Transmit Descriptor Ring + Length + 0 + 10 + + + + + DMACRxRLR + DMACRxRLR + Channel Rx descriptor ring length + register + 0x130 + 0x20 + read-write + 0x00000000 + + + RDRL + Receive Descriptor Ring + Length + 0 + 10 + + + + + DMACIER + DMACIER + Channel interrupt enable + register + 0x134 + 0x20 + read-write + 0x00000000 + + + TIE + Transmit Interrupt Enable + 0 + 1 + + + TXSE + Transmit Stopped Enable + 1 + 1 + + + TBUE + Transmit Buffer Unavailable + Enable + 2 + 1 + + + RIE + Receive Interrupt Enable + 6 + 1 + + + RBUE + Receive Buffer Unavailable + Enable + 7 + 1 + + + RSE + Receive Stopped Enable + 8 + 1 + + + RWTE + Receive Watchdog Timeout + Enable + 9 + 1 + + + ETIE + Early Transmit Interrupt + Enable + 10 + 1 + + + ERIE + Early Receive Interrupt + Enable + 11 + 1 + + + FBEE + Fatal Bus Error Enable + 12 + 1 + + + CDEE + Context Descriptor Error + Enable + 13 + 1 + + + AIE + Abnormal Interrupt Summary + Enable + 14 + 1 + + + NIE + Normal Interrupt Summary + Enable + 15 + 1 + + + + + DMACRxIWTR + DMACRxIWTR + Channel Rx interrupt watchdog timer + register + 0x138 + 0x20 + read-write + 0x00000000 + + + RWT + Receive Interrupt Watchdog Timer + Count + 0 + 8 + + + + + DMACCATxDR + DMACCATxDR + Channel current application transmit + descriptor register + 0x144 + 0x20 + read-only + 0x00000000 + + + CURTDESAPTR + Application Transmit Descriptor Address + Pointer + 0 + 32 + + + + + DMACCARxDR + DMACCARxDR + Channel current application receive + descriptor register + 0x14C + 0x20 + read-only + 0x00000000 + + + CURRDESAPTR + Application Receive Descriptor Address + Pointer + 0 + 32 + + + + + DMACCATxBR + DMACCATxBR + Channel current application transmit buffer + register + 0x154 + 0x20 + read-only + 0x00000000 + + + CURTBUFAPTR + Application Transmit Buffer Address + Pointer + 0 + 32 + + + + + DMACCARxBR + DMACCARxBR + Channel current application receive buffer + register + 0x15C + 0x20 + read-only + 0x00000000 + + + CURRBUFAPTR + Application Receive Buffer Address + Pointer + 0 + 32 + + + + + DMACSR + DMACSR + Channel status register + 0x160 + 0x20 + 0x00000000 + + + TI + Transmit Interrupt + 0 + 1 + read-write + + + TPS + Transmit Process Stopped + 1 + 1 + read-write + + + TBU + Transmit Buffer + Unavailable + 2 + 1 + read-write + + + RI + Receive Interrupt + 6 + 1 + read-write + + + RBU + Receive Buffer Unavailable + 7 + 1 + read-write + + + RPS + Receive Process Stopped + 8 + 1 + read-write + + + RWT + Receive Watchdog Timeout + 9 + 1 + read-write + + + ET + Early Transmit Interrupt + 10 + 1 + read-write + + + ER + Early Receive Interrupt + 11 + 1 + read-write + + + FBE + Fatal Bus Error + 12 + 1 + read-write + + + CDE + Context Descriptor Error + 13 + 1 + read-write + + + AIS + Abnormal Interrupt Summary + 14 + 1 + read-write + + + NIS + Normal Interrupt Summary + 15 + 1 + read-write + + + TEB + Tx DMA Error Bits + 16 + 3 + read-only + + + REB + Rx DMA Error Bits + 19 + 3 + read-only + + + + + DMACMFCR + DMACMFCR + Channel missed frame count + register + 0x16C + 0x20 + read-only + 0x00000000 + + + MFC + Dropped Packet Counters + 0 + 11 + + + MFCO + Overflow status of the MFC + Counter + 15 + 1 + + + + + + + Ethernet_MTL + Ethernet: MTL mode register (MTL) + Ethernet + 0x40028C00 + + 0x0 + 0x200 + registers + + + + MTLOMR + MTLOMR + Operating mode Register + 0x0 + 0x20 + read-write + 0x00000000 + + + DTXSTS + DTXSTS + 1 + 1 + + + CNTPRST + CNTPRST + 8 + 1 + + + CNTCLR + CNTCLR + 9 + 1 + + + + + MTLISR + MTLISR + Interrupt status Register + 0x20 + 0x20 + read-only + 0x00000000 + + + Q0IS + Queue interrupt status + 0 + 1 + + + + + MTLTxQOMR + MTLTxQOMR + Tx queue operating mode + Register + 0x100 + 0x20 + 0x00070008 + + + FTQ + Flush Transmit Queue + 0 + 1 + read-write + + + TSF + Transmit Store and Forward + 1 + 1 + read-write + + + TXQEN + Transmit Queue Enable + 2 + 2 + read-only + + + TTC + Transmit Threshold Control + 4 + 3 + read-write + + + TQS + Transmit Queue Size + 16 + 3 + read-write + + + + + MTLTxQUR + MTLTxQUR + Tx queue underflow register + 0x104 + 0x20 + read-only + 0x00000000 + + + UFFRMCNT + Underflow Packet Counter + 0 + 11 + + + UFCNTOVF + UFCNTOVF + 11 + 1 + + + + + MTLTxQDR + MTLTxQDR + Tx queue debug Register + 0x108 + 0x20 + read-only + 0x00000000 + + + TXQPAUSED + TXQPAUSED + 0 + 1 + + + TRCSTS + TRCSTS + 1 + 2 + + + TWCSTS + TWCSTS + 3 + 1 + + + TXQSTS + TXQSTS + 4 + 1 + + + TXSTSFSTS + TXSTSFSTS + 5 + 1 + + + PTXQ + PTXQ + 16 + 3 + + + STXSTSF + STXSTSF + 20 + 3 + + + + + MTLQICSR + MTLQICSR + Queue interrupt control status + Register + 0x12C + 0x20 + read-write + 0x00000000 + + + TXUNFIS + TXUNFIS + 0 + 1 + + + TXUIE + TXUIE + 8 + 1 + + + RXOVFIS + RXOVFIS + 16 + 1 + + + RXOIE + RXOIE + 24 + 1 + + + + + MTLRxQOMR + MTLRxQOMR + Rx queue operating mode + register + 0x130 + 0x20 + 0x00700000 + + + RTC + RTC + 0 + 2 + read-write + + + FUP + FUP + 3 + 1 + read-write + + + FEP + FEP + 4 + 1 + read-write + + + RSF + RSF + 5 + 1 + read-write + + + DIS_TCP_EF + DIS_TCP_EF + 6 + 1 + read-write + + + EHFC + EHFC + 7 + 1 + read-write + + + RFA + RFA + 8 + 3 + read-write + + + RFD + RFD + 14 + 3 + read-write + + + RQS + RQS + 20 + 3 + read-only + + + + + MTLRxQMPOCR + MTLRxQMPOCR + Rx queue missed packet and overflow counter + register + 0x134 + 0x20 + read-only + 0x00000000 + + + OVFPKTCNT + OVFPKTCNT + 0 + 11 + + + OVFCNTOVF + OVFCNTOVF + 11 + 1 + + + MISPKTCNT + MISPKTCNT + 16 + 11 + + + MISCNTOVF + MISCNTOVF + 27 + 1 + + + + + MTLRxQDR + MTLRxQDR + Rx queue debug register + 0x138 + 0x20 + read-only + 0x00000000 + + + RWCSTS + RWCSTS + 0 + 1 + + + RRCSTS + RRCSTS + 1 + 2 + + + RXQSTS + RXQSTS + 4 + 2 + + + PRXQ + PRXQ + 16 + 14 + + + + + + + Ethernet_MAC + Ethernet: media access control (MAC) + Ethernet + 0x40028000 + + 0x0 + 0xBDF + registers + + + ETH + Ethernet global interrupt + 61 + + + + MACCR + MACCR + Operating mode configuration + register + 0x0 + 0x20 + read-write + 0x00000000 + + + RE + Receiver Enable + 0 + 1 + + + TE + TE + 1 + 1 + + + PRELEN + PRELEN + 2 + 2 + + + DC + DC + 4 + 1 + + + BL + BL + 5 + 2 + + + DR + DR + 8 + 1 + + + DCRS + DCRS + 9 + 1 + + + DO + DO + 10 + 1 + + + ECRSFD + ECRSFD + 11 + 1 + + + LM + LM + 12 + 1 + + + DM + DM + 13 + 1 + + + FES + FES + 14 + 1 + + + JE + JE + 16 + 1 + + + JD + JD + 17 + 1 + + + WD + WD + 19 + 1 + + + ACS + ACS + 20 + 1 + + + CST + CST + 21 + 1 + + + S2KP + S2KP + 22 + 1 + + + GPSLCE + GPSLCE + 23 + 1 + + + IPG + IPG + 24 + 3 + + + IPC + IPC + 27 + 1 + + + SARC + SARC + 28 + 3 + + + ARPEN + ARPEN + 31 + 1 + + + + + MACECR + MACECR + Extended operating mode configuration + register + 0x4 + 0x20 + read-write + 0x00000000 + + + GPSL + GPSL + 0 + 14 + + + DCRCC + DCRCC + 16 + 1 + + + SPEN + SPEN + 17 + 1 + + + USP + USP + 18 + 1 + + + EIPGEN + EIPGEN + 24 + 1 + + + EIPG + EIPG + 25 + 5 + + + + + MACPFR + MACPFR + Packet filtering control + register + 0x8 + 0x20 + read-write + 0x00000000 + + + PR + PR + 0 + 1 + + + HUC + HUC + 1 + 1 + + + HMC + HMC + 2 + 1 + + + DAIF + DAIF + 3 + 1 + + + PM + PM + 4 + 1 + + + DBF + DBF + 5 + 1 + + + PCF + PCF + 6 + 2 + + + SAIF + SAIF + 8 + 1 + + + SAF + SAF + 9 + 1 + + + HPF + HPF + 10 + 1 + + + VTFE + VTFE + 16 + 1 + + + IPFE + IPFE + 20 + 1 + + + DNTU + DNTU + 21 + 1 + + + RA + RA + 31 + 1 + + + + + MACWTR + MACWTR + Watchdog timeout register + 0xC + 0x20 + read-write + 0x00000000 + + + WTO + WTO + 0 + 4 + + + PWE + PWE + 8 + 1 + + + + + MACHT0R + MACHT0R + Hash Table 0 register + 0x10 + 0x20 + read-write + 0x00000000 + + + HT31T0 + HT31T0 + 0 + 32 + + + + + MACHT1R + MACHT1R + Hash Table 1 register + 0x14 + 0x20 + read-write + 0x00000000 + + + HT63T32 + HT63T32 + 0 + 32 + + + + + MACVTR + MACVTR + VLAN tag register + 0x50 + 0x20 + read-write + 0x00000000 + + + VL + VL + 0 + 16 + + + ETV + ETV + 16 + 1 + + + VTIM + VTIM + 17 + 1 + + + ESVL + ESVL + 18 + 1 + + + ERSVLM + ERSVLM + 19 + 1 + + + DOVLTC + DOVLTC + 20 + 1 + + + EVLS + EVLS + 21 + 2 + + + EVLRXS + EVLRXS + 24 + 1 + + + VTHM + VTHM + 25 + 1 + + + EDVLP + EDVLP + 26 + 1 + + + ERIVLT + ERIVLT + 27 + 1 + + + EIVLS + EIVLS + 28 + 2 + + + EIVLRXS + EIVLRXS + 31 + 1 + + + + + MACVHTR + MACVHTR + VLAN Hash table register + 0x58 + 0x20 + read-write + 0x00000000 + + + VLHT + VLHT + 0 + 16 + + + + + MACVIR + MACVIR + VLAN inclusion register + 0x60 + 0x20 + read-write + 0x00000000 + + + VLT + VLT + 0 + 16 + + + VLC + VLC + 16 + 2 + + + VLP + VLP + 18 + 1 + + + CSVL + CSVL + 19 + 1 + + + VLTI + VLTI + 20 + 1 + + + + + MACIVIR + MACIVIR + Inner VLAN inclusion register + 0x64 + 0x20 + read-write + 0x00000000 + + + VLT + VLT + 0 + 16 + + + VLC + VLC + 16 + 2 + + + VLP + VLP + 18 + 1 + + + CSVL + CSVL + 19 + 1 + + + VLTI + VLTI + 20 + 1 + + + + + MACQTxFCR + MACQTxFCR + Tx Queue flow control register + 0x70 + 0x20 + read-write + 0x00000000 + + + FCB_BPA + FCB_BPA + 0 + 1 + + + TFE + TFE + 1 + 1 + + + PLT + PLT + 4 + 3 + + + DZPQ + DZPQ + 7 + 1 + + + PT + PT + 16 + 16 + + + + + MACRxFCR + MACRxFCR + Rx flow control register + 0x90 + 0x20 + read-write + 0x00000000 + + + RFE + RFE + 0 + 1 + + + UP + UP + 1 + 1 + + + + + MACISR + MACISR + Interrupt status register + 0xB0 + 0x20 + read-only + 0x00000000 + + + PHYIS + PHYIS + 3 + 1 + + + PMTIS + PMTIS + 4 + 1 + + + LPIIS + LPIIS + 5 + 1 + + + MMCIS + MMCIS + 8 + 1 + + + MMCRXIS + MMCRXIS + 9 + 1 + + + MMCTXIS + MMCTXIS + 10 + 1 + + + TSIS + TSIS + 12 + 1 + + + TXSTSIS + TXSTSIS + 13 + 1 + + + RXSTSIS + RXSTSIS + 14 + 1 + + + + + MACIER + MACIER + Interrupt enable register + 0xB4 + 0x20 + read-write + 0x00000000 + + + PHYIE + PHYIE + 3 + 1 + + + PMTIE + PMTIE + 4 + 1 + + + LPIIE + LPIIE + 5 + 1 + + + TSIE + TSIE + 12 + 1 + + + TXSTSIE + TXSTSIE + 13 + 1 + + + RXSTSIE + RXSTSIE + 14 + 1 + + + + + MACRxTxSR + MACRxTxSR + Rx Tx status register + 0xB8 + 0x20 + read-only + 0x00000000 + + + TJT + TJT + 0 + 1 + + + NCARR + NCARR + 1 + 1 + + + LCARR + LCARR + 2 + 1 + + + EXDEF + EXDEF + 3 + 1 + + + LCOL + LCOL + 4 + 1 + + + EXCOL + LCOL + 5 + 1 + + + RWT + RWT + 8 + 1 + + + + + MACPCSR + MACPCSR + PMT control status register + 0xC0 + 0x20 + 0x00000000 + + + PWRDWN + PWRDWN + 0 + 1 + read-write + + + MGKPKTEN + MGKPKTEN + 1 + 1 + read-write + + + RWKPKTEN + RWKPKTEN + 2 + 1 + read-write + + + MGKPRCVD + MGKPRCVD + 5 + 1 + read-only + + + RWKPRCVD + RWKPRCVD + 6 + 1 + read-only + + + GLBLUCAST + GLBLUCAST + 9 + 1 + read-write + + + RWKPFE + RWKPFE + 10 + 1 + read-write + + + RWKPTR + RWKPTR + 24 + 5 + read-write + + + RWKFILTRST + RWKFILTRST + 31 + 1 + read-write + + + + + MACRWKPFR + MACRWKPFR + Remove wakeup packet filter + register + 0xC4 + 0x20 + read-write + 0x00000000 + + + MACRWKPFR + MACRWKPFR + 0 + 32 + + + + + MACLCSR + MACLCSR + LPI control status register + 0xD0 + 0x20 + 0x00000000 + + + TLPIEN + TLPIEN + 0 + 1 + read-only + + + TLPIEX + TLPIEX + 1 + 1 + read-only + + + RLPIEN + RLPIEN + 2 + 1 + read-only + + + RLPIEX + RLPIEX + 3 + 1 + read-only + + + TLPIST + TLPIST + 8 + 1 + read-only + + + RLPIST + RLPIST + 9 + 1 + read-only + + + LPIEN + LPIEN + 16 + 1 + read-write + + + PLS + PLS + 17 + 1 + read-write + + + PLSEN + PLSEN + 18 + 1 + read-write + + + LPITXA + LPITXA + 19 + 1 + read-write + + + LPITE + LPITE + 20 + 1 + read-write + + + + + MACLTCR + MACLTCR + LPI timers control register + 0xD4 + 0x20 + read-write + 0x03E80000 + + + TWT + TWT + 0 + 16 + + + LST + LST + 16 + 10 + + + + + MACLETR + MACLETR + LPI entry timer register + 0xD8 + 0x20 + read-write + 0x00000000 + + + LPIET + LPIET + 0 + 17 + + + + + MAC1USTCR + MAC1USTCR + 1-microsecond-tick counter + register + 0xDC + 0x20 + read-write + 0x00000000 + + + TIC_1US_CNTR + TIC_1US_CNTR + 0 + 12 + + + + + MACVR + MACVR + Version register + 0x110 + 0x20 + read-only + 0x00003041 + + + SNPSVER + SNPSVER + 0 + 8 + + + USERVER + USERVER + 8 + 8 + + + + + MACDR + MACDR + Debug register + 0x114 + 0x20 + read-only + 0x00000000 + + + RPESTS + RPESTS + 0 + 1 + + + RFCFCSTS + RFCFCSTS + 1 + 2 + + + TPESTS + TPESTS + 16 + 1 + + + TFCSTS + TFCSTS + 17 + 2 + + + + + MACHWF1R + MACHWF1R + HW feature 1 register + 0x120 + 0x20 + read-only + 0x11841904 + + + RXFIFOSIZE + RXFIFOSIZE + 0 + 5 + + + TXFIFOSIZE + TXFIFOSIZE + 6 + 5 + + + OSTEN + OSTEN + 11 + 1 + + + PTOEN + PTOEN + 12 + 1 + + + ADVTHWORD + ADVTHWORD + 13 + 1 + + + ADDR64 + ADDR64 + 14 + 2 + + + DCBEN + DCBEN + 16 + 1 + + + SPHEN + SPHEN + 17 + 1 + + + TSOEN + TSOEN + 18 + 1 + + + DBGMEMA + DBGMEMA + 19 + 1 + + + AVSEL + AVSEL + 20 + 1 + + + HASHTBLSZ + HASHTBLSZ + 24 + 2 + + + L3L4FNUM + L3L4FNUM + 27 + 4 + + + + + MACHWF2R + MACHWF2R + HW feature 2 register + 0x124 + 0x20 + read-only + 0x41000000 + + + RXQCNT + RXQCNT + 0 + 4 + + + TXQCNT + TXQCNT + 6 + 4 + + + RXCHCNT + RXCHCNT + 12 + 4 + + + TXCHCNT + TXCHCNT + 18 + 4 + + + PPSOUTNUM + PPSOUTNUM + 24 + 3 + + + AUXSNAPNUM + AUXSNAPNUM + 28 + 3 + + + + + MACMDIOAR + MACMDIOAR + MDIO address register + 0x200 + 0x20 + read-write + 0x00000000 + + + MB + MB + 0 + 1 + + + C45E + C45E + 1 + 1 + + + GOC + GOC + 2 + 2 + + + SKAP + SKAP + 4 + 1 + + + CR + CR + 8 + 4 + + + NTC + NTC + 12 + 3 + + + RDA + RDA + 16 + 5 + + + PA + PA + 21 + 5 + + + BTB + BTB + 26 + 1 + + + PSE + PSE + 27 + 1 + + + + + MACMDIODR + MACMDIODR + MDIO data register + 0x204 + 0x20 + read-write + 0x00000000 + + + MD + MD + 0 + 16 + + + RA + RA + 16 + 16 + + + + + MACARPAR + MACARPAR + ARP address register + 0xAE0 + 0x20 + read-write + 0x00000000 + + + ARPPA + ARPPA + 0 + 32 + + + + + MACA0HR + MACA0HR + Address 0 high register + 0x300 + 0x20 + 0x8000FFFF + + + ADDRHI + ADDRHI + 0 + 16 + read-write + + + AE + AE + 31 + 1 + read-only + + + + + MACA0LR + MACA0LR + Address 0 low register + 0x304 + 0x20 + read-write + 0xFFFFFFFF + + + ADDRLO + ADDRLO + 0 + 32 + + + + + MACA1LR + MACA1LR + Address 1 low register + 0x30C + 0x20 + read-write + 0xFFFFFFFF + + + ADDRLO + ADDRLO + 0 + 32 + + + + + MACA2LR + MACA2LR + Address 2 low register + 0x314 + 0x20 + read-write + 0xFFFFFFFF + + + ADDRLO + ADDRLO + 0 + 32 + + + + + MACA1HR + MACA1HR + Address 1 high register + 0x308 + 0x20 + read-write + 0x0000FFFF + + + ADDRHI + ADDRHI + 0 + 16 + + + MBC + MBC + 24 + 6 + + + SA + SA + 30 + 1 + + + AE + AE + 31 + 1 + + + + + MACA2HR + MACA2HR + Address 2 high register + 0x310 + 0x20 + read-write + 0x0000FFFF + + + ADDRHI + ADDRHI + 0 + 16 + + + MBC + MBC + 24 + 6 + + + SA + SA + 30 + 1 + + + AE + AE + 31 + 1 + + + + + MACA3HR + MACA3HR + Address 3 high register + 0x318 + 0x20 + read-write + 0x0000FFFF + + + ADDRHI + ADDRHI + 0 + 16 + + + MBC + MBC + 24 + 6 + + + SA + SA + 30 + 1 + + + AE + AE + 31 + 1 + + + + + MACA3LR + MACA3LR + Address 3 low register + 0x31C + 0x20 + read-write + 0xFFFFFFFF + + + ADDRLO + ADDRLO + 0 + 32 + + + + + MMC_CONTROL + MMC_CONTROL + MMC control register + 0x700 + 0x20 + read-write + 0x00000000 + + + CNTRST + CNTRST + 0 + 1 + + + CNTSTOPRO + CNTSTOPRO + 1 + 1 + + + RSTONRD + RSTONRD + 2 + 1 + + + CNTFREEZ + CNTFREEZ + 3 + 1 + + + CNTPRST + CNTPRST + 4 + 1 + + + CNTPRSTLVL + CNTPRSTLVL + 5 + 1 + + + UCDBC + UCDBC + 8 + 1 + + + + + MMC_RX_INTERRUPT + MMC_RX_INTERRUPT + MMC Rx interrupt register + 0x704 + 0x20 + read-only + 0x00000000 + + + RXCRCERPIS + RXCRCERPIS + 5 + 1 + + + RXALGNERPIS + RXALGNERPIS + 6 + 1 + + + RXUCGPIS + RXUCGPIS + 17 + 1 + + + RXLPIUSCIS + RXLPIUSCIS + 26 + 1 + + + RXLPITRCIS + RXLPITRCIS + 27 + 1 + + + + + MMC_TX_INTERRUPT + MMC_TX_INTERRUPT + MMC Tx interrupt register + 0x708 + 0x20 + read-only + 0x00000000 + + + TXSCOLGPIS + TXSCOLGPIS + 14 + 1 + + + TXMCOLGPIS + TXMCOLGPIS + 15 + 1 + + + TXGPKTIS + TXGPKTIS + 21 + 1 + + + TXLPIUSCIS + TXLPIUSCIS + 26 + 1 + + + TXLPITRCIS + TXLPITRCIS + 27 + 1 + + + + + MMC_RX_INTERRUPT_MASK + MMC_RX_INTERRUPT_MASK + MMC Rx interrupt mask register + 0x70C + 0x20 + 0x00000000 + + + RXCRCERPIM + RXCRCERPIM + 5 + 1 + read-write + + + RXALGNERPIM + RXALGNERPIM + 6 + 1 + read-write + + + RXUCGPIM + RXUCGPIM + 17 + 1 + read-write + + + RXLPIUSCIM + RXLPIUSCIM + 26 + 1 + read-write + + + RXLPITRCIM + RXLPITRCIM + 27 + 1 + read-only + + + + + MMC_TX_INTERRUPT_MASK + MMC_TX_INTERRUPT_MASK + MMC Tx interrupt mask register + 0x710 + 0x20 + 0x00000000 + + + TXSCOLGPIM + TXSCOLGPIM + 14 + 1 + read-write + + + TXMCOLGPIM + TXMCOLGPIM + 15 + 1 + read-write + + + TXGPKTIM + TXGPKTIM + 21 + 1 + read-write + + + TXLPIUSCIM + TXLPIUSCIM + 26 + 1 + read-write + + + TXLPITRCIM + TXLPITRCIM + 27 + 1 + read-only + + + + + TX_SINGLE_COLLISION_GOOD_PACKETS + + TX_SINGLE_COLLISION_GOOD_PACKETS + Tx single collision good packets + register + 0x74C + 0x20 + read-only + 0x00000000 + + + TXSNGLCOLG + TXSNGLCOLG + 0 + 32 + + + + + TX_MULTIPLE_COLLISION_GOOD_PACKETS + + TX_MULTIPLE_COLLISION_GOOD_PACKETS + Tx multiple collision good packets + register + 0x750 + 0x20 + read-only + 0x00000000 + + + TXMULTCOLG + TXMULTCOLG + 0 + 32 + + + + + TX_PACKET_COUNT_GOOD + TX_PACKET_COUNT_GOOD + Tx packet count good register + 0x768 + 0x20 + read-only + 0x00000000 + + + TXPKTG + TXPKTG + 0 + 32 + + + + + RX_CRC_ERROR_PACKETS + RX_CRC_ERROR_PACKETS + Rx CRC error packets register + 0x794 + 0x20 + read-only + 0x00000000 + + + RXCRCERR + RXCRCERR + 0 + 32 + + + + + RX_ALIGNMENT_ERROR_PACKETS + RX_ALIGNMENT_ERROR_PACKETS + Rx alignment error packets + register + 0x798 + 0x20 + read-only + 0x00000000 + + + RXALGNERR + RXALGNERR + 0 + 32 + + + + + RX_UNICAST_PACKETS_GOOD + RX_UNICAST_PACKETS_GOOD + Rx unicast packets good + register + 0x7C4 + 0x20 + read-only + 0x00000000 + + + RXUCASTG + RXUCASTG + 0 + 32 + + + + + TX_LPI_USEC_CNTR + TX_LPI_USEC_CNTR + Tx LPI microsecond timer + register + 0x7EC + 0x20 + read-only + 0x00000000 + + + TXLPIUSC + TXLPIUSC + 0 + 32 + + + + + TX_LPI_TRAN_CNTR + TX_LPI_TRAN_CNTR + Tx LPI transition counter + register + 0x7F0 + 0x20 + read-only + 0x00000000 + + + TXLPITRC + TXLPITRC + 0 + 32 + + + + + RX_LPI_USEC_CNTR + RX_LPI_USEC_CNTR + Rx LPI microsecond counter + register + 0x7F4 + 0x20 + read-only + 0x00000000 + + + RXLPIUSC + RXLPIUSC + 0 + 32 + + + + + RX_LPI_TRAN_CNTR + RX_LPI_TRAN_CNTR + Rx LPI transition counter + register + 0x7F8 + 0x20 + read-only + 0x00000000 + + + RXLPITRC + RXLPITRC + 0 + 32 + + + + + MACL3L4C0R + MACL3L4C0R + L3 and L4 control 0 register + 0x900 + 0x20 + read-write + 0x00000000 + + + L3PEN0 + L3PEN0 + 0 + 1 + + + L3SAM0 + L3SAM0 + 2 + 1 + + + L3SAIM0 + L3SAIM0 + 3 + 1 + + + L3DAM0 + L3DAM0 + 4 + 1 + + + L3DAIM0 + L3DAIM0 + 5 + 1 + + + L3HSBM0 + L3HSBM0 + 6 + 5 + + + L3HDBM0 + L3HDBM0 + 11 + 5 + + + L4PEN0 + L4PEN0 + 16 + 1 + + + L4SPM0 + L4SPM0 + 18 + 1 + + + L4SPIM0 + L4SPIM0 + 19 + 1 + + + L4DPM0 + L4DPM0 + 20 + 1 + + + L4DPIM0 + L4DPIM0 + 21 + 1 + + + + + MACL4A0R + MACL4A0R + Layer4 address filter 0 + register + 0x904 + 0x20 + read-write + 0x00000000 + + + L4SP0 + L4SP0 + 0 + 16 + + + L4DP0 + L4DP0 + 16 + 16 + + + + + MACL3A00R + MACL3A00R + MACL3A00R + 0x910 + 0x20 + read-write + 0x00000000 + + + L3A00 + L3A00 + 0 + 32 + + + + + MACL3A10R + MACL3A10R + Layer3 address 1 filter 0 + register + 0x914 + 0x20 + read-write + 0x00000000 + + + L3A10 + L3A10 + 0 + 32 + + + + + MACL3A20 + MACL3A20 + Layer3 Address 2 filter 0 + register + 0x918 + 0x20 + read-write + 0x00000000 + + + L3A20 + L3A20 + 0 + 32 + + + + + MACL3A30 + MACL3A30 + Layer3 Address 3 filter 0 + register + 0x91C + 0x20 + read-write + 0x00000000 + + + L3A30 + L3A30 + 0 + 32 + + + + + MACL3L4C1R + MACL3L4C1R + L3 and L4 control 1 register + 0x930 + 0x20 + read-write + 0x00000000 + + + L3PEN1 + L3PEN1 + 0 + 1 + + + L3SAM1 + L3SAM1 + 2 + 1 + + + L3SAIM1 + L3SAIM1 + 3 + 1 + + + L3DAM1 + L3DAM1 + 4 + 1 + + + L3DAIM1 + L3DAIM1 + 5 + 1 + + + L3HSBM1 + L3HSBM1 + 6 + 5 + + + L3HDBM1 + L3HDBM1 + 11 + 5 + + + L4PEN1 + L4PEN1 + 16 + 1 + + + L4SPM1 + L4SPM1 + 18 + 1 + + + L4SPIM1 + L4SPIM1 + 19 + 1 + + + L4DPM1 + L4DPM1 + 20 + 1 + + + L4DPIM1 + L4DPIM1 + 21 + 1 + + + + + MACL4A1R + MACL4A1R + Layer 4 address filter 1 + register + 0x934 + 0x20 + read-write + 0x00000000 + + + L4SP1 + L4SP1 + 0 + 16 + + + L4DP1 + L4DP1 + 16 + 16 + + + + + MACL3A01R + MACL3A01R + Layer3 address 0 filter 1 + Register + 0x940 + 0x20 + read-write + 0x00000000 + + + L3A01 + L3A01 + 0 + 32 + + + + + MACL3A11R + MACL3A11R + Layer3 address 1 filter 1 + register + 0x944 + 0x20 + read-write + 0x00000000 + + + L3A11 + L3A11 + 0 + 32 + + + + + MACL3A21R + MACL3A21R + Layer3 address 2 filter 1 + Register + 0x948 + 0x20 + read-write + 0x00000000 + + + L3A21 + L3A21 + 0 + 32 + + + + + MACL3A31R + MACL3A31R + Layer3 address 3 filter 1 + register + 0x94C + 0x20 + read-write + 0x00000000 + + + L3A31 + L3A31 + 0 + 32 + + + + + MACTSCR + MACTSCR + Timestamp control Register + 0xB00 + 0x20 + 0x00000200 + + + TSENA + TSENA + 0 + 1 + read-write + + + TSCFUPDT + TSCFUPDT + 1 + 1 + read-write + + + TSINIT + TSINIT + 2 + 1 + read-write + + + TSUPDT + TSUPDT + 3 + 1 + read-write + + + TSADDREG + TSADDREG + 5 + 1 + read-write + + + TSENALL + TSENALL + 8 + 1 + read-write + + + TSCTRLSSR + TSCTRLSSR + 9 + 1 + read-write + + + TSVER2ENA + TSVER2ENA + 10 + 1 + read-write + + + TSIPENA + TSIPENA + 11 + 1 + read-write + + + TSIPV6ENA + TSIPV6ENA + 12 + 1 + read-write + + + TSIPV4ENA + TSIPV4ENA + 13 + 1 + read-write + + + TSEVNTENA + TSEVNTENA + 14 + 1 + read-write + + + TSMSTRENA + TSMSTRENA + 15 + 1 + read-write + + + SNAPTYPSEL + SNAPTYPSEL + 16 + 2 + read-write + + + TSENMACADDR + TSENMACADDR + 18 + 1 + read-write + + + CSC + CSC + 19 + 1 + read-only + + + TXTSSTSM + TXTSSTSM + 24 + 1 + read-write + + + + + MACSSIR + MACSSIR + Sub-second increment register + 0xB04 + 0x20 + read-write + 0x00000000 + + + SNSINC + SNSINC + 8 + 8 + + + SSINC + SSINC + 16 + 8 + + + + + MACSTSR + MACSTSR + System time seconds register + 0xB08 + 0x20 + read-only + 0x00000000 + + + TSS + TSS + 0 + 32 + + + + + MACSTNR + MACSTNR + System time nanoseconds + register + 0xB0C + 0x20 + read-only + 0x00000000 + + + TSSS + TSSS + 0 + 31 + + + + + MACSTSUR + MACSTSUR + System time seconds update + register + 0xB10 + 0x20 + read-write + 0x00000000 + + + TSS + TSS + 0 + 32 + + + + + MACSTNUR + MACSTNUR + System time nanoseconds update + register + 0xB14 + 0x20 + read-write + 0x00000000 + + + TSSS + TSSS + 0 + 31 + + + ADDSUB + ADDSUB + 31 + 1 + + + + + MACTSAR + MACTSAR + Timestamp addend register + 0xB18 + 0x20 + read-write + 0x00000000 + + + TSAR + TSAR + 0 + 32 + + + + + MACTSSR + MACTSSR + Timestamp status register + 0xB20 + 0x20 + read-only + 0x00000000 + + + TSSOVF + TSSOVF + 0 + 1 + + + TSTARGT0 + TSTARGT0 + 1 + 1 + + + AUXTSTRIG + AUXTSTRIG + 2 + 1 + + + TSTRGTERR0 + TSTRGTERR0 + 3 + 1 + + + TXTSSIS + TXTSSIS + 15 + 1 + + + ATSSTN + ATSSTN + 16 + 4 + + + ATSSTM + ATSSTM + 24 + 1 + + + ATSNS + ATSNS + 25 + 5 + + + + + MACTxTSSNR + MACTxTSSNR + Tx timestamp status nanoseconds + register + 0xB30 + 0x20 + read-only + 0x00000000 + + + TXTSSLO + TXTSSLO + 0 + 31 + + + TXTSSMIS + TXTSSMIS + 31 + 1 + + + + + MACTxTSSSR + MACTxTSSSR + Tx timestamp status seconds + register + 0xB34 + 0x20 + read-only + 0x00000000 + + + TXTSSHI + TXTSSHI + 0 + 32 + + + + + MACACR + MACACR + Auxiliary control register + 0xB40 + 0x20 + read-write + 0x00000000 + + + ATSFC + ATSFC + 0 + 1 + + + ATSEN0 + ATSEN0 + 4 + 1 + + + ATSEN1 + ATSEN1 + 5 + 1 + + + ATSEN2 + ATSEN2 + 6 + 1 + + + ATSEN3 + ATSEN3 + 7 + 1 + + + + + MACATSNR + MACATSNR + Auxiliary timestamp nanoseconds + register + 0xB48 + 0x20 + read-only + 0x00000000 + + + AUXTSLO + AUXTSLO + 0 + 31 + + + + + MACATSSR + MACATSSR + Auxiliary timestamp seconds + register + 0xB4C + 0x20 + read-only + 0x00000000 + + + AUXTSHI + AUXTSHI + 0 + 32 + + + + + MACTSIACR + MACTSIACR + Timestamp Ingress asymmetric correction + register + 0xB50 + 0x20 + read-write + 0x00000000 + + + OSTIAC + OSTIAC + 0 + 32 + + + + + MACTSEACR + MACTSEACR + Timestamp Egress asymmetric correction + register + 0xB54 + 0x20 + read-write + 0x00000000 + + + OSTEAC + OSTEAC + 0 + 32 + + + + + MACTSICNR + MACTSICNR + Timestamp Ingress correction nanosecond + register + 0xB58 + 0x20 + read-write + 0x00000000 + + + TSIC + TSIC + 0 + 32 + + + + + MACTSECNR + MACTSECNR + Timestamp Egress correction nanosecond + register + 0xB5C + 0x20 + read-write + 0x00000000 + + + TSEC + TSEC + 0 + 32 + + + + + MACPPSCR + MACPPSCR + PPS control register + 0xB70 + 0x20 + read-write + 0x00000000 + + + PPSCTRL + PPSCTRL + 0 + 4 + + + PPSEN0 + PPSEN0 + 4 + 1 + + + TRGTMODSEL0 + TRGTMODSEL0 + 5 + 2 + + + + + MACPPSTTSR + MACPPSTTSR + PPS target time seconds + register + 0xB80 + 0x20 + read-write + 0x00000000 + + + TSTRH0 + TSTRH0 + 0 + 31 + + + + + MACPPSTTNR + MACPPSTTNR + PPS target time nanoseconds + register + 0xB84 + 0x20 + read-write + 0x00000000 + + + TTSL0 + TTSL0 + 0 + 31 + + + TRGTBUSY0 + TRGTBUSY0 + 31 + 1 + + + + + MACPPSIR + MACPPSIR + PPS interval register + 0xB88 + 0x20 + read-write + 0x00000000 + + + PPSINT0 + PPSINT0 + 0 + 32 + + + + + MACPPSWR + MACPPSWR + PPS width register + 0xB8C + 0x20 + read-write + 0x00000000 + + + PPSWIDTH0 + PPSWIDTH0 + 0 + 32 + + + + + MACPOCR + MACPOCR + PTP Offload control register + 0xBC0 + 0x20 + read-write + 0x00000000 + + + PTOEN + PTOEN + 0 + 1 + + + ASYNCEN + ASYNCEN + 1 + 1 + + + APDREQEN + APDREQEN + 2 + 1 + + + ASYNCTRIG + ASYNCTRIG + 4 + 1 + + + APDREQTRIG + APDREQTRIG + 5 + 1 + + + DRRDIS + DRRDIS + 6 + 1 + + + DN + DN + 8 + 8 + + + + + MACSPI0R + MACSPI0R + PTP Source Port Identity 0 + Register + 0xBC4 + 0x20 + read-write + 0x00000000 + + + SPI0 + SPI0 + 0 + 32 + + + + + MACSPI1R + MACSPI1R + PTP Source port identity 1 + register + 0xBC8 + 0x20 + read-write + 0x00000000 + + + SPI1 + SPI1 + 0 + 32 + + + + + MACSPI2R + MACSPI2R + PTP Source port identity 2 + register + 0xBCC + 0x20 + read-write + 0x00000000 + + + SPI2 + SPI2 + 0 + 16 + + + + + MACLMIR + MACLMIR + Log message interval register + 0xBD0 + 0x20 + read-write + 0x00000000 + + + LSI + LSI + 0 + 8 + + + DRSYNCR + DRSYNCR + 8 + 3 + + + LMPDRI + LMPDRI + 24 + 8 + + + + + + + DMA1 + DMA controller + DMA + 0x40020000 + + 0x0 + 0x400 + registers + + + DMA_STR0 + DMA1 Stream0 + 11 + + + DMA_STR1 + DMA1 Stream1 + 12 + + + DMA1_STR7 + DMA1 Stream7 + 47 + + + + LISR + LISR + low interrupt status register + 0x0 + 0x20 + read-only + 0x00000000 + + + TCIF3 + Stream x transfer complete interrupt + flag (x = 3..0) + 27 + 1 + + + HTIF3 + Stream x half transfer interrupt flag + (x=3..0) + 26 + 1 + + + TEIF3 + Stream x transfer error interrupt flag + (x=3..0) + 25 + 1 + + + DMEIF3 + Stream x direct mode error interrupt + flag (x=3..0) + 24 + 1 + + + FEIF3 + Stream x FIFO error interrupt flag + (x=3..0) + 22 + 1 + + + TCIF2 + Stream x transfer complete interrupt + flag (x = 3..0) + 21 + 1 + + + HTIF2 + Stream x half transfer interrupt flag + (x=3..0) + 20 + 1 + + + TEIF2 + Stream x transfer error interrupt flag + (x=3..0) + 19 + 1 + + + DMEIF2 + Stream x direct mode error interrupt + flag (x=3..0) + 18 + 1 + + + FEIF2 + Stream x FIFO error interrupt flag + (x=3..0) + 16 + 1 + + + TCIF1 + Stream x transfer complete interrupt + flag (x = 3..0) + 11 + 1 + + + HTIF1 + Stream x half transfer interrupt flag + (x=3..0) + 10 + 1 + + + TEIF1 + Stream x transfer error interrupt flag + (x=3..0) + 9 + 1 + + + DMEIF1 + Stream x direct mode error interrupt + flag (x=3..0) + 8 + 1 + + + FEIF1 + Stream x FIFO error interrupt flag + (x=3..0) + 6 + 1 + + + TCIF0 + Stream x transfer complete interrupt + flag (x = 3..0) + 5 + 1 + + + HTIF0 + Stream x half transfer interrupt flag + (x=3..0) + 4 + 1 + + + TEIF0 + Stream x transfer error interrupt flag + (x=3..0) + 3 + 1 + + + DMEIF0 + Stream x direct mode error interrupt + flag (x=3..0) + 2 + 1 + + + FEIF0 + Stream x FIFO error interrupt flag + (x=3..0) + 0 + 1 + + + + + HISR + HISR + high interrupt status register + 0x4 + 0x20 + read-only + 0x00000000 + + + TCIF7 + Stream x transfer complete interrupt + flag (x=7..4) + 27 + 1 + + + HTIF7 + Stream x half transfer interrupt flag + (x=7..4) + 26 + 1 + + + TEIF7 + Stream x transfer error interrupt flag + (x=7..4) + 25 + 1 + + + DMEIF7 + Stream x direct mode error interrupt + flag (x=7..4) + 24 + 1 + + + FEIF7 + Stream x FIFO error interrupt flag + (x=7..4) + 22 + 1 + + + TCIF6 + Stream x transfer complete interrupt + flag (x=7..4) + 21 + 1 + + + HTIF6 + Stream x half transfer interrupt flag + (x=7..4) + 20 + 1 + + + TEIF6 + Stream x transfer error interrupt flag + (x=7..4) + 19 + 1 + + + DMEIF6 + Stream x direct mode error interrupt + flag (x=7..4) + 18 + 1 + + + FEIF6 + Stream x FIFO error interrupt flag + (x=7..4) + 16 + 1 + + + TCIF5 + Stream x transfer complete interrupt + flag (x=7..4) + 11 + 1 + + + HTIF5 + Stream x half transfer interrupt flag + (x=7..4) + 10 + 1 + + + TEIF5 + Stream x transfer error interrupt flag + (x=7..4) + 9 + 1 + + + DMEIF5 + Stream x direct mode error interrupt + flag (x=7..4) + 8 + 1 + + + FEIF5 + Stream x FIFO error interrupt flag + (x=7..4) + 6 + 1 + + + TCIF4 + Stream x transfer complete interrupt + flag (x=7..4) + 5 + 1 + + + HTIF4 + Stream x half transfer interrupt flag + (x=7..4) + 4 + 1 + + + TEIF4 + Stream x transfer error interrupt flag + (x=7..4) + 3 + 1 + + + DMEIF4 + Stream x direct mode error interrupt + flag (x=7..4) + 2 + 1 + + + FEIF4 + Stream x FIFO error interrupt flag + (x=7..4) + 0 + 1 + + + + + LIFCR + LIFCR + low interrupt flag clear + register + 0x8 + 0x20 + read-write + 0x00000000 + + + CTCIF3 + Stream x clear transfer complete + interrupt flag (x = 3..0) + 27 + 1 + + + CHTIF3 + Stream x clear half transfer interrupt + flag (x = 3..0) + 26 + 1 + + + CTEIF3 + Stream x clear transfer error interrupt + flag (x = 3..0) + 25 + 1 + + + CDMEIF3 + Stream x clear direct mode error + interrupt flag (x = 3..0) + 24 + 1 + + + CFEIF3 + Stream x clear FIFO error interrupt flag + (x = 3..0) + 22 + 1 + + + CTCIF2 + Stream x clear transfer complete + interrupt flag (x = 3..0) + 21 + 1 + + + CHTIF2 + Stream x clear half transfer interrupt + flag (x = 3..0) + 20 + 1 + + + CTEIF2 + Stream x clear transfer error interrupt + flag (x = 3..0) + 19 + 1 + + + CDMEIF2 + Stream x clear direct mode error + interrupt flag (x = 3..0) + 18 + 1 + + + CFEIF2 + Stream x clear FIFO error interrupt flag + (x = 3..0) + 16 + 1 + + + CTCIF1 + Stream x clear transfer complete + interrupt flag (x = 3..0) + 11 + 1 + + + CHTIF1 + Stream x clear half transfer interrupt + flag (x = 3..0) + 10 + 1 + + + CTEIF1 + Stream x clear transfer error interrupt + flag (x = 3..0) + 9 + 1 + + + CDMEIF1 + Stream x clear direct mode error + interrupt flag (x = 3..0) + 8 + 1 + + + CFEIF1 + Stream x clear FIFO error interrupt flag + (x = 3..0) + 6 + 1 + + + CTCIF0 + Stream x clear transfer complete + interrupt flag (x = 3..0) + 5 + 1 + + + CHTIF0 + Stream x clear half transfer interrupt + flag (x = 3..0) + 4 + 1 + + + CTEIF0 + Stream x clear transfer error interrupt + flag (x = 3..0) + 3 + 1 + + + CDMEIF0 + Stream x clear direct mode error + interrupt flag (x = 3..0) + 2 + 1 + + + CFEIF0 + Stream x clear FIFO error interrupt flag + (x = 3..0) + 0 + 1 + + + + + HIFCR + HIFCR + high interrupt flag clear + register + 0xC + 0x20 + read-write + 0x00000000 + + + CTCIF7 + Stream x clear transfer complete + interrupt flag (x = 7..4) + 27 + 1 + + + CHTIF7 + Stream x clear half transfer interrupt + flag (x = 7..4) + 26 + 1 + + + CTEIF7 + Stream x clear transfer error interrupt + flag (x = 7..4) + 25 + 1 + + + CDMEIF7 + Stream x clear direct mode error + interrupt flag (x = 7..4) + 24 + 1 + + + CFEIF7 + Stream x clear FIFO error interrupt flag + (x = 7..4) + 22 + 1 + + + CTCIF6 + Stream x clear transfer complete + interrupt flag (x = 7..4) + 21 + 1 + + + CHTIF6 + Stream x clear half transfer interrupt + flag (x = 7..4) + 20 + 1 + + + CTEIF6 + Stream x clear transfer error interrupt + flag (x = 7..4) + 19 + 1 + + + CDMEIF6 + Stream x clear direct mode error + interrupt flag (x = 7..4) + 18 + 1 + + + CFEIF6 + Stream x clear FIFO error interrupt flag + (x = 7..4) + 16 + 1 + + + CTCIF5 + Stream x clear transfer complete + interrupt flag (x = 7..4) + 11 + 1 + + + CHTIF5 + Stream x clear half transfer interrupt + flag (x = 7..4) + 10 + 1 + + + CTEIF5 + Stream x clear transfer error interrupt + flag (x = 7..4) + 9 + 1 + + + CDMEIF5 + Stream x clear direct mode error + interrupt flag (x = 7..4) + 8 + 1 + + + CFEIF5 + Stream x clear FIFO error interrupt flag + (x = 7..4) + 6 + 1 + + + CTCIF4 + Stream x clear transfer complete + interrupt flag (x = 7..4) + 5 + 1 + + + CHTIF4 + Stream x clear half transfer interrupt + flag (x = 7..4) + 4 + 1 + + + CTEIF4 + Stream x clear transfer error interrupt + flag (x = 7..4) + 3 + 1 + + + CDMEIF4 + Stream x clear direct mode error + interrupt flag (x = 7..4) + 2 + 1 + + + CFEIF4 + Stream x clear FIFO error interrupt flag + (x = 7..4) + 0 + 1 + + + + + S0CR + S0CR + stream x configuration + register + 0x10 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S0NDTR + S0NDTR + stream x number of data + register + 0x14 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S0PAR + S0PAR + stream x peripheral address + register + 0x18 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S0M0AR + S0M0AR + stream x memory 0 address + register + 0x1C + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S0M1AR + S0M1AR + stream x memory 1 address + register + 0x20 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S0FCR + S0FCR + stream x FIFO control register + 0x24 + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S1CR + S1CR + stream x configuration + register + 0x28 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S1NDTR + S1NDTR + stream x number of data + register + 0x2C + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S1PAR + S1PAR + stream x peripheral address + register + 0x30 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S1M0AR + S1M0AR + stream x memory 0 address + register + 0x34 + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S1M1AR + S1M1AR + stream x memory 1 address + register + 0x38 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S1FCR + S1FCR + stream x FIFO control register + 0x3C + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S2CR + S2CR + stream x configuration + register + 0x40 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S2NDTR + S2NDTR + stream x number of data + register + 0x44 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S2PAR + S2PAR + stream x peripheral address + register + 0x48 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S2M0AR + S2M0AR + stream x memory 0 address + register + 0x4C + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S2M1AR + S2M1AR + stream x memory 1 address + register + 0x50 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S2FCR + S2FCR + stream x FIFO control register + 0x54 + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S3CR + S3CR + stream x configuration + register + 0x58 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S3NDTR + S3NDTR + stream x number of data + register + 0x5C + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S3PAR + S3PAR + stream x peripheral address + register + 0x60 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S3M0AR + S3M0AR + stream x memory 0 address + register + 0x64 + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S3M1AR + S3M1AR + stream x memory 1 address + register + 0x68 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S3FCR + S3FCR + stream x FIFO control register + 0x6C + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S4CR + S4CR + stream x configuration + register + 0x70 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S4NDTR + S4NDTR + stream x number of data + register + 0x74 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S4PAR + S4PAR + stream x peripheral address + register + 0x78 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S4M0AR + S4M0AR + stream x memory 0 address + register + 0x7C + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S4M1AR + S4M1AR + stream x memory 1 address + register + 0x80 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S4FCR + S4FCR + stream x FIFO control register + 0x84 + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S5CR + S5CR + stream x configuration + register + 0x88 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S5NDTR + S5NDTR + stream x number of data + register + 0x8C + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S5PAR + S5PAR + stream x peripheral address + register + 0x90 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S5M0AR + S5M0AR + stream x memory 0 address + register + 0x94 + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S5M1AR + S5M1AR + stream x memory 1 address + register + 0x98 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S5FCR + S5FCR + stream x FIFO control register + 0x9C + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S6CR + S6CR + stream x configuration + register + 0xA0 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S6NDTR + S6NDTR + stream x number of data + register + 0xA4 + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S6PAR + S6PAR + stream x peripheral address + register + 0xA8 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S6M0AR + S6M0AR + stream x memory 0 address + register + 0xAC + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S6M1AR + S6M1AR + stream x memory 1 address + register + 0xB0 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S6FCR + S6FCR + stream x FIFO control register + 0xB4 + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + S7CR + S7CR + stream x configuration + register + 0xB8 + 0x20 + read-write + 0x00000000 + + + MBURST + Memory burst transfer + configuration + 23 + 2 + + + PBURST + Peripheral burst transfer + configuration + 21 + 2 + + + ACK + ACK + 20 + 1 + + + CT + Current target (only in double buffer + mode) + 19 + 1 + + + DBM + Double buffer mode + 18 + 1 + + + PL + Priority level + 16 + 2 + + + PINCOS + Peripheral increment offset + size + 15 + 1 + + + MSIZE + Memory data size + 13 + 2 + + + PSIZE + Peripheral data size + 11 + 2 + + + MINC + Memory increment mode + 10 + 1 + + + PINC + Peripheral increment mode + 9 + 1 + + + CIRC + Circular mode + 8 + 1 + + + DIR + Data transfer direction + 6 + 2 + + + PFCTRL + Peripheral flow controller + 5 + 1 + + + TCIE + Transfer complete interrupt + enable + 4 + 1 + + + HTIE + Half transfer interrupt + enable + 3 + 1 + + + TEIE + Transfer error interrupt + enable + 2 + 1 + + + DMEIE + Direct mode error interrupt + enable + 1 + 1 + + + EN + Stream enable / flag stream ready when + read low + 0 + 1 + + + + + S7NDTR + S7NDTR + stream x number of data + register + 0xBC + 0x20 + read-write + 0x00000000 + + + NDT + Number of data items to + transfer + 0 + 16 + + + + + S7PAR + S7PAR + stream x peripheral address + register + 0xC0 + 0x20 + read-write + 0x00000000 + + + PA + Peripheral address + 0 + 32 + + + + + S7M0AR + S7M0AR + stream x memory 0 address + register + 0xC4 + 0x20 + read-write + 0x00000000 + + + M0A + Memory 0 address + 0 + 32 + + + + + S7M1AR + S7M1AR + stream x memory 1 address + register + 0xC8 + 0x20 + read-write + 0x00000000 + + + M1A + Memory 1 address (used in case of Double + buffer mode) + 0 + 32 + + + + + S7FCR + S7FCR + stream x FIFO control register + 0xCC + 0x20 + 0x00000021 + + + FEIE + FIFO error interrupt + enable + 7 + 1 + read-write + + + FS + FIFO status + 3 + 3 + read-only + + + DMDIS + Direct mode disable + 2 + 1 + read-write + + + FTH + FIFO threshold selection + 0 + 2 + read-write + + + + + + + DMA2 + 0x40020400 + + DMA_STR2 + DMA1 Stream2 + 13 + + + DMA_STR3 + DMA1 Stream3 + 14 + + + DMA_STR4 + DMA1 Stream4 + 15 + + + DMA_STR5 + DMA1 Stream5 + 16 + + + DMA_STR6 + DMA1 Stream6 + 17 + + + DMA2_STR0 + DMA2 Stream0 interrupt + 56 + + + DMA2_STR1 + DMA2 Stream1 interrupt + 57 + + + DMA2_STR2 + DMA2 Stream2 interrupt + 58 + + + DMA2_STR3 + DMA2 Stream3 interrupt + 59 + + + DMA2_STR4 + DMA2 Stream4 interrupt + 60 + + + DMA2_STR5 + DMA2 Stream5 interrupt + 68 + + + DMA2_STR6 + DMA2 Stream6 interrupt + 69 + + + DMA2_STR7 + DMA2 Stream7 interrupt + 70 + + + + HRTIM_Master + High Resolution Timer: Master + Timers + HRTIM + 0x40017400 + + 0x0 + 0x80 + registers + + + + MCR + MCR + Master Timer Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + BRSTDMA + Burst DMA Update + 30 + 2 + + + MREPU + Master Timer Repetition + update + 29 + 1 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + TECEN + Timer E counter enable + 21 + 1 + + + TDCEN + Timer D counter enable + 20 + 1 + + + TCCEN + Timer C counter enable + 19 + 1 + + + TBCEN + Timer B counter enable + 18 + 1 + + + TACEN + Timer A counter enable + 17 + 1 + + + MCEN + Master Counter enable + 16 + 1 + + + SYNC_SRC + Synchronization source + 14 + 2 + + + SYNC_OUT + Synchronization output + 12 + 2 + + + SYNCSTRTM + Synchronization Starts + Master + 11 + 1 + + + SYNCRSTM + Synchronization Resets + Master + 10 + 1 + + + SYNC_IN + ynchronization input + 8 + 2 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Master Re-triggerable mode + 4 + 1 + + + CONT + Master Continuous mode + 3 + 1 + + + CK_PSC + HRTIM Master Clock + prescaler + 0 + 3 + + + + + MISR + MISR + Master Timer Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + MUPD + Master Update Interrupt + Flag + 6 + 1 + + + SYNC + Sync Input Interrupt Flag + 5 + 1 + + + MREP + Master Repetition Interrupt + Flag + 4 + 1 + + + MCMP4 + Master Compare 4 Interrupt + Flag + 3 + 1 + + + MCMP3 + Master Compare 3 Interrupt + Flag + 2 + 1 + + + MCMP2 + Master Compare 2 Interrupt + Flag + 1 + 1 + + + MCMP1 + Master Compare 1 Interrupt + Flag + 0 + 1 + + + + + MICR + MICR + Master Timer Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + MUPDC + Master update Interrupt flag + clear + 6 + 1 + + + SYNCC + Sync Input Interrupt flag + clear + 5 + 1 + + + MREPC + Repetition Interrupt flag + clear + 4 + 1 + + + MCMP4C + Master Compare 4 Interrupt flag + clear + 3 + 1 + + + MCMP3C + Master Compare 3 Interrupt flag + clear + 2 + 1 + + + MCMP2C + Master Compare 2 Interrupt flag + clear + 1 + 1 + + + MCMP1C + Master Compare 1 Interrupt flag + clear + 0 + 1 + + + + + MDIER4 + MDIER4 + MDIER4 + 0xC + 0x20 + read-write + 0x00000000 + + + MUPDDE + MUPDDE + 22 + 1 + + + SYNCDE + SYNCDE + 21 + 1 + + + MREPDE + MREPDE + 20 + 1 + + + MCMP4DE + MCMP4DE + 19 + 1 + + + MCMP3DE + MCMP3DE + 18 + 1 + + + MCMP2DE + MCMP2DE + 17 + 1 + + + MCMP1DE + MCMP1DE + 16 + 1 + + + MUPDIE + MUPDIE + 6 + 1 + + + SYNCIE + SYNCIE + 5 + 1 + + + MREPIE + MREPIE + 4 + 1 + + + MCMP4IE + MCMP4IE + 3 + 1 + + + MCMP3IE + MCMP3IE + 2 + 1 + + + MCMP2IE + MCMP2IE + 1 + 1 + + + MCMP1IE + MCMP1IE + 0 + 1 + + + + + MCNTR + MCNTR + Master Timer Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + MCNT + Counter value + 0 + 16 + + + + + MPER + MPER + Master Timer Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + MPER + Master Timer Period value + 0 + 16 + + + + + MREP + MREP + Master Timer Repetition + Register + 0x18 + 0x20 + read-write + 0x00000000 + + + MREP + Master Timer Repetition counter + value + 0 + 8 + + + + + MCMP1R + MCMP1R + Master Timer Compare 1 + Register + 0x1C + 0x20 + read-write + 0x00000000 + + + MCMP1 + Master Timer Compare 1 + value + 0 + 16 + + + + + MCMP2R + MCMP2R + Master Timer Compare 2 + Register + 0x24 + 0x20 + read-write + 0x00000000 + + + MCMP2 + Master Timer Compare 2 + value + 0 + 16 + + + + + MCMP3R + MCMP3R + Master Timer Compare 3 + Register + 0x28 + 0x20 + read-write + 0x00000000 + + + MCMP3 + Master Timer Compare 3 + value + 0 + 16 + + + + + MCMP4R + MCMP4R + Master Timer Compare 4 + Register + 0x2C + 0x20 + read-write + 0x00000000 + + + MCMP4 + Master Timer Compare 4 + value + 0 + 16 + + + + + + + HRTIM_TIMA + High Resolution Timer: TIMA + HRTIM + 0x40017480 + + 0x0 + 0x80 + registers + + + HRTIM1_MST + HRTIM1 master timer interrupt + 103 + + + HRTIM1_FLT + HRTIM1 fault interrupt + 109 + + + + TIMACR + TIMACR + Timerx Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + UPDGAT + Update Gating + 28 + 4 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + MSTU + Master Timer update + 24 + 1 + + + TEU + TEU + 23 + 1 + + + TDU + TDU + 22 + 1 + + + TCU + TCU + 21 + 1 + + + TBU + TBU + 20 + 1 + + + TxRSTU + Timerx reset update + 18 + 1 + + + TxREPU + Timer x Repetition update + 17 + 1 + + + DELCMP4 + Delayed CMP4 mode + 14 + 2 + + + DELCMP2 + Delayed CMP2 mode + 12 + 2 + + + SYNCSTRTx + Synchronization Starts Timer + x + 11 + 1 + + + SYNCRSTx + Synchronization Resets Timer + x + 10 + 1 + + + PSHPLL + Push-Pull mode enable + 6 + 1 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Re-triggerable mode + 4 + 1 + + + CONT + Continuous mode + 3 + 1 + + + CK_PSCx + HRTIM Timer x Clock + prescaler + 0 + 3 + + + + + TIMAISR + TIMAISR + Timerx Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + O2STAT + Output 2 State + 19 + 1 + + + O1STAT + Output 1 State + 18 + 1 + + + IPPSTAT + Idle Push Pull Status + 17 + 1 + + + CPPSTAT + Current Push Pull Status + 16 + 1 + + + DLYPRT + Delayed Protection Flag + 14 + 1 + + + RST + Reset Interrupt Flag + 13 + 1 + + + RSTx2 + Output 2 Reset Interrupt + Flag + 12 + 1 + + + SETx2 + Output 2 Set Interrupt + Flag + 11 + 1 + + + RSTx1 + Output 1 Reset Interrupt + Flag + 10 + 1 + + + SETx1 + Output 1 Set Interrupt + Flag + 9 + 1 + + + CPT2 + Capture2 Interrupt Flag + 8 + 1 + + + CPT1 + Capture1 Interrupt Flag + 7 + 1 + + + UPD + Update Interrupt Flag + 6 + 1 + + + REP + Repetition Interrupt Flag + 4 + 1 + + + CMP4 + Compare 4 Interrupt Flag + 3 + 1 + + + CMP3 + Compare 3 Interrupt Flag + 2 + 1 + + + CMP2 + Compare 2 Interrupt Flag + 1 + 1 + + + CMP1 + Compare 1 Interrupt Flag + 0 + 1 + + + + + TIMAICR + TIMAICR + Timerx Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + DLYPRTC + Delayed Protection Flag + Clear + 14 + 1 + + + RSTC + Reset Interrupt flag Clear + 13 + 1 + + + RSTx2C + Output 2 Reset flag Clear + 12 + 1 + + + SET2xC + Output 2 Set flag Clear + 11 + 1 + + + RSTx1C + Output 1 Reset flag Clear + 10 + 1 + + + SET1xC + Output 1 Set flag Clear + 9 + 1 + + + CPT2C + Capture2 Interrupt flag + Clear + 8 + 1 + + + CPT1C + Capture1 Interrupt flag + Clear + 7 + 1 + + + UPDC + Update Interrupt flag + Clear + 6 + 1 + + + REPC + Repetition Interrupt flag + Clear + 4 + 1 + + + CMP4C + Compare 4 Interrupt flag + Clear + 3 + 1 + + + CMP3C + Compare 3 Interrupt flag + Clear + 2 + 1 + + + CMP2C + Compare 2 Interrupt flag + Clear + 1 + 1 + + + CMP1C + Compare 1 Interrupt flag + Clear + 0 + 1 + + + + + TIMADIER5 + TIMADIER5 + TIMxDIER5 + 0xC + 0x20 + read-write + 0x00000000 + + + DLYPRTDE + DLYPRTDE + 30 + 1 + + + RSTDE + RSTDE + 29 + 1 + + + RSTx2DE + RSTx2DE + 28 + 1 + + + SETx2DE + SETx2DE + 27 + 1 + + + RSTx1DE + RSTx1DE + 26 + 1 + + + SET1xDE + SET1xDE + 25 + 1 + + + CPT2DE + CPT2DE + 24 + 1 + + + CPT1DE + CPT1DE + 23 + 1 + + + UPDDE + UPDDE + 22 + 1 + + + REPDE + REPDE + 20 + 1 + + + CMP4DE + CMP4DE + 19 + 1 + + + CMP3DE + CMP3DE + 18 + 1 + + + CMP2DE + CMP2DE + 17 + 1 + + + CMP1DE + CMP1DE + 16 + 1 + + + DLYPRTIE + DLYPRTIE + 14 + 1 + + + RSTIE + RSTIE + 13 + 1 + + + RSTx2IE + RSTx2IE + 12 + 1 + + + SETx2IE + SETx2IE + 11 + 1 + + + RSTx1IE + RSTx1IE + 10 + 1 + + + SET1xIE + SET1xIE + 9 + 1 + + + CPT2IE + CPT2IE + 8 + 1 + + + CPT1IE + CPT1IE + 7 + 1 + + + UPDIE + UPDIE + 6 + 1 + + + REPIE + REPIE + 4 + 1 + + + CMP4IE + CMP4IE + 3 + 1 + + + CMP3IE + CMP3IE + 2 + 1 + + + CMP2IE + CMP2IE + 1 + 1 + + + CMP1IE + CMP1IE + 0 + 1 + + + + + CNTAR + CNTAR + Timerx Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CNTx + Timerx Counter value + 0 + 16 + + + + + PERAR + PERAR + Timerx Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + PERx + Timerx Period value + 0 + 16 + + + + + REPAR + REPAR + Timerx Repetition Register + 0x18 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition counter + value + 0 + 8 + + + + + CMP1AR + CMP1AR + Timerx Compare 1 Register + 0x1C + 0x20 + read-write + 0x00000000 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP1CAR + CMP1CAR + Timerx Compare 1 Compound + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition value (aliased from + HRTIM_REPx register) + 16 + 8 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP2AR + CMP2AR + Timerx Compare 2 Register + 0x24 + 0x20 + read-write + 0x00000000 + + + CMP2x + Timerx Compare 2 value + 0 + 16 + + + + + CMP3AR + CMP3AR + Timerx Compare 3 Register + 0x28 + 0x20 + read-write + 0x00000000 + + + CMP3x + Timerx Compare 3 value + 0 + 16 + + + + + CMP4AR + CMP4AR + Timerx Compare 4 Register + 0x2C + 0x20 + read-write + 0x00000000 + + + CMP4x + Timerx Compare 4 value + 0 + 16 + + + + + CPT1AR + CPT1AR + Timerx Capture 1 Register + 0x30 + 0x20 + read-only + 0x00000000 + + + CPT1x + Timerx Capture 1 value + 0 + 16 + + + + + CPT2AR + CPT2AR + Timerx Capture 2 Register + 0x34 + 0x20 + read-only + 0x00000000 + + + CPT2x + Timerx Capture 2 value + 0 + 16 + + + + + DTAR + DTAR + Timerx Deadtime Register + 0x38 + 0x20 + read-write + 0x00000000 + + + DTFLKx + Deadtime Falling Lock + 31 + 1 + + + DTFSLKx + Deadtime Falling Sign Lock + 30 + 1 + + + SDTFx + Sign Deadtime Falling + value + 25 + 1 + + + DTFx + Deadtime Falling value + 16 + 9 + + + DTRLKx + Deadtime Rising Lock + 15 + 1 + + + DTRSLKx + Deadtime Rising Sign Lock + 14 + 1 + + + DTPRSC + Deadtime Prescaler + 10 + 3 + + + SDTRx + Sign Deadtime Rising value + 9 + 1 + + + DTRx + Deadtime Rising value + 0 + 9 + + + + + SETA1R + SETA1R + Timerx Output1 Set Register + 0x3C + 0x20 + read-write + 0x00000000 + + + UPDATE + Registers update (transfer preload to + active) + 31 + 1 + + + EXTEVNT10 + External Event 10 + 30 + 1 + + + EXTEVNT9 + External Event 9 + 29 + 1 + + + EXTEVNT8 + External Event 8 + 28 + 1 + + + EXTEVNT7 + External Event 7 + 27 + 1 + + + EXTEVNT6 + External Event 6 + 26 + 1 + + + EXTEVNT5 + External Event 5 + 25 + 1 + + + EXTEVNT4 + External Event 4 + 24 + 1 + + + EXTEVNT3 + External Event 3 + 23 + 1 + + + EXTEVNT2 + External Event 2 + 22 + 1 + + + EXTEVNT1 + External Event 1 + 21 + 1 + + + TIMEVNT9 + Timer Event 9 + 20 + 1 + + + TIMEVNT8 + Timer Event 8 + 19 + 1 + + + TIMEVNT7 + Timer Event 7 + 18 + 1 + + + TIMEVNT6 + Timer Event 6 + 17 + 1 + + + TIMEVNT5 + Timer Event 5 + 16 + 1 + + + TIMEVNT4 + Timer Event 4 + 15 + 1 + + + TIMEVNT3 + Timer Event 3 + 14 + 1 + + + TIMEVNT2 + Timer Event 2 + 13 + 1 + + + TIMEVNT1 + Timer Event 1 + 12 + 1 + + + MSTCMP4 + Master Compare 4 + 11 + 1 + + + MSTCMP3 + Master Compare 3 + 10 + 1 + + + MSTCMP2 + Master Compare 2 + 9 + 1 + + + MSTCMP1 + Master Compare 1 + 8 + 1 + + + MSTPER + Master Period + 7 + 1 + + + CMP4 + Timer A compare 4 + 6 + 1 + + + CMP3 + Timer A compare 3 + 5 + 1 + + + CMP2 + Timer A compare 2 + 4 + 1 + + + CMP1 + Timer A compare 1 + 3 + 1 + + + PER + Timer A Period + 2 + 1 + + + RESYNC + Timer A resynchronizaton + 1 + 1 + + + SST + Software Set trigger + 0 + 1 + + + + + RSTA1R + RSTA1R + Timerx Output1 Reset Register + 0x40 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + SETA2R + SETA2R + Timerx Output2 Set Register + 0x44 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SST + SST + 0 + 1 + + + + + RSTA2R + RSTA2R + Timerx Output2 Reset Register + 0x48 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + EEFAR1 + EEFAR1 + Timerx External Event Filtering Register + 1 + 0x4C + 0x20 + read-write + 0x00000000 + + + EE5FLTR + External Event 5 filter + 25 + 4 + + + EE5LTCH + External Event 5 latch + 24 + 1 + + + EE4FLTR + External Event 4 filter + 19 + 4 + + + EE4LTCH + External Event 4 latch + 18 + 1 + + + EE3FLTR + External Event 3 filter + 13 + 4 + + + EE3LTCH + External Event 3 latch + 12 + 1 + + + EE2FLTR + External Event 2 filter + 7 + 4 + + + EE2LTCH + External Event 2 latch + 6 + 1 + + + EE1FLTR + External Event 1 filter + 1 + 4 + + + EE1LTCH + External Event 1 latch + 0 + 1 + + + + + EEFAR2 + EEFAR2 + Timerx External Event Filtering Register + 2 + 0x50 + 0x20 + read-write + 0x00000000 + + + EE10FLTR + External Event 10 filter + 25 + 4 + + + EE10LTCH + External Event 10 latch + 24 + 1 + + + EE9FLTR + External Event 9 filter + 19 + 4 + + + EE9LTCH + External Event 9 latch + 18 + 1 + + + EE8FLTR + External Event 8 filter + 13 + 4 + + + EE8LTCH + External Event 8 latch + 12 + 1 + + + EE7FLTR + External Event 7 filter + 7 + 4 + + + EE7LTCH + External Event 7 latch + 6 + 1 + + + EE6FLTR + External Event 6 filter + 1 + 4 + + + EE6LTCH + External Event 6 latch + 0 + 1 + + + + + RSTAR + RSTAR + TimerA Reset Register + 0x54 + 0x20 + read-write + 0x00000000 + + + TIMECMP4 + Timer E Compare 4 + 30 + 1 + + + TIMECMP2 + Timer E Compare 2 + 29 + 1 + + + TIMECMP1 + Timer E Compare 1 + 28 + 1 + + + TIMDCMP4 + Timer D Compare 4 + 27 + 1 + + + TIMDCMP2 + Timer D Compare 2 + 26 + 1 + + + TIMDCMP1 + Timer D Compare 1 + 25 + 1 + + + TIMCCMP4 + Timer C Compare 4 + 24 + 1 + + + TIMCCMP2 + Timer C Compare 2 + 23 + 1 + + + TIMCCMP1 + Timer C Compare 1 + 22 + 1 + + + TIMBCMP4 + Timer B Compare 4 + 21 + 1 + + + TIMBCMP2 + Timer B Compare 2 + 20 + 1 + + + TIMBCMP1 + Timer B Compare 1 + 19 + 1 + + + EXTEVNT10 + External Event 10 + 18 + 1 + + + EXTEVNT9 + External Event 9 + 17 + 1 + + + EXTEVNT8 + External Event 8 + 16 + 1 + + + EXTEVNT7 + External Event 7 + 15 + 1 + + + EXTEVNT6 + External Event 6 + 14 + 1 + + + EXTEVNT5 + External Event 5 + 13 + 1 + + + EXTEVNT4 + External Event 4 + 12 + 1 + + + EXTEVNT3 + External Event 3 + 11 + 1 + + + EXTEVNT2 + External Event 2 + 10 + 1 + + + EXTEVNT1 + External Event 1 + 9 + 1 + + + MSTCMP4 + Master compare 4 + 8 + 1 + + + MSTCMP3 + Master compare 3 + 7 + 1 + + + MSTCMP2 + Master compare 2 + 6 + 1 + + + MSTCMP1 + Master compare 1 + 5 + 1 + + + MSTPER + Master timer Period + 4 + 1 + + + CMP4 + Timer A compare 4 reset + 3 + 1 + + + CMP2 + Timer A compare 2 reset + 2 + 1 + + + UPDT + Timer A Update reset + 1 + 1 + + + + + CHPAR + CHPAR + Timerx Chopper Register + 0x58 + 0x20 + read-write + 0x00000000 + + + STRTPW + STRTPW + 7 + 4 + + + CHPDTY + Timerx chopper duty cycle + value + 4 + 3 + + + CHPFRQ + Timerx carrier frequency + value + 0 + 4 + + + + + CPT1ACR + CPT1ACR + Timerx Capture 2 Control + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + CPT2ACR + CPT2ACR + CPT2xCR + 0x60 + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + OUTAR + OUTAR + Timerx Output Register + 0x64 + 0x20 + read-write + 0x00000000 + + + DIDL2 + Output 2 Deadtime upon burst mode Idle + entry + 23 + 1 + + + CHP2 + Output 2 Chopper enable + 22 + 1 + + + FAULT2 + Output 2 Fault state + 20 + 2 + + + IDLES2 + Output 2 Idle State + 19 + 1 + + + IDLEM2 + Output 2 Idle mode + 18 + 1 + + + POL2 + Output 2 polarity + 17 + 1 + + + DLYPRT + Delayed Protection + 10 + 3 + + + DLYPRTEN + Delayed Protection Enable + 9 + 1 + + + DTEN + Deadtime enable + 8 + 1 + + + DIDL1 + Output 1 Deadtime upon burst mode Idle + entry + 7 + 1 + + + CHP1 + Output 1 Chopper enable + 6 + 1 + + + FAULT1 + Output 1 Fault state + 4 + 2 + + + IDLES1 + Output 1 Idle State + 3 + 1 + + + IDLEM1 + Output 1 Idle mode + 2 + 1 + + + POL1 + Output 1 polarity + 1 + 1 + + + + + FLTAR + FLTAR + Timerx Fault Register + 0x68 + 0x20 + read-write + 0x00000000 + + + FLTLCK + Fault sources Lock + 31 + 1 + + + FLT5EN + Fault 5 enable + 4 + 1 + + + FLT4EN + Fault 4 enable + 3 + 1 + + + FLT3EN + Fault 3 enable + 2 + 1 + + + FLT2EN + Fault 2 enable + 1 + 1 + + + FLT1EN + Fault 1 enable + 0 + 1 + + + + + + + HRTIM_TIMB + High Resolution Timer: TIMB + HRTIM + 0x40017500 + + 0x0 + 0x80 + registers + + + HRTIM1_TIMA + HRTIM1 timer A interrupt + 104 + + + + TIMBCR + TIMBCR + Timerx Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + UPDGAT + Update Gating + 28 + 4 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + MSTU + Master Timer update + 24 + 1 + + + TEU + TEU + 23 + 1 + + + TDU + TDU + 22 + 1 + + + TCU + TCU + 21 + 1 + + + TBU + TBU + 20 + 1 + + + TxRSTU + Timerx reset update + 18 + 1 + + + TxREPU + Timer x Repetition update + 17 + 1 + + + DELCMP4 + Delayed CMP4 mode + 14 + 2 + + + DELCMP2 + Delayed CMP2 mode + 12 + 2 + + + SYNCSTRTx + Synchronization Starts Timer + x + 11 + 1 + + + SYNCRSTx + Synchronization Resets Timer + x + 10 + 1 + + + PSHPLL + Push-Pull mode enable + 6 + 1 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Re-triggerable mode + 4 + 1 + + + CONT + Continuous mode + 3 + 1 + + + CK_PSCx + HRTIM Timer x Clock + prescaler + 0 + 3 + + + + + TIMBISR + TIMBISR + Timerx Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + O2STAT + Output 2 State + 19 + 1 + + + O1STAT + Output 1 State + 18 + 1 + + + IPPSTAT + Idle Push Pull Status + 17 + 1 + + + CPPSTAT + Current Push Pull Status + 16 + 1 + + + DLYPRT + Delayed Protection Flag + 14 + 1 + + + RST + Reset Interrupt Flag + 13 + 1 + + + RSTx2 + Output 2 Reset Interrupt + Flag + 12 + 1 + + + SETx2 + Output 2 Set Interrupt + Flag + 11 + 1 + + + RSTx1 + Output 1 Reset Interrupt + Flag + 10 + 1 + + + SETx1 + Output 1 Set Interrupt + Flag + 9 + 1 + + + CPT2 + Capture2 Interrupt Flag + 8 + 1 + + + CPT1 + Capture1 Interrupt Flag + 7 + 1 + + + UPD + Update Interrupt Flag + 6 + 1 + + + REP + Repetition Interrupt Flag + 4 + 1 + + + CMP4 + Compare 4 Interrupt Flag + 3 + 1 + + + CMP3 + Compare 3 Interrupt Flag + 2 + 1 + + + CMP2 + Compare 2 Interrupt Flag + 1 + 1 + + + CMP1 + Compare 1 Interrupt Flag + 0 + 1 + + + + + TIMBICR + TIMBICR + Timerx Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + DLYPRTC + Delayed Protection Flag + Clear + 14 + 1 + + + RSTC + Reset Interrupt flag Clear + 13 + 1 + + + RSTx2C + Output 2 Reset flag Clear + 12 + 1 + + + SET2xC + Output 2 Set flag Clear + 11 + 1 + + + RSTx1C + Output 1 Reset flag Clear + 10 + 1 + + + SET1xC + Output 1 Set flag Clear + 9 + 1 + + + CPT2C + Capture2 Interrupt flag + Clear + 8 + 1 + + + CPT1C + Capture1 Interrupt flag + Clear + 7 + 1 + + + UPDC + Update Interrupt flag + Clear + 6 + 1 + + + REPC + Repetition Interrupt flag + Clear + 4 + 1 + + + CMP4C + Compare 4 Interrupt flag + Clear + 3 + 1 + + + CMP3C + Compare 3 Interrupt flag + Clear + 2 + 1 + + + CMP2C + Compare 2 Interrupt flag + Clear + 1 + 1 + + + CMP1C + Compare 1 Interrupt flag + Clear + 0 + 1 + + + + + TIMBDIER5 + TIMBDIER5 + TIMxDIER5 + 0xC + 0x20 + read-write + 0x00000000 + + + DLYPRTDE + DLYPRTDE + 30 + 1 + + + RSTDE + RSTDE + 29 + 1 + + + RSTx2DE + RSTx2DE + 28 + 1 + + + SETx2DE + SETx2DE + 27 + 1 + + + RSTx1DE + RSTx1DE + 26 + 1 + + + SET1xDE + SET1xDE + 25 + 1 + + + CPT2DE + CPT2DE + 24 + 1 + + + CPT1DE + CPT1DE + 23 + 1 + + + UPDDE + UPDDE + 22 + 1 + + + REPDE + REPDE + 20 + 1 + + + CMP4DE + CMP4DE + 19 + 1 + + + CMP3DE + CMP3DE + 18 + 1 + + + CMP2DE + CMP2DE + 17 + 1 + + + CMP1DE + CMP1DE + 16 + 1 + + + DLYPRTIE + DLYPRTIE + 14 + 1 + + + RSTIE + RSTIE + 13 + 1 + + + RSTx2IE + RSTx2IE + 12 + 1 + + + SETx2IE + SETx2IE + 11 + 1 + + + RSTx1IE + RSTx1IE + 10 + 1 + + + SET1xIE + SET1xIE + 9 + 1 + + + CPT2IE + CPT2IE + 8 + 1 + + + CPT1IE + CPT1IE + 7 + 1 + + + UPDIE + UPDIE + 6 + 1 + + + REPIE + REPIE + 4 + 1 + + + CMP4IE + CMP4IE + 3 + 1 + + + CMP3IE + CMP3IE + 2 + 1 + + + CMP2IE + CMP2IE + 1 + 1 + + + CMP1IE + CMP1IE + 0 + 1 + + + + + CNTR + CNTR + Timerx Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CNTx + Timerx Counter value + 0 + 16 + + + + + PERBR + PERBR + Timerx Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + PERx + Timerx Period value + 0 + 16 + + + + + REPBR + REPBR + Timerx Repetition Register + 0x18 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition counter + value + 0 + 8 + + + + + CMP1BR + CMP1BR + Timerx Compare 1 Register + 0x1C + 0x20 + read-write + 0x00000000 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP1CBR + CMP1CBR + Timerx Compare 1 Compound + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition value (aliased from + HRTIM_REPx register) + 16 + 8 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP2BR + CMP2BR + Timerx Compare 2 Register + 0x24 + 0x20 + read-write + 0x00000000 + + + CMP2x + Timerx Compare 2 value + 0 + 16 + + + + + CMP3BR + CMP3BR + Timerx Compare 3 Register + 0x28 + 0x20 + read-write + 0x00000000 + + + CMP3x + Timerx Compare 3 value + 0 + 16 + + + + + CMP4BR + CMP4BR + Timerx Compare 4 Register + 0x2C + 0x20 + read-write + 0x00000000 + + + CMP4x + Timerx Compare 4 value + 0 + 16 + + + + + CPT1BR + CPT1BR + Timerx Capture 1 Register + 0x30 + 0x20 + read-only + 0x00000000 + + + CPT1x + Timerx Capture 1 value + 0 + 16 + + + + + CPT2BR + CPT2BR + Timerx Capture 2 Register + 0x34 + 0x20 + read-only + 0x00000000 + + + CPT2x + Timerx Capture 2 value + 0 + 16 + + + + + DTBR + DTBR + Timerx Deadtime Register + 0x38 + 0x20 + read-write + 0x00000000 + + + DTFLKx + Deadtime Falling Lock + 31 + 1 + + + DTFSLKx + Deadtime Falling Sign Lock + 30 + 1 + + + SDTFx + Sign Deadtime Falling + value + 25 + 1 + + + DTFx + Deadtime Falling value + 16 + 9 + + + DTRLKx + Deadtime Rising Lock + 15 + 1 + + + DTRSLKx + Deadtime Rising Sign Lock + 14 + 1 + + + DTPRSC + Deadtime Prescaler + 10 + 3 + + + SDTRx + Sign Deadtime Rising value + 9 + 1 + + + DTRx + Deadtime Rising value + 0 + 9 + + + + + SETB1R + SETB1R + Timerx Output1 Set Register + 0x3C + 0x20 + read-write + 0x00000000 + + + UPDATE + Registers update (transfer preload to + active) + 31 + 1 + + + EXTEVNT10 + External Event 10 + 30 + 1 + + + EXTEVNT9 + External Event 9 + 29 + 1 + + + EXTEVNT8 + External Event 8 + 28 + 1 + + + EXTEVNT7 + External Event 7 + 27 + 1 + + + EXTEVNT6 + External Event 6 + 26 + 1 + + + EXTEVNT5 + External Event 5 + 25 + 1 + + + EXTEVNT4 + External Event 4 + 24 + 1 + + + EXTEVNT3 + External Event 3 + 23 + 1 + + + EXTEVNT2 + External Event 2 + 22 + 1 + + + EXTEVNT1 + External Event 1 + 21 + 1 + + + TIMEVNT9 + Timer Event 9 + 20 + 1 + + + TIMEVNT8 + Timer Event 8 + 19 + 1 + + + TIMEVNT7 + Timer Event 7 + 18 + 1 + + + TIMEVNT6 + Timer Event 6 + 17 + 1 + + + TIMEVNT5 + Timer Event 5 + 16 + 1 + + + TIMEVNT4 + Timer Event 4 + 15 + 1 + + + TIMEVNT3 + Timer Event 3 + 14 + 1 + + + TIMEVNT2 + Timer Event 2 + 13 + 1 + + + TIMEVNT1 + Timer Event 1 + 12 + 1 + + + MSTCMP4 + Master Compare 4 + 11 + 1 + + + MSTCMP3 + Master Compare 3 + 10 + 1 + + + MSTCMP2 + Master Compare 2 + 9 + 1 + + + MSTCMP1 + Master Compare 1 + 8 + 1 + + + MSTPER + Master Period + 7 + 1 + + + CMP4 + Timer A compare 4 + 6 + 1 + + + CMP3 + Timer A compare 3 + 5 + 1 + + + CMP2 + Timer A compare 2 + 4 + 1 + + + CMP1 + Timer A compare 1 + 3 + 1 + + + PER + Timer A Period + 2 + 1 + + + RESYNC + Timer A resynchronizaton + 1 + 1 + + + SST + Software Set trigger + 0 + 1 + + + + + RSTB1R + RSTB1R + Timerx Output1 Reset Register + 0x40 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + SETB2R + SETB2R + Timerx Output2 Set Register + 0x44 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SST + SST + 0 + 1 + + + + + RSTB2R + RSTB2R + Timerx Output2 Reset Register + 0x48 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + EEFBR1 + EEFBR1 + Timerx External Event Filtering Register + 1 + 0x4C + 0x20 + read-write + 0x00000000 + + + EE5FLTR + External Event 5 filter + 25 + 4 + + + EE5LTCH + External Event 5 latch + 24 + 1 + + + EE4FLTR + External Event 4 filter + 19 + 4 + + + EE4LTCH + External Event 4 latch + 18 + 1 + + + EE3FLTR + External Event 3 filter + 13 + 4 + + + EE3LTCH + External Event 3 latch + 12 + 1 + + + EE2FLTR + External Event 2 filter + 7 + 4 + + + EE2LTCH + External Event 2 latch + 6 + 1 + + + EE1FLTR + External Event 1 filter + 1 + 4 + + + EE1LTCH + External Event 1 latch + 0 + 1 + + + + + EEFBR2 + EEFBR2 + Timerx External Event Filtering Register + 2 + 0x50 + 0x20 + read-write + 0x00000000 + + + EE10FLTR + External Event 10 filter + 25 + 4 + + + EE10LTCH + External Event 10 latch + 24 + 1 + + + EE9FLTR + External Event 9 filter + 19 + 4 + + + EE9LTCH + External Event 9 latch + 18 + 1 + + + EE8FLTR + External Event 8 filter + 13 + 4 + + + EE8LTCH + External Event 8 latch + 12 + 1 + + + EE7FLTR + External Event 7 filter + 7 + 4 + + + EE7LTCH + External Event 7 latch + 6 + 1 + + + EE6FLTR + External Event 6 filter + 1 + 4 + + + EE6LTCH + External Event 6 latch + 0 + 1 + + + + + RSTBR + RSTBR + TimerA Reset Register + 0x54 + 0x20 + read-write + 0x00000000 + + + TIMECMP4 + Timer E Compare 4 + 30 + 1 + + + TIMECMP2 + Timer E Compare 2 + 29 + 1 + + + TIMECMP1 + Timer E Compare 1 + 28 + 1 + + + TIMDCMP4 + Timer D Compare 4 + 27 + 1 + + + TIMDCMP2 + Timer D Compare 2 + 26 + 1 + + + TIMDCMP1 + Timer D Compare 1 + 25 + 1 + + + TIMCCMP4 + Timer C Compare 4 + 24 + 1 + + + TIMCCMP2 + Timer C Compare 2 + 23 + 1 + + + TIMCCMP1 + Timer C Compare 1 + 22 + 1 + + + TIMACMP4 + Timer A Compare 4 + 21 + 1 + + + TIMACMP2 + Timer A Compare 2 + 20 + 1 + + + TIMACMP1 + Timer A Compare 1 + 19 + 1 + + + EXTEVNT10 + External Event 10 + 18 + 1 + + + EXTEVNT9 + External Event 9 + 17 + 1 + + + EXTEVNT8 + External Event 8 + 16 + 1 + + + EXTEVNT7 + External Event 7 + 15 + 1 + + + EXTEVNT6 + External Event 6 + 14 + 1 + + + EXTEVNT5 + External Event 5 + 13 + 1 + + + EXTEVNT4 + External Event 4 + 12 + 1 + + + EXTEVNT3 + External Event 3 + 11 + 1 + + + EXTEVNT2 + External Event 2 + 10 + 1 + + + EXTEVNT1 + External Event 1 + 9 + 1 + + + MSTCMP4 + Master compare 4 + 8 + 1 + + + MSTCMP3 + Master compare 3 + 7 + 1 + + + MSTCMP2 + Master compare 2 + 6 + 1 + + + MSTCMP1 + Master compare 1 + 5 + 1 + + + MSTPER + Master timer Period + 4 + 1 + + + CMP4 + Timer A compare 4 reset + 3 + 1 + + + CMP2 + Timer A compare 2 reset + 2 + 1 + + + UPDT + Timer A Update reset + 1 + 1 + + + + + CHPBR + CHPBR + Timerx Chopper Register + 0x58 + 0x20 + read-write + 0x00000000 + + + STRTPW + STRTPW + 7 + 4 + + + CHPDTY + Timerx chopper duty cycle + value + 4 + 3 + + + CHPFRQ + Timerx carrier frequency + value + 0 + 4 + + + + + CPT1BCR + CPT1BCR + Timerx Capture 2 Control + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + CPT2BCR + CPT2BCR + CPT2xCR + 0x60 + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + OUTBR + OUTBR + Timerx Output Register + 0x64 + 0x20 + read-write + 0x00000000 + + + DIDL2 + Output 2 Deadtime upon burst mode Idle + entry + 23 + 1 + + + CHP2 + Output 2 Chopper enable + 22 + 1 + + + FAULT2 + Output 2 Fault state + 20 + 2 + + + IDLES2 + Output 2 Idle State + 19 + 1 + + + IDLEM2 + Output 2 Idle mode + 18 + 1 + + + POL2 + Output 2 polarity + 17 + 1 + + + DLYPRT + Delayed Protection + 10 + 3 + + + DLYPRTEN + Delayed Protection Enable + 9 + 1 + + + DTEN + Deadtime enable + 8 + 1 + + + DIDL1 + Output 1 Deadtime upon burst mode Idle + entry + 7 + 1 + + + CHP1 + Output 1 Chopper enable + 6 + 1 + + + FAULT1 + Output 1 Fault state + 4 + 2 + + + IDLES1 + Output 1 Idle State + 3 + 1 + + + IDLEM1 + Output 1 Idle mode + 2 + 1 + + + POL1 + Output 1 polarity + 1 + 1 + + + + + FLTBR + FLTBR + Timerx Fault Register + 0x68 + 0x20 + read-write + 0x00000000 + + + FLTLCK + Fault sources Lock + 31 + 1 + + + FLT5EN + Fault 5 enable + 4 + 1 + + + FLT4EN + Fault 4 enable + 3 + 1 + + + FLT3EN + Fault 3 enable + 2 + 1 + + + FLT2EN + Fault 2 enable + 1 + 1 + + + FLT1EN + Fault 1 enable + 0 + 1 + + + + + + + HRTIM_TIMC + High Resolution Timer: TIMC + HRTIM + 0x40017580 + + 0x0 + 0x80 + registers + + + HRTIM_TIMB + HRTIM1 timer B interrupt + 105 + + + + TIMCCR + TIMCCR + Timerx Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + UPDGAT + Update Gating + 28 + 4 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + MSTU + Master Timer update + 24 + 1 + + + TEU + TEU + 23 + 1 + + + TDU + TDU + 22 + 1 + + + TCU + TCU + 21 + 1 + + + TBU + TBU + 20 + 1 + + + TxRSTU + Timerx reset update + 18 + 1 + + + TxREPU + Timer x Repetition update + 17 + 1 + + + DELCMP4 + Delayed CMP4 mode + 14 + 2 + + + DELCMP2 + Delayed CMP2 mode + 12 + 2 + + + SYNCSTRTx + Synchronization Starts Timer + x + 11 + 1 + + + SYNCRSTx + Synchronization Resets Timer + x + 10 + 1 + + + PSHPLL + Push-Pull mode enable + 6 + 1 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Re-triggerable mode + 4 + 1 + + + CONT + Continuous mode + 3 + 1 + + + CK_PSCx + HRTIM Timer x Clock + prescaler + 0 + 3 + + + + + TIMCISR + TIMCISR + Timerx Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + O2STAT + Output 2 State + 19 + 1 + + + O1STAT + Output 1 State + 18 + 1 + + + IPPSTAT + Idle Push Pull Status + 17 + 1 + + + CPPSTAT + Current Push Pull Status + 16 + 1 + + + DLYPRT + Delayed Protection Flag + 14 + 1 + + + RST + Reset Interrupt Flag + 13 + 1 + + + RSTx2 + Output 2 Reset Interrupt + Flag + 12 + 1 + + + SETx2 + Output 2 Set Interrupt + Flag + 11 + 1 + + + RSTx1 + Output 1 Reset Interrupt + Flag + 10 + 1 + + + SETx1 + Output 1 Set Interrupt + Flag + 9 + 1 + + + CPT2 + Capture2 Interrupt Flag + 8 + 1 + + + CPT1 + Capture1 Interrupt Flag + 7 + 1 + + + UPD + Update Interrupt Flag + 6 + 1 + + + REP + Repetition Interrupt Flag + 4 + 1 + + + CMP4 + Compare 4 Interrupt Flag + 3 + 1 + + + CMP3 + Compare 3 Interrupt Flag + 2 + 1 + + + CMP2 + Compare 2 Interrupt Flag + 1 + 1 + + + CMP1 + Compare 1 Interrupt Flag + 0 + 1 + + + + + TIMCICR + TIMCICR + Timerx Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + DLYPRTC + Delayed Protection Flag + Clear + 14 + 1 + + + RSTC + Reset Interrupt flag Clear + 13 + 1 + + + RSTx2C + Output 2 Reset flag Clear + 12 + 1 + + + SET2xC + Output 2 Set flag Clear + 11 + 1 + + + RSTx1C + Output 1 Reset flag Clear + 10 + 1 + + + SET1xC + Output 1 Set flag Clear + 9 + 1 + + + CPT2C + Capture2 Interrupt flag + Clear + 8 + 1 + + + CPT1C + Capture1 Interrupt flag + Clear + 7 + 1 + + + UPDC + Update Interrupt flag + Clear + 6 + 1 + + + REPC + Repetition Interrupt flag + Clear + 4 + 1 + + + CMP4C + Compare 4 Interrupt flag + Clear + 3 + 1 + + + CMP3C + Compare 3 Interrupt flag + Clear + 2 + 1 + + + CMP2C + Compare 2 Interrupt flag + Clear + 1 + 1 + + + CMP1C + Compare 1 Interrupt flag + Clear + 0 + 1 + + + + + TIMCDIER5 + TIMCDIER5 + TIMxDIER5 + 0xC + 0x20 + read-write + 0x00000000 + + + DLYPRTDE + DLYPRTDE + 30 + 1 + + + RSTDE + RSTDE + 29 + 1 + + + RSTx2DE + RSTx2DE + 28 + 1 + + + SETx2DE + SETx2DE + 27 + 1 + + + RSTx1DE + RSTx1DE + 26 + 1 + + + SET1xDE + SET1xDE + 25 + 1 + + + CPT2DE + CPT2DE + 24 + 1 + + + CPT1DE + CPT1DE + 23 + 1 + + + UPDDE + UPDDE + 22 + 1 + + + REPDE + REPDE + 20 + 1 + + + CMP4DE + CMP4DE + 19 + 1 + + + CMP3DE + CMP3DE + 18 + 1 + + + CMP2DE + CMP2DE + 17 + 1 + + + CMP1DE + CMP1DE + 16 + 1 + + + DLYPRTIE + DLYPRTIE + 14 + 1 + + + RSTIE + RSTIE + 13 + 1 + + + RSTx2IE + RSTx2IE + 12 + 1 + + + SETx2IE + SETx2IE + 11 + 1 + + + RSTx1IE + RSTx1IE + 10 + 1 + + + SET1xIE + SET1xIE + 9 + 1 + + + CPT2IE + CPT2IE + 8 + 1 + + + CPT1IE + CPT1IE + 7 + 1 + + + UPDIE + UPDIE + 6 + 1 + + + REPIE + REPIE + 4 + 1 + + + CMP4IE + CMP4IE + 3 + 1 + + + CMP3IE + CMP3IE + 2 + 1 + + + CMP2IE + CMP2IE + 1 + 1 + + + CMP1IE + CMP1IE + 0 + 1 + + + + + CNTCR + CNTCR + Timerx Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CNTx + Timerx Counter value + 0 + 16 + + + + + PERCR + PERCR + Timerx Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + PERx + Timerx Period value + 0 + 16 + + + + + REPCR + REPCR + Timerx Repetition Register + 0x18 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition counter + value + 0 + 8 + + + + + CMP1CR + CMP1CR + Timerx Compare 1 Register + 0x1C + 0x20 + read-write + 0x00000000 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP1CCR + CMP1CCR + Timerx Compare 1 Compound + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition value (aliased from + HRTIM_REPx register) + 16 + 8 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP2CR + CMP2CR + Timerx Compare 2 Register + 0x24 + 0x20 + read-write + 0x00000000 + + + CMP2x + Timerx Compare 2 value + 0 + 16 + + + + + CMP3CR + CMP3CR + Timerx Compare 3 Register + 0x28 + 0x20 + read-write + 0x00000000 + + + CMP3x + Timerx Compare 3 value + 0 + 16 + + + + + CMP4CR + CMP4CR + Timerx Compare 4 Register + 0x2C + 0x20 + read-write + 0x00000000 + + + CMP4x + Timerx Compare 4 value + 0 + 16 + + + + + CPT1CR + CPT1CR + Timerx Capture 1 Register + 0x30 + 0x20 + read-only + 0x00000000 + + + CPT1x + Timerx Capture 1 value + 0 + 16 + + + + + CPT2CR + CPT2CR + Timerx Capture 2 Register + 0x34 + 0x20 + read-only + 0x00000000 + + + CPT2x + Timerx Capture 2 value + 0 + 16 + + + + + DTCR + DTCR + Timerx Deadtime Register + 0x38 + 0x20 + read-write + 0x00000000 + + + DTFLKx + Deadtime Falling Lock + 31 + 1 + + + DTFSLKx + Deadtime Falling Sign Lock + 30 + 1 + + + SDTFx + Sign Deadtime Falling + value + 25 + 1 + + + DTFx + Deadtime Falling value + 16 + 9 + + + DTRLKx + Deadtime Rising Lock + 15 + 1 + + + DTRSLKx + Deadtime Rising Sign Lock + 14 + 1 + + + DTPRSC + Deadtime Prescaler + 10 + 3 + + + SDTRx + Sign Deadtime Rising value + 9 + 1 + + + DTRx + Deadtime Rising value + 0 + 9 + + + + + SETC1R + SETC1R + Timerx Output1 Set Register + 0x3C + 0x20 + read-write + 0x00000000 + + + UPDATE + Registers update (transfer preload to + active) + 31 + 1 + + + EXTEVNT10 + External Event 10 + 30 + 1 + + + EXTEVNT9 + External Event 9 + 29 + 1 + + + EXTEVNT8 + External Event 8 + 28 + 1 + + + EXTEVNT7 + External Event 7 + 27 + 1 + + + EXTEVNT6 + External Event 6 + 26 + 1 + + + EXTEVNT5 + External Event 5 + 25 + 1 + + + EXTEVNT4 + External Event 4 + 24 + 1 + + + EXTEVNT3 + External Event 3 + 23 + 1 + + + EXTEVNT2 + External Event 2 + 22 + 1 + + + EXTEVNT1 + External Event 1 + 21 + 1 + + + TIMEVNT9 + Timer Event 9 + 20 + 1 + + + TIMEVNT8 + Timer Event 8 + 19 + 1 + + + TIMEVNT7 + Timer Event 7 + 18 + 1 + + + TIMEVNT6 + Timer Event 6 + 17 + 1 + + + TIMEVNT5 + Timer Event 5 + 16 + 1 + + + TIMEVNT4 + Timer Event 4 + 15 + 1 + + + TIMEVNT3 + Timer Event 3 + 14 + 1 + + + TIMEVNT2 + Timer Event 2 + 13 + 1 + + + TIMEVNT1 + Timer Event 1 + 12 + 1 + + + MSTCMP4 + Master Compare 4 + 11 + 1 + + + MSTCMP3 + Master Compare 3 + 10 + 1 + + + MSTCMP2 + Master Compare 2 + 9 + 1 + + + MSTCMP1 + Master Compare 1 + 8 + 1 + + + MSTPER + Master Period + 7 + 1 + + + CMP4 + Timer A compare 4 + 6 + 1 + + + CMP3 + Timer A compare 3 + 5 + 1 + + + CMP2 + Timer A compare 2 + 4 + 1 + + + CMP1 + Timer A compare 1 + 3 + 1 + + + PER + Timer A Period + 2 + 1 + + + RESYNC + Timer A resynchronizaton + 1 + 1 + + + SST + Software Set trigger + 0 + 1 + + + + + RSTC1R + RSTC1R + Timerx Output1 Reset Register + 0x40 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + SETC2R + SETC2R + Timerx Output2 Set Register + 0x44 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SST + SST + 0 + 1 + + + + + RSTC2R + RSTC2R + Timerx Output2 Reset Register + 0x48 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + EEFCR1 + EEFCR1 + Timerx External Event Filtering Register + 1 + 0x4C + 0x20 + read-write + 0x00000000 + + + EE5FLTR + External Event 5 filter + 25 + 4 + + + EE5LTCH + External Event 5 latch + 24 + 1 + + + EE4FLTR + External Event 4 filter + 19 + 4 + + + EE4LTCH + External Event 4 latch + 18 + 1 + + + EE3FLTR + External Event 3 filter + 13 + 4 + + + EE3LTCH + External Event 3 latch + 12 + 1 + + + EE2FLTR + External Event 2 filter + 7 + 4 + + + EE2LTCH + External Event 2 latch + 6 + 1 + + + EE1FLTR + External Event 1 filter + 1 + 4 + + + EE1LTCH + External Event 1 latch + 0 + 1 + + + + + EEFCR2 + EEFCR2 + Timerx External Event Filtering Register + 2 + 0x50 + 0x20 + read-write + 0x00000000 + + + EE10FLTR + External Event 10 filter + 25 + 4 + + + EE10LTCH + External Event 10 latch + 24 + 1 + + + EE9FLTR + External Event 9 filter + 19 + 4 + + + EE9LTCH + External Event 9 latch + 18 + 1 + + + EE8FLTR + External Event 8 filter + 13 + 4 + + + EE8LTCH + External Event 8 latch + 12 + 1 + + + EE7FLTR + External Event 7 filter + 7 + 4 + + + EE7LTCH + External Event 7 latch + 6 + 1 + + + EE6FLTR + External Event 6 filter + 1 + 4 + + + EE6LTCH + External Event 6 latch + 0 + 1 + + + + + RSTCR + RSTCR + TimerA Reset Register + 0x54 + 0x20 + read-write + 0x00000000 + + + TIMECMP4 + Timer E Compare 4 + 30 + 1 + + + TIMECMP2 + Timer E Compare 2 + 29 + 1 + + + TIMECMP1 + Timer E Compare 1 + 28 + 1 + + + TIMDCMP4 + Timer D Compare 4 + 27 + 1 + + + TIMDCMP2 + Timer D Compare 2 + 26 + 1 + + + TIMDCMP1 + Timer D Compare 1 + 25 + 1 + + + TIMBCMP4 + Timer B Compare 4 + 24 + 1 + + + TIMBCMP2 + Timer B Compare 2 + 23 + 1 + + + TIMBCMP1 + Timer B Compare 1 + 22 + 1 + + + TIMACMP4 + Timer A Compare 4 + 21 + 1 + + + TIMACMP2 + Timer A Compare 2 + 20 + 1 + + + TIMACMP1 + Timer A Compare 1 + 19 + 1 + + + EXTEVNT10 + External Event 10 + 18 + 1 + + + EXTEVNT9 + External Event 9 + 17 + 1 + + + EXTEVNT8 + External Event 8 + 16 + 1 + + + EXTEVNT7 + External Event 7 + 15 + 1 + + + EXTEVNT6 + External Event 6 + 14 + 1 + + + EXTEVNT5 + External Event 5 + 13 + 1 + + + EXTEVNT4 + External Event 4 + 12 + 1 + + + EXTEVNT3 + External Event 3 + 11 + 1 + + + EXTEVNT2 + External Event 2 + 10 + 1 + + + EXTEVNT1 + External Event 1 + 9 + 1 + + + MSTCMP4 + Master compare 4 + 8 + 1 + + + MSTCMP3 + Master compare 3 + 7 + 1 + + + MSTCMP2 + Master compare 2 + 6 + 1 + + + MSTCMP1 + Master compare 1 + 5 + 1 + + + MSTPER + Master timer Period + 4 + 1 + + + CMP4 + Timer A compare 4 reset + 3 + 1 + + + CMP2 + Timer A compare 2 reset + 2 + 1 + + + UPDT + Timer A Update reset + 1 + 1 + + + + + CHPCR + CHPCR + Timerx Chopper Register + 0x58 + 0x20 + read-write + 0x00000000 + + + STRTPW + STRTPW + 7 + 4 + + + CHPDTY + Timerx chopper duty cycle + value + 4 + 3 + + + CHPFRQ + Timerx carrier frequency + value + 0 + 4 + + + + + CPT1CCR + CPT1CCR + Timerx Capture 2 Control + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + CPT2CCR + CPT2CCR + CPT2xCR + 0x60 + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + OUTCR + OUTCR + Timerx Output Register + 0x64 + 0x20 + read-write + 0x00000000 + + + DIDL2 + Output 2 Deadtime upon burst mode Idle + entry + 23 + 1 + + + CHP2 + Output 2 Chopper enable + 22 + 1 + + + FAULT2 + Output 2 Fault state + 20 + 2 + + + IDLES2 + Output 2 Idle State + 19 + 1 + + + IDLEM2 + Output 2 Idle mode + 18 + 1 + + + POL2 + Output 2 polarity + 17 + 1 + + + DLYPRT + Delayed Protection + 10 + 3 + + + DLYPRTEN + Delayed Protection Enable + 9 + 1 + + + DTEN + Deadtime enable + 8 + 1 + + + DIDL1 + Output 1 Deadtime upon burst mode Idle + entry + 7 + 1 + + + CHP1 + Output 1 Chopper enable + 6 + 1 + + + FAULT1 + Output 1 Fault state + 4 + 2 + + + IDLES1 + Output 1 Idle State + 3 + 1 + + + IDLEM1 + Output 1 Idle mode + 2 + 1 + + + POL1 + Output 1 polarity + 1 + 1 + + + + + FLTCR + FLTCR + Timerx Fault Register + 0x68 + 0x20 + read-write + 0x00000000 + + + FLTLCK + Fault sources Lock + 31 + 1 + + + FLT5EN + Fault 5 enable + 4 + 1 + + + FLT4EN + Fault 4 enable + 3 + 1 + + + FLT3EN + Fault 3 enable + 2 + 1 + + + FLT2EN + Fault 2 enable + 1 + 1 + + + FLT1EN + Fault 1 enable + 0 + 1 + + + + + + + HRTIM_TIMD + High Resolution Timer: TIMD + HRTIM + 0x40017600 + + 0x0 + 0x80 + registers + + + HRTIM1_TIMC + HRTIM1 timer C interrupt + 106 + + + + TIMDCR + TIMDCR + Timerx Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + UPDGAT + Update Gating + 28 + 4 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + MSTU + Master Timer update + 24 + 1 + + + TEU + TEU + 23 + 1 + + + TDU + TDU + 22 + 1 + + + TCU + TCU + 21 + 1 + + + TBU + TBU + 20 + 1 + + + TxRSTU + Timerx reset update + 18 + 1 + + + TxREPU + Timer x Repetition update + 17 + 1 + + + DELCMP4 + Delayed CMP4 mode + 14 + 2 + + + DELCMP2 + Delayed CMP2 mode + 12 + 2 + + + SYNCSTRTx + Synchronization Starts Timer + x + 11 + 1 + + + SYNCRSTx + Synchronization Resets Timer + x + 10 + 1 + + + PSHPLL + Push-Pull mode enable + 6 + 1 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Re-triggerable mode + 4 + 1 + + + CONT + Continuous mode + 3 + 1 + + + CK_PSCx + HRTIM Timer x Clock + prescaler + 0 + 3 + + + + + TIMDISR + TIMDISR + Timerx Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + O2STAT + Output 2 State + 19 + 1 + + + O1STAT + Output 1 State + 18 + 1 + + + IPPSTAT + Idle Push Pull Status + 17 + 1 + + + CPPSTAT + Current Push Pull Status + 16 + 1 + + + DLYPRT + Delayed Protection Flag + 14 + 1 + + + RST + Reset Interrupt Flag + 13 + 1 + + + RSTx2 + Output 2 Reset Interrupt + Flag + 12 + 1 + + + SETx2 + Output 2 Set Interrupt + Flag + 11 + 1 + + + RSTx1 + Output 1 Reset Interrupt + Flag + 10 + 1 + + + SETx1 + Output 1 Set Interrupt + Flag + 9 + 1 + + + CPT2 + Capture2 Interrupt Flag + 8 + 1 + + + CPT1 + Capture1 Interrupt Flag + 7 + 1 + + + UPD + Update Interrupt Flag + 6 + 1 + + + REP + Repetition Interrupt Flag + 4 + 1 + + + CMP4 + Compare 4 Interrupt Flag + 3 + 1 + + + CMP3 + Compare 3 Interrupt Flag + 2 + 1 + + + CMP2 + Compare 2 Interrupt Flag + 1 + 1 + + + CMP1 + Compare 1 Interrupt Flag + 0 + 1 + + + + + TIMDICR + TIMDICR + Timerx Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + DLYPRTC + Delayed Protection Flag + Clear + 14 + 1 + + + RSTC + Reset Interrupt flag Clear + 13 + 1 + + + RSTx2C + Output 2 Reset flag Clear + 12 + 1 + + + SET2xC + Output 2 Set flag Clear + 11 + 1 + + + RSTx1C + Output 1 Reset flag Clear + 10 + 1 + + + SET1xC + Output 1 Set flag Clear + 9 + 1 + + + CPT2C + Capture2 Interrupt flag + Clear + 8 + 1 + + + CPT1C + Capture1 Interrupt flag + Clear + 7 + 1 + + + UPDC + Update Interrupt flag + Clear + 6 + 1 + + + REPC + Repetition Interrupt flag + Clear + 4 + 1 + + + CMP4C + Compare 4 Interrupt flag + Clear + 3 + 1 + + + CMP3C + Compare 3 Interrupt flag + Clear + 2 + 1 + + + CMP2C + Compare 2 Interrupt flag + Clear + 1 + 1 + + + CMP1C + Compare 1 Interrupt flag + Clear + 0 + 1 + + + + + TIMDDIER5 + TIMDDIER5 + TIMxDIER5 + 0xC + 0x20 + read-write + 0x00000000 + + + DLYPRTDE + DLYPRTDE + 30 + 1 + + + RSTDE + RSTDE + 29 + 1 + + + RSTx2DE + RSTx2DE + 28 + 1 + + + SETx2DE + SETx2DE + 27 + 1 + + + RSTx1DE + RSTx1DE + 26 + 1 + + + SET1xDE + SET1xDE + 25 + 1 + + + CPT2DE + CPT2DE + 24 + 1 + + + CPT1DE + CPT1DE + 23 + 1 + + + UPDDE + UPDDE + 22 + 1 + + + REPDE + REPDE + 20 + 1 + + + CMP4DE + CMP4DE + 19 + 1 + + + CMP3DE + CMP3DE + 18 + 1 + + + CMP2DE + CMP2DE + 17 + 1 + + + CMP1DE + CMP1DE + 16 + 1 + + + DLYPRTIE + DLYPRTIE + 14 + 1 + + + RSTIE + RSTIE + 13 + 1 + + + RSTx2IE + RSTx2IE + 12 + 1 + + + SETx2IE + SETx2IE + 11 + 1 + + + RSTx1IE + RSTx1IE + 10 + 1 + + + SET1xIE + SET1xIE + 9 + 1 + + + CPT2IE + CPT2IE + 8 + 1 + + + CPT1IE + CPT1IE + 7 + 1 + + + UPDIE + UPDIE + 6 + 1 + + + REPIE + REPIE + 4 + 1 + + + CMP4IE + CMP4IE + 3 + 1 + + + CMP3IE + CMP3IE + 2 + 1 + + + CMP2IE + CMP2IE + 1 + 1 + + + CMP1IE + CMP1IE + 0 + 1 + + + + + CNTDR + CNTDR + Timerx Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CNTx + Timerx Counter value + 0 + 16 + + + + + PERDR + PERDR + Timerx Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + PERx + Timerx Period value + 0 + 16 + + + + + REPDR + REPDR + Timerx Repetition Register + 0x18 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition counter + value + 0 + 8 + + + + + CMP1DR + CMP1DR + Timerx Compare 1 Register + 0x1C + 0x20 + read-write + 0x00000000 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP1CDR + CMP1CDR + Timerx Compare 1 Compound + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition value (aliased from + HRTIM_REPx register) + 16 + 8 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP2DR + CMP2DR + Timerx Compare 2 Register + 0x24 + 0x20 + read-write + 0x00000000 + + + CMP2x + Timerx Compare 2 value + 0 + 16 + + + + + CMP3DR + CMP3DR + Timerx Compare 3 Register + 0x28 + 0x20 + read-write + 0x00000000 + + + CMP3x + Timerx Compare 3 value + 0 + 16 + + + + + CMP4DR + CMP4DR + Timerx Compare 4 Register + 0x2C + 0x20 + read-write + 0x00000000 + + + CMP4x + Timerx Compare 4 value + 0 + 16 + + + + + CPT1DR + CPT1DR + Timerx Capture 1 Register + 0x30 + 0x20 + read-only + 0x00000000 + + + CPT1x + Timerx Capture 1 value + 0 + 16 + + + + + CPT2DR + CPT2DR + Timerx Capture 2 Register + 0x34 + 0x20 + read-only + 0x00000000 + + + CPT2x + Timerx Capture 2 value + 0 + 16 + + + + + DTDR + DTDR + Timerx Deadtime Register + 0x38 + 0x20 + read-write + 0x00000000 + + + DTFLKx + Deadtime Falling Lock + 31 + 1 + + + DTFSLKx + Deadtime Falling Sign Lock + 30 + 1 + + + SDTFx + Sign Deadtime Falling + value + 25 + 1 + + + DTFx + Deadtime Falling value + 16 + 9 + + + DTRLKx + Deadtime Rising Lock + 15 + 1 + + + DTRSLKx + Deadtime Rising Sign Lock + 14 + 1 + + + DTPRSC + Deadtime Prescaler + 10 + 3 + + + SDTRx + Sign Deadtime Rising value + 9 + 1 + + + DTRx + Deadtime Rising value + 0 + 9 + + + + + SETD1R + SETD1R + Timerx Output1 Set Register + 0x3C + 0x20 + read-write + 0x00000000 + + + UPDATE + Registers update (transfer preload to + active) + 31 + 1 + + + EXTEVNT10 + External Event 10 + 30 + 1 + + + EXTEVNT9 + External Event 9 + 29 + 1 + + + EXTEVNT8 + External Event 8 + 28 + 1 + + + EXTEVNT7 + External Event 7 + 27 + 1 + + + EXTEVNT6 + External Event 6 + 26 + 1 + + + EXTEVNT5 + External Event 5 + 25 + 1 + + + EXTEVNT4 + External Event 4 + 24 + 1 + + + EXTEVNT3 + External Event 3 + 23 + 1 + + + EXTEVNT2 + External Event 2 + 22 + 1 + + + EXTEVNT1 + External Event 1 + 21 + 1 + + + TIMEVNT9 + Timer Event 9 + 20 + 1 + + + TIMEVNT8 + Timer Event 8 + 19 + 1 + + + TIMEVNT7 + Timer Event 7 + 18 + 1 + + + TIMEVNT6 + Timer Event 6 + 17 + 1 + + + TIMEVNT5 + Timer Event 5 + 16 + 1 + + + TIMEVNT4 + Timer Event 4 + 15 + 1 + + + TIMEVNT3 + Timer Event 3 + 14 + 1 + + + TIMEVNT2 + Timer Event 2 + 13 + 1 + + + TIMEVNT1 + Timer Event 1 + 12 + 1 + + + MSTCMP4 + Master Compare 4 + 11 + 1 + + + MSTCMP3 + Master Compare 3 + 10 + 1 + + + MSTCMP2 + Master Compare 2 + 9 + 1 + + + MSTCMP1 + Master Compare 1 + 8 + 1 + + + MSTPER + Master Period + 7 + 1 + + + CMP4 + Timer A compare 4 + 6 + 1 + + + CMP3 + Timer A compare 3 + 5 + 1 + + + CMP2 + Timer A compare 2 + 4 + 1 + + + CMP1 + Timer A compare 1 + 3 + 1 + + + PER + Timer A Period + 2 + 1 + + + RESYNC + Timer A resynchronizaton + 1 + 1 + + + SST + Software Set trigger + 0 + 1 + + + + + RSTD1R + RSTD1R + Timerx Output1 Reset Register + 0x40 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + SETD2R + SETD2R + Timerx Output2 Set Register + 0x44 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SST + SST + 0 + 1 + + + + + RSTD2R + RSTD2R + Timerx Output2 Reset Register + 0x48 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + EEFDR1 + EEFDR1 + Timerx External Event Filtering Register + 1 + 0x4C + 0x20 + read-write + 0x00000000 + + + EE5FLTR + External Event 5 filter + 25 + 4 + + + EE5LTCH + External Event 5 latch + 24 + 1 + + + EE4FLTR + External Event 4 filter + 19 + 4 + + + EE4LTCH + External Event 4 latch + 18 + 1 + + + EE3FLTR + External Event 3 filter + 13 + 4 + + + EE3LTCH + External Event 3 latch + 12 + 1 + + + EE2FLTR + External Event 2 filter + 7 + 4 + + + EE2LTCH + External Event 2 latch + 6 + 1 + + + EE1FLTR + External Event 1 filter + 1 + 4 + + + EE1LTCH + External Event 1 latch + 0 + 1 + + + + + EEFDR2 + EEFDR2 + Timerx External Event Filtering Register + 2 + 0x50 + 0x20 + read-write + 0x00000000 + + + EE10FLTR + External Event 10 filter + 25 + 4 + + + EE10LTCH + External Event 10 latch + 24 + 1 + + + EE9FLTR + External Event 9 filter + 19 + 4 + + + EE9LTCH + External Event 9 latch + 18 + 1 + + + EE8FLTR + External Event 8 filter + 13 + 4 + + + EE8LTCH + External Event 8 latch + 12 + 1 + + + EE7FLTR + External Event 7 filter + 7 + 4 + + + EE7LTCH + External Event 7 latch + 6 + 1 + + + EE6FLTR + External Event 6 filter + 1 + 4 + + + EE6LTCH + External Event 6 latch + 0 + 1 + + + + + RSTDR + RSTDR + TimerA Reset Register + 0x54 + 0x20 + read-write + 0x00000000 + + + TIMECMP4 + Timer E Compare 4 + 30 + 1 + + + TIMECMP2 + Timer E Compare 2 + 29 + 1 + + + TIMECMP1 + Timer E Compare 1 + 28 + 1 + + + TIMCCMP4 + Timer C Compare 4 + 27 + 1 + + + TIMCCMP2 + Timer C Compare 2 + 26 + 1 + + + TIMCCMP1 + Timer C Compare 1 + 25 + 1 + + + TIMBCMP4 + Timer B Compare 4 + 24 + 1 + + + TIMBCMP2 + Timer B Compare 2 + 23 + 1 + + + TIMBCMP1 + Timer B Compare 1 + 22 + 1 + + + TIMACMP4 + Timer A Compare 4 + 21 + 1 + + + TIMACMP2 + Timer A Compare 2 + 20 + 1 + + + TIMACMP1 + Timer A Compare 1 + 19 + 1 + + + EXTEVNT10 + External Event 10 + 18 + 1 + + + EXTEVNT9 + External Event 9 + 17 + 1 + + + EXTEVNT8 + External Event 8 + 16 + 1 + + + EXTEVNT7 + External Event 7 + 15 + 1 + + + EXTEVNT6 + External Event 6 + 14 + 1 + + + EXTEVNT5 + External Event 5 + 13 + 1 + + + EXTEVNT4 + External Event 4 + 12 + 1 + + + EXTEVNT3 + External Event 3 + 11 + 1 + + + EXTEVNT2 + External Event 2 + 10 + 1 + + + EXTEVNT1 + External Event 1 + 9 + 1 + + + MSTCMP4 + Master compare 4 + 8 + 1 + + + MSTCMP3 + Master compare 3 + 7 + 1 + + + MSTCMP2 + Master compare 2 + 6 + 1 + + + MSTCMP1 + Master compare 1 + 5 + 1 + + + MSTPER + Master timer Period + 4 + 1 + + + CMP4 + Timer A compare 4 reset + 3 + 1 + + + CMP2 + Timer A compare 2 reset + 2 + 1 + + + UPDT + Timer A Update reset + 1 + 1 + + + + + CHPDR + CHPDR + Timerx Chopper Register + 0x58 + 0x20 + read-write + 0x00000000 + + + STRTPW + STRTPW + 7 + 4 + + + CHPDTY + Timerx chopper duty cycle + value + 4 + 3 + + + CHPFRQ + Timerx carrier frequency + value + 0 + 4 + + + + + CPT1DCR + CPT1DCR + Timerx Capture 2 Control + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + CPT2DCR + CPT2DCR + CPT2xCR + 0x60 + 0x20 + read-write + 0x00000000 + + + TECMP2 + Timer E Compare 2 + 31 + 1 + + + TECMP1 + Timer E Compare 1 + 30 + 1 + + + TE1RST + Timer E output 1 Reset + 29 + 1 + + + TE1SET + Timer E output 1 Set + 28 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + OUTDR + OUTDR + Timerx Output Register + 0x64 + 0x20 + read-write + 0x00000000 + + + DIDL2 + Output 2 Deadtime upon burst mode Idle + entry + 23 + 1 + + + CHP2 + Output 2 Chopper enable + 22 + 1 + + + FAULT2 + Output 2 Fault state + 20 + 2 + + + IDLES2 + Output 2 Idle State + 19 + 1 + + + IDLEM2 + Output 2 Idle mode + 18 + 1 + + + POL2 + Output 2 polarity + 17 + 1 + + + DLYPRT + Delayed Protection + 10 + 3 + + + DLYPRTEN + Delayed Protection Enable + 9 + 1 + + + DTEN + Deadtime enable + 8 + 1 + + + DIDL1 + Output 1 Deadtime upon burst mode Idle + entry + 7 + 1 + + + CHP1 + Output 1 Chopper enable + 6 + 1 + + + FAULT1 + Output 1 Fault state + 4 + 2 + + + IDLES1 + Output 1 Idle State + 3 + 1 + + + IDLEM1 + Output 1 Idle mode + 2 + 1 + + + POL1 + Output 1 polarity + 1 + 1 + + + + + FLTDR + FLTDR + Timerx Fault Register + 0x68 + 0x20 + read-write + 0x00000000 + + + FLTLCK + Fault sources Lock + 31 + 1 + + + FLT5EN + Fault 5 enable + 4 + 1 + + + FLT4EN + Fault 4 enable + 3 + 1 + + + FLT3EN + Fault 3 enable + 2 + 1 + + + FLT2EN + Fault 2 enable + 1 + 1 + + + FLT1EN + Fault 1 enable + 0 + 1 + + + + + + + HRTIM_TIME + High Resolution Timer: TIME + HRTIM + 0x40017680 + + 0x0 + 0x80 + registers + + + HRTIM1_TIMD + HRTIM1 timer D interrupt + 107 + + + + TIMECR + TIMECR + Timerx Control Register + 0x0 + 0x20 + read-write + 0x00000000 + + + UPDGAT + Update Gating + 28 + 4 + + + PREEN + Preload enable + 27 + 1 + + + DACSYNC + AC Synchronization + 25 + 2 + + + MSTU + Master Timer update + 24 + 1 + + + TEU + TEU + 23 + 1 + + + TDU + TDU + 22 + 1 + + + TCU + TCU + 21 + 1 + + + TBU + TBU + 20 + 1 + + + TxRSTU + Timerx reset update + 18 + 1 + + + TxREPU + Timer x Repetition update + 17 + 1 + + + DELCMP4 + Delayed CMP4 mode + 14 + 2 + + + DELCMP2 + Delayed CMP2 mode + 12 + 2 + + + SYNCSTRTx + Synchronization Starts Timer + x + 11 + 1 + + + SYNCRSTx + Synchronization Resets Timer + x + 10 + 1 + + + PSHPLL + Push-Pull mode enable + 6 + 1 + + + HALF + Half mode enable + 5 + 1 + + + RETRIG + Re-triggerable mode + 4 + 1 + + + CONT + Continuous mode + 3 + 1 + + + CK_PSCx + HRTIM Timer x Clock + prescaler + 0 + 3 + + + + + TIMEISR + TIMEISR + Timerx Interrupt Status + Register + 0x4 + 0x20 + read-only + 0x00000000 + + + O2STAT + Output 2 State + 19 + 1 + + + O1STAT + Output 1 State + 18 + 1 + + + IPPSTAT + Idle Push Pull Status + 17 + 1 + + + CPPSTAT + Current Push Pull Status + 16 + 1 + + + DLYPRT + Delayed Protection Flag + 14 + 1 + + + RST + Reset Interrupt Flag + 13 + 1 + + + RSTx2 + Output 2 Reset Interrupt + Flag + 12 + 1 + + + SETx2 + Output 2 Set Interrupt + Flag + 11 + 1 + + + RSTx1 + Output 1 Reset Interrupt + Flag + 10 + 1 + + + SETx1 + Output 1 Set Interrupt + Flag + 9 + 1 + + + CPT2 + Capture2 Interrupt Flag + 8 + 1 + + + CPT1 + Capture1 Interrupt Flag + 7 + 1 + + + UPD + Update Interrupt Flag + 6 + 1 + + + REP + Repetition Interrupt Flag + 4 + 1 + + + CMP4 + Compare 4 Interrupt Flag + 3 + 1 + + + CMP3 + Compare 3 Interrupt Flag + 2 + 1 + + + CMP2 + Compare 2 Interrupt Flag + 1 + 1 + + + CMP1 + Compare 1 Interrupt Flag + 0 + 1 + + + + + TIMEICR + TIMEICR + Timerx Interrupt Clear + Register + 0x8 + 0x20 + write-only + 0x00000000 + + + DLYPRTC + Delayed Protection Flag + Clear + 14 + 1 + + + RSTC + Reset Interrupt flag Clear + 13 + 1 + + + RSTx2C + Output 2 Reset flag Clear + 12 + 1 + + + SET2xC + Output 2 Set flag Clear + 11 + 1 + + + RSTx1C + Output 1 Reset flag Clear + 10 + 1 + + + SET1xC + Output 1 Set flag Clear + 9 + 1 + + + CPT2C + Capture2 Interrupt flag + Clear + 8 + 1 + + + CPT1C + Capture1 Interrupt flag + Clear + 7 + 1 + + + UPDC + Update Interrupt flag + Clear + 6 + 1 + + + REPC + Repetition Interrupt flag + Clear + 4 + 1 + + + CMP4C + Compare 4 Interrupt flag + Clear + 3 + 1 + + + CMP3C + Compare 3 Interrupt flag + Clear + 2 + 1 + + + CMP2C + Compare 2 Interrupt flag + Clear + 1 + 1 + + + CMP1C + Compare 1 Interrupt flag + Clear + 0 + 1 + + + + + TIMEDIER5 + TIMEDIER5 + TIMxDIER5 + 0xC + 0x20 + read-write + 0x00000000 + + + DLYPRTDE + DLYPRTDE + 30 + 1 + + + RSTDE + RSTDE + 29 + 1 + + + RSTx2DE + RSTx2DE + 28 + 1 + + + SETx2DE + SETx2DE + 27 + 1 + + + RSTx1DE + RSTx1DE + 26 + 1 + + + SET1xDE + SET1xDE + 25 + 1 + + + CPT2DE + CPT2DE + 24 + 1 + + + CPT1DE + CPT1DE + 23 + 1 + + + UPDDE + UPDDE + 22 + 1 + + + REPDE + REPDE + 20 + 1 + + + CMP4DE + CMP4DE + 19 + 1 + + + CMP3DE + CMP3DE + 18 + 1 + + + CMP2DE + CMP2DE + 17 + 1 + + + CMP1DE + CMP1DE + 16 + 1 + + + DLYPRTIE + DLYPRTIE + 14 + 1 + + + RSTIE + RSTIE + 13 + 1 + + + RSTx2IE + RSTx2IE + 12 + 1 + + + SETx2IE + SETx2IE + 11 + 1 + + + RSTx1IE + RSTx1IE + 10 + 1 + + + SET1xIE + SET1xIE + 9 + 1 + + + CPT2IE + CPT2IE + 8 + 1 + + + CPT1IE + CPT1IE + 7 + 1 + + + UPDIE + UPDIE + 6 + 1 + + + REPIE + REPIE + 4 + 1 + + + CMP4IE + CMP4IE + 3 + 1 + + + CMP3IE + CMP3IE + 2 + 1 + + + CMP2IE + CMP2IE + 1 + 1 + + + CMP1IE + CMP1IE + 0 + 1 + + + + + CNTER + CNTER + Timerx Counter Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CNTx + Timerx Counter value + 0 + 16 + + + + + PERER + PERER + Timerx Period Register + 0x14 + 0x20 + read-write + 0x0000FFFF + + + PERx + Timerx Period value + 0 + 16 + + + + + REPER + REPER + Timerx Repetition Register + 0x18 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition counter + value + 0 + 8 + + + + + CMP1ER + CMP1ER + Timerx Compare 1 Register + 0x1C + 0x20 + read-write + 0x00000000 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP1CER + CMP1CER + Timerx Compare 1 Compound + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + REPx + Timerx Repetition value (aliased from + HRTIM_REPx register) + 16 + 8 + + + CMP1x + Timerx Compare 1 value + 0 + 16 + + + + + CMP2ER + CMP2ER + Timerx Compare 2 Register + 0x24 + 0x20 + read-write + 0x00000000 + + + CMP2x + Timerx Compare 2 value + 0 + 16 + + + + + CMP3ER + CMP3ER + Timerx Compare 3 Register + 0x28 + 0x20 + read-write + 0x00000000 + + + CMP3x + Timerx Compare 3 value + 0 + 16 + + + + + CMP4ER + CMP4ER + Timerx Compare 4 Register + 0x2C + 0x20 + read-write + 0x00000000 + + + CMP4x + Timerx Compare 4 value + 0 + 16 + + + + + CPT1ER + CPT1ER + Timerx Capture 1 Register + 0x30 + 0x20 + read-only + 0x00000000 + + + CPT1x + Timerx Capture 1 value + 0 + 16 + + + + + CPT2ER + CPT2ER + Timerx Capture 2 Register + 0x34 + 0x20 + read-only + 0x00000000 + + + CPT2x + Timerx Capture 2 value + 0 + 16 + + + + + DTER + DTER + Timerx Deadtime Register + 0x38 + 0x20 + read-write + 0x00000000 + + + DTFLKx + Deadtime Falling Lock + 31 + 1 + + + DTFSLKx + Deadtime Falling Sign Lock + 30 + 1 + + + SDTFx + Sign Deadtime Falling + value + 25 + 1 + + + DTFx + Deadtime Falling value + 16 + 9 + + + DTRLKx + Deadtime Rising Lock + 15 + 1 + + + DTRSLKx + Deadtime Rising Sign Lock + 14 + 1 + + + DTPRSC + Deadtime Prescaler + 10 + 3 + + + SDTRx + Sign Deadtime Rising value + 9 + 1 + + + DTRx + Deadtime Rising value + 0 + 9 + + + + + SETE1R + SETE1R + Timerx Output1 Set Register + 0x3C + 0x20 + read-write + 0x00000000 + + + UPDATE + Registers update (transfer preload to + active) + 31 + 1 + + + EXTEVNT10 + External Event 10 + 30 + 1 + + + EXTEVNT9 + External Event 9 + 29 + 1 + + + EXTEVNT8 + External Event 8 + 28 + 1 + + + EXTEVNT7 + External Event 7 + 27 + 1 + + + EXTEVNT6 + External Event 6 + 26 + 1 + + + EXTEVNT5 + External Event 5 + 25 + 1 + + + EXTEVNT4 + External Event 4 + 24 + 1 + + + EXTEVNT3 + External Event 3 + 23 + 1 + + + EXTEVNT2 + External Event 2 + 22 + 1 + + + EXTEVNT1 + External Event 1 + 21 + 1 + + + TIMEVNT9 + Timer Event 9 + 20 + 1 + + + TIMEVNT8 + Timer Event 8 + 19 + 1 + + + TIMEVNT7 + Timer Event 7 + 18 + 1 + + + TIMEVNT6 + Timer Event 6 + 17 + 1 + + + TIMEVNT5 + Timer Event 5 + 16 + 1 + + + TIMEVNT4 + Timer Event 4 + 15 + 1 + + + TIMEVNT3 + Timer Event 3 + 14 + 1 + + + TIMEVNT2 + Timer Event 2 + 13 + 1 + + + TIMEVNT1 + Timer Event 1 + 12 + 1 + + + MSTCMP4 + Master Compare 4 + 11 + 1 + + + MSTCMP3 + Master Compare 3 + 10 + 1 + + + MSTCMP2 + Master Compare 2 + 9 + 1 + + + MSTCMP1 + Master Compare 1 + 8 + 1 + + + MSTPER + Master Period + 7 + 1 + + + CMP4 + Timer A compare 4 + 6 + 1 + + + CMP3 + Timer A compare 3 + 5 + 1 + + + CMP2 + Timer A compare 2 + 4 + 1 + + + CMP1 + Timer A compare 1 + 3 + 1 + + + PER + Timer A Period + 2 + 1 + + + RESYNC + Timer A resynchronizaton + 1 + 1 + + + SST + Software Set trigger + 0 + 1 + + + + + RSTE1R + RSTE1R + Timerx Output1 Reset Register + 0x40 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + SETE2R + SETE2R + Timerx Output2 Set Register + 0x44 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SST + SST + 0 + 1 + + + + + RSTE2R + RSTE2R + Timerx Output2 Reset Register + 0x48 + 0x20 + read-write + 0x00000000 + + + UPDATE + UPDATE + 31 + 1 + + + EXTEVNT10 + EXTEVNT10 + 30 + 1 + + + EXTEVNT9 + EXTEVNT9 + 29 + 1 + + + EXTEVNT8 + EXTEVNT8 + 28 + 1 + + + EXTEVNT7 + EXTEVNT7 + 27 + 1 + + + EXTEVNT6 + EXTEVNT6 + 26 + 1 + + + EXTEVNT5 + EXTEVNT5 + 25 + 1 + + + EXTEVNT4 + EXTEVNT4 + 24 + 1 + + + EXTEVNT3 + EXTEVNT3 + 23 + 1 + + + EXTEVNT2 + EXTEVNT2 + 22 + 1 + + + EXTEVNT1 + EXTEVNT1 + 21 + 1 + + + TIMEVNT9 + TIMEVNT9 + 20 + 1 + + + TIMEVNT8 + TIMEVNT8 + 19 + 1 + + + TIMEVNT7 + TIMEVNT7 + 18 + 1 + + + TIMEVNT6 + TIMEVNT6 + 17 + 1 + + + TIMEVNT5 + TIMEVNT5 + 16 + 1 + + + TIMEVNT4 + TIMEVNT4 + 15 + 1 + + + TIMEVNT3 + TIMEVNT3 + 14 + 1 + + + TIMEVNT2 + TIMEVNT2 + 13 + 1 + + + TIMEVNT1 + TIMEVNT1 + 12 + 1 + + + MSTCMP4 + MSTCMP4 + 11 + 1 + + + MSTCMP3 + MSTCMP3 + 10 + 1 + + + MSTCMP2 + MSTCMP2 + 9 + 1 + + + MSTCMP1 + MSTCMP1 + 8 + 1 + + + MSTPER + MSTPER + 7 + 1 + + + CMP4 + CMP4 + 6 + 1 + + + CMP3 + CMP3 + 5 + 1 + + + CMP2 + CMP2 + 4 + 1 + + + CMP1 + CMP1 + 3 + 1 + + + PER + PER + 2 + 1 + + + RESYNC + RESYNC + 1 + 1 + + + SRT + SRT + 0 + 1 + + + + + EEFER1 + EEFER1 + Timerx External Event Filtering Register + 1 + 0x4C + 0x20 + read-write + 0x00000000 + + + EE5FLTR + External Event 5 filter + 25 + 4 + + + EE5LTCH + External Event 5 latch + 24 + 1 + + + EE4FLTR + External Event 4 filter + 19 + 4 + + + EE4LTCH + External Event 4 latch + 18 + 1 + + + EE3FLTR + External Event 3 filter + 13 + 4 + + + EE3LTCH + External Event 3 latch + 12 + 1 + + + EE2FLTR + External Event 2 filter + 7 + 4 + + + EE2LTCH + External Event 2 latch + 6 + 1 + + + EE1FLTR + External Event 1 filter + 1 + 4 + + + EE1LTCH + External Event 1 latch + 0 + 1 + + + + + EEFER2 + EEFER2 + Timerx External Event Filtering Register + 2 + 0x50 + 0x20 + read-write + 0x00000000 + + + EE10FLTR + External Event 10 filter + 25 + 4 + + + EE10LTCH + External Event 10 latch + 24 + 1 + + + EE9FLTR + External Event 9 filter + 19 + 4 + + + EE9LTCH + External Event 9 latch + 18 + 1 + + + EE8FLTR + External Event 8 filter + 13 + 4 + + + EE8LTCH + External Event 8 latch + 12 + 1 + + + EE7FLTR + External Event 7 filter + 7 + 4 + + + EE7LTCH + External Event 7 latch + 6 + 1 + + + EE6FLTR + External Event 6 filter + 1 + 4 + + + EE6LTCH + External Event 6 latch + 0 + 1 + + + + + RSTER + RSTER + TimerA Reset Register + 0x54 + 0x20 + read-write + 0x00000000 + + + TIMDCMP4 + Timer D Compare 4 + 30 + 1 + + + TIMDCMP2 + Timer D Compare 2 + 29 + 1 + + + TIMDCMP1 + Timer D Compare 1 + 28 + 1 + + + TIMCCMP4 + Timer C Compare 4 + 27 + 1 + + + TIMCCMP2 + Timer C Compare 2 + 26 + 1 + + + TIMCCMP1 + Timer C Compare 1 + 25 + 1 + + + TIMBCMP4 + Timer B Compare 4 + 24 + 1 + + + TIMBCMP2 + Timer B Compare 2 + 23 + 1 + + + TIMBCMP1 + Timer B Compare 1 + 22 + 1 + + + TIMACMP4 + Timer A Compare 4 + 21 + 1 + + + TIMACMP2 + Timer A Compare 2 + 20 + 1 + + + TIMACMP1 + Timer A Compare 1 + 19 + 1 + + + EXTEVNT10 + External Event 10 + 18 + 1 + + + EXTEVNT9 + External Event 9 + 17 + 1 + + + EXTEVNT8 + External Event 8 + 16 + 1 + + + EXTEVNT7 + External Event 7 + 15 + 1 + + + EXTEVNT6 + External Event 6 + 14 + 1 + + + EXTEVNT5 + External Event 5 + 13 + 1 + + + EXTEVNT4 + External Event 4 + 12 + 1 + + + EXTEVNT3 + External Event 3 + 11 + 1 + + + EXTEVNT2 + External Event 2 + 10 + 1 + + + EXTEVNT1 + External Event 1 + 9 + 1 + + + MSTCMP4 + Master compare 4 + 8 + 1 + + + MSTCMP3 + Master compare 3 + 7 + 1 + + + MSTCMP2 + Master compare 2 + 6 + 1 + + + MSTCMP1 + Master compare 1 + 5 + 1 + + + MSTPER + Master timer Period + 4 + 1 + + + CMP4 + Timer A compare 4 reset + 3 + 1 + + + CMP2 + Timer A compare 2 reset + 2 + 1 + + + UPDT + Timer A Update reset + 1 + 1 + + + + + CHPER + CHPER + Timerx Chopper Register + 0x58 + 0x20 + read-write + 0x00000000 + + + STRTPW + STRTPW + 7 + 4 + + + CHPDTY + Timerx chopper duty cycle + value + 4 + 3 + + + CHPFRQ + Timerx carrier frequency + value + 0 + 4 + + + + + CPT1ECR + CPT1ECR + Timerx Capture 2 Control + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + CPT2ECR + CPT2ECR + CPT2xCR + 0x60 + 0x20 + read-write + 0x00000000 + + + TDCMP2 + Timer D Compare 2 + 27 + 1 + + + TDCMP1 + Timer D Compare 1 + 26 + 1 + + + TD1RST + Timer D output 1 Reset + 25 + 1 + + + TD1SET + Timer D output 1 Set + 24 + 1 + + + TCCMP2 + Timer C Compare 2 + 23 + 1 + + + TCCMP1 + Timer C Compare 1 + 22 + 1 + + + TC1RST + Timer C output 1 Reset + 21 + 1 + + + TC1SET + Timer C output 1 Set + 20 + 1 + + + TBCMP2 + Timer B Compare 2 + 19 + 1 + + + TBCMP1 + Timer B Compare 1 + 18 + 1 + + + TB1RST + Timer B output 1 Reset + 17 + 1 + + + TB1SET + Timer B output 1 Set + 16 + 1 + + + TACMP2 + Timer A Compare 2 + 15 + 1 + + + TACMP1 + Timer A Compare 1 + 14 + 1 + + + TA1RST + Timer A output 1 Reset + 13 + 1 + + + TA1SET + Timer A output 1 Set + 12 + 1 + + + EXEV10CPT + External Event 10 Capture + 11 + 1 + + + EXEV9CPT + External Event 9 Capture + 10 + 1 + + + EXEV8CPT + External Event 8 Capture + 9 + 1 + + + EXEV7CPT + External Event 7 Capture + 8 + 1 + + + EXEV6CPT + External Event 6 Capture + 7 + 1 + + + EXEV5CPT + External Event 5 Capture + 6 + 1 + + + EXEV4CPT + External Event 4 Capture + 5 + 1 + + + EXEV3CPT + External Event 3 Capture + 4 + 1 + + + EXEV2CPT + External Event 2 Capture + 3 + 1 + + + EXEV1CPT + External Event 1 Capture + 2 + 1 + + + UDPCPT + Update Capture + 1 + 1 + + + SWCPT + Software Capture + 0 + 1 + + + + + OUTER + OUTER + Timerx Output Register + 0x64 + 0x20 + read-write + 0x00000000 + + + DIDL2 + Output 2 Deadtime upon burst mode Idle + entry + 23 + 1 + + + CHP2 + Output 2 Chopper enable + 22 + 1 + + + FAULT2 + Output 2 Fault state + 20 + 2 + + + IDLES2 + Output 2 Idle State + 19 + 1 + + + IDLEM2 + Output 2 Idle mode + 18 + 1 + + + POL2 + Output 2 polarity + 17 + 1 + + + DLYPRT + Delayed Protection + 10 + 3 + + + DLYPRTEN + Delayed Protection Enable + 9 + 1 + + + DTEN + Deadtime enable + 8 + 1 + + + DIDL1 + Output 1 Deadtime upon burst mode Idle + entry + 7 + 1 + + + CHP1 + Output 1 Chopper enable + 6 + 1 + + + FAULT1 + Output 1 Fault state + 4 + 2 + + + IDLES1 + Output 1 Idle State + 3 + 1 + + + IDLEM1 + Output 1 Idle mode + 2 + 1 + + + POL1 + Output 1 polarity + 1 + 1 + + + + + FLTER + FLTER + Timerx Fault Register + 0x68 + 0x20 + read-write + 0x00000000 + + + FLTLCK + Fault sources Lock + 31 + 1 + + + FLT5EN + Fault 5 enable + 4 + 1 + + + FLT4EN + Fault 4 enable + 3 + 1 + + + FLT3EN + Fault 3 enable + 2 + 1 + + + FLT2EN + Fault 2 enable + 1 + 1 + + + FLT1EN + Fault 1 enable + 0 + 1 + + + + + + + HRTIM_Common + High Resolution Timer: Common + functions + HRTIM + 0x40017780 + + 0x0 + 0x80 + registers + + + HRTIM_TIME + HRTIM1 timer E interrupt + 108 + + + + CR1 + CR1 + Control Register 1 + 0x0 + 0x20 + read-write + 0x00000000 + + + AD4USRC + ADC Trigger 4 Update + Source + 25 + 3 + + + AD3USRC + ADC Trigger 3 Update + Source + 22 + 3 + + + AD2USRC + ADC Trigger 2 Update + Source + 19 + 3 + + + AD1USRC + ADC Trigger 1 Update + Source + 16 + 3 + + + TEUDIS + Timer E Update Disable + 5 + 1 + + + TDUDIS + Timer D Update Disable + 4 + 1 + + + TCUDIS + Timer C Update Disable + 3 + 1 + + + TBUDIS + Timer B Update Disable + 2 + 1 + + + TAUDIS + Timer A Update Disable + 1 + 1 + + + MUDIS + Master Update Disable + 0 + 1 + + + + + CR2 + CR2 + Control Register 2 + 0x4 + 0x20 + read-write + 0x00000000 + + + TERST + Timer E counter software + reset + 13 + 1 + + + TDRST + Timer D counter software + reset + 12 + 1 + + + TCRST + Timer C counter software + reset + 11 + 1 + + + TBRST + Timer B counter software + reset + 10 + 1 + + + TARST + Timer A counter software + reset + 9 + 1 + + + MRST + Master Counter software + reset + 8 + 1 + + + TESWU + Timer E Software Update + 5 + 1 + + + TDSWU + Timer D Software Update + 4 + 1 + + + TCSWU + Timer C Software Update + 3 + 1 + + + TBSWU + Timer B Software Update + 2 + 1 + + + TASWU + Timer A Software update + 1 + 1 + + + MSWU + Master Timer Software + update + 0 + 1 + + + + + ISR + ISR + Interrupt Status Register + 0x8 + 0x20 + 0x00000000 + + + BMPER + Burst mode Period Interrupt + Flag + 17 + 1 + read-only + + + DLLRDY + DLL Ready Interrupt Flag + 16 + 1 + read-only + + + SYSFLT + System Fault Interrupt + Flag + 5 + 1 + read-write + + + FLT5 + Fault 5 Interrupt Flag + 4 + 1 + read-only + + + FLT4 + Fault 4 Interrupt Flag + 3 + 1 + read-only + + + FLT3 + Fault 3 Interrupt Flag + 2 + 1 + read-only + + + FLT2 + Fault 2 Interrupt Flag + 1 + 1 + read-only + + + FLT1 + Fault 1 Interrupt Flag + 0 + 1 + read-only + + + + + ICR + ICR + Interrupt Clear Register + 0xC + 0x20 + 0x00000000 + + + BMPERC + Burst mode period flag + Clear + 17 + 1 + write-only + + + DLLRDYC + DLL Ready Interrupt flag + Clear + 16 + 1 + write-only + + + SYSFLTC + System Fault Interrupt Flag + Clear + 5 + 1 + read-write + + + FLT5C + Fault 5 Interrupt Flag + Clear + 4 + 1 + write-only + + + FLT4C + Fault 4 Interrupt Flag + Clear + 3 + 1 + write-only + + + FLT3C + Fault 3 Interrupt Flag + Clear + 2 + 1 + write-only + + + FLT2C + Fault 2 Interrupt Flag + Clear + 1 + 1 + write-only + + + FLT1C + Fault 1 Interrupt Flag + Clear + 0 + 1 + write-only + + + + + IER + IER + Interrupt Enable Register + 0x10 + 0x20 + read-write + 0x00000000 + + + BMPERIE + Burst mode period Interrupt + Enable + 17 + 1 + + + DLLRDYIE + DLL Ready Interrupt Enable + 16 + 1 + + + SYSFLTE + System Fault Interrupt + Enable + 5 + 1 + + + FLT5IE + Fault 5 Interrupt Enable + 4 + 1 + + + FLT4IE + Fault 4 Interrupt Enable + 3 + 1 + + + FLT3IE + Fault 3 Interrupt Enable + 2 + 1 + + + FLT2IE + Fault 2 Interrupt Enable + 1 + 1 + + + FLT1IE + Fault 1 Interrupt Enable + 0 + 1 + + + + + OENR + OENR + Output Enable Register + 0x14 + 0x20 + write-only + 0x00000000 + + + TE2OEN + Timer E Output 2 Enable + 9 + 1 + + + TE1OEN + Timer E Output 1 Enable + 8 + 1 + + + TD2OEN + Timer D Output 2 Enable + 7 + 1 + + + TD1OEN + Timer D Output 1 Enable + 6 + 1 + + + TC2OEN + Timer C Output 2 Enable + 5 + 1 + + + TC1OEN + Timer C Output 1 Enable + 4 + 1 + + + TB2OEN + Timer B Output 2 Enable + 3 + 1 + + + TB1OEN + Timer B Output 1 Enable + 2 + 1 + + + TA2OEN + Timer A Output 2 Enable + 1 + 1 + + + TA1OEN + Timer A Output 1 Enable + 0 + 1 + + + + + DISR + DISR + DISR + 0x18 + 0x20 + read-write + 0x00000000 + + + TE2ODIS + TE2ODIS + 9 + 1 + + + TE1ODIS + TE1ODIS + 8 + 1 + + + TD2ODIS + TD2ODIS + 7 + 1 + + + TD1ODIS + TD1ODIS + 6 + 1 + + + TC2ODIS + TC2ODIS + 5 + 1 + + + TC1ODIS + TC1ODIS + 4 + 1 + + + TB2ODIS + TB2ODIS + 3 + 1 + + + TB1ODIS + TB1ODIS + 2 + 1 + + + TA2ODIS + TA2ODIS + 1 + 1 + + + TA1ODIS + TA1ODIS + 0 + 1 + + + + + ODSR + ODSR + Output Disable Status Register + 0x1C + 0x20 + read-only + 0x00000000 + + + TE2ODS + Timer E Output 2 disable + status + 9 + 1 + + + TE1ODS + Timer E Output 1 disable + status + 8 + 1 + + + TD2ODS + Timer D Output 2 disable + status + 7 + 1 + + + TD1ODS + Timer D Output 1 disable + status + 6 + 1 + + + TC2ODS + Timer C Output 2 disable + status + 5 + 1 + + + TC1ODS + Timer C Output 1 disable + status + 4 + 1 + + + TB2ODS + Timer B Output 2 disable + status + 3 + 1 + + + TB1ODS + Timer B Output 1 disable + status + 2 + 1 + + + TA2ODS + Timer A Output 2 disable + status + 1 + 1 + + + TA1ODS + Timer A Output 1 disable + status + 0 + 1 + + + + + BMCR + BMCR + Burst Mode Control Register + 0x20 + 0x20 + read-write + 0x00000000 + + + BMSTAT + Burst Mode Status + 31 + 1 + + + TEBM + Timer E Burst Mode + 21 + 1 + + + TDBM + Timer D Burst Mode + 20 + 1 + + + TCBM + Timer C Burst Mode + 19 + 1 + + + TBBM + Timer B Burst Mode + 18 + 1 + + + TABM + Timer A Burst Mode + 17 + 1 + + + MTBM + Master Timer Burst Mode + 16 + 1 + + + BMPREN + Burst Mode Preload Enable + 10 + 1 + + + BMPRSC + Burst Mode Prescaler + 6 + 4 + + + BMCLK + Burst Mode Clock source + 2 + 4 + + + BMOM + Burst Mode operating mode + 1 + 1 + + + BME + Burst Mode enable + 0 + 1 + + + + + BMTRG + BMTRG + BMTRG + 0x24 + 0x20 + read-write + 0x00000000 + + + OCHPEV + OCHPEV + 31 + 1 + + + TECMP2 + TECMP2 + 26 + 1 + + + TECMP1 + TECMP1 + 25 + 1 + + + TEREP + TEREP + 24 + 1 + + + TERST + TERST + 23 + 1 + + + TDCMP2 + TDCMP2 + 22 + 1 + + + TDCMP1 + TDCMP1 + 21 + 1 + + + TDREP + TDREP + 20 + 1 + + + TDRST + TDRST + 19 + 1 + + + TCCMP2 + TCCMP2 + 18 + 1 + + + TCCMP1 + TCCMP1 + 17 + 1 + + + TCREP + TCREP + 16 + 1 + + + TCRST + TCRST + 15 + 1 + + + TBCMP2 + TBCMP2 + 14 + 1 + + + TBCMP1 + TBCMP1 + 13 + 1 + + + TBREP + TBREP + 12 + 1 + + + TBRST + TBRST + 11 + 1 + + + TACMP2 + TACMP2 + 10 + 1 + + + TACMP1 + TACMP1 + 9 + 1 + + + TAREP + TAREP + 8 + 1 + + + TARST + TARST + 7 + 1 + + + MSTCMP4 + MSTCMP4 + 6 + 1 + + + MSTCMP3 + MSTCMP3 + 5 + 1 + + + MSTCMP2 + MSTCMP2 + 4 + 1 + + + MSTCMP1 + MSTCMP1 + 3 + 1 + + + MSTREP + MSTREP + 2 + 1 + + + MSTRST + MSTRST + 1 + 1 + + + SW + SW + 0 + 1 + + + + + BMCMPR6 + BMCMPR6 + BMCMPR6 + 0x28 + 0x20 + read-write + 0x00000000 + + + BMCMP + BMCMP + 0 + 16 + + + + + BMPER + BMPER + Burst Mode Period Register + 0x2C + 0x20 + read-write + 0x00000000 + + + BMPER + Burst mode Period + 0 + 16 + + + + + EECR1 + EECR1 + Timer External Event Control Register + 1 + 0x30 + 0x20 + read-write + 0x00000000 + + + EE5FAST + External Event 5 Fast mode + 29 + 1 + + + EE5SNS + External Event 5 + Sensitivity + 27 + 2 + + + EE5POL + External Event 5 Polarity + 26 + 1 + + + EE5SRC + External Event 5 Source + 24 + 2 + + + EE4FAST + External Event 4 Fast mode + 23 + 1 + + + EE4SNS + External Event 4 + Sensitivity + 21 + 2 + + + EE4POL + External Event 4 Polarity + 20 + 1 + + + EE4SRC + External Event 4 Source + 18 + 2 + + + EE3FAST + External Event 3 Fast mode + 17 + 1 + + + EE3SNS + External Event 3 + Sensitivity + 15 + 2 + + + EE3POL + External Event 3 Polarity + 14 + 1 + + + EE3SRC + External Event 3 Source + 12 + 2 + + + EE2FAST + External Event 2 Fast mode + 11 + 1 + + + EE2SNS + External Event 2 + Sensitivity + 9 + 2 + + + EE2POL + External Event 2 Polarity + 8 + 1 + + + EE2SRC + External Event 2 Source + 6 + 2 + + + EE1FAST + External Event 1 Fast mode + 5 + 1 + + + EE1SNS + External Event 1 + Sensitivity + 3 + 2 + + + EE1POL + External Event 1 Polarity + 2 + 1 + + + EE1SRC + External Event 1 Source + 0 + 2 + + + + + EECR2 + EECR2 + Timer External Event Control Register + 2 + 0x34 + 0x20 + read-write + 0x00000000 + + + EE10SNS + External Event 10 + Sensitivity + 27 + 2 + + + EE10POL + External Event 10 Polarity + 26 + 1 + + + EE10SRC + External Event 10 Source + 24 + 2 + + + EE9SNS + External Event 9 + Sensitivity + 21 + 2 + + + EE9POL + External Event 9 Polarity + 20 + 1 + + + EE9SRC + External Event 9 Source + 18 + 2 + + + EE8SNS + External Event 8 + Sensitivity + 15 + 2 + + + EE8POL + External Event 8 Polarity + 14 + 1 + + + EE8SRC + External Event 8 Source + 12 + 2 + + + EE7SNS + External Event 7 + Sensitivity + 9 + 2 + + + EE7POL + External Event 7 Polarity + 8 + 1 + + + EE7SRC + External Event 7 Source + 6 + 2 + + + EE6SNS + External Event 6 + Sensitivity + 3 + 2 + + + EE6POL + External Event 6 Polarity + 2 + 1 + + + EE6SRC + External Event 6 Source + 0 + 2 + + + + + EECR3 + EECR3 + Timer External Event Control Register + 3 + 0x38 + 0x20 + read-write + 0x00000000 + + + EE10SNS + EE10SNS + 27 + 2 + + + EE10POL + EE10POL + 26 + 1 + + + EE10SRC + EE10SRC + 24 + 2 + + + EE9SNS + EE9SNS + 21 + 2 + + + EE9POL + EE9POL + 20 + 1 + + + EE9SRC + EE9SRC + 18 + 2 + + + EE8SNS + EE8SNS + 15 + 2 + + + EE8POL + EE8POL + 14 + 1 + + + EE8SRC + EE8SRC + 12 + 2 + + + EE7SNS + EE7SNS + 9 + 2 + + + EE7POL + EE7POL + 8 + 1 + + + EE7SRC + EE7SRC + 6 + 2 + + + EE6SNS + EE6SNS + 3 + 2 + + + EE6POL + EE6POL + 2 + 1 + + + EE6SRC + EE6SRC + 0 + 2 + + + + + ADC1R + ADC1R + ADC Trigger 1 Register + 0x3C + 0x20 + read-write + 0x00000000 + + + AD1TEPER + ADC trigger 1 on Timer E + Period + 31 + 1 + + + AD1TEC4 + ADC trigger 1 on Timer E compare + 4 + 30 + 1 + + + AD1TEC3 + ADC trigger 1 on Timer E compare + 3 + 29 + 1 + + + AD1TEC2 + ADC trigger 1 on Timer E compare + 2 + 28 + 1 + + + AD1TDPER + ADC trigger 1 on Timer D + Period + 27 + 1 + + + AD1TDC4 + ADC trigger 1 on Timer D compare + 4 + 26 + 1 + + + AD1TDC3 + ADC trigger 1 on Timer D compare + 3 + 25 + 1 + + + AD1TDC2 + ADC trigger 1 on Timer D compare + 2 + 24 + 1 + + + AD1TCPER + ADC trigger 1 on Timer C + Period + 23 + 1 + + + AD1TCC4 + ADC trigger 1 on Timer C compare + 4 + 22 + 1 + + + AD1TCC3 + ADC trigger 1 on Timer C compare + 3 + 21 + 1 + + + AD1TCC2 + ADC trigger 1 on Timer C compare + 2 + 20 + 1 + + + AD1TBRST + ADC trigger 1 on Timer B + Reset + 19 + 1 + + + AD1TBPER + ADC trigger 1 on Timer B + Period + 18 + 1 + + + AD1TBC4 + ADC trigger 1 on Timer B compare + 4 + 17 + 1 + + + AD1TBC3 + ADC trigger 1 on Timer B compare + 3 + 16 + 1 + + + AD1TBC2 + ADC trigger 1 on Timer B compare + 2 + 15 + 1 + + + AD1TARST + ADC trigger 1 on Timer A + Reset + 14 + 1 + + + AD1TAPER + ADC trigger 1 on Timer A + Period + 13 + 1 + + + AD1TAC4 + ADC trigger 1 on Timer A compare + 4 + 12 + 1 + + + AD1TAC3 + ADC trigger 1 on Timer A compare + 3 + 11 + 1 + + + AD1TAC2 + ADC trigger 1 on Timer A compare + 2 + 10 + 1 + + + AD1EEV5 + ADC trigger 1 on External Event + 5 + 9 + 1 + + + AD1EEV4 + ADC trigger 1 on External Event + 4 + 8 + 1 + + + AD1EEV3 + ADC trigger 1 on External Event + 3 + 7 + 1 + + + AD1EEV2 + ADC trigger 1 on External Event + 2 + 6 + 1 + + + AD1EEV1 + ADC trigger 1 on External Event + 1 + 5 + 1 + + + AD1MPER + ADC trigger 1 on Master + Period + 4 + 1 + + + AD1MC4 + ADC trigger 1 on Master Compare + 4 + 3 + 1 + + + AD1MC3 + ADC trigger 1 on Master Compare + 3 + 2 + 1 + + + AD1MC2 + ADC trigger 1 on Master Compare + 2 + 1 + 1 + + + AD1MC1 + ADC trigger 1 on Master Compare + 1 + 0 + 1 + + + + + ADC2R + ADC2R + ADC Trigger 2 Register + 0x40 + 0x20 + read-write + 0x00000000 + + + AD2TERST + ADC trigger 2 on Timer E + Reset + 31 + 1 + + + AD2TEC4 + ADC trigger 2 on Timer E compare + 4 + 30 + 1 + + + AD2TEC3 + ADC trigger 2 on Timer E compare + 3 + 29 + 1 + + + AD2TEC2 + ADC trigger 2 on Timer E compare + 2 + 28 + 1 + + + AD2TDRST + ADC trigger 2 on Timer D + Reset + 27 + 1 + + + AD2TDPER + ADC trigger 2 on Timer D + Period + 26 + 1 + + + AD2TDC4 + ADC trigger 2 on Timer D compare + 4 + 25 + 1 + + + AD2TDC3 + ADC trigger 2 on Timer D compare + 3 + 24 + 1 + + + AD2TDC2 + ADC trigger 2 on Timer D compare + 2 + 23 + 1 + + + AD2TCRST + ADC trigger 2 on Timer C + Reset + 22 + 1 + + + AD2TCPER + ADC trigger 2 on Timer C + Period + 21 + 1 + + + AD2TCC4 + ADC trigger 2 on Timer C compare + 4 + 20 + 1 + + + AD2TCC3 + ADC trigger 2 on Timer C compare + 3 + 19 + 1 + + + AD2TCC2 + ADC trigger 2 on Timer C compare + 2 + 18 + 1 + + + AD2TBPER + ADC trigger 2 on Timer B + Period + 17 + 1 + + + AD2TBC4 + ADC trigger 2 on Timer B compare + 4 + 16 + 1 + + + AD2TBC3 + ADC trigger 2 on Timer B compare + 3 + 15 + 1 + + + AD2TBC2 + ADC trigger 2 on Timer B compare + 2 + 14 + 1 + + + AD2TAPER + ADC trigger 2 on Timer A + Period + 13 + 1 + + + AD2TAC4 + ADC trigger 2 on Timer A compare + 4 + 12 + 1 + + + AD2TAC3 + ADC trigger 2 on Timer A compare + 3 + 11 + 1 + + + AD2TAC2 + ADC trigger 2 on Timer A compare + 2 + 10 + 1 + + + AD2EEV10 + ADC trigger 2 on External Event + 10 + 9 + 1 + + + AD2EEV9 + ADC trigger 2 on External Event + 9 + 8 + 1 + + + AD2EEV8 + ADC trigger 2 on External Event + 8 + 7 + 1 + + + AD2EEV7 + ADC trigger 2 on External Event + 7 + 6 + 1 + + + AD2EEV6 + ADC trigger 2 on External Event + 6 + 5 + 1 + + + AD2MPER + ADC trigger 2 on Master + Period + 4 + 1 + + + AD2MC4 + ADC trigger 2 on Master Compare + 4 + 3 + 1 + + + AD2MC3 + ADC trigger 2 on Master Compare + 3 + 2 + 1 + + + AD2MC2 + ADC trigger 2 on Master Compare + 2 + 1 + 1 + + + AD2MC1 + ADC trigger 2 on Master Compare + 1 + 0 + 1 + + + + + ADC3R + ADC3R + ADC Trigger 3 Register + 0x44 + 0x20 + read-write + 0x00000000 + + + AD1TEPER + AD1TEPER + 31 + 1 + + + AD1TEC4 + AD1TEC4 + 30 + 1 + + + AD1TEC3 + AD1TEC3 + 29 + 1 + + + AD1TEC2 + AD1TEC2 + 28 + 1 + + + AD1TDPER + AD1TDPER + 27 + 1 + + + AD1TDC4 + AD1TDC4 + 26 + 1 + + + AD1TDC3 + AD1TDC3 + 25 + 1 + + + AD1TDC2 + AD1TDC2 + 24 + 1 + + + AD1TCPER + AD1TCPER + 23 + 1 + + + AD1TCC4 + AD1TCC4 + 22 + 1 + + + AD1TCC3 + AD1TCC3 + 21 + 1 + + + AD1TCC2 + AD1TCC2 + 20 + 1 + + + AD1TBRST + AD1TBRST + 19 + 1 + + + AD1TBPER + AD1TBPER + 18 + 1 + + + AD1TBC4 + AD1TBC4 + 17 + 1 + + + AD1TBC3 + AD1TBC3 + 16 + 1 + + + AD1TBC2 + AD1TBC2 + 15 + 1 + + + AD1TARST + AD1TARST + 14 + 1 + + + AD1TAPER + AD1TAPER + 13 + 1 + + + AD1TAC4 + AD1TAC4 + 12 + 1 + + + AD1TAC3 + AD1TAC3 + 11 + 1 + + + AD1TAC2 + AD1TAC2 + 10 + 1 + + + AD1EEV5 + AD1EEV5 + 9 + 1 + + + AD1EEV4 + AD1EEV4 + 8 + 1 + + + AD1EEV3 + AD1EEV3 + 7 + 1 + + + AD1EEV2 + AD1EEV2 + 6 + 1 + + + AD1EEV1 + AD1EEV1 + 5 + 1 + + + AD1MPER + AD1MPER + 4 + 1 + + + AD1MC4 + AD1MC4 + 3 + 1 + + + AD1MC3 + AD1MC3 + 2 + 1 + + + AD1MC2 + AD1MC2 + 1 + 1 + + + AD1MC1 + AD1MC1 + 0 + 1 + + + + + ADC4R + ADC4R + ADC Trigger 4 Register + 0x48 + 0x20 + read-write + 0x00000000 + + + AD2TERST + AD2TERST + 31 + 1 + + + AD2TEC4 + AD2TEC4 + 30 + 1 + + + AD2TEC3 + AD2TEC3 + 29 + 1 + + + AD2TEC2 + AD2TEC2 + 28 + 1 + + + AD2TDRST + AD2TDRST + 27 + 1 + + + AD2TDPER + AD2TDPER + 26 + 1 + + + AD2TDC4 + AD2TDC4 + 25 + 1 + + + AD2TDC3 + AD2TDC3 + 24 + 1 + + + AD2TDC2 + AD2TDC2 + 23 + 1 + + + AD2TCRST + AD2TCRST + 22 + 1 + + + AD2TCPER + AD2TCPER + 21 + 1 + + + AD2TCC4 + AD2TCC4 + 20 + 1 + + + AD2TCC3 + AD2TCC3 + 19 + 1 + + + AD2TCC2 + AD2TCC2 + 18 + 1 + + + AD2TBPER + AD2TBPER + 17 + 1 + + + AD2TBC4 + AD2TBC4 + 16 + 1 + + + AD2TBC3 + AD2TBC3 + 15 + 1 + + + AD2TBC2 + AD2TBC2 + 14 + 1 + + + AD2TAPER + AD2TAPER + 13 + 1 + + + AD2TAC4 + AD2TAC4 + 12 + 1 + + + AD2TAC3 + AD2TAC3 + 11 + 1 + + + AD2TAC2 + AD2TAC2 + 10 + 1 + + + AD2EEV10 + AD2EEV10 + 9 + 1 + + + AD2EEV9 + AD2EEV9 + 8 + 1 + + + AD2EEV8 + AD2EEV8 + 7 + 1 + + + AD2EEV7 + AD2EEV7 + 6 + 1 + + + AD2EEV6 + AD2EEV6 + 5 + 1 + + + AD2MPER + AD2MPER + 4 + 1 + + + AD2MC4 + AD2MC4 + 3 + 1 + + + AD2MC3 + AD2MC3 + 2 + 1 + + + AD2MC2 + AD2MC2 + 1 + 1 + + + AD2MC1 + AD2MC1 + 0 + 1 + + + + + DLLCR + DLLCR + DLL Control Register + 0x4C + 0x20 + read-write + 0x00000000 + + + CALRTE + DLL Calibration rate + 2 + 2 + + + CALEN + DLL Calibration Enable + 1 + 1 + + + CAL + DLL Calibration Start + 0 + 1 + + + + + FLTINR1 + FLTINR1 + HRTIM Fault Input Register 1 + 0x50 + 0x20 + read-write + 0x00000000 + + + FLT4LCK + FLT4LCK + 31 + 1 + + + FLT4F + FLT4F + 27 + 4 + + + FLT4SRC + FLT4SRC + 26 + 1 + + + FLT4P + FLT4P + 25 + 1 + + + FLT4E + FLT4E + 24 + 1 + + + FLT3LCK + FLT3LCK + 23 + 1 + + + FLT3F + FLT3F + 19 + 4 + + + FLT3SRC + FLT3SRC + 18 + 1 + + + FLT3P + FLT3P + 17 + 1 + + + FLT3E + FLT3E + 16 + 1 + + + FLT2LCK + FLT2LCK + 15 + 1 + + + FLT2F + FLT2F + 11 + 4 + + + FLT2SRC + FLT2SRC + 10 + 1 + + + FLT2P + FLT2P + 9 + 1 + + + FLT2E + FLT2E + 8 + 1 + + + FLT1LCK + FLT1LCK + 7 + 1 + + + FLT1F + FLT1F + 3 + 4 + + + FLT1SRC + FLT1SRC + 2 + 1 + + + FLT1P + FLT1P + 1 + 1 + + + FLT1E + FLT1E + 0 + 1 + + + + + FLTINR2 + FLTINR2 + HRTIM Fault Input Register 2 + 0x54 + 0x20 + read-write + 0x00000000 + + + FLTSD + FLTSD + 24 + 2 + + + FLT5LCK + FLT5LCK + 7 + 1 + + + FLT5F + FLT5F + 3 + 4 + + + FLT5SRC + FLT5SRC + 2 + 1 + + + FLT5P + FLT5P + 1 + 1 + + + FLT5E + FLT5E + 0 + 1 + + + + + BDMUPDR + BDMUPDR + BDMUPDR + 0x58 + 0x20 + read-write + 0x00000000 + + + MCMP4 + MCMP4 + 9 + 1 + + + MCMP3 + MCMP3 + 8 + 1 + + + MCMP2 + MCMP2 + 7 + 1 + + + MCMP1 + MCMP1 + 6 + 1 + + + MREP + MREP + 5 + 1 + + + MPER + MPER + 4 + 1 + + + MCNT + MCNT + 3 + 1 + + + MDIER + MDIER + 2 + 1 + + + MICR + MICR + 1 + 1 + + + MCR + MCR + 0 + 1 + + + + + BDTxUPR + BDTxUPR + Burst DMA Timerx update + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + TIMxFLTR + HRTIM_FLTxR register update + enable + 20 + 1 + + + TIMxOUTR + HRTIM_OUTxR register update + enable + 19 + 1 + + + TIMxCHPR + HRTIM_CHPxR register update + enable + 18 + 1 + + + TIMxRSTR + HRTIM_RSTxR register update + enable + 17 + 1 + + + TIMxEEFR2 + HRTIM_EEFxR2 register update + enable + 16 + 1 + + + TIMxEEFR1 + HRTIM_EEFxR1 register update + enable + 15 + 1 + + + TIMxRST2R + HRTIM_RST2xR register update + enable + 14 + 1 + + + TIMxSET2R + HRTIM_SET2xR register update + enable + 13 + 1 + + + TIMxRST1R + HRTIM_RST1xR register update + enable + 12 + 1 + + + TIMxSET1R + HRTIM_SET1xR register update + enable + 11 + 1 + + + TIMx_DTxR + HRTIM_DTxR register update + enable + 10 + 1 + + + TIMxCMP4 + HRTIM_CMP4xR register update + enable + 9 + 1 + + + TIMxCMP3 + HRTIM_CMP3xR register update + enable + 8 + 1 + + + TIMxCMP2 + HRTIM_CMP2xR register update + enable + 7 + 1 + + + TIMxCMP1 + HRTIM_CMP1xR register update + enable + 6 + 1 + + + TIMxREP + HRTIM_REPxR register update + enable + 5 + 1 + + + TIMxPER + HRTIM_PERxR register update + enable + 4 + 1 + + + TIMxCNT + HRTIM_CNTxR register update + enable + 3 + 1 + + + TIMxDIER + HRTIM_TIMxDIER register update + enable + 2 + 1 + + + TIMxICR + HRTIM_TIMxICR register update + enable + 1 + 1 + + + TIMxCR + HRTIM_TIMxCR register update + enable + 0 + 1 + + + + + BDMADR + BDMADR + Burst DMA Data Register + 0x60 + 0x20 + read-write + 0x00000000 + + + BDMADR + Burst DMA Data register + 0 + 32 + + + + + + + DFSDM + Digital filter for sigma delta + modulators + DFSDM + 0x40017000 + + 0x0 + 0x400 + registers + + + DFSDM1_FLT0 + DFSDM1 filter 0 interrupt + 110 + + + DFSDM1_FLT1 + DFSDM1 filter 1 interrupt + 111 + + + DFSDM1_FLT2 + DFSDM1 filter 2 interrupt + 112 + + + DFSDM1_FLT3 + DFSDM1 filter 3 interrupt + 113 + + + + DFSDM_CHCFG0R1 + DFSDM_CHCFG0R1 + DFSDM channel configuration 0 register + 1 + 0x0 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 0 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 0 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 0 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 0 + 6 + 1 + + + CHEN + Channel 0 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 0 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG1R1 + DFSDM_CHCFG1R1 + DFSDM channel configuration 1 register + 1 + 0x4 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 1 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 1 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 1 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 1 + 6 + 1 + + + CHEN + Channel 1 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 1 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG2R1 + DFSDM_CHCFG2R1 + DFSDM channel configuration 2 register + 1 + 0x8 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 2 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 2 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 2 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 2 + 6 + 1 + + + CHEN + Channel 2 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 2 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG3R1 + DFSDM_CHCFG3R1 + DFSDM channel configuration 3 register + 1 + 0xC + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 3 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 3 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 3 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 3 + 6 + 1 + + + CHEN + Channel 3 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 3 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG4R1 + DFSDM_CHCFG4R1 + DFSDM channel configuration 4 register + 1 + 0x10 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 4 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 4 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 4 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 4 + 6 + 1 + + + CHEN + Channel 4 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 4 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG5R1 + DFSDM_CHCFG5R1 + DFSDM channel configuration 5 register + 1 + 0x14 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 5 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 5 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 5 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 5 + 6 + 1 + + + CHEN + Channel 5 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 5 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG6R1 + DFSDM_CHCFG6R1 + DFSDM channel configuration 6 register + 1 + 0x18 + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 6 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 6 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 6 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 6 + 6 + 1 + + + CHEN + Channel 6 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 6 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG7R1 + DFSDM_CHCFG7R1 + DFSDM channel configuration 7 register + 1 + 0x1C + 0x20 + read-write + 0x00000000 + + + SITP + Serial interface type for channel + 7 + 0 + 2 + + + SPICKSEL + SPI clock select for channel + 7 + 2 + 2 + + + SCDEN + Short-circuit detector enable on channel + 7 + 5 + 1 + + + CKABEN + Clock absence detector enable on channel + 7 + 6 + 1 + + + CHEN + Channel 7 enable + 7 + 1 + + + CHINSEL + Channel inputs selection + 8 + 1 + + + DATMPX + Input data multiplexer for channel + 7 + 12 + 2 + + + DATPACK + Data packing mode in DFSDM_CHDATINyR + register + 14 + 2 + + + CKOUTDIV + Output serial clock + divider + 16 + 8 + + + CKOUTSRC + Output serial clock source + selection + 30 + 1 + + + DFSDMEN + Global enable for DFSDM + interface + 31 + 1 + + + + + DFSDM_CHCFG0R2 + DFSDM_CHCFG0R2 + DFSDM channel configuration 0 register + 2 + 0x20 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 0 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 0 + 8 + 24 + + + + + DFSDM_CHCFG1R2 + DFSDM_CHCFG1R2 + DFSDM channel configuration 1 register + 2 + 0x24 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 1 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 1 + 8 + 24 + + + + + DFSDM_CHCFG2R2 + DFSDM_CHCFG2R2 + DFSDM channel configuration 2 register + 2 + 0x28 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 2 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 2 + 8 + 24 + + + + + DFSDM_CHCFG3R2 + DFSDM_CHCFG3R2 + DFSDM channel configuration 3 register + 2 + 0x2C + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 3 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 3 + 8 + 24 + + + + + DFSDM_CHCFG4R2 + DFSDM_CHCFG4R2 + DFSDM channel configuration 4 register + 2 + 0x30 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 4 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 4 + 8 + 24 + + + + + DFSDM_CHCFG5R2 + DFSDM_CHCFG5R2 + DFSDM channel configuration 5 register + 2 + 0x34 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 5 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 5 + 8 + 24 + + + + + DFSDM_CHCFG6R2 + DFSDM_CHCFG6R2 + DFSDM channel configuration 6 register + 2 + 0x38 + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 6 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 6 + 8 + 24 + + + + + DFSDM_CHCFG7R2 + DFSDM_CHCFG7R2 + DFSDM channel configuration 7 register + 2 + 0x3C + 0x20 + read-write + 0x00000000 + + + DTRBS + Data right bit-shift for channel + 7 + 3 + 5 + + + OFFSET + 24-bit calibration offset for channel + 7 + 8 + 24 + + + + + DFSDM_AWSCD0R + DFSDM_AWSCD0R + DFSDM analog watchdog and short-circuit + detector register + 0x40 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 0 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 0 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 0 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 0 + 22 + 2 + + + + + DFSDM_AWSCD1R + DFSDM_AWSCD1R + DFSDM analog watchdog and short-circuit + detector register + 0x44 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 1 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 1 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 1 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 1 + 22 + 2 + + + + + DFSDM_AWSCD2R + DFSDM_AWSCD2R + DFSDM analog watchdog and short-circuit + detector register + 0x48 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 2 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 2 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 2 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 2 + 22 + 2 + + + + + DFSDM_AWSCD3R + DFSDM_AWSCD3R + DFSDM analog watchdog and short-circuit + detector register + 0x4C + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 3 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 3 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 3 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 3 + 22 + 2 + + + + + DFSDM_AWSCD4R + DFSDM_AWSCD4R + DFSDM analog watchdog and short-circuit + detector register + 0x50 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 4 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 4 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 4 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 4 + 22 + 2 + + + + + DFSDM_AWSCD5R + DFSDM_AWSCD5R + DFSDM analog watchdog and short-circuit + detector register + 0x54 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 5 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 5 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 5 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 5 + 22 + 2 + + + + + DFSDM_AWSCD6R + DFSDM_AWSCD6R + DFSDM analog watchdog and short-circuit + detector register + 0x58 + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 6 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 6 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 6 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 6 + 22 + 2 + + + + + DFSDM_AWSCD7R + DFSDM_AWSCD7R + DFSDM analog watchdog and short-circuit + detector register + 0x5C + 0x20 + read-write + 0x00000000 + + + SCDT + short-circuit detector threshold for + channel 7 + 0 + 8 + + + BKSCD + Break signal assignment for + short-circuit detector on channel 7 + 12 + 4 + + + AWFOSR + Analog watchdog filter oversampling + ratio (decimation rate) on channel 7 + 16 + 5 + + + AWFORD + Analog watchdog Sinc filter order on + channel 7 + 22 + 2 + + + + + DFSDM_CHWDAT0R + DFSDM_CHWDAT0R + DFSDM channel watchdog filter data + register + 0x60 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT1R + DFSDM_CHWDAT1R + DFSDM channel watchdog filter data + register + 0x64 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT2R + DFSDM_CHWDAT2R + DFSDM channel watchdog filter data + register + 0x68 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT3R + DFSDM_CHWDAT3R + DFSDM channel watchdog filter data + register + 0x6C + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT4R + DFSDM_CHWDAT4R + DFSDM channel watchdog filter data + register + 0x70 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT5R + DFSDM_CHWDAT5R + DFSDM channel watchdog filter data + register + 0x74 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT6R + DFSDM_CHWDAT6R + DFSDM channel watchdog filter data + register + 0x78 + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHWDAT7R + DFSDM_CHWDAT7R + DFSDM channel watchdog filter data + register + 0x7C + 0x20 + read-only + 0x00000000 + + + WDATA + Input channel y watchdog + data + 0 + 16 + + + + + DFSDM_CHDATIN0R + DFSDM_CHDATIN0R + DFSDM channel data input + register + 0x80 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 0 + 0 + 16 + + + INDAT1 + Input data for channel 1 + 16 + 16 + + + + + DFSDM_CHDATIN1R + DFSDM_CHDATIN1R + DFSDM channel data input + register + 0x84 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 1 + 0 + 16 + + + INDAT1 + Input data for channel 2 + 16 + 16 + + + + + DFSDM_CHDATIN2R + DFSDM_CHDATIN2R + DFSDM channel data input + register + 0x88 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 2 + 0 + 16 + + + INDAT1 + Input data for channel 3 + 16 + 16 + + + + + DFSDM_CHDATIN3R + DFSDM_CHDATIN3R + DFSDM channel data input + register + 0x8C + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 3 + 0 + 16 + + + INDAT1 + Input data for channel 4 + 16 + 16 + + + + + DFSDM_CHDATIN4R + DFSDM_CHDATIN4R + DFSDM channel data input + register + 0x90 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 4 + 0 + 16 + + + INDAT1 + Input data for channel 5 + 16 + 16 + + + + + DFSDM_CHDATIN5R + DFSDM_CHDATIN5R + DFSDM channel data input + register + 0x94 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 5 + 0 + 16 + + + INDAT1 + Input data for channel 6 + 16 + 16 + + + + + DFSDM_CHDATIN6R + DFSDM_CHDATIN6R + DFSDM channel data input + register + 0x98 + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 6 + 0 + 16 + + + INDAT1 + Input data for channel 7 + 16 + 16 + + + + + DFSDM_CHDATIN7R + DFSDM_CHDATIN7R + DFSDM channel data input + register + 0x9C + 0x20 + read-write + 0x00000000 + + + INDAT0 + Input data for channel 7 + 0 + 16 + + + INDAT1 + Input data for channel 8 + 16 + 16 + + + + + DFSDM0_CR1 + DFSDM0_CR1 + DFSDM control register 1 + 0xA0 + 0x20 + read-write + 0x00000000 + + + DFEN + DFSDM enable + 0 + 1 + + + JSWSTART + Start a conversion of the injected group + of channels + 1 + 1 + + + JSYNC + Launch an injected conversion + synchronously with the DFSDM0 JSWSTART + trigger + 3 + 1 + + + JSCAN + Scanning conversion mode for injected + conversions + 4 + 1 + + + JDMAEN + DMA channel enabled to read data for the + injected channel group + 5 + 1 + + + JEXTSEL + Trigger signal selection for launching + injected conversions + 8 + 5 + + + JEXTEN + Trigger enable and trigger edge + selection for injected conversions + 13 + 2 + + + RSWSTART + Software start of a conversion on the + regular channel + 17 + 1 + + + RCONT + Continuous mode selection for regular + conversions + 18 + 1 + + + RSYNC + Launch regular conversion synchronously + with DFSDM0 + 19 + 1 + + + RDMAEN + DMA channel enabled to read data for the + regular conversion + 21 + 1 + + + RCH + Regular channel selection + 24 + 3 + + + FAST + Fast conversion mode selection for + regular conversions + 29 + 1 + + + AWFSEL + Analog watchdog fast mode + select + 30 + 1 + + + + + DFSDM1_CR1 + DFSDM1_CR1 + DFSDM control register 1 + 0xA4 + 0x20 + read-write + 0x00000000 + + + DFEN + DFSDM enable + 0 + 1 + + + JSWSTART + Start a conversion of the injected group + of channels + 1 + 1 + + + JSYNC + Launch an injected conversion + synchronously with the DFSDM0 JSWSTART + trigger + 3 + 1 + + + JSCAN + Scanning conversion mode for injected + conversions + 4 + 1 + + + JDMAEN + DMA channel enabled to read data for the + injected channel group + 5 + 1 + + + JEXTSEL + Trigger signal selection for launching + injected conversions + 8 + 5 + + + JEXTEN + Trigger enable and trigger edge + selection for injected conversions + 13 + 2 + + + RSWSTART + Software start of a conversion on the + regular channel + 17 + 1 + + + RCONT + Continuous mode selection for regular + conversions + 18 + 1 + + + RSYNC + Launch regular conversion synchronously + with DFSDM0 + 19 + 1 + + + RDMAEN + DMA channel enabled to read data for the + regular conversion + 21 + 1 + + + RCH + Regular channel selection + 24 + 3 + + + FAST + Fast conversion mode selection for + regular conversions + 29 + 1 + + + AWFSEL + Analog watchdog fast mode + select + 30 + 1 + + + + + DFSDM2_CR1 + DFSDM2_CR1 + DFSDM control register 1 + 0xA8 + 0x20 + read-write + 0x00000000 + + + DFEN + DFSDM enable + 0 + 1 + + + JSWSTART + Start a conversion of the injected group + of channels + 1 + 1 + + + JSYNC + Launch an injected conversion + synchronously with the DFSDM0 JSWSTART + trigger + 3 + 1 + + + JSCAN + Scanning conversion mode for injected + conversions + 4 + 1 + + + JDMAEN + DMA channel enabled to read data for the + injected channel group + 5 + 1 + + + JEXTSEL + Trigger signal selection for launching + injected conversions + 8 + 5 + + + JEXTEN + Trigger enable and trigger edge + selection for injected conversions + 13 + 2 + + + RSWSTART + Software start of a conversion on the + regular channel + 17 + 1 + + + RCONT + Continuous mode selection for regular + conversions + 18 + 1 + + + RSYNC + Launch regular conversion synchronously + with DFSDM0 + 19 + 1 + + + RDMAEN + DMA channel enabled to read data for the + regular conversion + 21 + 1 + + + RCH + Regular channel selection + 24 + 3 + + + FAST + Fast conversion mode selection for + regular conversions + 29 + 1 + + + AWFSEL + Analog watchdog fast mode + select + 30 + 1 + + + + + DFSDM3_CR1 + DFSDM3_CR1 + DFSDM control register 1 + 0xAC + 0x20 + read-write + 0x00000000 + + + DFEN + DFSDM enable + 0 + 1 + + + JSWSTART + Start a conversion of the injected group + of channels + 1 + 1 + + + JSYNC + Launch an injected conversion + synchronously with the DFSDM0 JSWSTART + trigger + 3 + 1 + + + JSCAN + Scanning conversion mode for injected + conversions + 4 + 1 + + + JDMAEN + DMA channel enabled to read data for the + injected channel group + 5 + 1 + + + JEXTSEL + Trigger signal selection for launching + injected conversions + 8 + 5 + + + JEXTEN + Trigger enable and trigger edge + selection for injected conversions + 13 + 2 + + + RSWSTART + Software start of a conversion on the + regular channel + 17 + 1 + + + RCONT + Continuous mode selection for regular + conversions + 18 + 1 + + + RSYNC + Launch regular conversion synchronously + with DFSDM0 + 19 + 1 + + + RDMAEN + DMA channel enabled to read data for the + regular conversion + 21 + 1 + + + RCH + Regular channel selection + 24 + 3 + + + FAST + Fast conversion mode selection for + regular conversions + 29 + 1 + + + AWFSEL + Analog watchdog fast mode + select + 30 + 1 + + + + + DFSDM0_CR2 + DFSDM0_CR2 + DFSDM control register 2 + 0xB0 + 0x20 + read-write + 0x00000000 + + + JEOCIE + Injected end of conversion interrupt + enable + 0 + 1 + + + REOCIE + Regular end of conversion interrupt + enable + 1 + 1 + + + JOVRIE + Injected data overrun interrupt + enable + 2 + 1 + + + ROVRIE + Regular data overrun interrupt + enable + 3 + 1 + + + AWDIE + Analog watchdog interrupt + enable + 4 + 1 + + + SCDIE + Short-circuit detector interrupt + enable + 5 + 1 + + + CKABIE + Clock absence interrupt + enable + 6 + 1 + + + EXCH + Extremes detector channel + selection + 8 + 8 + + + AWDCH + Analog watchdog channel + selection + 16 + 8 + + + + + DFSDM1_CR2 + DFSDM1_CR2 + DFSDM control register 2 + 0xB4 + 0x20 + read-write + 0x00000000 + + + JEOCIE + Injected end of conversion interrupt + enable + 0 + 1 + + + REOCIE + Regular end of conversion interrupt + enable + 1 + 1 + + + JOVRIE + Injected data overrun interrupt + enable + 2 + 1 + + + ROVRIE + Regular data overrun interrupt + enable + 3 + 1 + + + AWDIE + Analog watchdog interrupt + enable + 4 + 1 + + + SCDIE + Short-circuit detector interrupt + enable + 5 + 1 + + + CKABIE + Clock absence interrupt + enable + 6 + 1 + + + EXCH + Extremes detector channel + selection + 8 + 8 + + + AWDCH + Analog watchdog channel + selection + 16 + 8 + + + + + DFSDM2_CR2 + DFSDM2_CR2 + DFSDM control register 2 + 0xB8 + 0x20 + read-write + 0x00000000 + + + JEOCIE + Injected end of conversion interrupt + enable + 0 + 1 + + + REOCIE + Regular end of conversion interrupt + enable + 1 + 1 + + + JOVRIE + Injected data overrun interrupt + enable + 2 + 1 + + + ROVRIE + Regular data overrun interrupt + enable + 3 + 1 + + + AWDIE + Analog watchdog interrupt + enable + 4 + 1 + + + SCDIE + Short-circuit detector interrupt + enable + 5 + 1 + + + CKABIE + Clock absence interrupt + enable + 6 + 1 + + + EXCH + Extremes detector channel + selection + 8 + 8 + + + AWDCH + Analog watchdog channel + selection + 16 + 8 + + + + + DFSDM3_CR2 + DFSDM3_CR2 + DFSDM control register 2 + 0xBC + 0x20 + read-write + 0x00000000 + + + JEOCIE + Injected end of conversion interrupt + enable + 0 + 1 + + + REOCIE + Regular end of conversion interrupt + enable + 1 + 1 + + + JOVRIE + Injected data overrun interrupt + enable + 2 + 1 + + + ROVRIE + Regular data overrun interrupt + enable + 3 + 1 + + + AWDIE + Analog watchdog interrupt + enable + 4 + 1 + + + SCDIE + Short-circuit detector interrupt + enable + 5 + 1 + + + CKABIE + Clock absence interrupt + enable + 6 + 1 + + + EXCH + Extremes detector channel + selection + 8 + 8 + + + AWDCH + Analog watchdog channel + selection + 16 + 8 + + + + + DFSDM0_ISR + DFSDM0_ISR + DFSDM interrupt and status + register + 0xC0 + 0x20 + read-only + 0x00000000 + + + JEOCF + End of injected conversion + flag + 0 + 1 + + + REOCF + End of regular conversion + flag + 1 + 1 + + + JOVRF + Injected conversion overrun + flag + 2 + 1 + + + ROVRF + Regular conversion overrun + flag + 3 + 1 + + + AWDF + Analog watchdog + 4 + 1 + + + JCIP + Injected conversion in progress + status + 13 + 1 + + + RCIP + Regular conversion in progress + status + 14 + 1 + + + CKABF + Clock absence flag + 16 + 8 + + + SCDF + short-circuit detector + flag + 24 + 8 + + + + + DFSDM1_ISR + DFSDM1_ISR + DFSDM interrupt and status + register + 0xC4 + 0x20 + read-only + 0x00000000 + + + JEOCF + End of injected conversion + flag + 0 + 1 + + + REOCF + End of regular conversion + flag + 1 + 1 + + + JOVRF + Injected conversion overrun + flag + 2 + 1 + + + ROVRF + Regular conversion overrun + flag + 3 + 1 + + + AWDF + Analog watchdog + 4 + 1 + + + JCIP + Injected conversion in progress + status + 13 + 1 + + + RCIP + Regular conversion in progress + status + 14 + 1 + + + CKABF + Clock absence flag + 16 + 8 + + + SCDF + short-circuit detector + flag + 24 + 8 + + + + + DFSDM2_ISR + DFSDM2_ISR + DFSDM interrupt and status + register + 0xC8 + 0x20 + read-only + 0x00000000 + + + JEOCF + End of injected conversion + flag + 0 + 1 + + + REOCF + End of regular conversion + flag + 1 + 1 + + + JOVRF + Injected conversion overrun + flag + 2 + 1 + + + ROVRF + Regular conversion overrun + flag + 3 + 1 + + + AWDF + Analog watchdog + 4 + 1 + + + JCIP + Injected conversion in progress + status + 13 + 1 + + + RCIP + Regular conversion in progress + status + 14 + 1 + + + CKABF + Clock absence flag + 16 + 8 + + + SCDF + short-circuit detector + flag + 24 + 8 + + + + + DFSDM3_ISR + DFSDM3_ISR + DFSDM interrupt and status + register + 0xCC + 0x20 + read-only + 0x00000000 + + + JEOCF + End of injected conversion + flag + 0 + 1 + + + REOCF + End of regular conversion + flag + 1 + 1 + + + JOVRF + Injected conversion overrun + flag + 2 + 1 + + + ROVRF + Regular conversion overrun + flag + 3 + 1 + + + AWDF + Analog watchdog + 4 + 1 + + + JCIP + Injected conversion in progress + status + 13 + 1 + + + RCIP + Regular conversion in progress + status + 14 + 1 + + + CKABF + Clock absence flag + 16 + 8 + + + SCDF + short-circuit detector + flag + 24 + 8 + + + + + DFSDM0_ICR + DFSDM0_ICR + DFSDM interrupt flag clear + register + 0xD0 + 0x20 + read-write + 0x00000000 + + + CLRJOVRF + Clear the injected conversion overrun + flag + 2 + 1 + + + CLRROVRF + Clear the regular conversion overrun + flag + 3 + 1 + + + CLRCKABF + Clear the clock absence + flag + 16 + 8 + + + CLRSCDF + Clear the short-circuit detector + flag + 24 + 8 + + + + + DFSDM1_ICR + DFSDM1_ICR + DFSDM interrupt flag clear + register + 0xD4 + 0x20 + read-write + 0x00000000 + + + CLRJOVRF + Clear the injected conversion overrun + flag + 2 + 1 + + + CLRROVRF + Clear the regular conversion overrun + flag + 3 + 1 + + + CLRCKABF + Clear the clock absence + flag + 16 + 8 + + + CLRSCDF + Clear the short-circuit detector + flag + 24 + 8 + + + + + DFSDM2_ICR + DFSDM2_ICR + DFSDM interrupt flag clear + register + 0xD8 + 0x20 + read-write + 0x00000000 + + + CLRJOVRF + Clear the injected conversion overrun + flag + 2 + 1 + + + CLRROVRF + Clear the regular conversion overrun + flag + 3 + 1 + + + CLRCKABF + Clear the clock absence + flag + 16 + 8 + + + CLRSCDF + Clear the short-circuit detector + flag + 24 + 8 + + + + + DFSDM3_ICR + DFSDM3_ICR + DFSDM interrupt flag clear + register + 0xDC + 0x20 + read-write + 0x00000000 + + + CLRJOVRF + Clear the injected conversion overrun + flag + 2 + 1 + + + CLRROVRF + Clear the regular conversion overrun + flag + 3 + 1 + + + CLRCKABF + Clear the clock absence + flag + 16 + 8 + + + CLRSCDF + Clear the short-circuit detector + flag + 24 + 8 + + + + + DFSDM0_JCHGR + DFSDM0_JCHGR + DFSDM injected channel group selection + register + 0xE0 + 0x20 + read-write + 0x00000000 + + + JCHG + Injected channel group + selection + 0 + 8 + + + + + DFSDM1_JCHGR + DFSDM1_JCHGR + DFSDM injected channel group selection + register + 0xE4 + 0x20 + read-write + 0x00000000 + + + JCHG + Injected channel group + selection + 0 + 8 + + + + + DFSDM2_JCHGR + DFSDM2_JCHGR + DFSDM injected channel group selection + register + 0xE8 + 0x20 + read-write + 0x00000000 + + + JCHG + Injected channel group + selection + 0 + 8 + + + + + DFSDM3_JCHGR + DFSDM3_JCHGR + DFSDM injected channel group selection + register + 0xEC + 0x20 + read-write + 0x00000000 + + + JCHG + Injected channel group + selection + 0 + 8 + + + + + DFSDM0_FCR + DFSDM0_FCR + DFSDM filter control register + 0xF0 + 0x20 + read-write + 0x00000000 + + + IOSR + Integrator oversampling ratio (averaging + length) + 0 + 8 + + + FOSR + Sinc filter oversampling ratio + (decimation rate) + 16 + 10 + + + FORD + Sinc filter order + 29 + 3 + + + + + DFSDM1_FCR + DFSDM1_FCR + DFSDM filter control register + 0xF4 + 0x20 + read-write + 0x00000000 + + + IOSR + Integrator oversampling ratio (averaging + length) + 0 + 8 + + + FOSR + Sinc filter oversampling ratio + (decimation rate) + 16 + 10 + + + FORD + Sinc filter order + 29 + 3 + + + + + DFSDM2_FCR + DFSDM2_FCR + DFSDM filter control register + 0xF8 + 0x20 + read-write + 0x00000000 + + + IOSR + Integrator oversampling ratio (averaging + length) + 0 + 8 + + + FOSR + Sinc filter oversampling ratio + (decimation rate) + 16 + 10 + + + FORD + Sinc filter order + 29 + 3 + + + + + DFSDM3_FCR + DFSDM3_FCR + DFSDM filter control register + 0xFC + 0x20 + read-write + 0x00000000 + + + IOSR + Integrator oversampling ratio (averaging + length) + 0 + 8 + + + FOSR + Sinc filter oversampling ratio + (decimation rate) + 16 + 10 + + + FORD + Sinc filter order + 29 + 3 + + + + + DFSDM0_JDATAR + DFSDM0_JDATAR + DFSDM data register for injected + group + 0x100 + 0x20 + read-only + 0x00000000 + + + JDATACH + Injected channel most recently + converted + 0 + 3 + + + JDATA + Injected group conversion + data + 8 + 24 + + + + + DFSDM1_JDATAR + DFSDM1_JDATAR + DFSDM data register for injected + group + 0x104 + 0x20 + read-only + 0x00000000 + + + JDATACH + Injected channel most recently + converted + 0 + 3 + + + JDATA + Injected group conversion + data + 8 + 24 + + + + + DFSDM2_JDATAR + DFSDM2_JDATAR + DFSDM data register for injected + group + 0x108 + 0x20 + read-only + 0x00000000 + + + JDATACH + Injected channel most recently + converted + 0 + 3 + + + JDATA + Injected group conversion + data + 8 + 24 + + + + + DFSDM3_JDATAR + DFSDM3_JDATAR + DFSDM data register for injected + group + 0x10C + 0x20 + read-only + 0x00000000 + + + JDATACH + Injected channel most recently + converted + 0 + 3 + + + JDATA + Injected group conversion + data + 8 + 24 + + + + + DFSDM0_RDATAR + DFSDM0_RDATAR + DFSDM data register for the regular + channel + 0x110 + 0x20 + read-only + 0x00000000 + + + RDATACH + Regular channel most recently + converted + 0 + 3 + + + RPEND + Regular channel pending + data + 4 + 1 + + + RDATA + Regular channel conversion + data + 8 + 24 + + + + + DFSDM1_RDATAR + DFSDM1_RDATAR + DFSDM data register for the regular + channel + 0x114 + 0x20 + read-only + 0x00000000 + + + RDATACH + Regular channel most recently + converted + 0 + 3 + + + RPEND + Regular channel pending + data + 4 + 1 + + + RDATA + Regular channel conversion + data + 8 + 24 + + + + + DFSDM2_RDATAR + DFSDM2_RDATAR + DFSDM data register for the regular + channel + 0x118 + 0x20 + read-only + 0x00000000 + + + RDATACH + Regular channel most recently + converted + 0 + 3 + + + RPEND + Regular channel pending + data + 4 + 1 + + + RDATA + Regular channel conversion + data + 8 + 24 + + + + + DFSDM3_RDATAR + DFSDM3_RDATAR + DFSDM data register for the regular + channel + 0x11C + 0x20 + read-only + 0x00000000 + + + RDATACH + Regular channel most recently + converted + 0 + 3 + + + RPEND + Regular channel pending + data + 4 + 1 + + + RDATA + Regular channel conversion + data + 8 + 24 + + + + + DFSDM0_AWHTR + DFSDM0_AWHTR + DFSDM analog watchdog high threshold + register + 0x120 + 0x20 + read-write + 0x00000000 + + + BKAWH + Break signal assignment to analog + watchdog high threshold event + 0 + 4 + + + AWHT + Analog watchdog high + threshold + 8 + 24 + + + + + DFSDM1_AWHTR + DFSDM1_AWHTR + DFSDM analog watchdog high threshold + register + 0x124 + 0x20 + read-write + 0x00000000 + + + BKAWH + Break signal assignment to analog + watchdog high threshold event + 0 + 4 + + + AWHT + Analog watchdog high + threshold + 8 + 24 + + + + + DFSDM2_AWHTR + DFSDM2_AWHTR + DFSDM analog watchdog high threshold + register + 0x128 + 0x20 + read-write + 0x00000000 + + + BKAWH + Break signal assignment to analog + watchdog high threshold event + 0 + 4 + + + AWHT + Analog watchdog high + threshold + 8 + 24 + + + + + DFSDM3_AWHTR + DFSDM3_AWHTR + DFSDM analog watchdog high threshold + register + 0x12C + 0x20 + read-write + 0x00000000 + + + BKAWH + Break signal assignment to analog + watchdog high threshold event + 0 + 4 + + + AWHT + Analog watchdog high + threshold + 8 + 24 + + + + + DFSDM0_AWLTR + DFSDM0_AWLTR + DFSDM analog watchdog low threshold + register + 0x130 + 0x20 + read-write + 0x00000000 + + + BKAWL + Break signal assignment to analog + watchdog low threshold event + 0 + 4 + + + AWLT + Analog watchdog low + threshold + 8 + 24 + + + + + DFSDM1_AWLTR + DFSDM1_AWLTR + DFSDM analog watchdog low threshold + register + 0x134 + 0x20 + read-write + 0x00000000 + + + BKAWL + Break signal assignment to analog + watchdog low threshold event + 0 + 4 + + + AWLT + Analog watchdog low + threshold + 8 + 24 + + + + + DFSDM2_AWLTR + DFSDM2_AWLTR + DFSDM analog watchdog low threshold + register + 0x138 + 0x20 + read-write + 0x00000000 + + + BKAWL + Break signal assignment to analog + watchdog low threshold event + 0 + 4 + + + AWLT + Analog watchdog low + threshold + 8 + 24 + + + + + DFSDM3_AWLTR + DFSDM3_AWLTR + DFSDM analog watchdog low threshold + register + 0x13C + 0x20 + read-write + 0x00000000 + + + BKAWL + Break signal assignment to analog + watchdog low threshold event + 0 + 4 + + + AWLT + Analog watchdog low + threshold + 8 + 24 + + + + + DFSDM0_AWSR + DFSDM0_AWSR + DFSDM analog watchdog status + register + 0x140 + 0x20 + read-only + 0x00000000 + + + AWLTF + Analog watchdog low threshold + flag + 0 + 8 + + + AWHTF + Analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM1_AWSR + DFSDM1_AWSR + DFSDM analog watchdog status + register + 0x144 + 0x20 + read-only + 0x00000000 + + + AWLTF + Analog watchdog low threshold + flag + 0 + 8 + + + AWHTF + Analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM2_AWSR + DFSDM2_AWSR + DFSDM analog watchdog status + register + 0x148 + 0x20 + read-only + 0x00000000 + + + AWLTF + Analog watchdog low threshold + flag + 0 + 8 + + + AWHTF + Analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM3_AWSR + DFSDM3_AWSR + DFSDM analog watchdog status + register + 0x14C + 0x20 + read-only + 0x00000000 + + + AWLTF + Analog watchdog low threshold + flag + 0 + 8 + + + AWHTF + Analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM0_AWCFR + DFSDM0_AWCFR + DFSDM analog watchdog clear flag + register + 0x150 + 0x20 + read-write + 0x00000000 + + + CLRAWLTF + Clear the analog watchdog low threshold + flag + 0 + 8 + + + CLRAWHTF + Clear the analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM1_AWCFR + DFSDM1_AWCFR + DFSDM analog watchdog clear flag + register + 0x154 + 0x20 + read-write + 0x00000000 + + + CLRAWLTF + Clear the analog watchdog low threshold + flag + 0 + 8 + + + CLRAWHTF + Clear the analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM2_AWCFR + DFSDM2_AWCFR + DFSDM analog watchdog clear flag + register + 0x158 + 0x20 + read-write + 0x00000000 + + + CLRAWLTF + Clear the analog watchdog low threshold + flag + 0 + 8 + + + CLRAWHTF + Clear the analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM3_AWCFR + DFSDM3_AWCFR + DFSDM analog watchdog clear flag + register + 0x15C + 0x20 + read-write + 0x00000000 + + + CLRAWLTF + Clear the analog watchdog low threshold + flag + 0 + 8 + + + CLRAWHTF + Clear the analog watchdog high threshold + flag + 8 + 8 + + + + + DFSDM0_EXMAX + DFSDM0_EXMAX + DFSDM Extremes detector maximum + register + 0x160 + 0x20 + read-only + 0x00000000 + + + EXMAXCH + Extremes detector maximum data + channel + 0 + 3 + + + EXMAX + Extremes detector maximum + value + 8 + 24 + + + + + DFSDM1_EXMAX + DFSDM1_EXMAX + DFSDM Extremes detector maximum + register + 0x164 + 0x20 + read-only + 0x00000000 + + + EXMAXCH + Extremes detector maximum data + channel + 0 + 3 + + + EXMAX + Extremes detector maximum + value + 8 + 24 + + + + + DFSDM2_EXMAX + DFSDM2_EXMAX + DFSDM Extremes detector maximum + register + 0x168 + 0x20 + read-only + 0x00000000 + + + EXMAXCH + Extremes detector maximum data + channel + 0 + 3 + + + EXMAX + Extremes detector maximum + value + 8 + 24 + + + + + DFSDM3_EXMAX + DFSDM3_EXMAX + DFSDM Extremes detector maximum + register + 0x16C + 0x20 + read-only + 0x00000000 + + + EXMAXCH + Extremes detector maximum data + channel + 0 + 3 + + + EXMAX + Extremes detector maximum + value + 8 + 24 + + + + + DFSDM0_EXMIN + DFSDM0_EXMIN + DFSDM Extremes detector minimum + register + 0x170 + 0x20 + read-only + 0x00000000 + + + EXMINCH + Extremes detector minimum data + channel + 0 + 3 + + + EXMIN + Extremes detector minimum + value + 8 + 24 + + + + + DFSDM1_EXMIN + DFSDM1_EXMIN + DFSDM Extremes detector minimum + register + 0x174 + 0x20 + read-only + 0x00000000 + + + EXMINCH + Extremes detector minimum data + channel + 0 + 3 + + + EXMIN + Extremes detector minimum + value + 8 + 24 + + + + + DFSDM2_EXMIN + DFSDM2_EXMIN + DFSDM Extremes detector minimum + register + 0x178 + 0x20 + read-only + 0x00000000 + + + EXMINCH + Extremes detector minimum data + channel + 0 + 3 + + + EXMIN + Extremes detector minimum + value + 8 + 24 + + + + + DFSDM3_EXMIN + DFSDM3_EXMIN + DFSDM Extremes detector minimum + register + 0x17C + 0x20 + read-only + 0x00000000 + + + EXMINCH + Extremes detector minimum data + channel + 0 + 3 + + + EXMIN + Extremes detector minimum + value + 8 + 24 + + + + + DFSDM0_CNVTIMR + DFSDM0_CNVTIMR + DFSDM conversion timer + register + 0x180 + 0x20 + read-only + 0x00000000 + + + CNVCNT + 28-bit timer counting conversion + time + 4 + 28 + + + + + DFSDM1_CNVTIMR + DFSDM1_CNVTIMR + DFSDM conversion timer + register + 0x184 + 0x20 + read-only + 0x00000000 + + + CNVCNT + 28-bit timer counting conversion + time + 4 + 28 + + + + + DFSDM2_CNVTIMR + DFSDM2_CNVTIMR + DFSDM conversion timer + register + 0x188 + 0x20 + read-only + 0x00000000 + + + CNVCNT + 28-bit timer counting conversion + time + 4 + 28 + + + + + DFSDM3_CNVTIMR + DFSDM3_CNVTIMR + DFSDM conversion timer + register + 0x18C + 0x20 + read-only + 0x00000000 + + + CNVCNT + 28-bit timer counting conversion + time + 4 + 28 + + + + + + + TIM16 + General-purpose-timers + TIMs + 0x40014400 + + 0x0 + 0x400 + registers + + + TIM16 + TIM16 global interrupt + 117 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + CEN + Counter enable + 0 + 1 + + + UDIS + Update disable + 1 + 1 + + + URS + Update request source + 2 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + CKD + Clock division + 8 + 2 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + OIS1N + Output Idle state 1 + 9 + 1 + + + OIS1 + Output Idle state 1 + 8 + 1 + + + CCDS + Capture/compare DMA + selection + 3 + 1 + + + CCUS + Capture/compare control update + selection + 2 + 1 + + + CCPC + Capture/compare preloaded + control + 0 + 1 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + UIE + Update interrupt enable + 0 + 1 + + + CC1IE + Capture/Compare 1 interrupt + enable + 1 + 1 + + + COMIE + COM interrupt enable + 5 + 1 + + + BIE + Break interrupt enable + 7 + 1 + + + UDE + Update DMA request enable + 8 + 1 + + + CC1DE + Capture/Compare 1 DMA request + enable + 9 + 1 + + + COMDE + COM DMA request enable + 13 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + CC1OF + Capture/Compare 1 overcapture + flag + 9 + 1 + + + BIF + Break interrupt flag + 7 + 1 + + + COMIF + COM interrupt flag + 5 + 1 + + + CC1IF + Capture/compare 1 interrupt + flag + 1 + 1 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + BG + Break generation + 7 + 1 + + + COMG + Capture/Compare control update + generation + 5 + 1 + + + CC1G + Capture/compare 1 + generation + 1 + 1 + + + UG + Update generation + 0 + 1 + + + + + CCMR1_Output + CCMR1_Output + capture/compare mode register (output + mode) + 0x18 + 0x20 + read-write + 0x00000000 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + OC1FE + Output Compare 1 fast + enable + 2 + 1 + + + OC1PE + Output Compare 1 preload + enable + 3 + 1 + + + OC1M + Output Compare 1 mode + 4 + 3 + + + OC1M_3 + Output Compare 1 mode + 16 + 1 + + + + + CCMR1_Input + CCMR1_Input + capture/compare mode register 1 (input + mode) + CCMR1_Output + 0x18 + 0x20 + read-write + 0x00000000 + + + IC1F + Input capture 1 filter + 4 + 4 + + + IC1PSC + Input capture 1 prescaler + 2 + 2 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + + + CCER + CCER + capture/compare enable + register + 0x20 + 0x20 + read-write + 0x0000 + + + CC1NP + Capture/Compare 1 output + Polarity + 3 + 1 + + + CC1NE + Capture/Compare 1 complementary output + enable + 2 + 1 + + + CC1P + Capture/Compare 1 output + Polarity + 1 + 1 + + + CC1E + Capture/Compare 1 output + enable + 0 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + 0x00000000 + + + CNT + counter value + 0 + 16 + read-write + + + UIFCPY + UIF Copy + 31 + 1 + read-only + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR + Auto-reload value + 0 + 16 + + + + + RCR + RCR + repetition counter register + 0x30 + 0x20 + read-write + 0x0000 + + + REP + Repetition counter value + 0 + 8 + + + + + CCR1 + CCR1 + capture/compare register 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + CCR1 + Capture/Compare 1 value + 0 + 16 + + + + + BDTR + BDTR + break and dead-time register + 0x44 + 0x20 + read-write + 0x0000 + + + DTG + Dead-time generator setup + 0 + 8 + + + LOCK + Lock configuration + 8 + 2 + + + OSSI + Off-state selection for Idle + mode + 10 + 1 + + + OSSR + Off-state selection for Run + mode + 11 + 1 + + + BKE + Break enable + 12 + 1 + + + BKP + Break polarity + 13 + 1 + + + AOE + Automatic output enable + 14 + 1 + + + MOE + Main output enable + 15 + 1 + + + BKF + Break filter + 16 + 4 + + + + + DCR + DCR + DMA control register + 0x48 + 0x20 + read-write + 0x0000 + + + DBL + DMA burst length + 8 + 5 + + + DBA + DMA base address + 0 + 5 + + + + + DMAR + DMAR + DMA address for full transfer + 0x4C + 0x20 + read-write + 0x0000 + + + DMAB + DMA register for burst + accesses + 0 + 16 + + + + + TIM16_AF1 + TIM16_AF1 + TIM16 alternate function register + 1 + 0x60 + 0x20 + read-write + 0x0000 + + + BKINE + BRK BKIN input enable + 0 + 1 + + + BKCMP1E + BRK COMP1 enable + 1 + 1 + + + BKCMP2E + BRK COMP2 enable + 2 + 1 + + + BKDFBK1E + BRK dfsdm1_break[1] enable + 8 + 1 + + + BKINP + BRK BKIN input polarity + 9 + 1 + + + BKCMP1P + BRK COMP1 input polarity + 10 + 1 + + + BKCMP2P + BRK COMP2 input polarity + 11 + 1 + + + + + TIM16_TISEL + TIM16_TISEL + TIM16 input selection register + 0x68 + 0x20 + read-write + 0x0000 + + + TI1SEL + selects TI1[0] to TI1[15] + input + 0 + 4 + + + + + + + TIM17 + General-purpose-timers + TIMs + 0x40014800 + + 0x0 + 0x400 + registers + + + TIM17 + TIM17 global interrupt + 118 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + CEN + Counter enable + 0 + 1 + + + UDIS + Update disable + 1 + 1 + + + URS + Update request source + 2 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + CKD + Clock division + 8 + 2 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + OIS1N + Output Idle state 1 + 9 + 1 + + + OIS1 + Output Idle state 1 + 8 + 1 + + + CCDS + Capture/compare DMA + selection + 3 + 1 + + + CCUS + Capture/compare control update + selection + 2 + 1 + + + CCPC + Capture/compare preloaded + control + 0 + 1 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + UIE + Update interrupt enable + 0 + 1 + + + CC1IE + Capture/Compare 1 interrupt + enable + 1 + 1 + + + COMIE + COM interrupt enable + 5 + 1 + + + BIE + Break interrupt enable + 7 + 1 + + + UDE + Update DMA request enable + 8 + 1 + + + CC1DE + Capture/Compare 1 DMA request + enable + 9 + 1 + + + COMDE + COM DMA request enable + 13 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + CC1OF + Capture/Compare 1 overcapture + flag + 9 + 1 + + + BIF + Break interrupt flag + 7 + 1 + + + COMIF + COM interrupt flag + 5 + 1 + + + CC1IF + Capture/compare 1 interrupt + flag + 1 + 1 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + BG + Break generation + 7 + 1 + + + COMG + Capture/Compare control update + generation + 5 + 1 + + + CC1G + Capture/compare 1 + generation + 1 + 1 + + + UG + Update generation + 0 + 1 + + + + + CCMR1_Output + CCMR1_Output + capture/compare mode register (output + mode) + 0x18 + 0x20 + read-write + 0x00000000 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + OC1FE + Output Compare 1 fast + enable + 2 + 1 + + + OC1PE + Output Compare 1 preload + enable + 3 + 1 + + + OC1M + Output Compare 1 mode + 4 + 3 + + + OC1M_3 + Output Compare 1 mode + 16 + 1 + + + + + CCMR1_Input + CCMR1_Input + capture/compare mode register 1 (input + mode) + CCMR1_Output + 0x18 + 0x20 + read-write + 0x00000000 + + + IC1F + Input capture 1 filter + 4 + 4 + + + IC1PSC + Input capture 1 prescaler + 2 + 2 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + + + CCER + CCER + capture/compare enable + register + 0x20 + 0x20 + read-write + 0x0000 + + + CC1NP + Capture/Compare 1 output + Polarity + 3 + 1 + + + CC1NE + Capture/Compare 1 complementary output + enable + 2 + 1 + + + CC1P + Capture/Compare 1 output + Polarity + 1 + 1 + + + CC1E + Capture/Compare 1 output + enable + 0 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + 0x00000000 + + + CNT + counter value + 0 + 16 + read-write + + + UIFCPY + UIF Copy + 31 + 1 + read-only + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR + Auto-reload value + 0 + 16 + + + + + RCR + RCR + repetition counter register + 0x30 + 0x20 + read-write + 0x0000 + + + REP + Repetition counter value + 0 + 8 + + + + + CCR1 + CCR1 + capture/compare register 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + CCR1 + Capture/Compare 1 value + 0 + 16 + + + + + BDTR + BDTR + break and dead-time register + 0x44 + 0x20 + read-write + 0x0000 + + + DTG + Dead-time generator setup + 0 + 8 + + + LOCK + Lock configuration + 8 + 2 + + + OSSI + Off-state selection for Idle + mode + 10 + 1 + + + OSSR + Off-state selection for Run + mode + 11 + 1 + + + BKE + Break enable + 12 + 1 + + + BKP + Break polarity + 13 + 1 + + + AOE + Automatic output enable + 14 + 1 + + + MOE + Main output enable + 15 + 1 + + + BKF + Break filter + 16 + 4 + + + + + DCR + DCR + DMA control register + 0x48 + 0x20 + read-write + 0x0000 + + + DBL + DMA burst length + 8 + 5 + + + DBA + DMA base address + 0 + 5 + + + + + DMAR + DMAR + DMA address for full transfer + 0x4C + 0x20 + read-write + 0x0000 + + + DMAB + DMA register for burst + accesses + 0 + 16 + + + + + TIM17_AF1 + TIM17_AF1 + TIM17 alternate function register + 1 + 0x60 + 0x20 + read-write + 0x0000 + + + BKINE + BRK BKIN input enable + 0 + 1 + + + BKCMP1E + BRK COMP1 enable + 1 + 1 + + + BKCMP2E + BRK COMP2 enable + 2 + 1 + + + BKDFBK1E + BRK dfsdm1_break[1] enable + 8 + 1 + + + BKINP + BRK BKIN input polarity + 9 + 1 + + + BKCMP1P + BRK COMP1 input polarity + 10 + 1 + + + BKCMP2P + BRK COMP2 input polarity + 11 + 1 + + + + + TIM17_TISEL + TIM17_TISEL + TIM17 input selection register + 0x68 + 0x20 + read-write + 0x0000 + + + TI1SEL + selects TI1[0] to TI1[15] + input + 0 + 4 + + + + + + + TIM15 + General purpose timers + TIMs + 0x40014000 + + 0x0 + 0x400 + registers + + + TIM15 + TIM15 global interrupt + 116 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + CEN + Counter enable + 0 + 1 + + + UDIS + Update disable + 1 + 1 + + + URS + Update request source + 2 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + CKD + Clock division + 8 + 2 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + CCPC + Capture/compare preloaded + control + 0 + 1 + + + CCUS + Capture/compare control update + selection + 2 + 1 + + + CCDS + Capture/compare DMA + selection + 3 + 1 + + + MMS + Master mode selection + 4 + 3 + + + TI1S + TI1 selection + 7 + 1 + + + OIS1 + Output Idle state 1 + 8 + 1 + + + OIS1N + Output Idle state 1 + 9 + 1 + + + OIS2 + Output Idle state 2 + 10 + 1 + + + + + SMCR + SMCR + slave mode control register + 0x8 + 0x20 + read-write + 0x0000 + + + SMS + Slave mode selection + 0 + 3 + + + TS_2_0 + Trigger selection + 4 + 3 + + + MSM + Master/Slave mode + 7 + 1 + + + SMS_3 + Slave mode selection bit 3 + 16 + 1 + + + TS_4_3 + Trigger selection - bit + 4:3 + 20 + 2 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + UIE + Update interrupt enable + 0 + 1 + + + CC1IE + Capture/Compare 1 interrupt + enable + 1 + 1 + + + CC2IE + Capture/Compare 2 interrupt + enable + 2 + 1 + + + COMIE + COM interrupt enable + 5 + 1 + + + TIE + Trigger interrupt enable + 6 + 1 + + + BIE + Break interrupt enable + 7 + 1 + + + UDE + Update DMA request enable + 8 + 1 + + + CC1DE + Capture/Compare 1 DMA request + enable + 9 + 1 + + + CC2DE + Capture/Compare 2 DMA request + enable + 10 + 1 + + + COMDE + COM DMA request enable + 13 + 1 + + + TDE + Trigger DMA request enable + 14 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + CC2OF + Capture/compare 2 overcapture + flag + 10 + 1 + + + CC1OF + Capture/Compare 1 overcapture + flag + 9 + 1 + + + BIF + Break interrupt flag + 7 + 1 + + + TIF + Trigger interrupt flag + 6 + 1 + + + COMIF + COM interrupt flag + 5 + 1 + + + CC2IF + Capture/Compare 2 interrupt + flag + 2 + 1 + + + CC1IF + Capture/compare 1 interrupt + flag + 1 + 1 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + BG + Break generation + 7 + 1 + + + TG + Trigger generation + 6 + 1 + + + COMG + Capture/Compare control update + generation + 5 + 1 + + + CC2G + Capture/compare 2 + generation + 2 + 1 + + + CC1G + Capture/compare 1 + generation + 1 + 1 + + + UG + Update generation + 0 + 1 + + + + + CCMR1_Output + CCMR1_Output + capture/compare mode register (output + mode) + 0x18 + 0x20 + read-write + 0x00000000 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + OC1FE + Output Compare 1 fast + enable + 2 + 1 + + + OC1PE + Output Compare 1 preload + enable + 3 + 1 + + + OC1M + Output Compare 1 mode + 4 + 3 + + + CC2S + Capture/Compare 2 + selection + 8 + 2 + + + OC2FE + Output Compare 2 fast + enable + 10 + 1 + + + OC2PE + Output Compare 2 preload + enable + 11 + 1 + + + OC2M + Output Compare 2 mode + 12 + 3 + + + OC1M_3 + Output Compare 1 mode bit + 3 + 16 + 1 + + + OC2M_3 + Output Compare 2 mode bit + 3 + 24 + 1 + + + + + CCMR1_Input + CCMR1_Input + capture/compare mode register 1 (input + mode) + CCMR1_Output + 0x18 + 0x20 + read-write + 0x00000000 + + + IC2F + Input capture 2 filter + 12 + 4 + + + IC2PSC + Input capture 2 prescaler + 10 + 2 + + + CC2S + Capture/Compare 2 + selection + 8 + 2 + + + IC1F + Input capture 1 filter + 4 + 4 + + + IC1PSC + Input capture 1 prescaler + 2 + 2 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + + + CCER + CCER + capture/compare enable + register + 0x20 + 0x20 + read-write + 0x0000 + + + CC2NP + Capture/Compare 2 output + Polarity + 7 + 1 + + + CC2P + Capture/Compare 2 output + Polarity + 5 + 1 + + + CC2E + Capture/Compare 2 output + enable + 4 + 1 + + + CC1NP + Capture/Compare 1 output + Polarity + 3 + 1 + + + CC1NE + Capture/Compare 1 complementary output + enable + 2 + 1 + + + CC1P + Capture/Compare 1 output + Polarity + 1 + 1 + + + CC1E + Capture/Compare 1 output + enable + 0 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + 0x00000000 + + + CNT + counter value + 0 + 16 + read-write + + + UIFCPY + UIF copy + 31 + 1 + read-only + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR + Auto-reload value + 0 + 16 + + + + + RCR + RCR + repetition counter register + 0x30 + 0x20 + read-write + 0x0000 + + + REP + Repetition counter value + 0 + 8 + + + + + CCR1 + CCR1 + capture/compare register 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + CCR1 + Capture/Compare 1 value + 0 + 16 + + + + + CCR2 + CCR2 + capture/compare register 2 + 0x38 + 0x20 + read-write + 0x00000000 + + + CCR2 + Capture/Compare 2 value + 0 + 16 + + + + + BDTR + BDTR + break and dead-time register + 0x44 + 0x20 + read-write + 0x0000 + + + MOE + Main output enable + 15 + 1 + + + AOE + Automatic output enable + 14 + 1 + + + BKP + Break polarity + 13 + 1 + + + BKE + Break enable + 12 + 1 + + + OSSR + Off-state selection for Run + mode + 11 + 1 + + + OSSI + Off-state selection for Idle + mode + 10 + 1 + + + LOCK + Lock configuration + 8 + 2 + + + DTG + Dead-time generator setup + 0 + 8 + + + BKF + Break filter + 16 + 4 + + + + + DCR + DCR + DMA control register + 0x48 + 0x20 + read-write + 0x0000 + + + DBL + DMA burst length + 8 + 5 + + + DBA + DMA base address + 0 + 5 + + + + + DMAR + DMAR + DMA address for full transfer + 0x4C + 0x20 + read-write + 0x0000 + + + DMAB + DMA register for burst + accesses + 0 + 16 + + + + + AF1 + AF1 + TIM15 alternate fdfsdm1_breakon register + 1 + 0x60 + 0x20 + read-write + 0x0000 + + + BKINE + BRK BKIN input enable + 0 + 1 + + + BKCMP1E + BRK COMP1 enable + 1 + 1 + + + BKCMP2E + BRK COMP2 enable + 2 + 1 + + + BKDF1BK0E + BRK dfsdm1_break[0] enable + 8 + 1 + + + BKINP + BRK BKIN input polarity + 9 + 1 + + + BKCMP1P + BRK COMP1 input polarity + 10 + 1 + + + BKCMP2P + BRK COMP2 input polarity + 11 + 1 + + + + + TISEL + TISEL + TIM15 input selection register + 0x68 + 0x20 + read-write + 0x0000 + + + TI1SEL + selects TI1[0] to TI1[15] + input + 0 + 4 + + + TI2SEL + selects TI2[0] to TI2[15] + input + 8 + 4 + + + + + + + USART1 + Universal synchronous asynchronous receiver + transmitter + USART + 0x40011000 + + 0x0 + 0x400 + registers + + + + CR1 + CR1 + Control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + RXFFIE + RXFIFO Full interrupt + enable + 31 + 1 + + + TXFEIE + TXFIFO empty interrupt + enable + 30 + 1 + + + FIFOEN + FIFO mode enable + 29 + 1 + + + M1 + Word length + 28 + 1 + + + EOBIE + End of Block interrupt + enable + 27 + 1 + + + RTOIE + Receiver timeout interrupt + enable + 26 + 1 + + + DEAT4 + Driver Enable assertion + time + 25 + 1 + + + DEAT3 + DEAT3 + 24 + 1 + + + DEAT2 + DEAT2 + 23 + 1 + + + DEAT1 + DEAT1 + 22 + 1 + + + DEAT0 + DEAT0 + 21 + 1 + + + DEDT4 + Driver Enable de-assertion + time + 20 + 1 + + + DEDT3 + DEDT3 + 19 + 1 + + + DEDT2 + DEDT2 + 18 + 1 + + + DEDT1 + DEDT1 + 17 + 1 + + + DEDT0 + DEDT0 + 16 + 1 + + + OVER8 + Oversampling mode + 15 + 1 + + + CMIE + Character match interrupt + enable + 14 + 1 + + + MME + Mute mode enable + 13 + 1 + + + M0 + Word length + 12 + 1 + + + WAKE + Receiver wakeup method + 11 + 1 + + + PCE + Parity control enable + 10 + 1 + + + PS + Parity selection + 9 + 1 + + + PEIE + PE interrupt enable + 8 + 1 + + + TXEIE + interrupt enable + 7 + 1 + + + TCIE + Transmission complete interrupt + enable + 6 + 1 + + + RXNEIE + RXNE interrupt enable + 5 + 1 + + + IDLEIE + IDLE interrupt enable + 4 + 1 + + + TE + Transmitter enable + 3 + 1 + + + RE + Receiver enable + 2 + 1 + + + UESM + USART enable in Stop mode + 1 + 1 + + + UE + USART enable + 0 + 1 + + + + + CR2 + CR2 + Control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + ADD4_7 + Address of the USART node + 28 + 4 + + + ADD0_3 + Address of the USART node + 24 + 4 + + + RTOEN + Receiver timeout enable + 23 + 1 + + + ABRMOD1 + Auto baud rate mode + 22 + 1 + + + ABRMOD0 + ABRMOD0 + 21 + 1 + + + ABREN + Auto baud rate enable + 20 + 1 + + + MSBFIRST + Most significant bit first + 19 + 1 + + + TAINV + Binary data inversion + 18 + 1 + + + TXINV + TX pin active level + inversion + 17 + 1 + + + RXINV + RX pin active level + inversion + 16 + 1 + + + SWAP + Swap TX/RX pins + 15 + 1 + + + LINEN + LIN mode enable + 14 + 1 + + + STOP + STOP bits + 12 + 2 + + + CLKEN + Clock enable + 11 + 1 + + + CPOL + Clock polarity + 10 + 1 + + + CPHA + Clock phase + 9 + 1 + + + LBCL + Last bit clock pulse + 8 + 1 + + + LBDIE + LIN break detection interrupt + enable + 6 + 1 + + + LBDL + LIN break detection length + 5 + 1 + + + ADDM7 + 7-bit Address Detection/4-bit Address + Detection + 4 + 1 + + + DIS_NSS + When the DSI_NSS bit is set, the NSS pin + input is ignored + 3 + 1 + + + SLVEN + Synchronous Slave mode + enable + 0 + 1 + + + + + CR3 + CR3 + Control register 3 + 0x8 + 0x20 + read-write + 0x0000 + + + TXFTCFG + TXFIFO threshold + configuration + 29 + 3 + + + RXFTIE + RXFIFO threshold interrupt + enable + 28 + 1 + + + RXFTCFG + Receive FIFO threshold + configuration + 25 + 3 + + + TCBGTIE + Transmission Complete before guard time, + interrupt enable + 24 + 1 + + + TXFTIE + TXFIFO threshold interrupt + enable + 23 + 1 + + + WUFIE + Wakeup from Stop mode interrupt + enable + 22 + 1 + + + WUS + Wakeup from Stop mode interrupt flag + selection + 20 + 2 + + + SCARCNT + Smartcard auto-retry count + 17 + 3 + + + DEP + Driver enable polarity + selection + 15 + 1 + + + DEM + Driver enable mode + 14 + 1 + + + DDRE + DMA Disable on Reception + Error + 13 + 1 + + + OVRDIS + Overrun Disable + 12 + 1 + + + ONEBIT + One sample bit method + enable + 11 + 1 + + + CTSIE + CTS interrupt enable + 10 + 1 + + + CTSE + CTS enable + 9 + 1 + + + RTSE + RTS enable + 8 + 1 + + + DMAT + DMA enable transmitter + 7 + 1 + + + DMAR + DMA enable receiver + 6 + 1 + + + SCEN + Smartcard mode enable + 5 + 1 + + + NACK + Smartcard NACK enable + 4 + 1 + + + HDSEL + Half-duplex selection + 3 + 1 + + + IRLP + Ir low-power + 2 + 1 + + + IREN + Ir mode enable + 1 + 1 + + + EIE + Error interrupt enable + 0 + 1 + + + + + BRR + BRR + Baud rate register + 0xC + 0x20 + read-write + 0x0000 + + + BRR_4_15 + DIV_Mantissa + 4 + 12 + + + BRR_0_3 + DIV_Fraction + 0 + 4 + + + + + GTPR + GTPR + Guard time and prescaler + register + 0x10 + 0x20 + read-write + 0x0000 + + + GT + Guard time value + 8 + 8 + + + PSC + Prescaler value + 0 + 8 + + + + + RTOR + RTOR + Receiver timeout register + 0x14 + 0x20 + read-write + 0x0000 + + + BLEN + Block Length + 24 + 8 + + + RTO + Receiver timeout value + 0 + 24 + + + + + RQR + RQR + Request register + 0x18 + 0x20 + write-only + 0x0000 + + + TXFRQ + Transmit data flush + request + 4 + 1 + + + RXFRQ + Receive data flush request + 3 + 1 + + + MMRQ + Mute mode request + 2 + 1 + + + SBKRQ + Send break request + 1 + 1 + + + ABRRQ + Auto baud rate request + 0 + 1 + + + + + ISR + ISR + Interrupt & status + register + 0x1C + 0x20 + read-only + 0x00C0 + + + TXFT + TXFIFO threshold flag + 27 + 1 + + + RXFT + RXFIFO threshold flag + 26 + 1 + + + TCBGT + Transmission complete before guard time + flag + 25 + 1 + + + RXFF + RXFIFO Full + 24 + 1 + + + TXFE + TXFIFO Empty + 23 + 1 + + + REACK + REACK + 22 + 1 + + + TEACK + TEACK + 21 + 1 + + + WUF + WUF + 20 + 1 + + + RWU + RWU + 19 + 1 + + + SBKF + SBKF + 18 + 1 + + + CMF + CMF + 17 + 1 + + + BUSY + BUSY + 16 + 1 + + + ABRF + ABRF + 15 + 1 + + + ABRE + ABRE + 14 + 1 + + + UDR + SPI slave underrun error + flag + 13 + 1 + + + EOBF + EOBF + 12 + 1 + + + RTOF + RTOF + 11 + 1 + + + CTS + CTS + 10 + 1 + + + CTSIF + CTSIF + 9 + 1 + + + LBDF + LBDF + 8 + 1 + + + TXE + TXE + 7 + 1 + + + TC + TC + 6 + 1 + + + RXNE + RXNE + 5 + 1 + + + IDLE + IDLE + 4 + 1 + + + ORE + ORE + 3 + 1 + + + NF + NF + 2 + 1 + + + FE + FE + 1 + 1 + + + PE + PE + 0 + 1 + + + + + ICR + ICR + Interrupt flag clear register + 0x20 + 0x20 + write-only + 0x0000 + + + WUCF + Wakeup from Stop mode clear + flag + 20 + 1 + + + CMCF + Character match clear flag + 17 + 1 + + + UDRCF + SPI slave underrun clear + flag + 13 + 1 + + + EOBCF + End of block clear flag + 12 + 1 + + + RTOCF + Receiver timeout clear + flag + 11 + 1 + + + CTSCF + CTS clear flag + 9 + 1 + + + LBDCF + LIN break detection clear + flag + 8 + 1 + + + TCBGTC + Transmission complete before Guard time + clear flag + 7 + 1 + + + TCCF + Transmission complete clear + flag + 6 + 1 + + + TXFECF + TXFIFO empty clear flag + 5 + 1 + + + IDLECF + Idle line detected clear + flag + 4 + 1 + + + ORECF + Overrun error clear flag + 3 + 1 + + + NCF + Noise detected clear flag + 2 + 1 + + + FECF + Framing error clear flag + 1 + 1 + + + PECF + Parity error clear flag + 0 + 1 + + + + + RDR + RDR + Receive data register + 0x24 + 0x20 + read-only + 0x0000 + + + RDR + Receive data value + 0 + 9 + + + + + TDR + TDR + Transmit data register + 0x28 + 0x20 + read-write + 0x0000 + + + TDR + Transmit data value + 0 + 9 + + + + + PRESC + PRESC + USART prescaler register + 0x2C + 0x20 + read-write + 0x0000 + + + PRESCALER + Clock prescaler + 0 + 4 + + + + + + + USART2 + 0x40004400 + + USART1 + USART1 global interrupt + 37 + + + + USART3 + 0x40004800 + + USART2 + USART2 global interrupt + 38 + + + + UART4 + 0x40004C00 + + USART3 + USART3 global interrupt + 39 + + + UART4 + UART4 global interrupt + 52 + + + + UART5 + 0x40005000 + + UART5 + UART5 global interrupt + 53 + + + + USART6 + 0x40011400 + + USART6 + USART6 global interrupt + 71 + + + + UART7 + 0x40007800 + + UART7 + UART7 global interrupt + 82 + + + + UART8 + 0x40007C00 + + UART8 + UART8 global interrupt + 83 + + + + TIM1 + Advanced-timers + TIM + 0x40010000 + + 0x0 + 0x400 + registers + + + TIM1_BRK + TIM1 break interrupt + 24 + + + TIM1_UP + TIM1 update interrupt + 25 + + + TIM1_TRG_COM + TIM1 trigger and commutation + 26 + + + TIM_CC + TIM1 capture / compare + 27 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + CEN + Counter enable + 0 + 1 + + + UDIS + Update disable + 1 + 1 + + + URS + Update request source + 2 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + DIR + Direction + 4 + 1 + + + CMS + Center-aligned mode + selection + 5 + 2 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + CKD + Clock division + 8 + 2 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + MMS2 + Master mode selection 2 + 20 + 4 + + + OIS6 + Output Idle state 6 + 18 + 1 + + + OIS5 + Output Idle state 5 + 16 + 1 + + + OIS4 + Output Idle state 4 + 14 + 1 + + + OIS3N + Output Idle state 3 + 13 + 1 + + + OIS3 + Output Idle state 3 + 12 + 1 + + + OIS2N + Output Idle state 2 + 11 + 1 + + + OIS2 + Output Idle state 2 + 10 + 1 + + + OIS1N + Output Idle state 1 + 9 + 1 + + + OIS1 + Output Idle state 1 + 8 + 1 + + + TI1S + TI1 selection + 7 + 1 + + + MMS + Master mode selection + 4 + 3 + + + CCDS + Capture/compare DMA + selection + 3 + 1 + + + CCUS + Capture/compare control update + selection + 2 + 1 + + + CCPC + Capture/compare preloaded + control + 0 + 1 + + + + + SMCR + SMCR + slave mode control register + 0x8 + 0x20 + read-write + 0x0000 + + + SMS + Slave mode selection + 0 + 3 + + + TS + Trigger selection + 4 + 3 + + + MSM + Master/Slave mode + 7 + 1 + + + ETF + External trigger filter + 8 + 4 + + + ETPS + External trigger prescaler + 12 + 2 + + + ECE + External clock enable + 14 + 1 + + + ETP + External trigger polarity + 15 + 1 + + + SMS_3 + Slave mode selection - bit + 3 + 16 + 1 + + + TS_4_3 + Trigger selection - bit + 4:3 + 20 + 2 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + TDE + Trigger DMA request enable + 14 + 1 + + + COMDE + COM DMA request enable + 13 + 1 + + + CC4DE + Capture/Compare 4 DMA request + enable + 12 + 1 + + + CC3DE + Capture/Compare 3 DMA request + enable + 11 + 1 + + + CC2DE + Capture/Compare 2 DMA request + enable + 10 + 1 + + + CC1DE + Capture/Compare 1 DMA request + enable + 9 + 1 + + + UDE + Update DMA request enable + 8 + 1 + + + TIE + Trigger interrupt enable + 6 + 1 + + + CC4IE + Capture/Compare 4 interrupt + enable + 4 + 1 + + + CC3IE + Capture/Compare 3 interrupt + enable + 3 + 1 + + + CC2IE + Capture/Compare 2 interrupt + enable + 2 + 1 + + + CC1IE + Capture/Compare 1 interrupt + enable + 1 + 1 + + + UIE + Update interrupt enable + 0 + 1 + + + BIE + Break interrupt enable + 7 + 1 + + + COMIE + COM interrupt enable + 5 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + CC6IF + Compare 6 interrupt flag + 17 + 1 + + + CC5IF + Compare 5 interrupt flag + 16 + 1 + + + SBIF + System Break interrupt + flag + 13 + 1 + + + CC4OF + Capture/Compare 4 overcapture + flag + 12 + 1 + + + CC3OF + Capture/Compare 3 overcapture + flag + 11 + 1 + + + CC2OF + Capture/compare 2 overcapture + flag + 10 + 1 + + + CC1OF + Capture/Compare 1 overcapture + flag + 9 + 1 + + + B2IF + Break 2 interrupt flag + 8 + 1 + + + BIF + Break interrupt flag + 7 + 1 + + + TIF + Trigger interrupt flag + 6 + 1 + + + COMIF + COM interrupt flag + 5 + 1 + + + CC4IF + Capture/Compare 4 interrupt + flag + 4 + 1 + + + CC3IF + Capture/Compare 3 interrupt + flag + 3 + 1 + + + CC2IF + Capture/Compare 2 interrupt + flag + 2 + 1 + + + CC1IF + Capture/compare 1 interrupt + flag + 1 + 1 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + UG + Update generation + 0 + 1 + + + CC1G + Capture/compare 1 + generation + 1 + 1 + + + CC2G + Capture/compare 2 + generation + 2 + 1 + + + CC3G + Capture/compare 3 + generation + 3 + 1 + + + CC4G + Capture/compare 4 + generation + 4 + 1 + + + COMG + Capture/Compare control update + generation + 5 + 1 + + + TG + Trigger generation + 6 + 1 + + + BG + Break generation + 7 + 1 + + + B2G + Break 2 generation + 8 + 1 + + + + + CCMR1_Output + CCMR1_Output + capture/compare mode register 1 (output + mode) + 0x18 + 0x20 + read-write + 0x00000000 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + OC1FE + Output Compare 1 fast + enable + 2 + 1 + + + OC1PE + Output Compare 1 preload + enable + 3 + 1 + + + OC1M + Output Compare 1 mode + 4 + 3 + + + OC1CE + Output Compare 1 clear + enable + 7 + 1 + + + CC2S + Capture/Compare 2 + selection + 8 + 2 + + + OC2FE + Output Compare 2 fast + enable + 10 + 1 + + + OC2PE + Output Compare 2 preload + enable + 11 + 1 + + + OC2M + Output Compare 2 mode + 12 + 3 + + + OC2CE + Output Compare 2 clear + enable + 15 + 1 + + + OC1M_3 + Output Compare 1 mode - bit + 3 + 16 + 1 + + + OC2M_3 + Output Compare 2 mode - bit + 3 + 24 + 1 + + + + + CCMR1_Input + CCMR1_Input + capture/compare mode register 1 (input + mode) + CCMR1_Output + 0x18 + 0x20 + read-write + 0x00000000 + + + IC2F + Input capture 2 filter + 12 + 4 + + + IC2PCS + Input capture 2 prescaler + 10 + 2 + + + CC2S + Capture/Compare 2 + selection + 8 + 2 + + + IC1F + Input capture 1 filter + 4 + 4 + + + ICPCS + Input capture 1 prescaler + 2 + 2 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + + + CCMR2_Output + CCMR2_Output + capture/compare mode register 2 (output + mode) + 0x1C + 0x20 + read-write + 0x00000000 + + + CC3S + Capture/Compare 3 + selection + 0 + 2 + + + OC3FE + Output compare 3 fast + enable + 2 + 1 + + + OC3PE + Output compare 3 preload + enable + 3 + 1 + + + OC3M + Output compare 3 mode + 4 + 3 + + + OC3CE + Output compare 3 clear + enable + 7 + 1 + + + CC4S + Capture/Compare 4 + selection + 8 + 2 + + + OC4FE + Output compare 4 fast + enable + 10 + 1 + + + OC4PE + Output compare 4 preload + enable + 11 + 1 + + + OC4M + Output compare 4 mode + 12 + 3 + + + OC4CE + Output compare 4 clear + enable + 15 + 1 + + + OC3M_3 + Output Compare 3 mode - bit + 3 + 16 + 1 + + + OC4M_4 + Output Compare 4 mode - bit + 3 + 24 + 1 + + + + + CCMR2_Input + CCMR2_Input + capture/compare mode register 2 (input + mode) + CCMR2_Output + 0x1C + 0x20 + read-write + 0x00000000 + + + IC4F + Input capture 4 filter + 12 + 4 + + + IC4PSC + Input capture 4 prescaler + 10 + 2 + + + CC4S + Capture/Compare 4 + selection + 8 + 2 + + + IC3F + Input capture 3 filter + 4 + 4 + + + IC3PSC + Input capture 3 prescaler + 2 + 2 + + + CC3S + Capture/compare 3 + selection + 0 + 2 + + + + + CCER + CCER + capture/compare enable + register + 0x20 + 0x20 + read-write + 0x0000 + + + CC1E + Capture/Compare 1 output + enable + 0 + 1 + + + CC1P + Capture/Compare 1 output + Polarity + 1 + 1 + + + CC1NE + Capture/Compare 1 complementary output + enable + 2 + 1 + + + CC1NP + Capture/Compare 1 output + Polarity + 3 + 1 + + + CC2E + Capture/Compare 2 output + enable + 4 + 1 + + + CC2P + Capture/Compare 2 output + Polarity + 5 + 1 + + + CC2NE + Capture/Compare 2 complementary output + enable + 6 + 1 + + + CC2NP + Capture/Compare 2 output + Polarity + 7 + 1 + + + CC3E + Capture/Compare 3 output + enable + 8 + 1 + + + CC3P + Capture/Compare 3 output + Polarity + 9 + 1 + + + CC3NE + Capture/Compare 3 complementary output + enable + 10 + 1 + + + CC3NP + Capture/Compare 3 output + Polarity + 11 + 1 + + + CC4E + Capture/Compare 4 output + enable + 12 + 1 + + + CC4P + Capture/Compare 3 output + Polarity + 13 + 1 + + + CC4NP + Capture/Compare 4 complementary output + polarity + 15 + 1 + + + CC5E + Capture/Compare 5 output + enable + 16 + 1 + + + CC5P + Capture/Compare 5 output + polarity + 17 + 1 + + + CC6E + Capture/Compare 6 output + enable + 20 + 1 + + + CC6P + Capture/Compare 6 output + polarity + 21 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + 0x00000000 + + + CNT + counter value + 0 + 16 + read-write + + + UIFCPY + UIF copy + 31 + 1 + read-only + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR + Auto-reload value + 0 + 16 + + + + + CCR1 + CCR1 + capture/compare register 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + CCR1 + Capture/Compare 1 value + 0 + 16 + + + + + CCR2 + CCR2 + capture/compare register 2 + 0x38 + 0x20 + read-write + 0x00000000 + + + CCR2 + Capture/Compare 2 value + 0 + 16 + + + + + CCR3 + CCR3 + capture/compare register 3 + 0x3C + 0x20 + read-write + 0x00000000 + + + CCR3 + Capture/Compare value + 0 + 16 + + + + + CCR4 + CCR4 + capture/compare register 4 + 0x40 + 0x20 + read-write + 0x00000000 + + + CCR4 + Capture/Compare value + 0 + 16 + + + + + DCR + DCR + DMA control register + 0x48 + 0x20 + read-write + 0x0000 + + + DBL + DMA burst length + 8 + 5 + + + DBA + DMA base address + 0 + 5 + + + + + DMAR + DMAR + DMA address for full transfer + 0x4C + 0x20 + read-write + 0x0000 + + + DMAB + DMA register for burst + accesses + 0 + 16 + + + + + RCR + RCR + repetition counter register + 0x30 + 0x20 + read-write + 0x0000 + + + REP + Repetition counter value + 0 + 8 + + + + + BDTR + BDTR + break and dead-time register + 0x44 + 0x20 + read-write + 0x0000 + + + DTG + Dead-time generator setup + 0 + 8 + + + LOCK + Lock configuration + 8 + 2 + + + OSSI + Off-state selection for Idle + mode + 10 + 1 + + + OSSR + Off-state selection for Run + mode + 11 + 1 + + + BKE + Break enable + 12 + 1 + + + BKP + Break polarity + 13 + 1 + + + AOE + Automatic output enable + 14 + 1 + + + MOE + Main output enable + 15 + 1 + + + BKF + Break filter + 16 + 4 + + + BK2F + Break 2 filter + 20 + 4 + + + BK2E + Break 2 enable + 24 + 1 + + + BK2P + Break 2 polarity + 25 + 1 + + + + + CCMR3_Output + CCMR3_Output + capture/compare mode register 3 (output + mode) + 0x54 + 0x20 + read-write + 0x0000 + + + OC5FE + Output compare 5 fast + enable + 2 + 1 + + + OC5PE + Output compare 5 preload + enable + 3 + 1 + + + OC5M + Output compare 5 mode + 4 + 3 + + + OC5CE + Output compare 5 clear + enable + 7 + 1 + + + OC6FE + Output compare 6 fast + enable + 10 + 1 + + + OC6PE + Output compare 6 preload + enable + 11 + 1 + + + OC6M + Output compare 6 mode + 12 + 3 + + + OC6CE + Output compare 6 clear + enable + 15 + 1 + + + OC5M3 + Output Compare 5 mode + 16 + 1 + + + OC6M3 + Output Compare 6 mode + 24 + 1 + + + + + CCR5 + CCR5 + capture/compare register 5 + 0x58 + 0x20 + read-write + 0x0000 + + + CCR5 + Capture/Compare 5 value + 0 + 16 + + + GC5C1 + Group Channel 5 and Channel + 1 + 29 + 1 + + + GC5C2 + Group Channel 5 and Channel + 2 + 30 + 1 + + + GC5C3 + Group Channel 5 and Channel + 3 + 31 + 1 + + + + + CRR6 + CRR6 + capture/compare register 6 + 0x5C + 0x20 + read-write + 0x0000 + + + CCR6 + Capture/Compare 6 value + 0 + 16 + + + + + AF1 + AF1 + TIM1 alternate function option register + 1 + 0x60 + 0x20 + read-write + 0x0000 + + + BKINE + BRK BKIN input enable + 0 + 1 + + + BKCMP1E + BRK COMP1 enable + 1 + 1 + + + BKCMP2E + BRK COMP2 enable + 2 + 1 + + + BKDF1BK0E + BRK dfsdm1_break[0] enable + 8 + 1 + + + BKINP + BRK BKIN input polarity + 9 + 1 + + + BKCMP1P + BRK COMP1 input polarity + 10 + 1 + + + BKCMP2P + BRK COMP2 input polarity + 11 + 1 + + + ETRSEL + ETR source selection + 14 + 4 + + + + + AF2 + AF2 + TIM1 Alternate function odfsdm1_breakster + 2 + 0x64 + 0x20 + read-write + 0x0000 + + + BK2INE + BRK2 BKIN input enable + 0 + 1 + + + BK2CMP1E + BRK2 COMP1 enable + 1 + 1 + + + BK2CMP2E + BRK2 COMP2 enable + 2 + 1 + + + BK2DF1BK1E + BRK2 dfsdm1_break[1] + enable + 8 + 1 + + + BK2INP + BRK2 BKIN2 input polarity + 9 + 1 + + + BK2CMP1P + BRK2 COMP1 input polarit + 10 + 1 + + + BK2CMP2P + BRK2 COMP2 input polarity + 11 + 1 + + + + + TISEL + TISEL + TIM1 timer input selection + register + 0x68 + 0x20 + read-write + 0x0000 + + + TI1SEL + selects TI1[0] to TI1[15] + input + 0 + 4 + + + TI2SEL + selects TI2[0] to TI2[15] + input + 8 + 4 + + + TI3SEL + selects TI3[0] to TI3[15] + input + 16 + 4 + + + TI4SEL + selects TI4[0] to TI4[15] + input + 24 + 4 + + + + + + + TIM8 + 0x40010400 + + TIM8_CC + TIM8 capture / compare + 46 + + + + FDCAN1 + FDCAN1 + FDCAN + 0x4000A000 + + 0x0 + 0x400 + registers + + + FDCAN1_IT0 + FDCAN1 Interrupt 0 + 19 + + + FDCAN1_IT1 + FDCAN1 Interrupt 1 + 21 + + + FDCAN_CAL + CAN2TX interrupts + 63 + + + + FDCAN_CREL + FDCAN_CREL + FDCAN Core Release Register + 0x0 + 0x20 + read-only + 0x00000000 + + + REL + Core release + 28 + 4 + + + STEP + Step of Core release + 24 + 4 + + + SUBSTEP + Sub-step of Core release + 20 + 4 + + + YEAR + Timestamp Year + 16 + 4 + + + MON + Timestamp Month + 8 + 8 + + + DAY + Timestamp Day + 0 + 8 + + + + + FDCAN_ENDN + FDCAN_ENDN + FDCAN Core Release Register + 0x4 + 0x20 + read-only + 0x00000000 + + + ETV + Endiannes Test Value + 0 + 32 + + + + + FDCAN_DBTP + FDCAN_DBTP + FDCAN Data Bit Timing and Prescaler + Register + 0xC + 0x20 + read-only + 0x00000000 + + + DSJW + Synchronization Jump Width + 0 + 4 + + + DTSEG2 + Data time segment after sample + point + 4 + 4 + + + DTSEG1 + Data time segment after sample + point + 8 + 5 + + + DBRP + Data BIt Rate Prescaler + 16 + 5 + + + TDC + Transceiver Delay + Compensation + 23 + 1 + + + + + FDCAN_TEST + FDCAN_TEST + FDCAN Test Register + 0x10 + 0x20 + read-only + 0x00000000 + + + LBCK + Loop Back mode + 4 + 1 + + + TX + Loop Back mode + 5 + 2 + + + RX + Control of Transmit Pin + 7 + 1 + + + + + FDCAN_RWD + FDCAN_RWD + FDCAN RAM Watchdog Register + 0x14 + 0x20 + read-only + 0x00000000 + + + WDV + Watchdog value + 8 + 8 + + + WDC + Watchdog configuration + 0 + 8 + + + + + FDCAN_CCCR + FDCAN_CCCR + FDCAN CC Control Register + 0x18 + 0x20 + read-write + 0x00000000 + + + INIT + Initialization + 0 + 1 + + + CCE + Configuration Change + Enable + 1 + 1 + + + ASM + ASM Restricted Operation + Mode + 2 + 1 + + + CSA + Clock Stop Acknowledge + 3 + 1 + + + CSR + Clock Stop Request + 4 + 1 + + + MON + Bus Monitoring Mode + 5 + 1 + + + DAR + Disable Automatic + Retransmission + 6 + 1 + + + TEST + Test Mode Enable + 7 + 1 + + + FDOE + FD Operation Enable + 8 + 1 + + + BSE + FDCAN Bit Rate Switching + 9 + 1 + + + PXHD + Protocol Exception Handling + Disable + 12 + 1 + + + EFBI + Edge Filtering during Bus + Integration + 13 + 1 + + + TXP + TXP + 14 + 1 + + + NISO + Non ISO Operation + 15 + 1 + + + + + FDCAN_NBTP + FDCAN_NBTP + FDCAN Nominal Bit Timing and Prescaler + Register + 0x1C + 0x20 + read-write + 0x00000000 + + + NSJW + NSJW: Nominal (Re)Synchronization Jump + Width + 25 + 7 + + + NBRP + Bit Rate Prescaler + 16 + 9 + + + NTSEG1 + Nominal Time segment before sample + point + 8 + 8 + + + TSEG2 + Nominal Time segment after sample + point + 0 + 7 + + + + + FDCAN_TSCC + FDCAN_TSCC + FDCAN Timestamp Counter Configuration + Register + 0x20 + 0x20 + read-write + 0x00000000 + + + TCP + Timestamp Counter + Prescaler + 16 + 4 + + + TSS + Timestamp Select + 0 + 2 + + + + + FDCAN_TSCV + FDCAN_TSCV + FDCAN Timestamp Counter Value + Register + 0x24 + 0x20 + read-write + 0x00000000 + + + TSC + Timestamp Counter + 0 + 16 + + + + + FDCAN_TOCC + FDCAN_TOCC + FDCAN Timeout Counter Configuration + Register + 0x28 + 0x20 + read-write + 0x00000000 + + + ETOC + Enable Timeout Counter + 0 + 1 + + + TOS + Timeout Select + 1 + 2 + + + TOP + Timeout Period + 16 + 16 + + + + + FDCAN_TOCV + FDCAN_TOCV + FDCAN Timeout Counter Value + Register + 0x2C + 0x20 + read-write + 0x00000000 + + + TOC + Timeout Counter + 0 + 16 + + + + + FDCAN_ECR + FDCAN_ECR + FDCAN Error Counter Register + 0x40 + 0x20 + read-write + 0x00000000 + + + CEL + AN Error Logging + 16 + 8 + + + RP + Receive Error Passive + 15 + 1 + + + TREC + Receive Error Counter + 8 + 7 + + + TEC + Transmit Error Counter + 0 + 8 + + + + + FDCAN_PSR + FDCAN_PSR + FDCAN Protocol Status Register + 0x44 + 0x20 + read-write + 0x00000000 + + + LEC + Last Error Code + 0 + 3 + + + ACT + Activity + 3 + 2 + + + EP + Error Passive + 5 + 1 + + + EW + Warning Status + 6 + 1 + + + BO + Bus_Off Status + 7 + 1 + + + DLEC + Data Last Error Code + 8 + 3 + + + RESI + ESI flag of last received FDCAN + Message + 11 + 1 + + + RBRS + BRS flag of last received FDCAN + Message + 12 + 1 + + + REDL + Received FDCAN Message + 13 + 1 + + + PXE + Protocol Exception Event + 14 + 1 + + + TDCV + Transmitter Delay Compensation + Value + 16 + 7 + + + + + FDCAN_TDCR + FDCAN_TDCR + FDCAN Transmitter Delay Compensation + Register + 0x48 + 0x20 + read-only + 0x00000000 + + + TDCF + Transmitter Delay Compensation Filter + Window Length + 0 + 7 + + + TDCO + Transmitter Delay Compensation + Offset + 8 + 7 + + + + + FDCAN_IR + FDCAN_IR + FDCAN Interrupt Register + 0x50 + 0x20 + read-only + 0x00000000 + + + RF0N + Rx FIFO 0 New Message + 0 + 1 + + + RF0W + Rx FIFO 0 Full + 1 + 1 + + + RF0F + Rx FIFO 0 Full + 2 + 1 + + + RF0L + Rx FIFO 0 Message Lost + 3 + 1 + + + RF1N + Rx FIFO 1 New Message + 4 + 1 + + + RF1W + Rx FIFO 1 Watermark + Reached + 5 + 1 + + + RF1F + Rx FIFO 1 Watermark + Reached + 6 + 1 + + + RF1L + Rx FIFO 1 Message Lost + 7 + 1 + + + HPM + High Priority Message + 8 + 1 + + + TC + Transmission Completed + 9 + 1 + + + TCF + Transmission Cancellation + Finished + 10 + 1 + + + TEF + Tx FIFO Empty + 11 + 1 + + + TEFN + Tx Event FIFO New Entry + 12 + 1 + + + TEFW + Tx Event FIFO Watermark + Reached + 13 + 1 + + + TEFF + Tx Event FIFO Full + 14 + 1 + + + TEFL + Tx Event FIFO Element Lost + 15 + 1 + + + TSW + Timestamp Wraparound + 16 + 1 + + + MRAF + Message RAM Access Failure + 17 + 1 + + + TOO + Timeout Occurred + 18 + 1 + + + DRX + Message stored to Dedicated Rx + Buffer + 19 + 1 + + + ELO + Error Logging Overflow + 22 + 1 + + + EP + Error Passive + 23 + 1 + + + EW + Warning Status + 24 + 1 + + + BO + Bus_Off Status + 25 + 1 + + + WDI + Watchdog Interrupt + 26 + 1 + + + PEA + Protocol Error in Arbitration Phase + (Nominal Bit Time is used) + 27 + 1 + + + PED + Protocol Error in Data Phase (Data Bit + Time is used) + 28 + 1 + + + ARA + Access to Reserved Address + 29 + 1 + + + + + FDCAN_IE + FDCAN_IE + FDCAN Interrupt Enable + Register + 0x54 + 0x20 + read-only + 0x00000000 + + + RF0NE + Rx FIFO 0 New Message + Enable + 0 + 1 + + + RF0WE + Rx FIFO 0 Full Enable + 1 + 1 + + + RF0FE + Rx FIFO 0 Full Enable + 2 + 1 + + + RF0LE + Rx FIFO 0 Message Lost + Enable + 3 + 1 + + + RF1NE + Rx FIFO 1 New Message + Enable + 4 + 1 + + + RF1WE + Rx FIFO 1 Watermark Reached + Enable + 5 + 1 + + + RF1FE + Rx FIFO 1 Watermark Reached + Enable + 6 + 1 + + + RF1LE + Rx FIFO 1 Message Lost + Enable + 7 + 1 + + + HPME + High Priority Message + Enable + 8 + 1 + + + TCE + Transmission Completed + Enable + 9 + 1 + + + TCFE + Transmission Cancellation Finished + Enable + 10 + 1 + + + TEFE + Tx FIFO Empty Enable + 11 + 1 + + + TEFNE + Tx Event FIFO New Entry + Enable + 12 + 1 + + + TEFWE + Tx Event FIFO Watermark Reached + Enable + 13 + 1 + + + TEFFE + Tx Event FIFO Full Enable + 14 + 1 + + + TEFLE + Tx Event FIFO Element Lost + Enable + 15 + 1 + + + TSWE + Timestamp Wraparound + Enable + 16 + 1 + + + MRAFE + Message RAM Access Failure + Enable + 17 + 1 + + + TOOE + Timeout Occurred Enable + 18 + 1 + + + DRXE + Message stored to Dedicated Rx Buffer + Enable + 19 + 1 + + + BECE + Bit Error Corrected Interrupt + Enable + 20 + 1 + + + BEUE + Bit Error Uncorrected Interrupt + Enable + 21 + 1 + + + ELOE + Error Logging Overflow + Enable + 22 + 1 + + + EPE + Error Passive Enable + 23 + 1 + + + EWE + Warning Status Enable + 24 + 1 + + + BOE + Bus_Off Status Enable + 25 + 1 + + + WDIE + Watchdog Interrupt Enable + 26 + 1 + + + PEAE + Protocol Error in Arbitration Phase + Enable + 27 + 1 + + + PEDE + Protocol Error in Data Phase + Enable + 28 + 1 + + + ARAE + Access to Reserved Address + Enable + 29 + 1 + + + + + FDCAN_ILS + FDCAN_ILS + FDCAN Interrupt Line Select + Register + 0x58 + 0x20 + read-only + 0x00000000 + + + RF0NL + Rx FIFO 0 New Message Interrupt + Line + 0 + 1 + + + RF0WL + Rx FIFO 0 Watermark Reached Interrupt + Line + 1 + 1 + + + RF0FL + Rx FIFO 0 Full Interrupt + Line + 2 + 1 + + + RF0LL + Rx FIFO 0 Message Lost Interrupt + Line + 3 + 1 + + + RF1NL + Rx FIFO 1 New Message Interrupt + Line + 4 + 1 + + + RF1WL + Rx FIFO 1 Watermark Reached Interrupt + Line + 5 + 1 + + + RF1FL + Rx FIFO 1 Full Interrupt + Line + 6 + 1 + + + RF1LL + Rx FIFO 1 Message Lost Interrupt + Line + 7 + 1 + + + HPML + High Priority Message Interrupt + Line + 8 + 1 + + + TCL + Transmission Completed Interrupt + Line + 9 + 1 + + + TCFL + Transmission Cancellation Finished + Interrupt Line + 10 + 1 + + + TEFL + Tx FIFO Empty Interrupt + Line + 11 + 1 + + + TEFNL + Tx Event FIFO New Entry Interrupt + Line + 12 + 1 + + + TEFWL + Tx Event FIFO Watermark Reached + Interrupt Line + 13 + 1 + + + TEFFL + Tx Event FIFO Full Interrupt + Line + 14 + 1 + + + TEFLL + Tx Event FIFO Element Lost Interrupt + Line + 15 + 1 + + + TSWL + Timestamp Wraparound Interrupt + Line + 16 + 1 + + + MRAFL + Message RAM Access Failure Interrupt + Line + 17 + 1 + + + TOOL + Timeout Occurred Interrupt + Line + 18 + 1 + + + DRXL + Message stored to Dedicated Rx Buffer + Interrupt Line + 19 + 1 + + + BECL + Bit Error Corrected Interrupt + Line + 20 + 1 + + + BEUL + Bit Error Uncorrected Interrupt + Line + 21 + 1 + + + ELOL + Error Logging Overflow Interrupt + Line + 22 + 1 + + + EPL + Error Passive Interrupt + Line + 23 + 1 + + + EWL + Warning Status Interrupt + Line + 24 + 1 + + + BOL + Bus_Off Status + 25 + 1 + + + WDIL + Watchdog Interrupt Line + 26 + 1 + + + PEAL + Protocol Error in Arbitration Phase + Line + 27 + 1 + + + PEDL + Protocol Error in Data Phase + Line + 28 + 1 + + + ARAL + Access to Reserved Address + Line + 29 + 1 + + + + + FDCAN_ILE + FDCAN_ILE + FDCAN Interrupt Line Enable + Register + 0x5C + 0x20 + read-write + 0x00000000 + + + EINT0 + Enable Interrupt Line 0 + 0 + 1 + + + EINT1 + Enable Interrupt Line 1 + 1 + 1 + + + + + FDCAN_GFC + FDCAN_GFC + FDCAN Global Filter Configuration + Register + 0x80 + 0x20 + read-write + 0x00000000 + + + RRFE + Reject Remote Frames + Extended + 0 + 1 + + + RRFS + Reject Remote Frames + Standard + 1 + 1 + + + ANFE + Accept Non-matching Frames + Extended + 2 + 2 + + + ANFS + Accept Non-matching Frames + Standard + 4 + 2 + + + + + FDCAN_SIDFC + FDCAN_SIDFC + FDCAN Standard ID Filter Configuration + Register + 0x84 + 0x20 + read-write + 0x00000000 + + + FLSSA + Filter List Standard Start + Address + 2 + 14 + + + LSS + List Size Standard + 16 + 8 + + + + + FDCAN_XIDFC + FDCAN_XIDFC + FDCAN Extended ID Filter Configuration + Register + 0x88 + 0x20 + read-write + 0x00000000 + + + FLESA + Filter List Standard Start + Address + 2 + 14 + + + LSE + List Size Extended + 16 + 8 + + + + + FDCAN_XIDAM + FDCAN_XIDAM + FDCAN Extended ID and Mask + Register + 0x90 + 0x20 + read-write + 0x00000000 + + + EIDM + Extended ID Mask + 0 + 29 + + + + + FDCAN_HPMS + FDCAN_HPMS + FDCAN High Priority Message Status + Register + 0x94 + 0x20 + read-only + 0x00000000 + + + BIDX + Buffer Index + 0 + 6 + + + MSI + Message Storage Indicator + 6 + 2 + + + FIDX + Filter Index + 8 + 7 + + + FLST + Filter List + 15 + 1 + + + + + FDCAN_NDAT1 + FDCAN_NDAT1 + FDCAN New Data 1 Register + 0x98 + 0x20 + read-only + 0x00000000 + + + ND0 + New data + 0 + 1 + + + ND1 + New data + 1 + 1 + + + ND2 + New data + 2 + 1 + + + ND3 + New data + 3 + 1 + + + ND4 + New data + 4 + 1 + + + ND5 + New data + 5 + 1 + + + ND6 + New data + 6 + 1 + + + ND7 + New data + 7 + 1 + + + ND8 + New data + 8 + 1 + + + ND9 + New data + 9 + 1 + + + ND10 + New data + 10 + 1 + + + ND11 + New data + 11 + 1 + + + ND12 + New data + 12 + 1 + + + ND13 + New data + 13 + 1 + + + ND14 + New data + 14 + 1 + + + ND15 + New data + 15 + 1 + + + ND16 + New data + 16 + 1 + + + ND17 + New data + 17 + 1 + + + ND18 + New data + 18 + 1 + + + ND19 + New data + 19 + 1 + + + ND20 + New data + 20 + 1 + + + ND21 + New data + 21 + 1 + + + ND22 + New data + 22 + 1 + + + ND23 + New data + 23 + 1 + + + ND24 + New data + 24 + 1 + + + ND25 + New data + 25 + 1 + + + ND26 + New data + 26 + 1 + + + ND27 + New data + 27 + 1 + + + ND28 + New data + 28 + 1 + + + ND29 + New data + 29 + 1 + + + ND30 + New data + 30 + 1 + + + ND31 + New data + 31 + 1 + + + + + FDCAN_NDAT2 + FDCAN_NDAT2 + FDCAN New Data 2 Register + 0x9C + 0x20 + read-only + 0x00000000 + + + ND32 + New data + 0 + 1 + + + ND33 + New data + 1 + 1 + + + ND34 + New data + 2 + 1 + + + ND35 + New data + 3 + 1 + + + ND36 + New data + 4 + 1 + + + ND37 + New data + 5 + 1 + + + ND38 + New data + 6 + 1 + + + ND39 + New data + 7 + 1 + + + ND40 + New data + 8 + 1 + + + ND41 + New data + 9 + 1 + + + ND42 + New data + 10 + 1 + + + ND43 + New data + 11 + 1 + + + ND44 + New data + 12 + 1 + + + ND45 + New data + 13 + 1 + + + ND46 + New data + 14 + 1 + + + ND47 + New data + 15 + 1 + + + ND48 + New data + 16 + 1 + + + ND49 + New data + 17 + 1 + + + ND50 + New data + 18 + 1 + + + ND51 + New data + 19 + 1 + + + ND52 + New data + 20 + 1 + + + ND53 + New data + 21 + 1 + + + ND54 + New data + 22 + 1 + + + ND55 + New data + 23 + 1 + + + ND56 + New data + 24 + 1 + + + ND57 + New data + 25 + 1 + + + ND58 + New data + 26 + 1 + + + ND59 + New data + 27 + 1 + + + ND60 + New data + 28 + 1 + + + ND61 + New data + 29 + 1 + + + ND62 + New data + 30 + 1 + + + ND63 + New data + 31 + 1 + + + + + FDCAN_RXF0C + FDCAN_RXF0C + FDCAN Rx FIFO 0 Configuration + Register + 0xA0 + 0x20 + read-write + 0x00000000 + + + F0SA + Rx FIFO 0 Start Address + 2 + 14 + + + F0S + Rx FIFO 0 Size + 16 + 8 + + + F0WM + FIFO 0 Watermark + 24 + 8 + + + + + FDCAN_RXF0S + FDCAN_RXF0S + FDCAN Rx FIFO 0 Status + Register + 0xA4 + 0x20 + read-write + 0x00000000 + + + F0FL + Rx FIFO 0 Fill Level + 0 + 7 + + + F0G + Rx FIFO 0 Get Index + 8 + 6 + + + F0P + Rx FIFO 0 Put Index + 16 + 6 + + + F0F + Rx FIFO 0 Full + 24 + 1 + + + RF0L + Rx FIFO 0 Message Lost + 25 + 1 + + + + + FDCAN_RXF0A + FDCAN_RXF0A + CAN Rx FIFO 0 Acknowledge + Register + 0xA8 + 0x20 + read-write + 0x00000000 + + + FA01 + Rx FIFO 0 Acknowledge + Index + 0 + 6 + + + + + FDCAN_RXBC + FDCAN_RXBC + FDCAN Rx Buffer Configuration + Register + 0xAC + 0x20 + read-write + 0x00000000 + + + RBSA + Rx Buffer Start Address + 2 + 14 + + + + + FDCAN_RXF1C + FDCAN_RXF1C + FDCAN Rx FIFO 1 Configuration + Register + 0xB0 + 0x20 + read-write + 0x00000000 + + + F1SA + Rx FIFO 1 Start Address + 2 + 14 + + + F1S + Rx FIFO 1 Size + 16 + 7 + + + F1WM + Rx FIFO 1 Watermark + 24 + 7 + + + + + FDCAN_RXF1S + FDCAN_RXF1S + FDCAN Rx FIFO 1 Status + Register + 0xB4 + 0x20 + read-write + 0x00000000 + + + F1FL + Rx FIFO 1 Fill Level + 0 + 7 + + + F1GI + Rx FIFO 1 Get Index + 8 + 7 + + + F1PI + Rx FIFO 1 Put Index + 16 + 7 + + + F1F + Rx FIFO 1 Full + 24 + 1 + + + RF1L + Rx FIFO 1 Message Lost + 25 + 1 + + + DMS + Debug Message Status + 30 + 2 + + + + + FDCAN_RXF1A + FDCAN_RXF1A + FDCAN Rx FIFO 1 Acknowledge + Register + 0xB8 + 0x20 + read-write + 0x00000000 + + + F1AI + Rx FIFO 1 Acknowledge + Index + 0 + 6 + + + + + FDCAN_RXESC + FDCAN_RXESC + FDCAN Rx Buffer Element Size Configuration + Register + 0xBC + 0x20 + read-write + 0x00000000 + + + F0DS + Rx FIFO 1 Data Field Size: + 0 + 3 + + + F1DS + Rx FIFO 0 Data Field Size: + 4 + 3 + + + RBDS + Rx Buffer Data Field Size: + 8 + 3 + + + + + FDCAN_TXBC + FDCAN_TXBC + FDCAN Tx Buffer Configuration + Register + 0xC0 + 0x20 + read-write + 0x00000000 + + + TBSA + Tx Buffers Start Address + 2 + 14 + + + NDTB + Number of Dedicated Transmit + Buffers + 16 + 6 + + + TFQS + Transmit FIFO/Queue Size + 24 + 6 + + + TFQM + Tx FIFO/Queue Mode + 30 + 1 + + + + + FDCAN_TXFQS + FDCAN_TXFQS + FDCAN Tx FIFO/Queue Status + Register + 0xC4 + 0x20 + read-only + 0x00000000 + + + TFFL + Tx FIFO Free Level + 0 + 6 + + + TFGI + TFGI + 8 + 5 + + + TFQPI + Tx FIFO/Queue Put Index + 16 + 5 + + + TFQF + Tx FIFO/Queue Full + 21 + 1 + + + + + FDCAN_TXESC + FDCAN_TXESC + FDCAN Tx Buffer Element Size Configuration + Register + 0xC8 + 0x20 + read-write + 0x00000000 + + + TBDS + Tx Buffer Data Field Size: + 0 + 3 + + + + + FDCAN_TXBRP + FDCAN_TXBRP + FDCAN Tx Buffer Request Pending + Register + 0xCC + 0x20 + read-only + 0x00000000 + + + TRP + Transmission Request + Pending + 0 + 32 + + + + + FDCAN_TXBAR + FDCAN_TXBAR + FDCAN Tx Buffer Add Request + Register + 0xD0 + 0x20 + read-write + 0x00000000 + + + AR + Add Request + 0 + 32 + + + + + FDCAN_TXBCR + FDCAN_TXBCR + FDCAN Tx Buffer Cancellation Request + Register + 0xD4 + 0x20 + read-write + 0x00000000 + + + CR + Cancellation Request + 0 + 32 + + + + + FDCAN_TXBTO + FDCAN_TXBTO + FDCAN Tx Buffer Transmission Occurred + Register + 0xD8 + 0x20 + read-write + 0x00000000 + + + TO + Transmission Occurred. + 0 + 32 + + + + + FDCAN_TXBCF + FDCAN_TXBCF + FDCAN Tx Buffer Cancellation Finished + Register + 0xDC + 0x20 + read-only + 0x00000000 + + + CF + Cancellation Finished + 0 + 32 + + + + + FDCAN_TXBTIE + FDCAN_TXBTIE + FDCAN Tx Buffer Transmission Interrupt + Enable Register + 0xE0 + 0x20 + read-write + 0x00000000 + + + TIE + Transmission Interrupt + Enable + 0 + 32 + + + + + FDCAN_TXBCIE + FDCAN_TXBCIE + FDCAN Tx Buffer Cancellation Finished + Interrupt Enable Register + 0xE4 + 0x20 + read-write + 0x00000000 + + + CF + Cancellation Finished Interrupt + Enable + 0 + 32 + + + + + FDCAN_TXEFC + FDCAN_TXEFC + FDCAN Tx Event FIFO Configuration + Register + 0xF0 + 0x20 + read-write + 0x00000000 + + + EFSA + Event FIFO Start Address + 2 + 14 + + + EFS + Event FIFO Size + 16 + 6 + + + EFWM + Event FIFO Watermark + 24 + 6 + + + + + FDCAN_TXEFS + FDCAN_TXEFS + FDCAN Tx Event FIFO Status + Register + 0xF4 + 0x20 + read-write + 0x00000000 + + + EFFL + Event FIFO Fill Level + 0 + 6 + + + EFGI + Event FIFO Get Index. + 8 + 5 + + + EFF + Event FIFO Full. + 24 + 1 + + + TEFL + Tx Event FIFO Element + Lost. + 25 + 1 + + + + + FDCAN_TXEFA + FDCAN_TXEFA + FDCAN Tx Event FIFO Acknowledge + Register + 0xF8 + 0x20 + read-write + 0x00000000 + + + EFAI + Event FIFO Acknowledge + Index + 0 + 5 + + + + + FDCAN_TTTMC + FDCAN_TTTMC + FDCAN TT Trigger Memory Configuration + Register + 0x100 + 0x20 + read-write + 0x00000000 + + + TMSA + Trigger Memory Start + Address + 2 + 14 + + + TME + Trigger Memory Elements + 16 + 7 + + + + + FDCAN_TTRMC + FDCAN_TTRMC + FDCAN TT Reference Message Configuration + Register + 0x104 + 0x20 + read-write + 0x00000000 + + + RID + Reference Identifier. + 0 + 29 + + + XTD + Extended Identifier + 30 + 1 + + + RMPS + Reference Message Payload + Select + 31 + 1 + + + + + FDCAN_TTOCF + FDCAN_TTOCF + FDCAN TT Operation Configuration + Register + 0x108 + 0x20 + read-write + 0x00000000 + + + OM + Operation Mode + 0 + 2 + + + GEN + Gap Enable + 3 + 1 + + + TM + Time Master + 4 + 1 + + + LDSDL + LD of Synchronization Deviation + Limit + 5 + 3 + + + IRTO + Initial Reference Trigger + Offset + 8 + 7 + + + EECS + Enable External Clock + Synchronization + 15 + 1 + + + AWL + Application Watchdog Limit + 16 + 8 + + + EGTF + Enable Global Time + Filtering + 24 + 1 + + + ECC + Enable Clock Calibration + 25 + 1 + + + EVTP + Event Trigger Polarity + 26 + 1 + + + + + FDCAN_TTMLM + FDCAN_TTMLM + FDCAN TT Matrix Limits + Register + 0x10C + 0x20 + read-write + 0x00000000 + + + CCM + Cycle Count Max + 0 + 6 + + + CSS + Cycle Start + Synchronization + 6 + 2 + + + TXEW + Tx Enable Window + 8 + 4 + + + ENTT + Expected Number of Tx + Triggers + 16 + 12 + + + + + FDCAN_TURCF + FDCAN_TURCF + FDCAN TUR Configuration + Register + 0x110 + 0x20 + read-write + 0x00000000 + + + NCL + Numerator Configuration + Low. + 0 + 16 + + + DC + Denominator Configuration. + 16 + 14 + + + ELT + Enable Local Time + 31 + 1 + + + + + FDCAN_TTOCN + FDCAN_TTOCN + FDCAN TT Operation Control + Register + 0x114 + 0x20 + read-write + 0x00000000 + + + SGT + Set Global time + 0 + 1 + + + ECS + External Clock + Synchronization + 1 + 1 + + + SWP + Stop Watch Polarity + 2 + 1 + + + SWS + Stop Watch Source. + 3 + 2 + + + RTIE + Register Time Mark Interrupt Pulse + Enable + 5 + 1 + + + TMC + Register Time Mark Compare + 6 + 2 + + + TTIE + Trigger Time Mark Interrupt Pulse + Enable + 8 + 1 + + + GCS + Gap Control Select + 9 + 1 + + + FGP + Finish Gap. + 10 + 1 + + + TMG + Time Mark Gap + 11 + 1 + + + NIG + Next is Gap + 12 + 1 + + + ESCN + External Synchronization + Control + 13 + 1 + + + LCKC + TT Operation Control Register + Locked + 15 + 1 + + + + + CAN_TTGTP + CAN_TTGTP + FDCAN TT Global Time Preset + Register + 0x118 + 0x20 + read-write + 0x00000000 + + + NCL + Time Preset + 0 + 16 + + + CTP + Cycle Time Target Phase + 16 + 16 + + + + + FDCAN_TTTMK + FDCAN_TTTMK + FDCAN TT Time Mark Register + 0x11C + 0x20 + read-write + 0x00000000 + + + TM + Time Mark + 0 + 16 + + + TICC + Time Mark Cycle Code + 16 + 7 + + + LCKM + TT Time Mark Register + Locked + 31 + 1 + + + + + FDCAN_TTIR + FDCAN_TTIR + FDCAN TT Interrupt Register + 0x120 + 0x20 + read-write + 0x00000000 + + + SBC + Start of Basic Cycle + 0 + 1 + + + SMC + Start of Matrix Cycle + 1 + 1 + + + CSM + Change of Synchronization + Mode + 2 + 1 + + + SOG + Start of Gap + 3 + 1 + + + RTMI + Register Time Mark + Interrupt. + 4 + 1 + + + TTMI + Trigger Time Mark Event + Internal + 5 + 1 + + + SWE + Stop Watch Event + 6 + 1 + + + GTW + Global Time Wrap + 7 + 1 + + + GTD + Global Time Discontinuity + 8 + 1 + + + GTE + Global Time Error + 9 + 1 + + + TXU + Tx Count Underflow + 10 + 1 + + + TXO + Tx Count Overflow + 11 + 1 + + + SE1 + Scheduling Error 1 + 12 + 1 + + + SE2 + Scheduling Error 2 + 13 + 1 + + + ELC + Error Level Changed. + 14 + 1 + + + IWTG + Initialization Watch + Trigger + 15 + 1 + + + WT + Watch Trigger + 16 + 1 + + + AW + Application Watchdog + 17 + 1 + + + CER + Configuration Error + 18 + 1 + + + + + FDCAN_TTIE + FDCAN_TTIE + FDCAN TT Interrupt Enable + Register + 0x124 + 0x20 + read-write + 0x00000000 + + + SBCE + Start of Basic Cycle Interrupt + Enable + 0 + 1 + + + SMCE + Start of Matrix Cycle Interrupt + Enable + 1 + 1 + + + CSME + Change of Synchronization Mode Interrupt + Enable + 2 + 1 + + + SOGE + Start of Gap Interrupt + Enable + 3 + 1 + + + RTMIE + Register Time Mark Interrupt + Enable + 4 + 1 + + + TTMIE + Trigger Time Mark Event Internal + Interrupt Enable + 5 + 1 + + + SWEE + Stop Watch Event Interrupt + Enable + 6 + 1 + + + GTWE + Global Time Wrap Interrupt + Enable + 7 + 1 + + + GTDE + Global Time Discontinuity Interrupt + Enable + 8 + 1 + + + GTEE + Global Time Error Interrupt + Enable + 9 + 1 + + + TXUE + Tx Count Underflow Interrupt + Enable + 10 + 1 + + + TXOE + Tx Count Overflow Interrupt + Enable + 11 + 1 + + + SE1E + Scheduling Error 1 Interrupt + Enable + 12 + 1 + + + SE2E + Scheduling Error 2 Interrupt + Enable + 13 + 1 + + + ELCE + Change Error Level Interrupt + Enable + 14 + 1 + + + IWTGE + Initialization Watch Trigger Interrupt + Enable + 15 + 1 + + + WTE + Watch Trigger Interrupt + Enable + 16 + 1 + + + AWE + Application Watchdog Interrupt + Enable + 17 + 1 + + + CERE + Configuration Error Interrupt + Enable + 18 + 1 + + + + + FDCAN_TTILS + FDCAN_TTILS + FDCAN TT Interrupt Line Select + Register + 0x128 + 0x20 + read-write + 0x00000000 + + + SBCL + Start of Basic Cycle Interrupt + Line + 0 + 1 + + + SMCL + Start of Matrix Cycle Interrupt + Line + 1 + 1 + + + CSML + Change of Synchronization Mode Interrupt + Line + 2 + 1 + + + SOGL + Start of Gap Interrupt + Line + 3 + 1 + + + RTMIL + Register Time Mark Interrupt + Line + 4 + 1 + + + TTMIL + Trigger Time Mark Event Internal + Interrupt Line + 5 + 1 + + + SWEL + Stop Watch Event Interrupt + Line + 6 + 1 + + + GTWL + Global Time Wrap Interrupt + Line + 7 + 1 + + + GTDL + Global Time Discontinuity Interrupt + Line + 8 + 1 + + + GTEL + Global Time Error Interrupt + Line + 9 + 1 + + + TXUL + Tx Count Underflow Interrupt + Line + 10 + 1 + + + TXOL + Tx Count Overflow Interrupt + Line + 11 + 1 + + + SE1L + Scheduling Error 1 Interrupt + Line + 12 + 1 + + + SE2L + Scheduling Error 2 Interrupt + Line + 13 + 1 + + + ELCL + Change Error Level Interrupt + Line + 14 + 1 + + + IWTGL + Initialization Watch Trigger Interrupt + Line + 15 + 1 + + + WTL + Watch Trigger Interrupt + Line + 16 + 1 + + + AWL + Application Watchdog Interrupt + Line + 17 + 1 + + + CERL + Configuration Error Interrupt + Line + 18 + 1 + + + + + FDCAN_TTOST + FDCAN_TTOST + FDCAN TT Operation Status + Register + 0x12C + 0x20 + read-write + 0x00000000 + + + EL + Error Level + 0 + 2 + + + MS + Master State. + 2 + 2 + + + SYS + Synchronization State + 4 + 2 + + + GTP + Quality of Global Time + Phase + 6 + 1 + + + QCS + Quality of Clock Speed + 7 + 1 + + + RTO + Reference Trigger Offset + 8 + 8 + + + WGTD + Wait for Global Time + Discontinuity + 22 + 1 + + + GFI + Gap Finished Indicator. + 23 + 1 + + + TMP + Time Master Priority + 24 + 3 + + + GSI + Gap Started Indicator. + 27 + 1 + + + WFE + Wait for Event + 28 + 1 + + + AWE + Application Watchdog Event + 29 + 1 + + + WECS + Wait for External Clock + Synchronization + 30 + 1 + + + SPL + Schedule Phase Lock + 31 + 1 + + + + + FDCAN_TURNA + FDCAN_TURNA + FDCAN TUR Numerator Actual + Register + 0x130 + 0x20 + read-only + 0x00000000 + + + NAV + Numerator Actual Value + 0 + 18 + + + + + FDCAN_TTLGT + FDCAN_TTLGT + FDCAN TT Local and Global Time + Register + 0x134 + 0x20 + read-only + 0x00000000 + + + LT + Local Time + 0 + 16 + + + GT + Global Time + 16 + 16 + + + + + FDCAN_TTCTC + FDCAN_TTCTC + FDCAN TT Cycle Time and Count + Register + 0x138 + 0x20 + read-only + 0x00000000 + + + CT + Cycle Time + 0 + 16 + + + CC + Cycle Count + 16 + 6 + + + + + FDCAN_TTCPT + FDCAN_TTCPT + FDCAN TT Capture Time Register + 0x13C + 0x20 + read-only + 0x00000000 + + + CT + Cycle Count Value + 0 + 6 + + + SWV + Stop Watch Value + 16 + 16 + + + + + FDCAN_TTCSM + FDCAN_TTCSM + FDCAN TT Cycle Sync Mark + Register + 0x140 + 0x20 + read-only + 0x00000000 + + + CSM + Cycle Sync Mark + 0 + 16 + + + + + FDCAN_TTTS + FDCAN_TTTS + FDCAN TT Trigger Select + Register + 0x300 + 0x20 + read-write + 0x00000000 + + + SWTDEL + Stop watch trigger input + selection + 0 + 2 + + + EVTSEL + Event trigger input + selection + 4 + 2 + + + + + + + FDCAN2 + 0x4000A400 + + FDCAN2_IT0 + FDCAN2 Interrupt 0 + 20 + + + FDCAN2_IT1 + FDCAN2 Interrupt 1 + 22 + + + + CAN_CCU + CCU registers + FDCAN + 0x4000A800 + + 0x0 + 0x400 + registers + + + + CREL + CREL + Clock Calibration Unit Core Release + Register + 0x0 + 0x20 + read-write + 0x00000000 + + + DAY + Time Stamp Day + 0 + 8 + + + MON + Time Stamp Month + 8 + 8 + + + YEAR + Time Stamp Year + 16 + 4 + + + SUBSTEP + Sub-step of Core Release + 20 + 4 + + + STEP + Step of Core Release + 24 + 4 + + + REL + Core Release + 28 + 4 + + + + + CCFG + CCFG + Calibration Configuration + Register + 0x4 + 0x20 + read-write + 0x00000000 + + + TQBT + Time Quanta per Bit Time + 0 + 5 + + + BCC + Bypass Clock Calibration + 6 + 1 + + + CFL + Calibration Field Length + 7 + 1 + + + OCPM + Oscillator Clock Periods + Minimum + 8 + 8 + + + CDIV + Clock Divider + 16 + 4 + + + SWR + Software Reset + 31 + 1 + + + + + CSTAT + CSTAT + Calibration Status Register + 0x8 + 0x20 + read-write + 0x00000000 + + + OCPC + Oscillator Clock Period + Counter + 0 + 18 + + + TQC + Time Quanta Counter + 18 + 11 + + + CALS + Calibration State + 30 + 2 + + + + + CWD + CWD + Calibration Watchdog Register + 0xC + 0x20 + read-write + 0x00000000 + + + WDC + WDC + 0 + 16 + + + WDV + WDV + 16 + 16 + + + + + IR + IR + Clock Calibration Unit Interrupt + Register + 0x10 + 0x20 + read-write + 0x00000000 + + + CWE + Calibration Watchdog Event + 0 + 1 + + + CSC + Calibration State Changed + 1 + 1 + + + + + IE + IE + Clock Calibration Unit Interrupt Enable + Register + 0x14 + 0x20 + read-write + 0x00000000 + + + CWEE + Calibration Watchdog Event + Enable + 0 + 1 + + + CSCE + Calibration State Changed + Enable + 1 + 1 + + + + + + + MDIOS + Management data input/output slave + MDIOS + 0x40009400 + + 0x0 + 0x400 + registers + + + MDIOS_WKUP + MDIOS wakeup + 119 + + + MDIOS + MDIOS global interrupt + 120 + + + + CR + CR + MDIOS configuration register + 0x0 + 0x20 + read-write + 0x00000000 + + + EN + Peripheral enable + 0 + 1 + + + WRIE + Register write interrupt + enable + 1 + 1 + + + RDIE + Register Read Interrupt + Enable + 2 + 1 + + + EIE + Error interrupt enable + 3 + 1 + + + DPC + Disable Preamble Check + 7 + 1 + + + PORT_ADDRESS + Slaves's address + 8 + 5 + + + + + WRFR + WRFR + MDIOS write flag register + 0x4 + 0x20 + read-only + 0x00000000 + + + WRF + Write flags for MDIO registers 0 to + 31 + 0 + 32 + + + + + CWRFR + CWRFR + MDIOS clear write flag + register + 0x8 + 0x20 + read-write + 0x00000000 + + + CWRF + Clear the write flag + 0 + 32 + + + + + RDFR + RDFR + MDIOS read flag register + 0xC + 0x20 + read-only + 0x00000000 + + + RDF + Read flags for MDIO registers 0 to + 31 + 0 + 32 + + + + + CRDFR + CRDFR + MDIOS clear read flag register + 0x10 + 0x20 + read-write + 0x00000000 + + + CRDF + Clear the read flag + 0 + 32 + + + + + SR + SR + MDIOS status register + 0x14 + 0x20 + read-only + 0x00000000 + + + PERF + Preamble error flag + 0 + 1 + + + SERF + Start error flag + 1 + 1 + + + TERF + Turnaround error flag + 2 + 1 + + + + + CLRFR + CLRFR + MDIOS clear flag register + 0x18 + 0x20 + read-write + 0x00000000 + + + CPERF + Clear the preamble error + flag + 0 + 1 + + + CSERF + Clear the start error flag + 1 + 1 + + + CTERF + Clear the turnaround error + flag + 2 + 1 + + + + + DINR0 + DINR0 + MDIOS input data register 0 + 0x1C + 0x20 + read-only + 0x00000000 + + + DIN0 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR1 + DINR1 + MDIOS input data register 1 + 0x20 + 0x20 + read-only + 0x00000000 + + + DIN1 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR2 + DINR2 + MDIOS input data register 2 + 0x24 + 0x20 + read-only + 0x00000000 + + + DIN2 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR3 + DINR3 + MDIOS input data register 3 + 0x28 + 0x20 + read-only + 0x00000000 + + + DIN3 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR4 + DINR4 + MDIOS input data register 4 + 0x2C + 0x20 + read-only + 0x00000000 + + + DIN4 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR5 + DINR5 + MDIOS input data register 5 + 0x30 + 0x20 + read-only + 0x00000000 + + + DIN5 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR6 + DINR6 + MDIOS input data register 6 + 0x34 + 0x20 + read-only + 0x00000000 + + + DIN6 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR7 + DINR7 + MDIOS input data register 7 + 0x38 + 0x20 + read-only + 0x00000000 + + + DIN7 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR8 + DINR8 + MDIOS input data register 8 + 0x3C + 0x20 + read-only + 0x00000000 + + + DIN8 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR9 + DINR9 + MDIOS input data register 9 + 0x40 + 0x20 + read-only + 0x00000000 + + + DIN9 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR10 + DINR10 + MDIOS input data register 10 + 0x44 + 0x20 + read-only + 0x00000000 + + + DIN10 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR11 + DINR11 + MDIOS input data register 11 + 0x48 + 0x20 + read-only + 0x00000000 + + + DIN11 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR12 + DINR12 + MDIOS input data register 12 + 0x4C + 0x20 + read-only + 0x00000000 + + + DIN12 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR13 + DINR13 + MDIOS input data register 13 + 0x50 + 0x20 + read-only + 0x00000000 + + + DIN13 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR14 + DINR14 + MDIOS input data register 14 + 0x54 + 0x20 + read-only + 0x00000000 + + + DIN14 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR15 + DINR15 + MDIOS input data register 15 + 0x58 + 0x20 + read-only + 0x00000000 + + + DIN15 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR16 + DINR16 + MDIOS input data register 16 + 0x5C + 0x20 + read-only + 0x00000000 + + + DIN16 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR17 + DINR17 + MDIOS input data register 17 + 0x60 + 0x20 + read-only + 0x00000000 + + + DIN17 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR18 + DINR18 + MDIOS input data register 18 + 0x64 + 0x20 + read-only + 0x00000000 + + + DIN18 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR19 + DINR19 + MDIOS input data register 19 + 0x68 + 0x20 + read-only + 0x00000000 + + + DIN19 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR20 + DINR20 + MDIOS input data register 20 + 0x6C + 0x20 + read-only + 0x00000000 + + + DIN20 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR21 + DINR21 + MDIOS input data register 21 + 0x70 + 0x20 + read-only + 0x00000000 + + + DIN21 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR22 + DINR22 + MDIOS input data register 22 + 0x74 + 0x20 + read-only + 0x00000000 + + + DIN22 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR23 + DINR23 + MDIOS input data register 23 + 0x78 + 0x20 + read-only + 0x00000000 + + + DIN23 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR24 + DINR24 + MDIOS input data register 24 + 0x7C + 0x20 + read-only + 0x00000000 + + + DIN24 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR25 + DINR25 + MDIOS input data register 25 + 0x80 + 0x20 + read-only + 0x00000000 + + + DIN25 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR26 + DINR26 + MDIOS input data register 26 + 0x84 + 0x20 + read-only + 0x00000000 + + + DIN26 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR27 + DINR27 + MDIOS input data register 27 + 0x88 + 0x20 + read-only + 0x00000000 + + + DIN27 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR28 + DINR28 + MDIOS input data register 28 + 0x8C + 0x20 + read-only + 0x00000000 + + + DIN28 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR29 + DINR29 + MDIOS input data register 29 + 0x90 + 0x20 + read-only + 0x00000000 + + + DIN29 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR30 + DINR30 + MDIOS input data register 30 + 0x94 + 0x20 + read-only + 0x00000000 + + + DIN30 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DINR31 + DINR31 + MDIOS input data register 31 + 0x98 + 0x20 + read-only + 0x00000000 + + + DIN31 + Input data received from MDIO Master + during write frames + 0 + 16 + + + + + DOUTR0 + DOUTR0 + MDIOS output data register 0 + 0x9C + 0x20 + read-write + 0x00000000 + + + DOUT0 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR1 + DOUTR1 + MDIOS output data register 1 + 0xA0 + 0x20 + read-write + 0x00000000 + + + DOUT1 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR2 + DOUTR2 + MDIOS output data register 2 + 0xA4 + 0x20 + read-write + 0x00000000 + + + DOUT2 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR3 + DOUTR3 + MDIOS output data register 3 + 0xA8 + 0x20 + read-write + 0x00000000 + + + DOUT3 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR4 + DOUTR4 + MDIOS output data register 4 + 0xAC + 0x20 + read-write + 0x00000000 + + + DOUT4 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR5 + DOUTR5 + MDIOS output data register 5 + 0xB0 + 0x20 + read-write + 0x00000000 + + + DOUT5 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR6 + DOUTR6 + MDIOS output data register 6 + 0xB4 + 0x20 + read-write + 0x00000000 + + + DOUT6 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR7 + DOUTR7 + MDIOS output data register 7 + 0xB8 + 0x20 + read-write + 0x00000000 + + + DOUT7 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR8 + DOUTR8 + MDIOS output data register 8 + 0xBC + 0x20 + read-write + 0x00000000 + + + DOUT8 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR9 + DOUTR9 + MDIOS output data register 9 + 0xC0 + 0x20 + read-write + 0x00000000 + + + DOUT9 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR10 + DOUTR10 + MDIOS output data register 10 + 0xC4 + 0x20 + read-write + 0x00000000 + + + DOUT10 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR11 + DOUTR11 + MDIOS output data register 11 + 0xC8 + 0x20 + read-write + 0x00000000 + + + DOUT11 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR12 + DOUTR12 + MDIOS output data register 12 + 0xCC + 0x20 + read-write + 0x00000000 + + + DOUT12 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR13 + DOUTR13 + MDIOS output data register 13 + 0xD0 + 0x20 + read-write + 0x00000000 + + + DOUT13 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR14 + DOUTR14 + MDIOS output data register 14 + 0xD4 + 0x20 + read-write + 0x00000000 + + + DOUT14 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR15 + DOUTR15 + MDIOS output data register 15 + 0xD8 + 0x20 + read-write + 0x00000000 + + + DOUT15 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR16 + DOUTR16 + MDIOS output data register 16 + 0xDC + 0x20 + read-write + 0x00000000 + + + DOUT16 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR17 + DOUTR17 + MDIOS output data register 17 + 0xE0 + 0x20 + read-write + 0x00000000 + + + DOUT17 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR18 + DOUTR18 + MDIOS output data register 18 + 0xE4 + 0x20 + read-write + 0x00000000 + + + DOUT18 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR19 + DOUTR19 + MDIOS output data register 19 + 0xE8 + 0x20 + read-write + 0x00000000 + + + DOUT19 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR20 + DOUTR20 + MDIOS output data register 20 + 0xEC + 0x20 + read-write + 0x00000000 + + + DOUT20 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR21 + DOUTR21 + MDIOS output data register 21 + 0xF0 + 0x20 + read-write + 0x00000000 + + + DOUT21 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR22 + DOUTR22 + MDIOS output data register 22 + 0xF4 + 0x20 + read-write + 0x00000000 + + + DOUT22 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR23 + DOUTR23 + MDIOS output data register 23 + 0xF8 + 0x20 + read-write + 0x00000000 + + + DOUT23 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR24 + DOUTR24 + MDIOS output data register 24 + 0xFC + 0x20 + read-write + 0x00000000 + + + DOUT24 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR25 + DOUTR25 + MDIOS output data register 25 + 0x100 + 0x20 + read-write + 0x00000000 + + + DOUT25 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR26 + DOUTR26 + MDIOS output data register 26 + 0x104 + 0x20 + read-write + 0x00000000 + + + DOUT26 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR27 + DOUTR27 + MDIOS output data register 27 + 0x108 + 0x20 + read-write + 0x00000000 + + + DOUT27 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR28 + DOUTR28 + MDIOS output data register 28 + 0x10C + 0x20 + read-write + 0x00000000 + + + DOUT28 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR29 + DOUTR29 + MDIOS output data register 29 + 0x110 + 0x20 + read-write + 0x00000000 + + + DOUT29 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR30 + DOUTR30 + MDIOS output data register 30 + 0x114 + 0x20 + read-write + 0x00000000 + + + DOUT30 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + DOUTR31 + DOUTR31 + MDIOS output data register 31 + 0x118 + 0x20 + read-write + 0x00000000 + + + DOUT31 + Output data sent to MDIO Master during + read frames + 0 + 16 + + + + + + + OPAMP + Operational amplifiers + OPAMP + 0x40009000 + + 0x0 + 0x400 + registers + + + + OPAMP1_CSR + OPAMP1_CSR + OPAMP1 control/status register + 0x0 + 0x20 + read-write + 0x00000000 + + + OPAEN + Operational amplifier + Enable + 0 + 1 + + + FORCE_VP + Force internal reference on VP (reserved + for test + 1 + 1 + + + VP_SEL + Operational amplifier PGA + mode + 2 + 2 + + + VM_SEL + Inverting input selection + 5 + 2 + + + OPAHSM + Operational amplifier high-speed + mode + 8 + 1 + + + CALON + Calibration mode enabled + 11 + 1 + + + CALSEL + Calibration selection + 12 + 2 + + + PGA_GAIN + allows to switch from AOP offset trimmed + values to AOP offset + 14 + 4 + + + USERTRIM + User trimming enable + 18 + 1 + + + TSTREF + OPAMP calibration reference voltage + output control (reserved for test) + 29 + 1 + + + CALOUT + Operational amplifier calibration + output + 30 + 1 + + + + + OPAMP1_OTR + OPAMP1_OTR + OPAMP1 offset trimming register in normal + mode + 0x4 + 0x20 + read-write + 0x00000000 + + + TRIMOFFSETN + Trim for NMOS differential + pairs + 0 + 5 + + + TRIMOFFSETP + Trim for PMOS differential + pairs + 8 + 5 + + + + + OPAMP1_HSOTR + OPAMP1_HSOTR + OPAMP1 offset trimming register in low-power + mode + 0x8 + 0x20 + read-write + 0x00000000 + + + TRIMLPOFFSETN + Trim for NMOS differential + pairs + 0 + 5 + + + TRIMLPOFFSETP + Trim for PMOS differential + pairs + 8 + 5 + + + + + OPAMP2_CSR + OPAMP2_CSR + OPAMP2 control/status register + 0x10 + 0x20 + read-write + 0x00000000 + + + OPAEN + Operational amplifier + Enable + 0 + 1 + + + FORCE_VP + Force internal reference on VP (reserved + for test) + 1 + 1 + + + VM_SEL + Inverting input selection + 5 + 2 + + + OPAHSM + Operational amplifier high-speed + mode + 8 + 1 + + + CALON + Calibration mode enabled + 11 + 1 + + + CALSEL + Calibration selection + 12 + 2 + + + PGA_GAIN + Operational amplifier Programmable + amplifier gain value + 14 + 4 + + + USERTRIM + User trimming enable + 18 + 1 + + + TSTREF + OPAMP calibration reference voltage + output control (reserved for test) + 29 + 1 + + + CALOUT + Operational amplifier calibration + output + 30 + 1 + + + + + OPAMP2_OTR + OPAMP2_OTR + OPAMP2 offset trimming register in normal + mode + 0x14 + 0x20 + read-write + 0x00000000 + + + TRIMOFFSETN + Trim for NMOS differential + pairs + 0 + 5 + + + TRIMOFFSETP + Trim for PMOS differential + pairs + 8 + 5 + + + + + OPAMP2_HSOTR + OPAMP2_HSOTR + OPAMP2 offset trimming register in low-power + mode + 0x18 + 0x20 + read-write + 0x00000000 + + + TRIMLPOFFSETN + Trim for NMOS differential + pairs + 0 + 5 + + + TRIMLPOFFSETP + Trim for PMOS differential + pairs + 8 + 5 + + + + + + + SWPMI + Single Wire Protocol Master + Interface + SWPMI + 0x40008800 + + 0x0 + 0x400 + registers + + + + CR + CR + SWPMI Configuration/Control + register + 0x0 + 0x20 + read-write + 0x00000000 + + + RXDMA + Reception DMA enable + 0 + 1 + + + TXDMA + Transmission DMA enable + 1 + 1 + + + RXMODE + Reception buffering mode + 2 + 1 + + + TXMODE + Transmission buffering + mode + 3 + 1 + + + LPBK + Loopback mode enable + 4 + 1 + + + SWPACT + Single wire protocol master interface + activate + 5 + 1 + + + DEACT + Single wire protocol master interface + deactivate + 10 + 1 + + + SWPTEN + Single wire protocol master transceiver + enable + 11 + 1 + + + + + BRR + BRR + SWPMI Bitrate register + 0x4 + 0x20 + read-write + 0x00000001 + + + BR + Bitrate prescaler + 0 + 8 + + + + + ISR + ISR + SWPMI Interrupt and Status + register + 0xC + 0x20 + read-only + 0x000002C2 + + + RXBFF + Receive buffer full flag + 0 + 1 + + + TXBEF + Transmit buffer empty flag + 1 + 1 + + + RXBERF + Receive CRC error flag + 2 + 1 + + + RXOVRF + Receive overrun error flag + 3 + 1 + + + TXUNRF + Transmit underrun error + flag + 4 + 1 + + + RXNE + Receive data register not + empty + 5 + 1 + + + TXE + Transmit data register + empty + 6 + 1 + + + TCF + Transfer complete flag + 7 + 1 + + + SRF + Slave resume flag + 8 + 1 + + + SUSP + SUSPEND flag + 9 + 1 + + + DEACTF + DEACTIVATED flag + 10 + 1 + + + RDYF + transceiver ready flag + 11 + 1 + + + + + ICR + ICR + SWPMI Interrupt Flag Clear + register + 0x10 + 0x20 + write-only + 0x00000000 + + + CRXBFF + Clear receive buffer full + flag + 0 + 1 + + + CTXBEF + Clear transmit buffer empty + flag + 1 + 1 + + + CRXBERF + Clear receive CRC error + flag + 2 + 1 + + + CRXOVRF + Clear receive overrun error + flag + 3 + 1 + + + CTXUNRF + Clear transmit underrun error + flag + 4 + 1 + + + CTCF + Clear transfer complete + flag + 7 + 1 + + + CSRF + Clear slave resume flag + 8 + 1 + + + CRDYF + Clear transceiver ready + flag + 11 + 1 + + + + + IER + IER + SWPMI Interrupt Enable + register + 0x14 + 0x20 + read-write + 0x00000000 + + + RXBFIE + Receive buffer full interrupt + enable + 0 + 1 + + + TXBEIE + Transmit buffer empty interrupt + enable + 1 + 1 + + + RXBERIE + Receive CRC error interrupt + enable + 2 + 1 + + + RXOVRIE + Receive overrun error interrupt + enable + 3 + 1 + + + TXUNRIE + Transmit underrun error interrupt + enable + 4 + 1 + + + RIE + Receive interrupt enable + 5 + 1 + + + TIE + Transmit interrupt enable + 6 + 1 + + + TCIE + Transmit complete interrupt + enable + 7 + 1 + + + SRIE + Slave resume interrupt + enable + 8 + 1 + + + RDYIE + Transceiver ready interrupt + enable + 11 + 1 + + + + + RFL + RFL + SWPMI Receive Frame Length + register + 0x18 + 0x20 + read-only + 0x00000000 + + + RFL + Receive frame length + 0 + 5 + + + + + TDR + TDR + SWPMI Transmit data register + 0x1C + 0x20 + write-only + 0x00000000 + + + TD + Transmit data + 0 + 32 + + + + + RDR + RDR + SWPMI Receive data register + 0x20 + 0x20 + read-only + 0x00000000 + + + RD + received data + 0 + 32 + + + + + OR + OR + SWPMI Option register + 0x24 + 0x20 + read-write + 0x00000000 + + + SWP_TBYP + SWP transceiver bypass + 0 + 1 + + + SWP_CLASS + SWP class selection + 1 + 1 + + + + + + + TIM2 + General purpose timers + TIM + 0x40000000 + + 0x0 + 0x400 + registers + + + TIM2 + TIM2 global interrupt + 28 + + + SWPMI1 + SWPMI global interrupt + 115 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + CKD + Clock division + 8 + 2 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + CMS + Center-aligned mode + selection + 5 + 2 + + + DIR + Direction + 4 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + URS + Update request source + 2 + 1 + + + UDIS + Update disable + 1 + 1 + + + CEN + Counter enable + 0 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + TI1S + TI1 selection + 7 + 1 + + + MMS + Master mode selection + 4 + 3 + + + CCDS + Capture/compare DMA + selection + 3 + 1 + + + + + SMCR + SMCR + slave mode control register + 0x8 + 0x20 + read-write + 0x0000 + + + TS_4_3 + Trigger selection + 20 + 2 + + + SMS_3 + Slave mode selection - bit + 3 + 16 + 1 + + + ETP + External trigger polarity + 15 + 1 + + + ECE + External clock enable + 14 + 1 + + + ETPS + External trigger prescaler + 12 + 2 + + + ETF + External trigger filter + 8 + 4 + + + MSM + Master/Slave mode + 7 + 1 + + + TS + Trigger selection + 4 + 3 + + + SMS + Slave mode selection + 0 + 3 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + TDE + Trigger DMA request enable + 14 + 1 + + + CC4DE + Capture/Compare 4 DMA request + enable + 12 + 1 + + + CC3DE + Capture/Compare 3 DMA request + enable + 11 + 1 + + + CC2DE + Capture/Compare 2 DMA request + enable + 10 + 1 + + + CC1DE + Capture/Compare 1 DMA request + enable + 9 + 1 + + + UDE + Update DMA request enable + 8 + 1 + + + TIE + Trigger interrupt enable + 6 + 1 + + + CC4IE + Capture/Compare 4 interrupt + enable + 4 + 1 + + + CC3IE + Capture/Compare 3 interrupt + enable + 3 + 1 + + + CC2IE + Capture/Compare 2 interrupt + enable + 2 + 1 + + + CC1IE + Capture/Compare 1 interrupt + enable + 1 + 1 + + + UIE + Update interrupt enable + 0 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + CC4OF + Capture/Compare 4 overcapture + flag + 12 + 1 + + + CC3OF + Capture/Compare 3 overcapture + flag + 11 + 1 + + + CC2OF + Capture/compare 2 overcapture + flag + 10 + 1 + + + CC1OF + Capture/Compare 1 overcapture + flag + 9 + 1 + + + TIF + Trigger interrupt flag + 6 + 1 + + + CC4IF + Capture/Compare 4 interrupt + flag + 4 + 1 + + + CC3IF + Capture/Compare 3 interrupt + flag + 3 + 1 + + + CC2IF + Capture/Compare 2 interrupt + flag + 2 + 1 + + + CC1IF + Capture/compare 1 interrupt + flag + 1 + 1 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + TG + Trigger generation + 6 + 1 + + + CC4G + Capture/compare 4 + generation + 4 + 1 + + + CC3G + Capture/compare 3 + generation + 3 + 1 + + + CC2G + Capture/compare 2 + generation + 2 + 1 + + + CC1G + Capture/compare 1 + generation + 1 + 1 + + + UG + Update generation + 0 + 1 + + + + + CCMR1_Output + CCMR1_Output + capture/compare mode register 1 (output + mode) + 0x18 + 0x20 + read-write + 0x00000000 + + + CC1S + CC1S + 0 + 2 + + + OC1FE + OC1FE + 2 + 1 + + + OC1PE + OC1PE + 3 + 1 + + + OC1M + OC1M + 4 + 3 + + + OC1CE + OC1CE + 7 + 1 + + + CC2S + CC2S + 8 + 2 + + + OC2FE + OC2FE + 10 + 1 + + + OC2PE + OC2PE + 11 + 1 + + + OC2M + OC2M + 12 + 3 + + + OC2CE + OC2CE + 15 + 1 + + + OC1M_3 + Output Compare 1 mode - bit + 3 + 16 + 1 + + + OC2M_3 + Output Compare 2 mode - bit + 3 + 24 + 1 + + + + + CCMR1_Input + CCMR1_Input + capture/compare mode register 1 (input + mode) + CCMR1_Output + 0x18 + 0x20 + read-write + 0x00000000 + + + IC2F + Input capture 2 filter + 12 + 4 + + + IC2PCS + Input capture 2 prescaler + 10 + 2 + + + CC2S + Capture/Compare 2 + selection + 8 + 2 + + + IC1F + Input capture 1 filter + 4 + 4 + + + ICPCS + Input capture 1 prescaler + 2 + 2 + + + CC1S + Capture/Compare 1 + selection + 0 + 2 + + + + + CCMR2_Output + CCMR2_Output + capture/compare mode register 2 (output + mode) + 0x1C + 0x20 + read-write + 0x00000000 + + + OC4M_3 + Output Compare 2 mode - bit + 3 + 24 + 1 + + + OC3M_3 + Output Compare 1 mode - bit + 3 + 16 + 1 + + + O24CE + O24CE + 15 + 1 + + + OC4M + OC4M + 12 + 3 + + + OC4PE + OC4PE + 11 + 1 + + + OC4FE + OC4FE + 10 + 1 + + + CC4S + CC4S + 8 + 2 + + + OC3CE + OC3CE + 7 + 1 + + + OC3M + OC3M + 4 + 3 + + + OC3PE + OC3PE + 3 + 1 + + + OC3FE + OC3FE + 2 + 1 + + + CC3S + CC3S + 0 + 2 + + + + + CCMR2_Input + CCMR2_Input + capture/compare mode register 2 (input + mode) + CCMR2_Output + 0x1C + 0x20 + read-write + 0x00000000 + + + IC4F + Input capture 4 filter + 12 + 4 + + + IC4PSC + Input capture 4 prescaler + 10 + 2 + + + CC4S + Capture/Compare 4 + selection + 8 + 2 + + + IC3F + Input capture 3 filter + 4 + 4 + + + IC3PSC + Input capture 3 prescaler + 2 + 2 + + + CC3S + Capture/compare 3 + selection + 0 + 2 + + + + + CCER + CCER + capture/compare enable + register + 0x20 + 0x20 + read-write + 0x0000 + + + CC4NP + Capture/Compare 4 output + Polarity + 15 + 1 + + + CC4P + Capture/Compare 3 output + Polarity + 13 + 1 + + + CC4E + Capture/Compare 4 output + enable + 12 + 1 + + + CC3NP + Capture/Compare 3 output + Polarity + 11 + 1 + + + CC3P + Capture/Compare 3 output + Polarity + 9 + 1 + + + CC3E + Capture/Compare 3 output + enable + 8 + 1 + + + CC2NP + Capture/Compare 2 output + Polarity + 7 + 1 + + + CC2P + Capture/Compare 2 output + Polarity + 5 + 1 + + + CC2E + Capture/Compare 2 output + enable + 4 + 1 + + + CC1NP + Capture/Compare 1 output + Polarity + 3 + 1 + + + CC1P + Capture/Compare 1 output + Polarity + 1 + 1 + + + CC1E + Capture/Compare 1 output + enable + 0 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + read-write + 0x00000000 + + + CNT_L + low counter value + 0 + 16 + + + CNT_H + High counter value + 16 + 16 + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR_H + High Auto-reload value + 16 + 16 + + + ARR_L + Low Auto-reload value + 0 + 16 + + + + + CCR1 + CCR1 + capture/compare register 1 + 0x34 + 0x20 + read-write + 0x00000000 + + + CCR1_H + High Capture/Compare 1 + value + 16 + 16 + + + CCR1_L + Low Capture/Compare 1 + value + 0 + 16 + + + + + CCR2 + CCR2 + capture/compare register 2 + 0x38 + 0x20 + read-write + 0x00000000 + + + CCR2_H + High Capture/Compare 2 + value + 16 + 16 + + + CCR2_L + Low Capture/Compare 2 + value + 0 + 16 + + + + + CCR3 + CCR3 + capture/compare register 3 + 0x3C + 0x20 + read-write + 0x00000000 + + + CCR3_H + High Capture/Compare value + 16 + 16 + + + CCR3_L + Low Capture/Compare value + 0 + 16 + + + + + CCR4 + CCR4 + capture/compare register 4 + 0x40 + 0x20 + read-write + 0x00000000 + + + CCR4_H + High Capture/Compare value + 16 + 16 + + + CCR4_L + Low Capture/Compare value + 0 + 16 + + + + + DCR + DCR + DMA control register + 0x48 + 0x20 + read-write + 0x0000 + + + DBL + DMA burst length + 8 + 5 + + + DBA + DMA base address + 0 + 5 + + + + + DMAR + DMAR + DMA address for full transfer + 0x4C + 0x20 + read-write + 0x0000 + + + DMAB + DMA register for burst + accesses + 0 + 16 + + + + + AF1 + AF1 + TIM alternate function option register + 1 + 0x60 + 0x20 + read-write + 0x0000 + + + ETRSEL + ETR source selection + 14 + 4 + + + + + TISEL + TISEL + TIM timer input selection + register + 0x68 + 0x20 + read-write + 0x0000 + + + TI1SEL + TI1[0] to TI1[15] input + selection + 0 + 4 + + + TI2SEL + TI2[0] to TI2[15] input + selection + 8 + 4 + + + TI3SEL + TI3[0] to TI3[15] input + selection + 16 + 4 + + + TI4SEL + TI4[0] to TI4[15] input + selection + 24 + 4 + + + + + + + TIM3 + 0x40000400 + + TIM3 + TIM3 global interrupt + 29 + + + + TIM4 + 0x40000800 + + + TIM5 + 0x40000C00 + + TIM4 + TIM4 global interrupt + 30 + + + TIM5 + TIM5 global interrupt + 50 + + + + TIM12 + 0x40001800 + + TIM8_BRK_TIM12 + TIM8 and 12 break global + 43 + + + + TIM13 + 0x40001C00 + + TIM8_UP_TIM13 + TIM8 and 13 update global + 44 + + + + TIM14 + 0x40002000 + + TIM8_TRG_COM_TIM14 + TIM8 and 14 trigger /commutation and + global + 45 + + + + TIM6 + Basic timers + TIM + 0x40001000 + + 0x0 + 0x400 + registers + + + TIM6_DAC + TIM6 global interrupt + 54 + + + + CR1 + CR1 + control register 1 + 0x0 + 0x20 + read-write + 0x0000 + + + UIFREMAP + UIF status bit remapping + 11 + 1 + + + ARPE + Auto-reload preload enable + 7 + 1 + + + OPM + One-pulse mode + 3 + 1 + + + URS + Update request source + 2 + 1 + + + UDIS + Update disable + 1 + 1 + + + CEN + Counter enable + 0 + 1 + + + + + CR2 + CR2 + control register 2 + 0x4 + 0x20 + read-write + 0x0000 + + + MMS + Master mode selection + 4 + 3 + + + + + DIER + DIER + DMA/Interrupt enable register + 0xC + 0x20 + read-write + 0x0000 + + + UDE + Update DMA request enable + 8 + 1 + + + UIE + Update interrupt enable + 0 + 1 + + + + + SR + SR + status register + 0x10 + 0x20 + read-write + 0x0000 + + + UIF + Update interrupt flag + 0 + 1 + + + + + EGR + EGR + event generation register + 0x14 + 0x20 + write-only + 0x0000 + + + UG + Update generation + 0 + 1 + + + + + CNT + CNT + counter + 0x24 + 0x20 + read-write + 0x00000000 + + + CNT + Low counter value + 0 + 16 + + + UIFCPY + UIF Copy + 31 + 1 + + + + + PSC + PSC + prescaler + 0x28 + 0x20 + read-write + 0x0000 + + + PSC + Prescaler value + 0 + 16 + + + + + ARR + ARR + auto-reload register + 0x2C + 0x20 + read-write + 0x00000000 + + + ARR + Low Auto-reload value + 0 + 16 + + + + + + + TIM7 + 0x40001400 + + TIM7 + TIM7 global interrupt + 55 + + + + NVIC + Nested Vectored Interrupt + Controller + NVIC + 0xE000E100 + + 0x0 + 0x401 + registers + + + + ISER0 + ISER0 + Interrupt Set-Enable Register + 0x0 + 0x20 + read-write + 0x00000000 + + + SETENA + SETENA + 0 + 32 + + + + + ISER1 + ISER1 + Interrupt Set-Enable Register + 0x4 + 0x20 + read-write + 0x00000000 + + + SETENA + SETENA + 0 + 32 + + + + + ISER2 + ISER2 + Interrupt Set-Enable Register + 0x8 + 0x20 + read-write + 0x00000000 + + + SETENA + SETENA + 0 + 32 + + + + + ICER0 + ICER0 + Interrupt Clear-Enable + Register + 0x80 + 0x20 + read-write + 0x00000000 + + + CLRENA + CLRENA + 0 + 32 + + + + + ICER1 + ICER1 + Interrupt Clear-Enable + Register + 0x84 + 0x20 + read-write + 0x00000000 + + + CLRENA + CLRENA + 0 + 32 + + + + + ICER2 + ICER2 + Interrupt Clear-Enable + Register + 0x88 + 0x20 + read-write + 0x00000000 + + + CLRENA + CLRENA + 0 + 32 + + + + + ISPR0 + ISPR0 + Interrupt Set-Pending Register + 0x100 + 0x20 + read-write + 0x00000000 + + + SETPEND + SETPEND + 0 + 32 + + + + + ISPR1 + ISPR1 + Interrupt Set-Pending Register + 0x104 + 0x20 + read-write + 0x00000000 + + + SETPEND + SETPEND + 0 + 32 + + + + + ISPR2 + ISPR2 + Interrupt Set-Pending Register + 0x108 + 0x20 + read-write + 0x00000000 + + + SETPEND + SETPEND + 0 + 32 + + + + + ICPR0 + ICPR0 + Interrupt Clear-Pending + Register + 0x180 + 0x20 + read-write + 0x00000000 + + + CLRPEND + CLRPEND + 0 + 32 + + + + + ICPR1 + ICPR1 + Interrupt Clear-Pending + Register + 0x184 + 0x20 + read-write + 0x00000000 + + + CLRPEND + CLRPEND + 0 + 32 + + + + + ICPR2 + ICPR2 + Interrupt Clear-Pending + Register + 0x188 + 0x20 + read-write + 0x00000000 + + + CLRPEND + CLRPEND + 0 + 32 + + + + + IABR0 + IABR0 + Interrupt Active Bit Register + 0x200 + 0x20 + read-only + 0x00000000 + + + ACTIVE + ACTIVE + 0 + 32 + + + + + IABR1 + IABR1 + Interrupt Active Bit Register + 0x204 + 0x20 + read-only + 0x00000000 + + + ACTIVE + ACTIVE + 0 + 32 + + + + + IABR2 + IABR2 + Interrupt Active Bit Register + 0x208 + 0x20 + read-only + 0x00000000 + + + ACTIVE + ACTIVE + 0 + 32 + + + + + IPR0 + IPR0 + Interrupt Priority Register + 0x300 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR1 + IPR1 + Interrupt Priority Register + 0x304 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR2 + IPR2 + Interrupt Priority Register + 0x308 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR3 + IPR3 + Interrupt Priority Register + 0x30C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR4 + IPR4 + Interrupt Priority Register + 0x310 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR5 + IPR5 + Interrupt Priority Register + 0x314 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR6 + IPR6 + Interrupt Priority Register + 0x318 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR7 + IPR7 + Interrupt Priority Register + 0x31C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR8 + IPR8 + Interrupt Priority Register + 0x320 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR9 + IPR9 + Interrupt Priority Register + 0x324 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR10 + IPR10 + Interrupt Priority Register + 0x328 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR11 + IPR11 + Interrupt Priority Register + 0x32C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR12 + IPR12 + Interrupt Priority Register + 0x330 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR13 + IPR13 + Interrupt Priority Register + 0x334 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR14 + IPR14 + Interrupt Priority Register + 0x338 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR15 + IPR15 + Interrupt Priority Register + 0x33C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR16 + IPR16 + Interrupt Priority Register + 0x340 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR17 + IPR17 + Interrupt Priority Register + 0x344 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR18 + IPR18 + Interrupt Priority Register + 0x348 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR19 + IPR19 + Interrupt Priority Register + 0x34C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR20 + IPR20 + Interrupt Priority Register + 0x350 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR21 + IPR21 + Interrupt Priority Register + 0x354 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR22 + IPR22 + Interrupt Priority Register + 0x358 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR23 + IPR23 + Interrupt Priority Register + 0x35C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR24 + IPR24 + Interrupt Priority Register + 0x360 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR25 + IPR25 + Interrupt Priority Register + 0x364 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR26 + IPR26 + Interrupt Priority Register + 0x368 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR27 + IPR27 + Interrupt Priority Register + 0x36C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR28 + IPR28 + Interrupt Priority Register + 0x370 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR29 + IPR29 + Interrupt Priority Register + 0x374 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR30 + IPR30 + Interrupt Priority Register + 0x378 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR31 + IPR31 + Interrupt Priority Register + 0x37C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR32 + IPR32 + Interrupt Priority Register + 0x380 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR33 + IPR33 + Interrupt Priority Register + 0x384 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR34 + IPR34 + Interrupt Priority Register + 0x388 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR35 + IPR35 + Interrupt Priority Register + 0x38C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR36 + IPR36 + Interrupt Priority Register + 0x390 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR37 + IPR37 + Interrupt Priority Register + 0x394 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR38 + IPR38 + Interrupt Priority Register + 0x398 + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + IPR39 + IPR39 + Interrupt Priority Register + 0x39C + 0x20 + read-write + 0x00000000 + + + IPR_N0 + IPR_N0 + 0 + 8 + + + IPR_N1 + IPR_N1 + 8 + 8 + + + IPR_N2 + IPR_N2 + 16 + 8 + + + IPR_N3 + IPR_N3 + 24 + 8 + + + + + ISER3 + ISER3 + Interrupt Set-Enable Register + 0xC + 0x20 + read-write + 0x00000000 + + + ISER4 + ISER4 + Interrupt Set-Enable Register + 0x10 + 0x20 + read-write + 0x00000000 + + + ICER3 + ICER3 + Interrupt Clear-Enable + Register + 0x8C + 0x20 + read-write + 0x00000000 + + + ICER4 + ICER4 + Interrupt Clear-Enable + Register + 0x90 + 0x20 + read-write + 0x00000000 + + + ISPR3 + ISPR3 + Interrupt Set-Pending Register + 0x10C + 0x20 + read-write + 0x00000000 + + + ISPR4 + ISPR4 + Interrupt Set-Pending Register + 0x110 + 0x20 + read-write + 0x00000000 + + + ICPR3 + ICPR3 + Interrupt Clear-Pending + Register + 0x1C0 + 0x20 + read-write + 0x00000000 + + + ICPR4 + ICPR4 + Interrupt Clear-Pending + Register + 0x1C4 + 0x20 + read-write + 0x00000000 + + + IABR3 + IABR3 + Interrupt Active Bit Register + 0x20C + 0x20 + read-write + 0x00000000 + + + IABR4 + IABR4 + Interrupt Active Bit Register + 0x210 + 0x20 + read-write + 0x00000000 + + + + + DBGMCU + Microcontroller Debug Unit + DBGMCU + 0x5C001000 + + 0x0 + 0x400 + registers + + + + IDC + IDC + DBGMCU Identity Code Register + 0x0 + 0x20 + read-only + 0x10006450 + + + DEV_ID + Device ID + 0 + 12 + + + REV_ID + Revision + 16 + 16 + + + + + CR + CR + DBGMCU Configuration Register + 0x4 + 0x20 + read-write + 0x00000000 + + + DBGSLEEP_D1 + Allow D1 domain debug in Sleep mode + 0 + 1 + + + DBGSTOP_D1 + Allow D1 domain debug in Stop mode + 1 + 1 + + + DBGSTBY_D1 + Allow D1 domain debug in Standby mode + 2 + 1 + + + DBGSLEEP_D2 + Allow D2 domain debug in Sleep mode + 3 + 1 + + + DBGSTOP_D2 + Allow D2 domain debug in Stop mode + 4 + 1 + + + DBGSTBY_D2 + Allow D2 domain debug in Standby mode + 5 + 1 + + + DBGSTOP_D3 + Allow debug in D3 Stop mode + 7 + 1 + + + DBGSTBY_D3 + Allow debug in D3 Standby mode + 8 + 1 + + + TRACECLKEN + Trace port clock enable + 20 + 1 + + + D1DBGCKEN + D1 debug clock enable + 21 + 1 + + + D3DBGCKEN + D3 debug clock enable + 22 + 1 + + + TRGOEN + External trigger output enable + 28 + 1 + + + + + APB3FZ1 + APB3FZ1 + DBGMCU APB3 peripheral freeze register + 0x34 + 0x20 + read-write + 0x00000000 + + + WWDG1 + WWDG1 stop in debug + 6 + 1 + + + + + APB1LFZ1 + APB1LFZ1 + DBGMCU APB1L peripheral freeze register + 0x3C + 0x20 + read-write + 0x00000000 + + + DBG_TIM2 + TIM2 stop in debug + 0 + 1 + + + DBG_TIM3 + TIM3 stop in debug + 1 + 1 + + + DBG_TIM4 + TIM4 stop in debug + 2 + 1 + + + DBG_TIM5 + TIM5 stop in debug + 3 + 1 + + + DBG_TIM6 + TIM6 stop in debug + 4 + 1 + + + DBG_TIM7 + TIM7 stop in debug + 5 + 1 + + + DBG_TIM12 + TIM12 stop in debug + 6 + 1 + + + DBG_TIM13 + TIM13 stop in debug + 7 + 1 + + + DBG_TIM14 + TIM14 stop in debug + 8 + 1 + + + DBG_LPTIM1 + LPTIM1 stop in debug + 9 + 1 + + + DBG_I2C1 + I2C1 SMBUS timeout stop in debug + 21 + 1 + + + DBG_I2C2 + I2C2 SMBUS timeout stop in debug + 22 + 1 + + + DBG_I2C3 + I2C3 SMBUS timeout stop in debug + 23 + 1 + + + + + APB2FZ1 + APB2FZ1 + DBGMCU APB2 peripheral freeze register + 0x4C + 0x20 + read-write + 0x00000000 + + + DBG_TIM1 + TIM1 stop in debug + 0 + 1 + + + DBG_TIM8 + TIM8 stop in debug + 1 + 1 + + + DBG_TIM15 + TIM15 stop in debug + 16 + 1 + + + DBG_TIM16 + TIM16 stop in debug + 17 + 1 + + + DBG_TIM17 + TIM17 stop in debug + 18 + 1 + + + DBG_HRTIM + HRTIM stop in debug + 29 + 1 + + + + + APB4FZ1 + APB4FZ1 + DBGMCU APB4 peripheral freeze register + 0x54 + 0x20 + read-write + 0x00000000 + + + DBG_I2C4 + I2C4 SMBUS timeout stop in debug + 7 + 1 + + + DBG_LPTIM2 + LPTIM2 stop in debug + 9 + 1 + + + DBG_LPTIM3 + LPTIM2 stop in debug + 10 + 1 + + + DBG_LPTIM4 + LPTIM4 stop in debug + 11 + 1 + + + DBG_LPTIM5 + LPTIM5 stop in debug + 12 + 1 + + + DBG_RTC + RTC stop in debug + 16 + 1 + + + DBG_IWDG1 + Independent watchdog for D1 stop in debug + 18 + 1 + + + + + + + MPU + Memory protection unit + MPU + 0xE000ED90 + + 0x0 + 0x15 + registers + + + + MPU_TYPER + MPU_TYPER + MPU type register + 0x0 + 0x20 + read-only + 0X00000800 + + + SEPARATE + Separate flag + 0 + 1 + + + DREGION + Number of MPU data regions + 8 + 8 + + + IREGION + Number of MPU instruction + regions + 16 + 8 + + + + + MPU_CTRL + MPU_CTRL + MPU control register + 0x4 + 0x20 + read-write + 0X00000000 + + + ENABLE + Enables the MPU + 0 + 1 + + + HFNMIENA + Enables the operation of MPU during hard + fault + 1 + 1 + + + PRIVDEFENA + Enable priviliged software access to + default memory map + 2 + 1 + + + + + MPU_RNR + MPU_RNR + MPU region number register + 0x8 + 0x20 + read-write + 0X00000000 + + + REGION + MPU region + 0 + 8 + + + + + MPU_RBAR + MPU_RBAR + MPU region base address + register + 0xC + 0x20 + read-write + 0X00000000 + + + REGION + MPU region field + 0 + 4 + + + VALID + MPU region number valid + 4 + 1 + + + ADDR + Region base address field + 5 + 27 + + + + + MPU_RASR + MPU_RASR + MPU region attribute and size + register + 0x10 + 0x20 + read-write + 0X00000000 + + + ENABLE + Region enable bit. + 0 + 1 + + + SIZE + Size of the MPU protection + region + 1 + 5 + + + SRD + Subregion disable bits + 8 + 8 + + + B + memory attribute + 16 + 1 + + + C + memory attribute + 17 + 1 + + + S + Shareable memory attribute + 18 + 1 + + + TEX + memory attribute + 19 + 3 + + + AP + Access permission + 24 + 3 + + + XN + Instruction access disable + bit + 28 + 1 + + + + + + + STK + SysTick timer + STK + 0xE000E010 + + 0x0 + 0x11 + registers + + + + CSR + CSR + SysTick control and status + register + 0x0 + 0x20 + read-write + 0X00000000 + + + ENABLE + Counter enable + 0 + 1 + + + TICKINT + SysTick exception request + enable + 1 + 1 + + + CLKSOURCE + Clock source selection + 2 + 1 + + + COUNTFLAG + COUNTFLAG + 16 + 1 + + + + + RVR + RVR + SysTick reload value register + 0x4 + 0x20 + read-write + 0X00000000 + + + RELOAD + RELOAD value + 0 + 24 + + + + + CVR + CVR + SysTick current value register + 0x8 + 0x20 + read-write + 0X00000000 + + + CURRENT + Current counter value + 0 + 24 + + + + + CALIB + CALIB + SysTick calibration value + register + 0xC + 0x20 + read-write + 0X00000000 + + + TENMS + Calibration value + 0 + 24 + + + SKEW + SKEW flag: Indicates whether the TENMS + value is exact + 30 + 1 + + + NOREF + NOREF flag. Reads as zero + 31 + 1 + + + + + + + NVIC_STIR + Nested vectored interrupt + controller + NVIC + 0xE000EF00 + + 0x0 + 0x5 + registers + + + + STIR + STIR + Software trigger interrupt + register + 0x0 + 0x20 + read-write + 0x00000000 + + + INTID + Software generated interrupt + ID + 0 + 9 + + + + + + + FPU_CPACR + Floating point unit CPACR + FPU + 0xE000ED88 + + 0x0 + 0x5 + registers + + + + CPACR + CPACR + Coprocessor access control + register + 0x0 + 0x20 + read-write + 0x0000000 + + + CP + CP + 20 + 4 + + + + + + + SCB_ACTRL + System control block ACTLR + SCB + 0xE000E008 + + 0x0 + 0x5 + registers + + + + ACTRL + ACTRL + Auxiliary control register + 0x0 + 0x20 + read-write + 0x00000000 + + + DISFOLD + DISFOLD + 2 + 1 + + + FPEXCODIS + FPEXCODIS + 10 + 1 + + + DISRAMODE + DISRAMODE + 11 + 1 + + + DISITMATBFLUSH + DISITMATBFLUSH + 12 + 1 + + + + + + + FPU + Floting point unit + FPU + 0xE000EF34 + + 0x0 + 0xD + registers + + + FPU + Floating point unit interrupt + 81 + + + + FPCCR + FPCCR + Floating-point context control + register + 0x0 + 0x20 + read-write + 0x00000000 + + + LSPACT + LSPACT + 0 + 1 + + + USER + USER + 1 + 1 + + + THREAD + THREAD + 3 + 1 + + + HFRDY + HFRDY + 4 + 1 + + + MMRDY + MMRDY + 5 + 1 + + + BFRDY + BFRDY + 6 + 1 + + + MONRDY + MONRDY + 8 + 1 + + + LSPEN + LSPEN + 30 + 1 + + + ASPEN + ASPEN + 31 + 1 + + + + + FPCAR + FPCAR + Floating-point context address + register + 0x4 + 0x20 + read-write + 0x00000000 + + + ADDRESS + Location of unpopulated + floating-point + 3 + 29 + + + + + FPSCR + FPSCR + Floating-point status control + register + 0x8 + 0x20 + read-write + 0x00000000 + + + IOC + Invalid operation cumulative exception + bit + 0 + 1 + + + DZC + Division by zero cumulative exception + bit. + 1 + 1 + + + OFC + Overflow cumulative exception + bit + 2 + 1 + + + UFC + Underflow cumulative exception + bit + 3 + 1 + + + IXC + Inexact cumulative exception + bit + 4 + 1 + + + IDC + Input denormal cumulative exception + bit. + 7 + 1 + + + RMode + Rounding Mode control + field + 22 + 2 + + + FZ + Flush-to-zero mode control + bit: + 24 + 1 + + + DN + Default NaN mode control + bit + 25 + 1 + + + AHP + Alternative half-precision control + bit + 26 + 1 + + + V + Overflow condition code + flag + 28 + 1 + + + C + Carry condition code flag + 29 + 1 + + + Z + Zero condition code flag + 30 + 1 + + + N + Negative condition code + flag + 31 + 1 + + + + + + + SCB + System control block + SCB + 0xE000ED00 + + 0x0 + 0x41 + registers + + + + CPUID + CPUID + CPUID base register + 0x0 + 0x20 + read-only + 0x410FC241 + + + Revision + Revision number + 0 + 4 + + + PartNo + Part number of the + processor + 4 + 12 + + + Constant + Reads as 0xF + 16 + 4 + + + Variant + Variant number + 20 + 4 + + + Implementer + Implementer code + 24 + 8 + + + + + ICSR + ICSR + Interrupt control and state + register + 0x4 + 0x20 + read-write + 0x00000000 + + + VECTACTIVE + Active vector + 0 + 9 + + + RETTOBASE + Return to base level + 11 + 1 + + + VECTPENDING + Pending vector + 12 + 7 + + + ISRPENDING + Interrupt pending flag + 22 + 1 + + + PENDSTCLR + SysTick exception clear-pending + bit + 25 + 1 + + + PENDSTSET + SysTick exception set-pending + bit + 26 + 1 + + + PENDSVCLR + PendSV clear-pending bit + 27 + 1 + + + PENDSVSET + PendSV set-pending bit + 28 + 1 + + + NMIPENDSET + NMI set-pending bit. + 31 + 1 + + + + + VTOR + VTOR + Vector table offset register + 0x8 + 0x20 + read-write + 0x00000000 + + + TBLOFF + Vector table base offset + field + 9 + 21 + + + + + AIRCR + AIRCR + Application interrupt and reset control + register + 0xC + 0x20 + read-write + 0x00000000 + + + VECTRESET + VECTRESET + 0 + 1 + + + VECTCLRACTIVE + VECTCLRACTIVE + 1 + 1 + + + SYSRESETREQ + SYSRESETREQ + 2 + 1 + + + PRIGROUP + PRIGROUP + 8 + 3 + + + ENDIANESS + ENDIANESS + 15 + 1 + + + VECTKEYSTAT + Register key + 16 + 16 + + + + + SCR + SCR + System control register + 0x10 + 0x20 + read-write + 0x00000000 + + + SLEEPONEXIT + SLEEPONEXIT + 1 + 1 + + + SLEEPDEEP + SLEEPDEEP + 2 + 1 + + + SEVEONPEND + Send Event on Pending bit + 4 + 1 + + + + + CCR + CCR + Configuration and control + register + 0x14 + 0x20 + read-write + 0x00000000 + + + NONBASETHRDENA + Configures how the processor enters + Thread mode + 0 + 1 + + + USERSETMPEND + USERSETMPEND + 1 + 1 + + + UNALIGN__TRP + UNALIGN_ TRP + 3 + 1 + + + DIV_0_TRP + DIV_0_TRP + 4 + 1 + + + BFHFNMIGN + BFHFNMIGN + 8 + 1 + + + STKALIGN + STKALIGN + 9 + 1 + + + DC + DC + 16 + 1 + + + IC + IC + 17 + 1 + + + BP + BP + 18 + 1 + + + + + SHPR1 + SHPR1 + System handler priority + registers + 0x18 + 0x20 + read-write + 0x00000000 + + + PRI_4 + Priority of system handler + 4 + 0 + 8 + + + PRI_5 + Priority of system handler + 5 + 8 + 8 + + + PRI_6 + Priority of system handler + 6 + 16 + 8 + + + + + SHPR2 + SHPR2 + System handler priority + registers + 0x1C + 0x20 + read-write + 0x00000000 + + + PRI_11 + Priority of system handler + 11 + 24 + 8 + + + + + SHPR3 + SHPR3 + System handler priority + registers + 0x20 + 0x20 + read-write + 0x00000000 + + + PRI_14 + Priority of system handler + 14 + 16 + 8 + + + PRI_15 + Priority of system handler + 15 + 24 + 8 + + + + + SHCSR + SHCSR + System handler control and state + register + 0x24 + 0x20 + read-write + 0x00000000 + + + MEMFAULTACT + Memory management fault exception active + bit + 0 + 1 + + + BUSFAULTACT + Bus fault exception active + bit + 1 + 1 + + + USGFAULTACT + Usage fault exception active + bit + 3 + 1 + + + SVCALLACT + SVC call active bit + 7 + 1 + + + MONITORACT + Debug monitor active bit + 8 + 1 + + + PENDSVACT + PendSV exception active + bit + 10 + 1 + + + SYSTICKACT + SysTick exception active + bit + 11 + 1 + + + USGFAULTPENDED + Usage fault exception pending + bit + 12 + 1 + + + MEMFAULTPENDED + Memory management fault exception + pending bit + 13 + 1 + + + BUSFAULTPENDED + Bus fault exception pending + bit + 14 + 1 + + + SVCALLPENDED + SVC call pending bit + 15 + 1 + + + MEMFAULTENA + Memory management fault enable + bit + 16 + 1 + + + BUSFAULTENA + Bus fault enable bit + 17 + 1 + + + USGFAULTENA + Usage fault enable bit + 18 + 1 + + + + + CFSR_UFSR_BFSR_MMFSR + CFSR_UFSR_BFSR_MMFSR + Configurable fault status + register + 0x28 + 0x20 + read-write + 0x00000000 + + + IACCVIOL + IACCVIOL + 0 + 1 + + + DACCVIOL + DACCVIOL + 1 + 1 + + + MUNSTKERR + MUNSTKERR + 3 + 1 + + + MSTKERR + MSTKERR + 4 + 1 + + + MLSPERR + MLSPERR + 5 + 1 + + + MMARVALID + MMARVALID + 7 + 1 + + + IBUSERR + Instruction bus error + 8 + 1 + + + PRECISERR + Precise data bus error + 9 + 1 + + + IMPRECISERR + Imprecise data bus error + 10 + 1 + + + UNSTKERR + Bus fault on unstacking for a return + from exception + 11 + 1 + + + STKERR + Bus fault on stacking for exception + entry + 12 + 1 + + + LSPERR + Bus fault on floating-point lazy state + preservation + 13 + 1 + + + BFARVALID + Bus Fault Address Register (BFAR) valid + flag + 15 + 1 + + + UNDEFINSTR + Undefined instruction usage + fault + 16 + 1 + + + INVSTATE + Invalid state usage fault + 17 + 1 + + + INVPC + Invalid PC load usage + fault + 18 + 1 + + + NOCP + No coprocessor usage + fault. + 19 + 1 + + + UNALIGNED + Unaligned access usage + fault + 24 + 1 + + + DIVBYZERO + Divide by zero usage fault + 25 + 1 + + + + + HFSR + HFSR + Hard fault status register + 0x2C + 0x20 + read-write + 0x00000000 + + + VECTTBL + Vector table hard fault + 1 + 1 + + + FORCED + Forced hard fault + 30 + 1 + + + DEBUG_VT + Reserved for Debug use + 31 + 1 + + + + + MMFAR + MMFAR + Memory management fault address + register + 0x34 + 0x20 + read-write + 0x00000000 + + + ADDRESS + Memory management fault + address + 0 + 32 + + + + + BFAR + BFAR + Bus fault address register + 0x38 + 0x20 + read-write + 0x00000000 + + + ADDRESS + Bus fault address + 0 + 32 + + + + + + + PF + Processor features + PF + 0xE000ED78 + + 0x0 + 0xD + registers + + + + CLIDR + CLIDR + Cache Level ID register + 0x0 + 0x20 + read-only + 0x09000003 + + + CL1 + CL1 + 0 + 3 + + + CL2 + CL2 + 3 + 3 + + + CL3 + CL3 + 6 + 3 + + + CL4 + CL4 + 9 + 3 + + + CL5 + CL5 + 12 + 3 + + + CL6 + CL6 + 15 + 3 + + + CL7 + CL7 + 18 + 3 + + + LoUIS + LoUIS + 21 + 3 + + + LoC + LoC + 24 + 3 + + + LoU + LoU + 27 + 3 + + + + + CTR + CTR + Cache Type register + 0x4 + 0x20 + read-only + 0X8303C003 + + + _IminLine + IminLine + 0 + 4 + + + DMinLine + DMinLine + 16 + 4 + + + ERG + ERG + 20 + 4 + + + CWG + CWG + 24 + 4 + + + Format + Format + 29 + 3 + + + + + CCSIDR + CCSIDR + Cache Size ID register + 0x8 + 0x20 + read-only + 0X00000000 + + + LineSize + LineSize + 0 + 3 + + + Associativity + Associativity + 3 + 10 + + + NumSets + NumSets + 13 + 15 + + + WA + WA + 28 + 1 + + + RA + RA + 29 + 1 + + + WB + WB + 30 + 1 + + + WT + WT + 31 + 1 + + + + + + + AC + Access control + AC + 0xE000EF90 + + 0x0 + 0x1D + registers + + + + ITCMCR + ITCMCR + Instruction and Data Tightly-Coupled Memory + Control Registers + 0x0 + 0x20 + read-write + 0X00000000 + + + EN + EN + 0 + 1 + + + RMW + RMW + 1 + 1 + + + RETEN + RETEN + 2 + 1 + + + SZ + SZ + 3 + 4 + + + + + DTCMCR + DTCMCR + Instruction and Data Tightly-Coupled Memory + Control Registers + 0x4 + 0x20 + read-write + 0X00000000 + + + EN + EN + 0 + 1 + + + RMW + RMW + 1 + 1 + + + RETEN + RETEN + 2 + 1 + + + SZ + SZ + 3 + 4 + + + + + AHBPCR + AHBPCR + AHBP Control register + 0x8 + 0x20 + read-write + 0X00000000 + + + EN + EN + 0 + 1 + + + SZ + SZ + 1 + 3 + + + + + CACR + CACR + Auxiliary Cache Control + register + 0xC + 0x20 + read-write + 0X00000000 + + + SIWT + SIWT + 0 + 1 + + + ECCEN + ECCEN + 1 + 1 + + + FORCEWT + FORCEWT + 2 + 1 + + + + + AHBSCR + AHBSCR + AHB Slave Control register + 0x10 + 0x20 + read-write + 0X00000000 + + + CTL + CTL + 0 + 2 + + + TPRI + TPRI + 2 + 9 + + + INITCOUNT + INITCOUNT + 11 + 5 + + + + + ABFSR + ABFSR + Auxiliary Bus Fault Status + register + 0x18 + 0x20 + read-write + 0X00000000 + + + ITCM + ITCM + 0 + 1 + + + DTCM + DTCM + 1 + 1 + + + AHBP + AHBP + 2 + 1 + + + AXIM + AXIM + 3 + 1 + + + EPPB + EPPB + 4 + 1 + + + AXIMTYPE + AXIMTYPE + 8 + 2 + + + + + + + From 98bc9f0afd23098a2ca01d4d6e014ce6bb5843fa Mon Sep 17 00:00:00 2001 From: KY-S0ong <156529018+KY-S0ong@users.noreply.github.com> Date: Fri, 9 Aug 2024 06:22:39 -0400 Subject: [PATCH 427/429] Connecting to Configurator via USB-C cable --- docs/USB Flashing.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/USB Flashing.md b/docs/USB Flashing.md index 4981e95a043..5d627f499b4 100644 --- a/docs/USB Flashing.md +++ b/docs/USB Flashing.md @@ -56,15 +56,12 @@ With the board connected and in bootloader mode (reset it by sending the charact * Restart the Configurator (make sure it is completely closed, logout and login if unsure) * Now the DFU device should be seen by Configurator -## Platoform: Mac-OS - -Configuator devices can have a problem accesing USB devices on Mac-OS. This is *ussaly* solved by a cable change. - -* The official Apple USB-C to USB-C will not work no matter orentation. -* Make sure the cable you are using support data transfer - * For best results, use a USB-C to USB-A cable (And a dongle if your computer does not have an USB-A port) - * Dongle side pluged into the computer +## While Using USB-C cables +* If you are using a device with only USB-C ports such as a Mac-OS device, you will need a dongle. + * A USB-C to USB-C cable is identical on both ends and thus requires extra hardware to let them be auto detected as devices instead of hosts. + * This is __can__ by using a USB-C female to USB-C male dongle; **However** a USB-C to USB-A cable with a dongle works best as USB-A always sends power while USB-C needs the device to request it. + ## Using `dfu-util` `dfu-util` is a command line tool to flash ARM devices via DFU. It is available via the package manager on most Linux systems or from [source forge](http://sourceforge.net/p/dfu-util). From fc8aa0d7692c8078d92b908ebebb4990791cda26 Mon Sep 17 00:00:00 2001 From: Marcelo Bezerra <23555060+mmosca@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:34:52 +0200 Subject: [PATCH 428/429] Update USB Flashing.md --- docs/USB Flashing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/USB Flashing.md b/docs/USB Flashing.md index 5d627f499b4..9d79d5cd8d1 100644 --- a/docs/USB Flashing.md +++ b/docs/USB Flashing.md @@ -60,7 +60,7 @@ With the board connected and in bootloader mode (reset it by sending the charact * If you are using a device with only USB-C ports such as a Mac-OS device, you will need a dongle. * A USB-C to USB-C cable is identical on both ends and thus requires extra hardware to let them be auto detected as devices instead of hosts. - * This is __can__ by using a USB-C female to USB-C male dongle; **However** a USB-C to USB-A cable with a dongle works best as USB-A always sends power while USB-C needs the device to request it. + * Using a USB-A to C cable or dongle is usually the easiest way to get a working connection but an USB-OTG adapter also works. ## Using `dfu-util` From afea9fe74fed6e6190e18a744987b8d2d4ae8b03 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Thu, 8 Aug 2024 19:36:42 +0200 Subject: [PATCH 429/429] vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames --- src/main/drivers/vtx_common.h | 2 +- src/main/io/vtx_smartaudio.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/vtx_common.h b/src/main/drivers/vtx_common.h index 021d17f24de..80b957c5d13 100644 --- a/src/main/drivers/vtx_common.h +++ b/src/main/drivers/vtx_common.h @@ -34,7 +34,7 @@ #if defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP) || defined(USE_VTX_MSP) -#define VTX_SETTINGS_POWER_COUNT 5 +#define VTX_SETTINGS_POWER_COUNT 8 #define VTX_SETTINGS_DEFAULT_POWER 1 #define VTX_SETTINGS_MIN_POWER 1 #define VTX_SETTINGS_MIN_USER_FREQ 5000 diff --git a/src/main/io/vtx_smartaudio.c b/src/main/io/vtx_smartaudio.c index 20997c2da2c..7d5e213cce0 100644 --- a/src/main/io/vtx_smartaudio.c +++ b/src/main/io/vtx_smartaudio.c @@ -61,8 +61,8 @@ static serialPort_t *smartAudioSerialPort = NULL; uint8_t saPowerCount = VTX_SMARTAUDIO_DEFAULT_POWER_COUNT; -const char * saPowerNames[VTX_SMARTAUDIO_MAX_POWER_COUNT + 1] = { - "----", "25 ", "200 ", "500 ", "800 ", " " +const char *saPowerNames[VTX_SMARTAUDIO_MAX_POWER_COUNT + 1] = { + "----", "25 ", "200 ", "500 ", "800 ", " ", " ", " ", " " }; // Save powerlevels reported from SA 2.1 devices here