【板子开箱】新开发板到手,点灯!

[复制链接]
查看545 | 回复2 | 2023-11-20 20:37:46 | 显示全部楼层 |阅读模式
等了一周终于到了
先来个证件照

微信图片_20231120203044.jpg 微信图片_20231120203053.jpg 微信图片_20231120203100.jpg
接下来点灯!!!
翻了翻SDK里的demo aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output 这个是可以控制RGB灯。
按照原理图修改源码

                               
登录/注册后可看大图



  1. #include "bflb_gpio.h"
  2. #include "board.h"

  3. struct bflb_device_s *gpio;

  4. int main(void)
  5. {
  6.     board_init();

  7.     gpio = bflb_device_get_by_name("gpio");
  8.     printf("gpio output\r\n");
  9.     bflb_gpio_init(gpio, GPIO_PIN_15, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
  10.     bflb_gpio_init(gpio, GPIO_PIN_12, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
  11.     bflb_gpio_init(gpio, GPIO_PIN_13, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
  12.     bflb_gpio_init(gpio, GPIO_PIN_27, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);

  13.     bflb_gpio_set(gpio, GPIO_PIN_27);

  14.     while (1) {
  15.         bflb_gpio_set(gpio, GPIO_PIN_12);
  16.         bflb_gpio_set(gpio, GPIO_PIN_15);
  17.         bflb_gpio_set(gpio, GPIO_PIN_14);
  18.         
  19.         bflb_mtimer_delay_ms(200);

  20.         bflb_gpio_reset(gpio, GPIO_PIN_15);
  21.         bflb_gpio_reset(gpio, GPIO_PIN_12);
  22.         bflb_gpio_reset(gpio, GPIO_PIN_14);
  23.         bflb_mtimer_delay_ms(200);
  24.     }
  25. }
复制代码


按住boot插电进入下载模式,直接干进去
  1. PS E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output> make flash CHIP=bl616 COMX=COM7
  2. ./../../../../tools/cmake/bin/cmake.exe -S . -B build -G "MinGW Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl616 -DCPU_ID= -DBOARD=bl616dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM7 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y   
  3. -- [register library : libc], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/libc
  4. -- [register library : mm], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/mm
  5. -- [register library : utils], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/utils
  6. -- [register library : lhal], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
  7. -- [register extern library : libcsi_xt900p32f_dsp], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
  8. -- [register extern library : libpka], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
  9. -- [register library : std], path:E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/soc/bl616/std
  10. -- Configuring done
  11. -- Generating done
  12. -- Build files have been written to: E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/examples/peripherals/gpio/gpio_input_output/build
  13. make -C build -j8
  14. [  2%] Built target app
  15. [  7%] Built target utils
  16. [ 21%] Built target std
  17. [ 24%] Built target mm
  18. [ 66%] Built target libc
  19. [ 98%] Built target lhal
  20. [ 99%] Building C object CMakeFiles/gpio_input_output_bl616.elf.dir/main.c.obj
  21. [100%] Linking C executable build_out\gpio_input_output_bl616.elf
  22. Generate E:/MicroPython/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/examples/peripherals/gpio/gpio_input_output/build/build_out/gpio_input_output_bl616.bin
  23. [100%] Built target gpio_input_output_bl616.elf
  24. make -C build combine
  25. [20:02:42.085] - bflb firmware post process : V1.2.0
  26. [20:02:42.086] - Chipname: bl616
  27. [20:02:42.086] - Board config dir: ./../../../../bsp/board/bl616dk/config
  28. [20:02:42.087] - Create partition using partition_cfg_4M.toml
  29. [20:02:42.090] - Create dts for E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin
  30. [20:02:42.090] - Create dts using bl_factory_params_IoTKitA_auto.dts
  31. [20:02:42.095] - 4K header found,append dts file
  32. [20:02:42.096] - Copy boot2_bl616_release_v8.0.8.bin
  33. [20:02:42.097] - Copy mfg_bl616_gu_af8b0946f_v2.26.bin
  34. [20:02:42.099] - Create dts for E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
  35. [20:02:42.099] - Create dts using bl_factory_params_IoTKitA_auto.dts
  36. [20:02:42.108] - 4K header found,append dts file
  37. [20:02:42.109] -
  38. Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin
  39. [20:02:42.146] - ========= sp image create =========
  40. [20:02:42.146] - Flash config crc: b'b5fec518'
  41. [20:02:42.147] - Clock config crc: b'4a05f490'
  42. [20:02:42.147] - Image Offset:0x1000
  43. [20:02:42.147] - Image hash is b'6cfa14b98db277adb0a825571116ecc1f8a15db76471c98d12a142adeb3cc02e'
  44. [20:02:42.148] - Encrypt efuse data
  45. [20:02:42.151] - Image Offset:0x1000
  46. [20:02:42.151] - Image hash ignore,not calculate
  47. [20:02:42.151] - Bootheader config crc: b'8baad76b'
  48. [20:02:42.152] -
  49. Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\boot2_bl616_release_v8.0.8.bin
  50. [20:02:42.153] - ========= sp image create =========
  51. [20:02:42.154] - Flash config crc: b'b5fec518'
  52. [20:02:42.154] - Clock config crc: b'4a05f490'
  53. [20:02:42.155] - Image Offset:0x2000
  54. [20:02:42.155] - Image hash is b'4f4eecaddc6e597708f626253879f5560534d2e3baff848f4d96fabbce4b020f'
  55. [20:02:42.155] - Encrypt efuse data
  56. [20:02:42.156] - Image Offset:0x2000
  57. [20:02:42.156] - Image hash ignore,not calculate
  58. [20:02:42.157] - Bootheader config crc: b'ccbfa125'
  59. [20:02:42.157] -
  60. Process E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
  61. [20:02:42.158] - ========= sp image create =========
  62. [20:02:42.159] - Flash config crc: b'4fb1fe70'
  63. [20:02:42.159] - Clock config crc: b'0b34ef89'
  64. [20:02:42.159] - Image Offset:0x1000
  65. [20:02:42.161] - Image hash is b'69de5b7af45fea2e456fb6864612126bbdad58e69294d1466a2f892e010d1f3d'
  66. [20:02:42.162] - Encrypt efuse data
  67. [20:02:42.163] - Image Offset:0x1000
  68. [20:02:42.164] - Bootheader config crc: b'f9cf01e0'
  69. [20:02:42.165] - create OTA file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.bin.ota
  70. [20:02:42.169] - create XZ file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.xz
  71. [20:02:42.187] - create XZ OTA file:E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\build\build_out\gpio_input_output_bl616.xz.ota
  72. Built target combine
  73. ./../../../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe --interface=uart --baudrate=2000000 --port=COM7 --chipname=bl616 --cpu_id= --config=flash_prog_cfg.ini
  74. ['./../../../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe', '--interface=uart', '--baudrate=2000000', '--port=COM7', '--chipname=bl616', '--cpu_id=', '--config=flash_prog_cfg.ini']
  75. [20:02:43.998] - Serial port is COM7
  76. [20:02:43.999] - ==================================================
  77. [20:02:44.003] - Program Start
  78. [20:02:44.004] - ========= eflash loader cmd arguments =========
  79. [20:02:44.005] - serial port is COM7
  80. [20:02:44.005] - chiptype: bl616
  81. [20:02:44.005] - cpu_reset=False
  82. [20:02:44.030] - ========= Interface is uart =========
  83. [20:02:44.030] - Bootrom load
  84. [20:02:44.030] - ========= get_boot_info =========
  85. [20:02:44.031] - ========= image get bootinfo =========
  86. [20:02:44.317] - tx rx and power off, press the machine!
  87. [20:02:44.317] - cutoff time is 0.05
  88. [20:02:44.380] - power on tx and rx
  89. [20:02:45.384] - reset cnt: 0, reset hold: 0.05, shake hand delay: 0.1
  90. [20:02:45.384] - clean buf
  91. [20:02:45.391] - send sync
  92. [20:02:45.634] - ack is b'4f4b464c0201'
  93. [20:02:45.682] - shake hand success
  94. [20:02:46.185] - data read is b'0100160600000100271289011b032bcf0eb499000f758010'
  95. [20:02:46.185] - ========= ChipID: b40ecf2b031b =========
  96. [20:02:46.186] - Get bootinfo time cost(ms): 2154.61376953125
  97. [20:02:46.186] - change bdrate: 2000000
  98. [20:02:46.186] - Clock PLL set
  99. [20:02:46.188] - Set clock time cost(ms): 2.011962890625
  100. [20:02:46.323] - Read mac addr
  101. [20:02:46.325] - flash set para
  102. [20:02:46.325] - get flash pin cfg from bootinfo: 0x24
  103. [20:02:46.325] - set flash cfg: 14124
  104. [20:02:46.325] - Set flash config
  105. [20:02:46.329] - Set para time cost(ms): 2.103759765625
  106. [20:02:46.329] - ========= flash read jedec ID =========
  107. [20:02:46.331] - Read flash jedec ID
  108. [20:02:46.331] - readdata:
  109. [20:02:46.331] - b'5e401700'
  110. [20:02:46.331] - Finished
  111. [20:02:46.334] - Program operation
  112. [20:02:46.335] - Dealing Index 0
  113. [20:02:46.335] - ========= programming E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\peripherals\gpio\gpio_input_output\.\build\build_out\gpio_input_output_bl616.bin to 0x000000
  114. [20:02:46.337] - flash para file: E:\MicroPython\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\tools\bflb_tools\bouffalo_flash_cube\chips/bl616/efuse_bootheader/flash_para.bin
  115. [20:02:46.338] - Set flash config
  116. [20:02:46.342] - Set para time cost(ms): 2.9921875
  117. [20:02:46.343] - ========= flash load =========
  118. [20:02:46.344] - ========= flash erase =========
  119. [20:02:46.344] - Erase flash  from 0x0 to 0x7d5f
  120. [20:02:46.512] - Erase time cost(ms): 168.134765625
  121. [20:02:46.531] - Load 2048/32096 {"progress":6}
  122. [20:02:46.547] - Load 4096/32096 {"progress":12}
  123. [20:02:46.562] - Load 6144/32096 {"progress":19}
  124. [20:02:46.578] - Load 8192/32096 {"progress":25}
  125. [20:02:46.594] - Load 10240/32096 {"progress":31}
  126. [20:02:46.608] - Load 12288/32096 {"progress":38}
  127. [20:02:46.624] - Load 14336/32096 {"progress":44}
  128. [20:02:46.640] - Load 16384/32096 {"progress":51}
  129. [20:02:46.656] - Load 18432/32096 {"progress":57}
  130. [20:02:46.672] - Load 20480/32096 {"progress":63}
  131. [20:02:46.687] - Load 22528/32096 {"progress":70}
  132. [20:02:46.703] - Load 24576/32096 {"progress":76}
  133. [20:02:46.718] - Load 26624/32096 {"progress":82}
  134. [20:02:46.734] - Load 28672/32096 {"progress":89}
  135. [20:02:46.750] - Load 30720/32096 {"progress":95}
  136. [20:02:46.761] - Load 32096/32096 {"progress":100}
  137. [20:02:46.761] - Load 32096/32096 {"progress":100}
  138. [20:02:46.761] - Write check
  139. [20:02:46.768] - Flash load time cost(ms): 252.438232421875
  140. [20:02:46.768] - Finished
  141. [20:02:46.769] - Sha caled by host: b0dc271545d75d01b89b6e4c12227b20b5158c1ac24b9e215f36a2367306c015
  142. [20:02:46.769] - xip mode Verify
  143. [20:02:46.800] - Read Sha256/32096
  144. [20:02:46.800] - Flash xip readsha time cost(ms): 28.760986328125
  145. [20:02:46.801] - Finished
  146. [20:02:46.803] - Sha caled by dev: b0dc271545d75d01b89b6e4c12227b20b5158c1ac24b9e215f36a2367306c015
  147. [20:02:46.803] - Verify success
  148. [20:02:46.806] - Program Finished
  149. [20:02:46.806] - All time cost(ms): 2803.04443359375
  150. [20:02:46.920] - close interface
  151. [20:02:46.920] - [All Success]
复制代码


按下reset 完全OJBK
动画.gif

本帖被以下淘专辑推荐:

回复

使用道具 举报

爱笑 | 2023-12-13 17:09:06 | 显示全部楼层
用心做好保姆工作
回复

使用道具 举报

Pine | 2023-12-18 17:44:03 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则