Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    xr806 spi驱动出现问题

    Wireless & Analog Series
    2
    4
    1842
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aktoey LV 3 last edited by

      在做xr806的spi驱动的时候,只加了HAL_SPI_Deinit(DEMO_SPI_PORT);都会出错,代码如下:
      static void MainThread(void *arg)
      {

      HAL_SPI_Deinit(DEMO_SPI_PORT);
      SPI_Global_Config spi_param;

      spi_param.cs_level = DEMO_SPI_CS_LEVEL;
      spi_param.mclk = DEMO_SPI_MCLK;

      HAL_SPI_Init(DEMO_SPI_PORT, &spi_param);

      while (1) {
      IoTGpioSetOutputVal(GPIO_ID_PA21, 1);
      OS_MSleep(500);
      IoTGpioSetOutputVal(GPIO_ID_PA21, 0);
      OS_MSleep(500);
      }
      }

      void LCDMain(void)
      {
      if (OS_ThreadCreate(&g_main_thread, "MainThread", MainThread, NULL,OS_THREAD_PRIO_APP, 4 * 1024) != OS_OK) {
      printf("[ERR] Create MainThread Failed\n");
      }
      }
      SYS_RUN(LCDMain);

      串口打印的log是如下内容

      ====================================================================
      Hello! OpenHarmony!
      System tag : OpenHarmony 1.1.2_LTS

      use default flash chip mJedec 0x0
      [FD I]: mode: 0x10, freq: 96000000Hz, drv: 0
      [FD I]: jedec: 0x0, suspend_support: 1
      mode select:e

      wlan information ===================================================
      firmware:
      version : R0-XR_C07.08.52.65_02.84 May 27 2021 11:41:33-Y02.84
      buffer : 8
      driver:
      version : XR_V02.05
      mac address:
      in use : 4c:6e:c8:3e:c2:01
      in use : 4c:6e:c8:3e:c2:02

      wlan mode:a
      [VFS INF] SPIFFS mount success.

      platform information ===============================================
      XR806 SDK v1.2.0 Jan 15 2022 15:52:31

      heap space [0x228900, 0x247c00), size 127744

      cpu clock 160000000 Hz
      HF clock 40000000 Hz

      sdk option:
      XIP : enable
      INT LF OSC : enable
      SIP flash : enable

      mac address:
      efuse : 80:74:84:05:ba:de
      in use : 4c:6e:c8:3e:c2:01

      hiview init success.[SPI Alert] Changing State incorrectly in HAL_SPI_Deinit

      console init success

      I 1 Reply Last reply Reply Quote Share 0
      • I
        何镜勇 LV 4 @aktoey last edited by

        @aktoey 去初始化函数,只有在初始化成功后才能使用

        A 1 Reply Last reply Reply Quote Share 0
        • A
          aktoey LV 3 @I_A_student last edited by

          @i_a_student 我先试的init然后才试的deinit,都不行

          I 1 Reply Last reply Reply Quote Share 0
          • I
            何镜勇 LV 4 @aktoey last edited by

            @aktoey 试了一下,没啥问题,破案了,一定是你敲代码的姿势不对。

            1 Reply Last reply Reply Quote Share 0
            • 1 / 1
            • First post
              Last post

            Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

            行为准则 | 用户协议 | 隐私权政策