diff --git a/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.cpp b/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.cpp index a886639..dc0971f 100644 --- a/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.cpp +++ b/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.cpp @@ -1428,8 +1428,6 @@ void SetN2kPGN129810(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, u N2kMsg.Add2ByteUDouble(PosRefBow, 0.1); N2kMsg.Add4ByteUInt(MothershipID); N2kMsg.AddByte(0xff); // Reserved - - // TODO: Add AIS Transceiver Info here!!! N2kMsg.AddByte(AISInfo); } @@ -1758,7 +1756,7 @@ bool ParseN2kPGN129041(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat bool &OffPos, bool &Virtual, bool &AssignedMode, tN2kGNSStype &GNSSType, tN2kAISTranceiverInfo &AISinfo) { - if (N2kMsg.PGN != 129049L) return false; + if (N2kMsg.PGN != 129041L) return false; uint8_t vb; int Index = 0; diff --git a/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.h b/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.h index a2e4f11..5d807e1 100644 --- a/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.h +++ b/latest/Firmware/NMEA200Adapter/nmea2000/N2kMessages.h @@ -1233,12 +1233,12 @@ void SetN2kPGN129794(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, u uint32_t IMOnumber, const char *Callsign, const char *Name, uint8_t VesselType, double Length, double Beam, double PosRefStbd, double PosRefBow, uint16_t ETAdate, double ETAtime, double Draught, const char *Destination, tN2kAISVersion AISversion, tN2kGNSStype GNSStype, - tN2kAISDTE DTE, tN2kAISTranceiverInfo AISinfo); + tN2kAISDTE DTE, tN2kAISTranceiverInfo AISinfo = N2kaisti_Reserved); inline void SetN2kAISClassAStatic(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, uint32_t UserID, uint32_t IMOnumber, const char *Callsign, const char *Name, uint8_t VesselType, double Length, double Beam, double PosRefStbd, double PosRefBow, uint16_t ETAdate, double ETAtime, double Draught, const char *Destination, tN2kAISVersion AISversion, tN2kGNSStype GNSStype, - tN2kAISDTE DTE, tN2kAISTranceiverInfo AISinfo) { + tN2kAISDTE DTE, tN2kAISTranceiverInfo AISinfo = N2kaisti_Reserved) { SetN2kPGN129794(N2kMsg, MessageID, Repeat, UserID, IMOnumber, Callsign, Name, VesselType, Length, Beam, PosRefStbd, PosRefBow, ETAdate, ETAtime, Draught, Destination, AISversion, GNSStype, DTE, AISinfo); } @@ -1580,7 +1580,7 @@ void SetN2kPGN129041(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, u tN2kAtoNType type, const char *Name, double Length, double Beam, double PosRefStbd, double PosRefBow, bool OffPos, bool Virtual, bool AssignedMode, tN2kGNSStype GNSSType, - tN2kAISTranceiverInfo AISinfo); + tN2kAISTranceiverInfo AISinfo = N2kaisti_Reserved); bool ParseN2kPGN129041(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &UserID, double &Latitude, double &Longitude, bool &Accuracy, bool &RAIM, diff --git a/latest/Firmware/Transponder/README.md b/latest/Firmware/Transponder/README.md index 33032bb..d9945b9 100644 --- a/latest/Firmware/Transponder/README.md +++ b/latest/Firmware/Transponder/README.md @@ -2,15 +2,23 @@ This is a vanilla Eclipse CDT project. Import it into your workspace and (assuming you have ARM cross compiler installed) it should be straightforward. -The application is mainly interrupt driven, with a single event queue being dispatched by either main() or an RTOS task. +The application is mainly interrupt driven, with an event queue being dispatched by main(). ### Key updates - It turned out that FreeRTOS added no value, so it was removed - DFU can be achieved by jumping directly into the ROM bootloader, so there is no need for hardware to manipulate the BOOT0 pin - - The TX_DISABLE signal is now supported. It is active low in board 9.x and active high in board 10.x + - The TX_DISABLE signal is now supported. It is active low in board 9.x and active high in board 10.x and higher - Board 9.3 adds 3 "status" (LED driving) signals for GPS, RX and TX - Board 10.x needed a GPIO swap to make routing viable and inverted the logic of the TX_DISABLE signal, but it's all abstracted in the BSP - The new 'cli' command was introduced to reboot the board into 'quiet' mode, making it a lot easier to program and verify the station data - Station metadata is now stored in MCU flash, so it is handled in the Configuration class instead of the BSP. The EEPROM is obsolete. +### Building and flashing + +You will need Eclipse CDT with the MCU package, plus the ARM GCC crosscompiler toolkit. You may need to tweak toolkit paths for the build to work. + +The project supports the following STM32 MCUs: L412, L422, L431 and L432. + + +The openocd-flash-*** scripts in this folder can be run against an STLink programmer to flash the corresponding binary directly to the MCU without any kind of Debug session in Eclipse. \ No newline at end of file diff --git a/latest/Firmware/Transponder/Src/bsp/bsp_11_0.cpp b/latest/Firmware/Transponder/Src/bsp/bsp_11_0.cpp index 63b5dbd..bf8f94c 100644 --- a/latest/Firmware/Transponder/Src/bsp/bsp_11_0.cpp +++ b/latest/Firmware/Transponder/Src/bsp/bsp_11_0.cpp @@ -74,6 +74,8 @@ static const GPIO __gpios[] = { {RX_IC_CLK_PORT, {RX_IC_CLK_PIN, GPIO_MODE_IT_RISING, GPIO_NOPULL, GPIO_SPEED_LOW, 0}, GPIO_PIN_RESET}, {RX_IC_DATA_PORT, {RX_IC_DATA_PIN, GPIO_MODE_INPUT, GPIO_NOPULL, GPIO_SPEED_LOW, 0}, GPIO_PIN_RESET}, {PA_BIAS_PORT, {PA_BIAS_PIN, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_SPEED_LOW, 0}, GPIO_PIN_RESET}, + {LNA_PWR_PORT, {LNA_PWR_PIN, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_SPEED_LOW, 0}, GPIO_PIN_RESET}, + {RFSW_CTRL_PORT, {RFSW_CTRL_PIN, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_SPEED_LOW, 0}, GPIO_PIN_RESET}, }; extern "C" @@ -197,8 +199,6 @@ void bsp_hw_init() HAL_NVIC_SetPriority(EXTI3_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI3_IRQn); - // This is our HAL tick timer now - HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0); } @@ -273,12 +273,11 @@ void gpio_pin_init() for ( unsigned i = 0; i < sizeof __gpios / sizeof(GPIO); ++i ) { const GPIO* io = &__gpios[i]; - HAL_GPIO_Init(io->port, (GPIO_InitTypeDef*)&io->gpio); if ( io->gpio.Mode == GPIO_MODE_OUTPUT_PP || io->gpio.Mode == GPIO_MODE_OUTPUT_OD ) { HAL_GPIO_WritePin(io->port, io->gpio.Pin, io->init); } - + HAL_GPIO_Init(io->port, (GPIO_InitTypeDef*)&io->gpio); } } @@ -321,13 +320,15 @@ void HAL_MspInit(void) void bsp_set_rx_mode() { HAL_GPIO_WritePin(PA_BIAS_PORT, PA_BIAS_PIN, GPIO_PIN_RESET); // Kill the RF MOSFET bias voltage - GPIO_InitTypeDef gpio; gpio.Pin = TRX_IC_DATA_PIN; gpio.Mode = GPIO_MODE_INPUT; gpio.Speed = GPIO_SPEED_FREQ_LOW; gpio.Pull = GPIO_NOPULL; HAL_GPIO_Init(TRX_IC_DATA_PORT, &gpio); + + HAL_GPIO_WritePin(LNA_PWR_PORT, LNA_PWR_PIN, GPIO_PIN_SET); + HAL_GPIO_WritePin(RFSW_CTRL_PORT, RFSW_CTRL_PIN, GPIO_PIN_RESET); } void bsp_rx_led_on() @@ -363,6 +364,9 @@ void bsp_gps_led_off() void bsp_set_tx_mode() { + HAL_GPIO_WritePin(LNA_PWR_PORT, LNA_PWR_PIN, GPIO_PIN_RESET); + HAL_GPIO_WritePin(RFSW_CTRL_PORT, RFSW_CTRL_PIN, GPIO_PIN_SET); + GPIO_InitTypeDef gpio; gpio.Pin = TRX_IC_DATA_PIN; gpio.Mode = GPIO_MODE_OUTPUT_PP; diff --git a/latest/Firmware/Transponder/jlink-flash-release-build.command b/latest/Firmware/Transponder/jlink-flash-release-build.command deleted file mode 100644 index 07b7050..0000000 --- a/latest/Firmware/Transponder/jlink-flash-release-build.command +++ /dev/null @@ -1,8 +0,0 @@ -device STM32L432KB -si 1 -speed 1000 -connect -loadbin Release/ais_transponder.bin, 0x08000000 -r -g -q diff --git a/latest/Firmware/Transponder/openocd-flash-l431-release-build.cfg b/latest/Firmware/Transponder/openocd-flash-l431-release-build.cfg new file mode 100644 index 0000000..67f6fa8 --- /dev/null +++ b/latest/Firmware/Transponder/openocd-flash-l431-release-build.cfg @@ -0,0 +1,22 @@ +source [find interface/stlink.cfg] +transport select hla_swd +source [find target/stm32l4x.cfg] + +adapter speed 950 + +#reset_config srst_nogate +#adapter srst delay 100 +#adapter srst pulse_width 100 + +init +#targets +reset init +reset halt + +flash write_image erase "STM32L431-Release/maiana-transponder.bin" 0x08000000 +wait 5 +verify_image "STM32L431-Release/maiana-transponder.bin" 0x08000000 bin + + +reset run +shutdown diff --git a/latest/Firmware/Transponder/openocd-flash-l432-release-build.cfg b/latest/Firmware/Transponder/openocd-flash-l432-release-build.cfg index 938176f..626c179 100644 --- a/latest/Firmware/Transponder/openocd-flash-l432-release-build.cfg +++ b/latest/Firmware/Transponder/openocd-flash-l432-release-build.cfg @@ -1,4 +1,4 @@ -source [find interface/stlink.cfg] +TRX_IC_CLK_PINsource [find interface/stlink.cfg] transport select hla_swd source [find target/stm32l4x.cfg]