导航

    Freqchip开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 最新
    1. 主页
    2. Mars
    3. 帖子
    M
    • 继续与 Mars 聊天
    • 开始与 Mars 的新会话
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 主题
    • 帖子
    • 最佳
    • 群组

    Mars 发布的帖子

    • RE: 为什么FR8008GPU用不了QSPI的四线psram,只能用单线读取

      你用的是FR8008GP-U还是不带-U的?

      发布在 FR800x
      M
      Mars
    • RE: OTA后启动小概率失败问题

      你怎么判断失败是crc校验失败还是什么,bin文件多大,image_size改多少

      0_1793254204030_c38bd6bb-4686-4e77-89f0-17100a76e797-image.png

      发布在 FR800x
      M
      Mars
    • RE: FR800x Power Management Unit (PMU)

      @patrick_salvino 0_1789869400525_b653c3ce-e380-40ef-81d5-71dd281eb8b0-image.png

      发布在 FR800x
      M
      Mars
    • RE: FR8003A Unwanted Wake-up at 64 seconds

      @patrick_salvino SDK Version?

      发布在 FR800x
      M
      Mars
    • RE: FR8003A Unwanted Wake-up at 64 seconds

      After sleeping, you can wake up through the broadcast interval and connection interval PMU_IO os_timer RTC.
      All PMU domains can wake up
      0_1789869123303_568d98bf-2afb-4392-8891-0a266e125681-image.png

      发布在 FR800x
      M
      Mars
    • RE: FR8003A Unwanted Wake-up at 64 seconds

      @patrick_salvino Sleep to wake up condition RTC\ PMU\ os_timer

      发布在 FR800x
      M
      Mars
    • RE: FR8003A Unwanted Wake-up at 64 seconds

      0_1789639961431_2ec4c33c-a5fd-42b8-b037-a1728d711bd3-image.png

      发布在 FR800x
      M
      Mars
    • RE: FR8028D怎么读 128bit的 uuid呢?

      0_1789639890200_c9ba0999-783d-4b9a-8bb4-0b772146de9f-image.png 代码里面进行读取

      发布在 FR802x
      M
      Mars
    • RE: KEIL V5.28 加载ARM.CMSIS.5.9.0,芯片选择里面找不到FR8016H,是怎么回事?

      如果你安装了pack包就重启电脑试试

      发布在 FR801xH
      M
      Mars
    • RE: KEIL V5.28 加载ARM.CMSIS.5.9.0,芯片选择里面找不到FR8016H,是怎么回事?

      1、Windows 10版本以上系统;
      2、Keil V5:推荐使用528版本,高版本的测试过编译失败;
      Keil V5 V528:https://armkeil.blob.core.windows.net/eval/MDK528.EXE
      pack包:https://keilpack.azureedge.net/pack/ARM.CMSIS.5.9.0.pack

      发布在 FR801xH
      M
      Mars
    • RE: KEIL V5.28 加载ARM.CMSIS.5.9.0,芯片选择里面找不到FR8016H,是怎么回事?

      keil 工程里面不用动,直接编译就好了

      发布在 FR801xH
      M
      Mars
    • RE: 是否可以同时广播2个广播名称

      第二个广播,根据这个来图片的函数来设置
      0_1788919240570_9358ded7-dee3-44d8-90d3-c8bdb7a7e165-image.png

      发布在 FR800x
      M
      Mars
    • RE: FR802唤醒源

      sdk里面有rtc的demo自行烧录验证,rtc功能正常就可以移到你的工程里面进行休眠验证
      0_1787882625642_03debb97-fe98-43b0-bf1a-9905c10dd736-image.png

      发布在 FR802x
      M
      Mars
    • RE: FR802x 第一次能开机有日志,复位或者重启之后不能跑起来,115200波特率有freqchi

      检查一下固件的大小是否大于flashDB的操作空间
      检查flashDB设置flash的大小
      检查OTA设置的B区起始地址
      0_1787828307485_b99d07cd-972a-4b42-8764-fa796c7e1741-image.png
      举例假设使用的是FR5098芯片flash为2M,设置ota_get_start_address的start_address为512K+8K是B区OTA的起始地址,那么用户储存区地址就是512k+512k+8k开始到到0x1FD000之前为用户区,然后flashDB的操作地址也应该是512k+512k+8k之后到0x1FD000之前都是可以操作的
      0_1787884765856_ff46c29e-600f-4b66-a989-e79c41c112cd-image.png

      发布在 FR802x
      M
      Mars
    • FR802x 第一次能开机有日志,复位或者重启之后不能跑起来,115200波特率有freqchi

      FR802x 第一次能开机有日志,复位或者重启之后不能跑起来,115200波特率有freqchi

      发布在 FR802x
      M
      Mars
    • RE: FR802唤醒源

      gpio rtc也可以

      发布在 FR802x
      M
      Mars
    • RE: fr8008怎么实现 SysTick ?

      如下

      
      /*
       * INCLUDE FILES
       ****************************************************************************************
       */
      #include <stdio.h>
      #include <string.h>
      
      #include "gap_api.h"
      #include "gatt_api.h"
      #include "ble_stack.h"
      #include "app_config.h"
      
      #include "jump_table.h"
      #include "co_log.h"
      
      #include "plf.h"
      #include "driver_system.h"
      #include "driver_pmu.h"
      #include "driver_uart.h"
      
      #include "ble_simple_peripheral.h"
      #include "simple_gatt_service.h"
      
      #undef LOG_LOCAL_LEVEL
      #define LOG_LOCAL_LEVEL        (LOG_LEVEL_INFO)
      const char *app_tag = "project";
      
      #define SYSTEM_STACK_SIZE           0x800
      
      void patch_init(void);
      void disable_ch_sel_2(void);
      void conn_req_rssi_filter(int8_t rssi_value);
      
      void systick_init(void);
      void systick_delay_ms(uint32_t ms);
      void systick_delay_us(uint32_t us);
      uint32_t systick_get_ms(void);
      
      /*
       * LOCAL VARIABLES
       */
      static volatile uint32_t g_systick_ms = 0;
      
      __attribute__((section("stack_section"))) static uint32_t system_stack[SYSTEM_STACK_SIZE/sizeof(uint32_t)];
      
      const struct jump_table_version_t _jump_table_version __attribute__((section("jump_table_3"))) = 
      {
          .stack_top_address = &system_stack[SYSTEM_STACK_SIZE/sizeof(uint32_t)],
          .firmware_version = 0x00000000,
      };
      
      const struct jump_table_image_t _jump_table_image __attribute__((section("jump_table_1"))) =
      {
          .image_type = IMAGE_TYPE_APP,
          .image_size = 0x20000,      
      };
      
      /*********************************************************************
       * @fn      SysTick_Handler
       *
       * @brief   1ms tick. Overrides the WEAK handler in boot_vectors.
       */
      void SysTick_Handler(void)
      {
          g_systick_ms++;
      }
      
      /*********************************************************************
       * @fn      systick_init
       *
       * @brief   Start SysTick at 1ms. Must be called after system_set_clock().
       */
      void systick_init(void)
      {
          uint32_t ticks = system_get_clock() / 1000;
      
          if ((ticks == 0) || ((ticks - 1) > SysTick_LOAD_RELOAD_Msk)) {
              return;
          }
      
          SysTick_Config(ticks);
      }
      
      /*********************************************************************
       * @fn      systick_get_ms
       *
       * @brief   Milliseconds since systick_init. Does not advance in sleep.
       */
      uint32_t systick_get_ms(void)
      {
          return g_systick_ms;
      }
      
      /*********************************************************************
       * @fn      systick_delay_ms
       *
       * @brief   Blocking delay. Do not call with interrupts disabled.
       */
      void systick_delay_ms(uint32_t ms)
      {
          uint32_t start = g_systick_ms;
      
          while ((uint32_t)(g_systick_ms - start) < ms) {
          }
      }
      
      /*********************************************************************
       * @fn      systick_delay_us
       *
       * @brief   Blocking us delay. Temporarily uses SysTick as a one-shot,
       *          then restores the 1ms tick.
       */
      void systick_delay_us(uint32_t us)
      {
          uint32_t clk = system_get_clock();
          uint32_t ticks_per_us;
          uint32_t max_us;
      
          if ((us == 0) || (clk < 1000000)) {
              return;
          }
      
          ticks_per_us = clk / 1000000;
          max_us = SysTick_LOAD_RELOAD_Msk / ticks_per_us;
      
          while (us) {
              uint32_t chunk = (us > max_us) ? max_us : us;
      
              SysTick->CTRL = 0;
              SysTick->LOAD = ticks_per_us * chunk - 1;
              SysTick->VAL  = 0;
              SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
      
              while ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == 0) {
              }
      
              us -= chunk;
          }
      
          systick_init();
      }
      
      /*********************************************************************
       * @fn      user_entry_before_sleep_imp
       *
       * @brief   Before system goes to sleep mode, user_entry_before_sleep_imp()
       *          will be called, MCU peripherals can be configured properly before 
       *          system goes to sleep, for example, some MCU peripherals need to be
       *          used during the system is in sleep mode. 
       *
       * @param   None. 
       *       
       *
       * @return  None.
       */
      __attribute__((section("ram_code"))) void user_entry_before_sleep_imp(void)
      {
          /* SysTick uses CPU clock and would wake the core every 1ms */
          SysTick->CTRL = 0;
      
          pmu_calibration_stop();
      
          uart_putc_noint_no_wait(UART0, 's');
          co_delay_100us(1);
      
      	pmu_set_pin_to_PMU(GPIO_PORT_A, (1<<GPIO_BIT_1));
      	pmu_set_pin_to_PMU(GPIO_PORT_A, (1<<GPIO_BIT_0)|(1<<GPIO_BIT_4));
      	pmu_set_pin_dir(GPIO_PORT_A, (1<<GPIO_BIT_0)|(1<<GPIO_BIT_4),GPIO_DIR_IN);
      	pmu_set_pin_pull(GPIO_PORT_A, (1<<GPIO_BIT_0)|(1<<GPIO_BIT_4),GPIO_PULL_NONE);
          pmu_oscap_set(0);
      }
      
      /*********************************************************************
       * @fn      user_entry_after_sleep_imp
       *
       * @brief   After system wakes up from sleep mode, user_entry_after_sleep_imp()
       *          will be called, MCU peripherals need to be initialized again, 
       *          this can be done in user_entry_after_sleep_imp(). MCU peripherals
       *          status will not be kept during the sleep. 
       *
       * @param   None. 
       *       
       *
       * @return  None.
       */
      __attribute__((section("ram_code"))) void user_entry_after_sleep_imp(void)
      {
          
          pmu_set_pin_to_CPU(GPIO_PORT_A, (1<<GPIO_BIT_0));
          
          system_set_port_mux(GPIO_PORT_A, GPIO_BIT_0, PORTA0_FUNC_UART0_RXD);
          system_set_port_mux(GPIO_PORT_A, GPIO_BIT_1, PORTA1_FUNC_UART0_TXD);
          uart_init(UART0, 1152);
          fr_uart_enableIrq(UART0, Uart_irq_erbfi);
      
          /* RC calibration start. Ensure the accuracy of sleep wake time */
          pmu_calibration_start(PMU_CALI_SEL_RCLFOSC, LP_RC_CALIB_CNT);
      
          uart_putc_noint_no_wait(UART0, 'w');
          co_delay_100us(1);
      
          NVIC_EnableIRQ(PMU_IRQn);
      
          systick_init();
      }
      
      __attribute__((section("ram_code"))) void main_loop(void)
      {
          while(1)
          {
              if(ble_stack_schedule_allow())
              {
                  /*user code should be add here*/
                  
                  /* schedule internal stack event */
                  ble_stack_schedule();
              }
              
              GLOBAL_INT_DISABLE();
              switch(ble_stack_sleep_check())
              {
                  case 2:
                  {
                      ble_stack_enter_sleep();
                  }
                  break;
                  default:
                      break;
              }
              GLOBAL_INT_RESTORE();
              
              ble_stack_schedule_backward();
          }
      }
      
      /*********************************************************************
       * @fn      proj_init
       *
       * @brief   Main entrancy of user application. This function is called after BLE stack
       *          is initialized, and all the application code will be executed from here.
       *          In that case, application layer initializtion can be startd here. 
       *
       * @param   None. 
       *       
       *
       * @return  None.
       */
      void proj_init(void)
      {
          LOG_INFO(app_tag, "BLE Peripheral\r\n");
      	co_printf("%s\r\n",__func__);
          systick_delay_ms(500);
      	co_printf("%s\r\n",__TIME__);
      	
          // Application layer initialization, can included bond manager init, 
          // advertising parameters init, scanning parameter init, GATT service adding, etc.    
          simple_peripheral_init();
      }
      
      
      
      
      
      
      发布在 FR800x
      M
      Mars
    • RE: FR2012BFlash占用问题

      io口时钟开了吗

      发布在 FR201x
      M
      Mars
    • RE: FR8008GP-U RTC例程有没有?

      0_1787644286262_6eef0dac-8e35-4b2b-9edc-c90dba0f38c1-19c6922a430e8bfa185f50b08a9c4047.png

      RTC.c驱动部分

      
      /*
        ******************************************************************************
        * @file    driver_rtc.c
        * @author  FreqChip Firmware Team
        * @version V1.0.0
        * @date    2021
        * @brief   rtc module driver.
        *          This file provides firmware functions to manage the 
        *          Real Time Clock (RTC) peripheral
        ******************************************************************************
        * @attention
        *
        * Copyright (c) 2021 FreqChip.
        * All rights reserved.
        ******************************************************************************
      */
      #include "driver_rtc.h"
      
      str_Time_t AlarmTime_A;
      str_Time_t AlarmTime_B;
      
      /*********************************************************************
       * @fn      rtc_GetCount
       *
       * @brief   Get rtc current counter value
       *
       * @param   None.
       * @return  None.
       */
      void rtc_init(void)
      {
          uint8_t lu8_TempValue;
      
          /* RTC clock enable */
          lu8_TempValue = ool_read(PMU_REG_CLK_EN);
      
          ool_write(PMU_REG_CLK_EN, lu8_TempValue | PMU_RTC_CLK_EN);
      
          /* RTC Reset disable */
          lu8_TempValue = ool_read(PMU_REG_RST_CTRL);
      
          ool_write(PMU_REG_RST_CTRL, lu8_TempValue & ~PMU_RTC_SFT_RST);
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmConfig
       *
       * @brief   rtc alarm config
       *
       * @param   fe_Alarm:   alarm select.
                  lu8_hour:   hour
                  lu8_Minute: minute
                  lu8_Second: second
       * @return  None.
       */
      void rtc_AlarmConfig(e_alarm_t fe_Alarm, uint32_t fu32_hour, uint32_t fu32_Minute, uint32_t fu32_Second)
      {
          uint32_t lu32_Second;
      
          lu32_Second  = fu32_hour * 3600;
          lu32_Second += fu32_Minute * 60;
          lu32_Second += fu32_Second;
      
          switch (fe_Alarm)
          {
              case AlARM_A: 
              {
                  /* Timing backup */
                  if (AlarmTime_A.FirstBackup == 0)
                      AlarmTime_A.FirstBackup = lu32_Second;
      
                  AlarmTime_A.CycleBackup = lu32_Second;
                  
                  /* Convert to count value */
                  lu32_Second *= pmu_get_rc_clk(false);
                  lu32_Second += rtc_GetCount();
          
                  pmu_enable_isr(PMU_RTC_ALMA_INT_EN);
      
                  ool_pd_write32(PMU_REG_PD_RTC_ALARMA_CNT_0, lu32_Second);
      
                  rtc_AlarmEnable(AlARM_A);
              }break;
      
              case AlARM_B: 
              {
                  /* Timing backup */
                  if (AlarmTime_B.FirstBackup == 0)
                      AlarmTime_B.FirstBackup = lu32_Second;
      
                  AlarmTime_B.CycleBackup = lu32_Second;
                  
                  /* Convert to count value */
                  lu32_Second *= pmu_get_rc_clk(false);
                  lu32_Second += rtc_GetCount();
      
                  pmu_enable_isr(PMU_RTC_ALMB_INT_EN);
      
                  ool_pd_write32(PMU_REG_PD_RTC_ALARMB_CNT_0, lu32_Second);
      
                  rtc_AlarmEnable(AlARM_B);
              }break;
      
              default: break; 
          }
      }
      
      /*********************************************************************
       * @fn      rtc_GetCount
       *
       * @brief   Get rtc current counter value
       *
       * @param   None.
       * @return  lu32_CountValue: rtc current counter value.
       */
      uint32_t rtc_GetCount(void)
      {
          uint32_t lu32_CountValue;
      
          lu32_CountValue = ool_pd_read32(PMU_REG_PD_RTC_UPD_CNT_0);
          
          return lu32_CountValue;
      }
      
      /*********************************************************************
       * @fn      rtc_CountUpdate
       *
       * @brief   Update RTC counter
       *
       * @param   fu32_Count: update value.
       * @return  None.
       */
      void rtc_CountUpdate(uint32_t fu32_Count)
      {
          uint8_t lu8_TempValue;
          
          ool_pd_write32(PMU_REG_PD_RTC_ALARMA_CNT_0, fu32_Count);
      
          lu8_TempValue = ool_pd_read(PMU_REG_PD_RTC_CTRL);
      
          ool_pd_write(PMU_REG_PD_RTC_CTRL, lu8_TempValue |  PMU_RTC_UPD_EN);
          ool_pd_write(PMU_REG_PD_RTC_CTRL, lu8_TempValue & ~PMU_RTC_UPD_EN);
      
          AlarmTime_A.FirstBackup = 0;
          AlarmTime_B.FirstBackup = 0;
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmUpdate
       *
       * @brief   rtc alarm Update. 
       *          Update according to the periodic period in the rtc_AlarmConfig function.
       *
       * @param   fe_Alarm:   alarm select.
       */
      void rtc_AlarmUpdate(e_alarm_t fe_Alarm)
      {
          uint32_t lu32_AddValue;
          uint32_t lu32_AlarmValue;
      
          /* Convert to count value */
          if (fe_Alarm == AlARM_A)
              lu32_AddValue = AlarmTime_A.FirstBackup * pmu_get_rc_clk(false);
          else
              lu32_AddValue = AlarmTime_B.FirstBackup * pmu_get_rc_clk(false);
      
          lu32_AlarmValue = rtc_AlarmRead(fe_Alarm);
      
          lu32_AlarmValue += lu32_AddValue;
      
          rtc_AlarmSet(fe_Alarm, lu32_AlarmValue);
      }
      
      /*********************************************************************
       * @fn      rtc_ClockEnable
       *
       * @brief   RTC clock enable
       */
      void rtc_ClockEnable(void)
      {
          uint8_t lu8_TempValue;
          
          /* RTC clock enable */
          lu8_TempValue = ool_read(PMU_REG_CLK_EN);
          ool_write(PMU_REG_CLK_EN, lu8_TempValue | PMU_RTC_CLK_EN);
      }
      
      /*********************************************************************
       * @fn      rtc_ClockDisable
       *
       * @brief   RTC clock disable
       */
      void rtc_ClockDisable(void)
      {
          uint8_t lu8_TempValue;
          
          /* RTC clock enable */
          lu8_TempValue = ool_read(PMU_REG_CLK_EN);
          ool_write(PMU_REG_CLK_EN, lu8_TempValue & ~PMU_RTC_CLK_EN);
      }
      
      /*********************************************************************
       * @fn      rtc_ResetEnable
       *
       * @brief   RTC reset enable
       */
      void rtc_ResetEnable(void)
      {
          uint8_t lu8_TempValue;
      
          /* RTC Reset disable */
          lu8_TempValue = ool_read(PMU_REG_RST_CTRL);
          ool_write(PMU_REG_RST_CTRL, lu8_TempValue | PMU_RTC_SFT_RST);
      }
      
      /*********************************************************************
       * @fn      rtc_ResetDisable
       *
       * @brief   RTC reset disable
       */
      void rtc_ResetDisable(void)
      {
          uint8_t lu8_TempValue;
          
          /* RTC Reset disable */
          lu8_TempValue = ool_read(PMU_REG_RST_CTRL);
          ool_write(PMU_REG_RST_CTRL, lu8_TempValue & ~PMU_RTC_SFT_RST);
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmEnable
       *
       * @brief   Alarm Enable
       */
      void rtc_AlarmEnable(e_alarm_t fe_Alarm)
      {
          uint8_t lu8_TempValue;
      
          /* RTC Alarm Enable */
          lu8_TempValue = ool_pd_read(PMU_REG_PD_RTC_CTRL);
          ool_pd_write(PMU_REG_PD_RTC_CTRL, lu8_TempValue | fe_Alarm);
      } 
      
      /*********************************************************************
       * @fn      rtc_ALarmDisable
       *
       * @brief   Alarm Disable
       */
      void rtc_AlarmDisable(e_alarm_t fe_Alarm)
      {
          uint8_t lu8_TempValue;
      
          /* RTC Alarm Disable */
          lu8_TempValue = ool_pd_read(PMU_REG_PD_RTC_CTRL);
          ool_pd_write(PMU_REG_PD_RTC_CTRL, lu8_TempValue & ~fe_Alarm);
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmRead
       *
       * @brief   read rtc alarm config value
       *
       * @param   None.
       * @return  lu32_ConfigValue: alarm config value.
       */
      uint32_t rtc_AlarmRead(e_alarm_t fe_Alarm)
      {
          uint32_t lu32_ConfigValue;
      
          switch (fe_Alarm)
          {
              case AlARM_A: 
              {
                  lu32_ConfigValue  = ool_pd_read32(PMU_REG_PD_RTC_ALARMA_CNT_0);
              }break;
      
              case AlARM_B: 
              {
                  lu32_ConfigValue  = ool_pd_read32(PMU_REG_PD_RTC_ALARMB_CNT_0);
              }break;
      
              default: break; 
          }
          
          return lu32_ConfigValue;
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmSet
       *
       * @brief   Set rtc alarm config value
       *
       * @param   None.
       * @return  lu32_ConfigValue: alarm config value.
       */
      void rtc_AlarmSet(e_alarm_t fe_Alarm, uint32_t fu32_ConfigValue)
      {
          switch (fe_Alarm)
          {
              case AlARM_A: 
              {
                  ool_pd_write32(PMU_REG_PD_RTC_ALARMA_CNT_0, fu32_ConfigValue);
              }break;
      
              case AlARM_B: 
              {
                  ool_pd_write32(PMU_REG_PD_RTC_ALARMB_CNT_0, fu32_ConfigValue);
              }break;
          }
      }
      
      /*********************************************************************
       * @fn      rtc_AlarmHandler
       *
       * @brief   Alarm interrupt handler 
       */
      __attribute__((section("ram_code"))) void rtc_AlarmHandler(void)
      {
          if (pmu_get_isr_state() & PMU_RTC_ALMA_INT_STATUS) 
          {
              pmu_clear_isr_state(PMU_RTC_ALMA_INT_CLR);
      
              /* Update according to the periodic period in the rtc_AlarmConfig function. */
              rtc_AlarmUpdate(AlARM_A);
          }
          else if (pmu_get_isr_state() & PMU_RTC_ALMB_INT_STATUS) 
          {
              pmu_clear_isr_state(PMU_RTC_ALMB_INT_CLR);
      
              /* Update according to the periodic period in the rtc_AlarmConfig function. */
              rtc_AlarmUpdate(AlARM_B);
          }
      }
      
      
      
      发布在 FR800x
      M
      Mars