-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev me12 fthr support #469
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7384ab
Add MAX32662 FTHR Board in MSDK
karaanil adb4c58
[MSDK-1054] I2C example description and verifyData fix
karaanil 735f2ee
UART example FTHR fix
karaanil 8e6813b
clang-format-run
karaanil 5ce180a
[MSDK-1066] MAX32662 FTHR Pull Request Changes
karaanil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/****************************************************************************** | ||
* Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES | ||
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Except as contained in this notice, the name of Maxim Integrated | ||
* Products, Inc. shall not be used except as stated in the Maxim Integrated | ||
* Products, Inc. Branding Policy. | ||
* | ||
* The mere transfer of this software does not imply any licenses | ||
* of trade secrets, proprietary technology, copyrights, patents, | ||
* trademarks, maskwork rights, or any other form of intellectual | ||
* property whatsoever. Maxim Integrated Products, Inc. retains all | ||
* ownership rights. | ||
* | ||
******************************************************************************/ | ||
|
||
/** | ||
* @file board.h | ||
* @brief Board support package API. | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#ifndef LIBRARIES_BOARDS_MAX32662_FTHR_INCLUDE_BOARD_H_ | ||
#define LIBRARIES_BOARDS_MAX32662_FTHR_INCLUDE_BOARD_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* | ||
Define board name: | ||
Use as #if defined(BOARD_FTHR) | ||
Not as #if BOARD_FTHR | ||
*/ | ||
#define BOARD_FTHR 1 | ||
|
||
#ifndef CONSOLE_UART | ||
#define CONSOLE_UART 0 /// UART instance to use for console | ||
#endif | ||
|
||
#ifndef CONSOLE_BAUD | ||
#define CONSOLE_BAUD 115200 /// Console baud rate | ||
#endif | ||
|
||
#define LED_OFF 1 /// Inactive state of LEDs | ||
#define LED_ON 0 /// Active state of LEDs | ||
|
||
#define LED1 0 | ||
#define LED2 1 | ||
|
||
/** | ||
* \brief Initialize the BSP and board interfaces. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Board_Init(void); | ||
|
||
/** | ||
* \brief Initialize or reinitialize the console. This may be necessary if the | ||
* system clock rate is changed. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Console_Init(void); | ||
|
||
/** | ||
* \brief Shutdown the console. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Console_Shutdown(void); | ||
|
||
/** | ||
* \brief Attempt to prepare the console for sleep. | ||
* \returns #E_NO_ERROR if ready to sleep, #E_BUSY if not ready for sleep. | ||
*/ | ||
int Console_PrepForSleep(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // LIBRARIES_BOARDS_MAX32662_FTHR_INCLUDE_BOARD_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/****************************************************************************** | ||
* Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES | ||
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Except as contained in this notice, the name of Maxim Integrated | ||
* Products, Inc. shall not be used except as stated in the Maxim Integrated | ||
* Products, Inc. Branding Policy. | ||
* | ||
* The mere transfer of this software does not imply any licenses | ||
* of trade secrets, proprietary technology, copyrights, patents, | ||
* trademarks, maskwork rights, or any other form of intellectual | ||
* property whatsoever. Maxim Integrated Products, Inc. retains all | ||
* ownership rights. | ||
* | ||
******************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include "mxc_device.h" | ||
#include "mxc_sys.h" | ||
#include "mxc_errors.h" | ||
#include "mxc_assert.h" | ||
#include "board.h" | ||
#include "uart.h" | ||
#include "gpio.h" | ||
#include "mxc_pins.h" | ||
#include "led.h" | ||
#include "pb.h" | ||
|
||
/***** Global Variables *****/ | ||
mxc_uart_regs_t *ConsoleUart = MXC_UART_GET_UART(CONSOLE_UART); | ||
extern uint32_t SystemCoreClock; | ||
|
||
const mxc_gpio_cfg_t pb_pin[] = { { MXC_GPIO0, MXC_GPIO_PIN_6, MXC_GPIO_FUNC_IN, | ||
MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIOH } }; | ||
const unsigned int num_pbs = (sizeof(pb_pin) / sizeof(mxc_gpio_cfg_t)); | ||
|
||
const mxc_gpio_cfg_t led_pin[] = { { MXC_GPIO0, MXC_GPIO_PIN_14, MXC_GPIO_FUNC_OUT, | ||
MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO } }; | ||
const unsigned int num_leds = (sizeof(led_pin) / sizeof(mxc_gpio_cfg_t)); | ||
|
||
/***** File Scope Variables *****/ | ||
|
||
/******************************************************************************/ | ||
void mxc_assert(const char *expr, const char *file, int line) | ||
{ | ||
printf("MXC_ASSERT %s #%d: (%s)\n", file, line, expr); | ||
while (1) {} | ||
} | ||
|
||
/******************************************************************************/ | ||
int Board_Init(void) | ||
{ | ||
int err; | ||
|
||
if ((err = Console_Init()) < E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
if ((err = PB_Init()) != E_NO_ERROR) { | ||
MXC_ASSERT_FAIL(); | ||
return err; | ||
} | ||
|
||
if ((err = LED_Init()) != E_NO_ERROR) { | ||
MXC_ASSERT_FAIL(); | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
|
||
/******************************************************************************/ | ||
int Console_Init(void) | ||
{ | ||
int err; | ||
|
||
if ((err = MXC_UART_Init(ConsoleUart, CONSOLE_BAUD, MXC_UART_APB_CLK, MAP_A)) != E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
|
||
int Console_Shutdown(void) | ||
{ | ||
int err; | ||
|
||
if ((err = MXC_UART_Shutdown(ConsoleUart)) != E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
/******************************************************************************/ | ||
void NMI_Handler(void) | ||
{ | ||
__NOP(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/****************************************************************************** | ||
* Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES | ||
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Except as contained in this notice, the name of Maxim Integrated | ||
* Products, Inc. shall not be used except as stated in the Maxim Integrated | ||
* Products, Inc. Branding Policy. | ||
* | ||
* The mere transfer of this software does not imply any licenses | ||
* of trade secrets, proprietary technology, copyrights, patents, | ||
* trademarks, maskwork rights, or any other form of intellectual | ||
* property whatsoever. Maxim Integrated Products, Inc. retains all | ||
* ownership rights. | ||
* | ||
******************************************************************************/ | ||
|
||
#include "max32662.h" | ||
|
||
/* The stack address is defined by the linker | ||
* It is typed as a function here to avoid compiler warnings | ||
*/ | ||
extern void __StackTop(void); | ||
|
||
void Reset_Handler(void); | ||
void NMI_Handler_ROM(void); | ||
void HardFault_Handler_ROM(void); | ||
void MemManage_Handler(void); | ||
void BusFault_Handler(void); | ||
void UsageFault_Handler(void); | ||
void SVC_Handler(void); | ||
void DebugMon_Handler(void); | ||
void PendSV_Handler(void); | ||
void SysTick_Handler(void); | ||
|
||
/* Create a vector table to locate at zero in the ROM for handling reset and startup */ | ||
__attribute__((section(".rom_vector"))) void (*const rom_vector[])(void) = { | ||
__StackTop, /* Top of Stack */ | ||
Reset_Handler, /* Reset Handler */ | ||
NMI_Handler_ROM, /* NMI Handler */ | ||
HardFault_Handler_ROM, /* Hard Fault Handler */ | ||
MemManage_Handler, /* MPU Fault Handler */ | ||
BusFault_Handler, /* Bus Fault Handler */ | ||
UsageFault_Handler, /* Usage Fault Handler */ | ||
0, /* Reserved */ | ||
0, /* Reserved */ | ||
0, /* Reserved */ | ||
0, /* Reserved */ | ||
SVC_Handler, /* SVCall Handler */ | ||
DebugMon_Handler, /* Debug Monitor Handler */ | ||
0, /* Reserved */ | ||
PendSV_Handler, /* PendSV Handler */ | ||
SysTick_Handler, /* SysTick Handler */ | ||
}; | ||
|
||
/* This is needed to handle the NMI at POR */ | ||
__attribute__((section(".rom_handlers"))) void NMI_Handler_ROM(void) | ||
{ | ||
__NOP(); | ||
} | ||
|
||
/* This is needed to handle the fault after initial programming */ | ||
__attribute__((section(".rom_handlers"))) void HardFault_Handler_ROM(void) | ||
{ | ||
NVIC_SystemReset(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if else condition seems not needed.
The function and parameters are exactly same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if calls MAP_A else calls MAB_B. They are not exactly same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UART0B pins are accessible on the EvKit (RX: P0.7; TX: P0.8). Would it be easier if both the EvKit and FTHR boards use UART0B as the WRITING_UART and UART1A as the READING_UART? Unless you want to show the MAP_A vs MAP_B difference, this will minimize the amount of #if,#else,#endif directives used between the two boards if both run on the same set of pins.