SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
Loading...
Searching...
No Matches
Bus settings

Settings for the buses. More...

Macros

#define USED_SPI   SPI1
 Used SPI for sensor IO bus.
 
#define SPISPEED_IMU   10e6
 Speed of IMU SPI, max is 10e6.
 
#define SPISPEED_MAG   10e6
 Speed of MAG SPI, max is 10e6.
 
#define SPISPEED_DAC   10e6
 Speed of MAG SPI, max is 20e6.
 
#define UART_SPEEDSENS   Serial7
 Used UART for speed sensor bus.
 
#define BAUD_SPEEDSENS   4e6
 Baudrate of the UART for speed sensor bus.
 
#define UART_GPS   Serial2
 Used UART for GPS sensor bus.
 
#define BAUD_GPS_DEF   9600
 Default baudrate of GPS sensor (for init only).
 
#define BAUD_GPS   57600
 Actual baudrate of GPS sensor.
 
#define GPS_EXTBUFSIZE   128
 Extra buffer size for GPS sensor UART.
 
#define UART_SBUS   Serial8
 Used UART for SBUS communication. /details The UART used for the SBUS receiver. This runs with a baudrate of 100000. Initialization and setting is performed by the SBUS library.
 
#define ADC_RES   12
 ADC resolution (in bits).
 
#define ADC_AVERAGE   8
 ADC averaging 1/2/8/16 (samples). The more the averaging, the less the noise, but the more the reading time.
 
#define DAC_RES   12
 DAC resolution (in bits).
 
#define DAC_MTR_CH   0
 DAC channel for motor control.
 
#define DAC_THROTTLE_CH   1
 DAC channel for throttle control.
 
#define PWM_RES   12
 PWM resolution in bit (max is 14).
 
#define PWM_FREQ   5e3
 PWM frequency (max is 5kHz).
 
#define PWM_MIN   0.1F
 Minimum PWM value for motor current reference.
 
#define PWM_MAX   0.9F
 Maximum PWM value for motor current reference.
 

Detailed Description

Settings for the buses.

Settings of the used buses for the communications with sensorsaand drivers. This includes defines for the SPI and UART(s) used for the sensors, settings for the ADCs, DACs, and PWM.

Warning
Be careful to modify this parameters. Changes may lead to possible short circuits which kill the circuit.

Macro Definition Documentation

◆ ADC_AVERAGE

#define ADC_AVERAGE   8

ADC averaging 1/2/8/16 (samples). The more the averaging, the less the noise, but the more the reading time.

◆ ADC_RES

#define ADC_RES   12

ADC resolution (in bits).

◆ BAUD_GPS

#define BAUD_GPS   57600

Actual baudrate of GPS sensor.

◆ BAUD_GPS_DEF

#define BAUD_GPS_DEF   9600

Default baudrate of GPS sensor (for init only).

◆ BAUD_SPEEDSENS

#define BAUD_SPEEDSENS   4e6

Baudrate of the UART for speed sensor bus.

◆ DAC_MTR_CH

#define DAC_MTR_CH   0

DAC channel for motor control.

◆ DAC_RES

#define DAC_RES   12

DAC resolution (in bits).

◆ DAC_THROTTLE_CH

#define DAC_THROTTLE_CH   1

DAC channel for throttle control.

◆ GPS_EXTBUFSIZE

#define GPS_EXTBUFSIZE   128

Extra buffer size for GPS sensor UART.

◆ PWM_FREQ

#define PWM_FREQ   5e3

PWM frequency (max is 5kHz).

◆ PWM_MAX

#define PWM_MAX   0.9F

Maximum PWM value for motor current reference.

◆ PWM_MIN

#define PWM_MIN   0.1F

Minimum PWM value for motor current reference.

◆ PWM_RES

#define PWM_RES   12

PWM resolution in bit (max is 14).

◆ SPISPEED_DAC

#define SPISPEED_DAC   10e6

Speed of MAG SPI, max is 20e6.

◆ SPISPEED_IMU

#define SPISPEED_IMU   10e6

Speed of IMU SPI, max is 10e6.

◆ SPISPEED_MAG

#define SPISPEED_MAG   10e6

Speed of MAG SPI, max is 10e6.

◆ UART_GPS

#define UART_GPS   Serial2

Used UART for GPS sensor bus.

◆ UART_SBUS

#define UART_SBUS   Serial8

Used UART for SBUS communication. /details The UART used for the SBUS receiver. This runs with a baudrate of 100000. Initialization and setting is performed by the SBUS library.

◆ UART_SPEEDSENS

#define UART_SPEEDSENS   Serial7

Used UART for speed sensor bus.

◆ USED_SPI

#define USED_SPI   SPI1

Used SPI for sensor IO bus.