ASR650x
来自Jack's Lab
				
								
				(版本间的差异)
				
																
				
				
								
				 (→OpenOCD)  | 
			 (→OpenOCD)  | 
			||
| (未显示1个用户的4个中间版本) | |||
| 第175行: | 第175行: | ||
[[文件:JLink Interface Pinout SWD.jpg]]  | [[文件:JLink Interface Pinout SWD.jpg]]  | ||
| + | |||
| + | |||
| + | 使用 5 根线: VTref, GND, SWIO, SWCLK, RESET  | ||
<source lang=bash>  | <source lang=bash>  | ||
| 第249行: | 第252行: | ||
<br><br>  | <br><br>  | ||
| + | |||
| + | == ASR6501 SDK ==  | ||
| + | |||
| + | https://github.com/asrlora/alios-asr-lora   | ||
| + | |||
| + | '''ASR6501_ASR6502_QA_V0.2 Notes:'''  | ||
| + | |||
| + | * SDK V4.0 中增加了 uart bootloader,debug 时需要先将 bootloadable 组件 disable,同时在 asr_board.c 中 注释掉 Bootloadable_1_Load()的调用  [2-ASR6501_ASR6502_QA_V0.2.pdf - Page 8]  | ||
| + | * 可以 bypass MCU,把 MCU power down 掉,把 R1 和 R2 从模组上焊掉  | ||
| + | * ASR650X 默认使用 TCXO 晶振,如要使用 XO 晶振,请在 Project->Build Settings 中宏定义中将 CONFIG_LORA_USE_TCXO 去掉  | ||
| + | * 进入低功耗后,总要唤醒才能进行测试,为了测试方便,所以 SDK 默认关闭了低功耗功能,请在 Project->Build Setting 的宏定义中去除 LOW_POWER_DISABLE ...  | ||
| + | |||
| + | <br>  | ||
== Arduino SDK ==  | == Arduino SDK ==  | ||
| 第265行: | 第281行: | ||
./cores/asr650x/projects/PSoC4/Bootloadable_1.c:void Bootloadable_1_Load(void)  | ./cores/asr650x/projects/PSoC4/Bootloadable_1.c:void Bootloadable_1_Load(void)  | ||
./cores/asr650x/projects/PSoC4/Bootloadable_1.h:extern void Bootloadable_1_Load(void) ;  | ./cores/asr650x/projects/PSoC4/Bootloadable_1.h:extern void Bootloadable_1_Load(void) ;  | ||
| + | </source>  | ||
| + | Remove CubeCellLib.a:  | ||
| + | |||
| + | <source lang=bash>  | ||
| + | $ "C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/tools/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" -Wl,--start-group "-LC:\Users\comca\AppData\Local\Temp\arduino_build_294399" -mcpu=cortex-m0plus -mthumb -mthumb-interwork "-LC:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/projects/PSoC4"   "-TC:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/projects/PSoC4/cm0plusgcc.ld" -lstdc++ -lm  "-Wl,-Map,C:\Users\comca\AppData\Local\Temp\arduino_build_294399/ChipID.ino.map" -specs=nano.specs -Wl,--gc-sections -Wl,--wrap=printf -Wl,--wrap=fflush -Wl,--wrap=sprintf -Wl,--wrap=snprintf -g -ffunction-sections -Os -ffat-lto-objects  -o "C:\Users\comca\AppData\Local\Temp\arduino_build_294399/ChipID.ino.elf" "C:\Users\comca\AppData\Local\Temp\arduino_build_294399\sketch\ChipID.ino.cpp.o"  -lm "C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a" -Wl,--end-group  | ||
| + | C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(Cm0plusStart.c.o): In function `initialize_psoc':  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\projects\PSoC4/Cm0plusStart.c:519: undefined reference to `cyfitter_cfg'  | ||
| + | C:\Users\comca\AppData\Local\Temp\arduino_build_294399\sketch\ChipID.ino.cpp.o: In function `setup()':  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\libraries\Basics\examples\ChipID/ChipID.ino:5: undefined reference to `getID'  | ||
| + | C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(main.cpp.o): In function `main':  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x/main.cpp:31: undefined reference to `Asr_Timer_Init'  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x/main.cpp:32: undefined reference to `RtcInit'  | ||
| + | C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(HardwareSerial.cpp.o): In function `HardwareSerial::begin(unsigned long, signed char, unsigned long, bool, unsigned long)':  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:36: undefined reference to `digitalRead'  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:40: undefined reference to `UART_1_Start'  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:47: undefined reference to `UART_2_Start'  | ||
| + | C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(Stream.cpp.o): In function `Stream::timedRead()':  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/cores/Stream.cpp:33: undefined reference to `millis'  | ||
| + | C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/cores/Stream.cpp:39: undefined reference to `millis'  | ||
| + | collect2.exe: error: ld returned 1 exit status  | ||
</source>  | </source>  | ||
| + | |||
| + | |||
| + | <br><br>  | ||
| + | |||
| + | == Reference ==  | ||
| + | |||
| + | * [[LoRa]]  | ||
| + | * [[LoRaWAN]]  | ||
<br><br>  | <br><br>  | ||
2020年9月3日 (四) 11:11的最后版本
目录 | 
[编辑] 1 ASR6505
-  STM8L152
- Up to 16MHz
 - 4KB RAM (0x0000 ~ 0x0FFF, including 513B stack)
 - 2KB EEPROM (0x1000 ~ 0x1FFF)
 - 64KB Flash (0x8080 ~ 0x1 7FFF)
 - SPI x1, I2C x1, UART x2
 - GPIO x30, ADC x3, SWIM x1
 
 - 85mA @22dBm, 50mA@17dBm, 40mA@14dBm
 
- SX1262
 - 2.4V to 3.7V (3.9V max) Power supply
 - Sleep mode: 1uA without RTC, 1.6uA with RTC
 - QFN68, 8x8mm
 
[编辑] 2 ASR6501
[编辑] 2.1 Overview
-  PSoC 4100S Plus MCU
- 48 MHz ARM Cortex-M0+ Core
 - up to 128kbytes of Flash memory and 16Kbytes of SRAM
 - 6x configurable GPIOs, 1xI2C, 1xUART, 1xSWD
 - 8-Channel DMA engine
 - 12-bit 1Msps SAR ADC with differential and single-ended
 - 32.768kHz External Watch Crystal Oscillator
 - 4-33MHz External Crystal Oscillator for MCU (Optional)
 - 32MHz External Crystal Oscillator for LoRa Radio
 - Internal High frequency (48MHz) RC oscillator
 - Internal Low frequency (40kHz) RC oscillator
 - Internal PLL to generate 48MHz clock
 - 1.71V to 5.5V Power supply
 - Deep Sleep mode with 2.5uA
 
 - SX1262
 - 2.4V to 3.7V (3.9V max) Power supply
 - Sleep mode: 2.7uA with RTC; 2uA without RTC
 - QFN48 6x6mm
 
- 32-bit Arm® Cortex®-M0/M0+ PSoC® 4100 Intelligent Analog MCUs
 - PSOC 4100s plus 256KB Datasheet
 - PSOC 4100S Plus DatasheetENCN
 - AN88619 - PSOC 4 HARDWARE DESIGN CONSIDERATIONS
 
[编辑] 2.2 RF-AL42UH
* P1 GND 电源地 * P2 VDD, 电源输入,范围 2.8V ~ 3.6V DC * P3 ADC_IN,ADC输入脚,程序未启用,悬空 * P4 GPIO,MCU GPIO,悬空 * P5 AUX,MCU GPIO,悬空 * P6 SETA,MCU GPIO,悬空 * P7 RXD,UART 的 RX 信号 * P8 TXD,UART 的 TX 信号 * P9 SWD,SWD DATA引脚 * P10 SCLK,SWD CLK引脚 * P11 I2C_SCL,I2C引脚,程序未启用,悬空 * P12 I2C_SDA,I2C引脚,程序未启用,悬空 * P13 SETB,MCU GPIO,悬空 * P14 CTS,悬空 * P15 RTS,悬空 * P16 RESET,复位引脚,低电平有效。无须拉高(内部已经拉高) * P17 GND 电源地 * P18 天线接口
[编辑] 3 KitProg
[编辑] 3.1 PSoC Programmer
- https://www.cypress.com/products/psoc-programming-solutions
 - https://www.cypress.com/file/505286/download
 
[编辑] 3.2 CY8CKIT-145-40xx
插入 USB,Windows 下 'Devices and Printers' 显示 Cypress KitProg2
下载 fw-loader-2.3.1.610-windows.zip [1]
comca@AI-Workstation MINGW32 ~/work/asr6501/fw-loader
$ ./bin/fw-loader.exe --device-list
Cypress Firmware Updater, Version: 2.3.1.610
(C) Copyright 2018-2020 by Cypress Semiconductor
All Rights Reserved
Info: Start API initialization
Info: Connected - KitProg2-131B0F7303105400
Info: Hardware initialization complete (515 ms)
Connected supported devices:
        1: KitProg2-131B0F7303105400    FW Version 1.1.0
$ ./bin/fw-loader.exe --update-kp3
Cypress Firmware Updater, Version: 2.3.1.610
(C) Copyright 2018-2020 by Cypress Semiconductor
All Rights Reserved
Info: Start API initialization
Info: Connected - KitProg2-131B0F7303105400
Info: Hardware initialization complete (506 ms)
Device 'KitProg2-131B0F7303105400' opened successfully
Info: Kit FW is 'KitProg2' ver. 1.02 b000.  Upgrade file is 'KitProg3' ver. 1.21 b707.
Info: Disconnected - KitProg2-131B0F7303105400
Info: Connected - KitProg Bootloader-131B0F7303105400
Info: Bootloader Version: Major 1, Minor 1, Build 40
Info: FW Upgrade to version: 1.21 b707
Info: Bootloading of KitProg FW...
Info: Verifying of KitProg FW...
Info: Bootloading of DAPLink...
Info: Verifying of DAPLink...
Info: Upgrade completed
Info: Disconnected - KitProg Bootloader-131B0F7303105400
Info: Connected - KitProg3 CMSIS-DAP BULK-131B0F7303105400
FW update completed successfully
[编辑] 3.3 CY8CKIT-043
插入 USB,Windows 下 'Devices and Printers' 显示 Cypress KitProg
fw-loader 发现不了
[编辑] 4 OpenOCD
STLink-V2:
comcat@AI-Workstation MINGW32 ~/work/nodetao/toolchain/openocd-cypress (master)
$ ./bin/openocd.exe  -s ./scripts -f interface/stlink.cfg -c "source [find target/psoc4.cfg]; targets; shutdown"
Open On-Chip Debugger 0.10.0+dev-3.0.0.665 (2020-03-20-10:13)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
** Test Mode acquire not supported by selected adapter
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* psoc4.cpu          hla_target little psoc4.cpu          unknown
shutdown command invoked
$ ./bin/openocd.exe  -s ./scripts -f interface/stlink.cfg -c "program d:/BlinkyLED.hex verify reset; exit"
J-Link:
使用 5 根线: VTref, GND, SWIO, SWCLK, RESET
$ ./bin/openocd.exe -s ./scripts -f interface/jlink.cfg -c "transport select swd; source [find target/psoc4.cfg];"
KitProg3:
$ ./bin/openocd.exe -s ./scripts -f interface/kitprog3.cfg -c "transport select swd; source [find target/psoc4.cfg]; program ChipID.ino.hex verify reset; exit"
Open On-Chip Debugger 0.10.0+dev-3.0.0.665 (2020-03-20-10:13)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 2000 kHz
** Auto-acquire enabled, use "set PSOC4_USE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : KitProg3: FW version: 1.21.707
Info : KitProg3: Pipelined transfers enabled
Info : VTarget = 4.969 V
Info : kitprog3: acquiring PSoC device...
Info : clock speed 2000 kHz
Info : SWD DPIDR 0x0bc11477
Info : psoc4.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : psoc4.cpu: external reset detected
*****************************************
** Silicon: 0x256A, Family: 0xB5, Rev.: 0x12 (A1)
** Detected Device: CY8C4147AZI-S445
** Detected Family: PSoC 4100S Plus
** Detected Main Flash size, kb: 128
** Chip Protection: protection OPEN
*****************************************
Info : Listening on port 3333 for gdb connections
Error: DP initialisation failed
Info : kitprog3: acquiring PSoC device...
Info : SWD DPIDR 0x0bc11477
target halted due to debug-request, current mode: Thread
xPSR: 0xa1000000 pc: 0x10000040 msp: 0x20003fe8
** Device acquired successfully
** Programming Started **
auto erase enabled
Info : ignoring flash probed value, using configured bank size
Info : Flash write discontinued at 0x000090a0, next section at 0x0001ffc0
Info : Padding image section 0 at 0x000090a0 with 96 bytes (bank write end alignment)
Warn : Only mass erase available, erase skipped! (psoc4 mass_erase <bank_id>)
[100%] [################################] [ Programming ]
Info : Section start address 0x0001ffc0 breaks the required alignment of flash bank psoc4.mflash
Info : Padding 192 bytes from 0x0001ff00
Warn : Only mass erase available, erase skipped! (psoc4 mass_erase <bank_id>)
[100%] [################################] [ Programming ]
Warn : no flash bank found for address 0x90500000
Warn : no flash bank found for address 0x90600000
Warn : no flash bank found for address 0xf0000000
wrote 37440 bytes from file ChipID.ino.hex in 3.366695s (10.860 KiB/s)
** Programming Finished **
** Verify Started **
verified 37152 bytes in 0.109350s (331.790 KiB/s)
** Verified OK **
** Resetting Target **
Error: DP initialisation failed
Polling target psoc4.cpu failed, trying to reexamine
Error: Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 100ms
$ ./bin/openocd.exe -s ./scripts -f interface/kitprog3.cfg -c "transport select swd; source [find target/psoc4.cfg]; init; reset init; psoc4 mass_erase 0; program ChipID.ino.hex verify reset exit"
[编辑] 5 ASR6501 SDK
https://github.com/asrlora/alios-asr-lora
ASR6501_ASR6502_QA_V0.2 Notes:
- SDK V4.0 中增加了 uart bootloader,debug 时需要先将 bootloadable 组件 disable,同时在 asr_board.c 中 注释掉 Bootloadable_1_Load()的调用 [2-ASR6501_ASR6502_QA_V0.2.pdf - Page 8]
 - 可以 bypass MCU,把 MCU power down 掉,把 R1 和 R2 从模组上焊掉
 - ASR650X 默认使用 TCXO 晶振,如要使用 XO 晶振,请在 Project->Build Settings 中宏定义中将 CONFIG_LORA_USE_TCXO 去掉
 - 进入低功耗后,总要唤醒才能进行测试,为了测试方便,所以 SDK 默认关闭了低功耗功能,请在 Project->Build Setting 的宏定义中去除 LOW_POWER_DISABLE ...
 
[编辑] 6 Arduino SDK
comca@AI-Workstation MINGW32 ~/work/arduino-1.8.5/hardware/Cube/ASR650x-Arduino (master) $ ./tools/gcc-arm-none-eabi/bin/arm-none-eabi-strings.exe cores/asr650x/projects/CubeCellLib.a |grep -i "activated" activateDefaultChannel +The board is activated, don't need to active again +The board is activated, Arduino is supported! comca@AI-Workstation MINGW32 ~/work/arduino-1.8.5/hardware/Cube/ASR650x-Arduino (master) $ grep -ri Bootloadable_1_Load . ./cores/asr650x/board/src/asr_board.c: Bootloadable_1_Load(); ./cores/asr650x/projects/PSoC4/Bootloadable_1.c:* Function Name: Bootloadable_1_Load ./cores/asr650x/projects/PSoC4/Bootloadable_1.c:void Bootloadable_1_Load(void) ./cores/asr650x/projects/PSoC4/Bootloadable_1.h:extern void Bootloadable_1_Load(void) ;
Remove CubeCellLib.a:
$ "C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/tools/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" -Wl,--start-group "-LC:\Users\comca\AppData\Local\Temp\arduino_build_294399" -mcpu=cortex-m0plus -mthumb -mthumb-interwork "-LC:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/projects/PSoC4" "-TC:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/projects/PSoC4/cm0plusgcc.ld" -lstdc++ -lm "-Wl,-Map,C:\Users\comca\AppData\Local\Temp\arduino_build_294399/ChipID.ino.map" -specs=nano.specs -Wl,--gc-sections -Wl,--wrap=printf -Wl,--wrap=fflush -Wl,--wrap=sprintf -Wl,--wrap=snprintf -g -ffunction-sections -Os -ffat-lto-objects -o "C:\Users\comca\AppData\Local\Temp\arduino_build_294399/ChipID.ino.elf" "C:\Users\comca\AppData\Local\Temp\arduino_build_294399\sketch\ChipID.ino.cpp.o" -lm "C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a" -Wl,--end-group C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(Cm0plusStart.c.o): In function `initialize_psoc': C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\projects\PSoC4/Cm0plusStart.c:519: undefined reference to `cyfitter_cfg' C:\Users\comca\AppData\Local\Temp\arduino_build_294399\sketch\ChipID.ino.cpp.o: In function `setup()': C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\libraries\Basics\examples\ChipID/ChipID.ino:5: undefined reference to `getID' C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(main.cpp.o): In function `main': C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x/main.cpp:31: undefined reference to `Asr_Timer_Init' C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x/main.cpp:32: undefined reference to `RtcInit' C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(HardwareSerial.cpp.o): In function `HardwareSerial::begin(unsigned long, signed char, unsigned long, bool, unsigned long)': C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:36: undefined reference to `digitalRead' C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:40: undefined reference to `UART_1_Start' C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino\cores\asr650x\Serial/HardwareSerial.cpp:47: undefined reference to `UART_2_Start' C:\Users\comca\AppData\Local\Temp\arduino_build_294399/core\core.a(Stream.cpp.o): In function `Stream::timedRead()': C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/cores/Stream.cpp:33: undefined reference to `millis' C:\Users\comca\work\arduino-1.8.5\hardware\Cube\ASR650x-Arduino/cores/asr650x/cores/Stream.cpp:39: undefined reference to `millis' collect2.exe: error: ld returned 1 exit status
[编辑] 7 Reference

