Skip to content

Update SDK #176

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update SDK #176

wants to merge 1 commit into from

Conversation

21km43
Copy link

@21km43 21km43 commented Jan 11, 2025

Summary

Update board's SDK.

Also, CH32X035 doesn't seem to support manually config open-drain mode. (GPIO will be open-drain in I2C connection automatically.)

#if !defined(CH32X035)
          case CH_CNF_OUTPUT_OD:
               GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
               break;
#endif
          case CH_CNF_OUTPUT_AFPP:
               GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
               break;
#if !defined(CH32X035)
          case CH_CNF_OUTPUT_AFOD:
               GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
               break; 
#endif

And AFIO_Remap_SWJ_NONJTRST and AFIO_Remap_SWJ_NOJTAG were removed from variants\CH32V20x\PinAF_CH32V20x.h because they don't exist.

-   AFIO_Remap_SWJ_NONJTRST,
-   AFIO_Remap_SWJ_NOJTAG,
-
-   case AFIO_Remap_SWJ_NONJTRST: 
-     GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST,ENABLE);
-     break;
-   case AFIO_Remap_SWJ_NOJTAG: 
-     GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
-     break;

Update SDK log

  1. Copy from official SDK
  2. Disable _write in debug.c.
/*********************************************************************
 * @fn      _write
 *
 * @brief   Support Printf Function
 *
 * @param   *buf - UART send Data.
 *          size - Data length.
 *
 * @return  size - Data length
 */
+ #if 0
__attribute__((used)) 
int _write(int fd, char *buf, int size)
{
    
}
+ #endif
  1. Add _fini and _init in end of debug.c.
+ void _fini() {}
+ void _init() {}
  1. Comment out #define SYSCLK_FREQ_XXXX in system_ch32xxxx.c.
  2. Debug

Memo (SDK's bug)

  • In ch32l103_usb.h
#ifdef __cplusplus
extern "C" {
#endif

- #ifdef __cplusplus
- extern "C" {
- #endif
  • In ch32v10x_misc.h
+ #ifdef __cplusplus
+ }
+ #endif
  • Some boards use MHZ instead for MHz in system_ch32xxxx.c.

@21km43 21km43 changed the title Update sdk Update SDK Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant