scottalford75 / Remora-RT1052

Remora firmware for Novusun RT1052 Ethernet CNC controller boards
GNU General Public License v2.0
16 stars 3 forks source link

EC500 #3

Open jschoch opened 1 year ago

jschoch commented 1 year ago

wondering if you have received your EC500 yet. I just got one with the RT1052 and wanted to try it out but I know little about this chip. Can you let me know which branch would work and how to flash it? I see SWD 3.3v etc broken out on the right side of the board, assuming I can flash with a uart or stlink or something.

scottalford75 commented 1 year ago

Hopefully it arrives this week. I'm hoping to extend the Remora-RT1052 code for the additional IO and super hopeful that it's just that that needs to be modified.

jschoch commented 1 year ago

should I wait? If I can try to flash it what tools do you use to flash it, are you using the mcuxpresso IDE and a FTDI?

scottalford75 commented 1 year ago

You could try to flash it with the current code. I use MCUExpresso with a CMSIS-DAP debug probe.

jschoch commented 1 year ago

I may try to make a blackmagic out of an old blue pill and see if that works. FYI my board designation is "IMXR_EC500 2022-09-07"

jschoch commented 1 year ago

Ok, i now have 5 programmer/probes.... none work! Tried black magic ( a few builds) and CMSIS-DAP on STM32F103 and STM32F411 (even tried black magic on esp32 S3 which actually works over wifi!!!)

Wondering if you can link the exact version of CMSIS-DAP you are running. I've tried 3. Only one worked with mcuxpresso and i messed it up by changing the driver to winusb so now I can't get any of them to be seen in linkserver.

Also wondering if you have any idea what the boot_m0 pin and pro_b are. I've tried to pull them up but no luck.

Next i'm wondering if I have to jump through all those hoops you layout in post https://forum.linuxcnc.org/18-computer/44828-remora-ethernet-nvem-cnc-board?start=530#254824 or if you've added all that to this repo already. The screen shots are hard to read.

Finally, wondering if this EC500 has the same flash chip as the EC300? I can add a zoomed in pic if you haven't checked.

scottalford75 commented 1 year ago

Hi Jesse,

I should have an EC500 on Friday to can check out the connections and flash, as the EC300 and NVEM don't have the boot_m0 pin. The pro_b bin is present on the EC300 and it connects to the Power On Reset pin on the RT1052 so can be used to reset the board without power cycling. I've not used it in debug mode you can force a reset.

The CMSIS-DAP firmware I used (before the DAPLink code) is https://github.com/x893/CMSIS-DAP/tree/master/Firmware/STM32/hex

On Wed, Jan 25, 2023 at 5:01 PM Jesse Schoch @.***> wrote:

Ok, i now have 5 programmer/probes.... none work! Tried black magic ( a few builds) and CMSIS-DAP on STM32F103 and STM32F411 (even tried black magic on esp32 S3 which actually works over wifi!!!)

Wondering if you can link the exact version of CMSIS-DAP you are running. I've tried 3. Only one worked with mcuxpresso and i messed it up by changing the driver to winusb so now I can't get any of them to be seen in linkserver.

Also wondering if you have any idea what the boot_m0 pin and pro_b are. I've tried to pull them up but no luck.

Next i'm wondering if I have to jump through all those hoops you layout in post https://forum.linuxcnc.org/18-computer/44828-remora-ethernet-nvem-cnc-board?start=530#254824 or if you've added all that to this repo already. The screen shots are hard to read.

Finally, wondering if this EC500 has the same flash chip as the EC300? I can add a zoomed in pic if you haven't checked.

— Reply to this email directly, view it on GitHub https://github.com/scottalford75/Remora-RT1052/issues/3#issuecomment-1403134644, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGBMVIN7R5PZJQSTEHYWPE3WUC6U3ANCNFSM6AAAAAAUCXERGM . You are receiving this because you commented.Message ID: @.***>

jschoch commented 1 year ago

Some updates:

  1. I was able to get a bluepill with cmsis-dap connecting to the device but it seems to require 24 system power and not powering via the 3.3v pin.
  2. The led by the pins stays off when I can access it via openocd.
  3. pulling up on boot_m0 pin when powered via system power seems to put in the same state as powering from 3.3v, the led goes on and i can't access the processor.

Here is my openocd configs

scripts\target\rt1052.cfg

# NXP i.MX RT1050 family (Arm Cortex-M7 @ 600 MHz)
#

if { [info exists CHIPNAME] } {
        set _CHIPNAME $CHIPNAME
} else {
        set _CHIPNAME imxrt1050
}

source [find target/swj-dp.tcl]

if { [info exists CPU_SWD_TAPID] } {
        set _CPU_SWD_TAPID $CPU_SWD_TAPID
} else {
        set _CPU_SWD_TAPID 0x0bd11477
}

if { [using_jtag] } {
        set _CPU_TAPID 0
} else {
        set _CPU_TAPID $_CPU_SWD_TAPID
}

swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPU_TAPID

set _TARGETNAME $_CHIPNAME
dap create $_TARGETNAME.dap -chain-position $_TARGETNAME.cpu
target create $_TARGETNAME cortex_m -dap $_TARGETNAME.dap

if { ![using_hla] } {
        cortex_m reset_config sysresetreq
}

# uncommenting this doesn't allow connection
#gdb_breakpoint_override hard # ??XIP Flash???,???

adapter_khz 1000

here is my cmsis-dap.cfg

# SPDX-License-Identifier: GPL-2.0-or-later

#
# ARM CMSIS-DAP compliant adapter
#
# http://www.keil.com/support/man/docs/dapdebug/
#

adapter driver cmsis-dap
cmsis_dap_backend hid
transport select swd

# Optionally specify the serial number of CMSIS-DAP usb device.
# adapter serial 02200201E6661E601B98E3B9

Connection looks like this

.\bin\openocd.exe -f scripts\interface\cmsis-dap.cfg -f scripts\target\rt1052.cfg
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2022-09-01-17:58)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
DEPRECATED! use 'adapter speed' not 'adapter_khz'
adapter speed: 1000 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: JTAG supported
Info : CMSIS-DAP: SWO-UART supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer 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 = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x0bd11477
Info : [imxrt1050] Cortex-M7 r1p1 processor detected
Info : [imxrt1050] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for imxrt1050 on 3333
Info : Listening on port 3333 for gdb connections

and trying to flash hello world looks like this.


target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x60006286 psp: 0x20200eb0
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : SWD DPIDR 0x0bd11477
Polling target imxrt1050 failed, trying to reexamine
Info : SWD DPIDR 0x0bd11477
Info : [imxrt1050] Cortex-M7 r1p1 processor detected
Info : [imxrt1050] target has 8 breakpoints, 4 watchpoints
Info : [imxrt1050] external reset detected
Info : SWD DPIDR 0x0bd11477
Error: Failed to write memory at 0x600003e4
Info : SWD DPIDR 0x0bd11477
Error: Failed to write memory at 0x600023e4

I'm still unable to get mcuxpresso to see the cmsis-dap, i think I overwrote a usb driver definition with zadiag and it doesn't identify the device anymore. There is a probetable.csv file that has the PID/VID and configs but updating that has not helped me get it recognized. I've even uninstalled mcuxpresso. I may try to put it on my laptop to see if I can get it to work.

Question: Is the memory config here correct or do I need to change it per your initial instructions for the ec300?

scottalford75 commented 1 year ago

Hi, EC500 arrived last Friday and yes I found the same issue with the 3.3v pin. The EC500 has the same components as the EC300 and NVEM and I flashed the board successfully with the current RT1052 Remora firmware. Memory config is the same as the EC300 / NVEM.

How are you defining your flash algorithm for openOCD?

jschoch commented 1 year ago

I didn't try anything specific with openOCD, is that another config to add? I did get hello world to work in ram only mode with debugging which made me feel better.

What is your config for the flash?

scottalford75 commented 1 year ago

I think pyOCD might be a path as it can be setup to use flash algorithms (I think), which we now have for these boards. My quick googling for custom flash algorithms for openOCD didn't give much.

jschoch commented 1 year ago

it flashed!!!! i think

pyocd flash .\remora-rt1052.axf --target mimxrt1050_quadspi

pyocd seems way better so far.

jschoch commented 1 year ago

ok, so in pyocd setting the target to mimxrt1050_quadspi works, the mimxrt1052cvl5b wasn't working.

PS C:\Users\jesse\Documents\dev\Remora-RT1052\remora-rt1052\Release> pyocd flash .\remora-rt1052.axf --target mimxrt1050_quadspi
0002057 I Loading C:\Users\jesse\Documents\dev\Remora-RT1052\remora-rt1052\Release\remora-rt1052.axf [load_cmd]
[==================================================] 100%
0026042 I Erased 65536 bytes (1 sector), programmed 8448 bytes (33 pages), skipped 0 bytes (0 pages) at 0.34 kB/s [loader]
PS C:\Users\jesse\Documents\dev\Remora-RT1052\remora-rt1052\Release> vi .\pyocd_config.yaml
PS C:\Users\jesse\Documents\dev\Remora-RT1052\remora-rt1052\Release> gvim .\pyocd_config.yaml
PS C:\Users\jesse\Documents\dev\Remora-RT1052\remora-rt1052\Release> pyocd gdbserver --config=pyocd_config.yaml
0000892 I Using config options for probe 137B10A1 [session]
0001032 I Target type is mimxrt1050_quadspi [board]
0001316 I DP IDR = 0x0bd11477 (v1 MINDP rev0) [dap]
0001587 I AHB-AP#0 IDR = 0x04770041 (AHB-AP var4 rev0) [ap]
0001729 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00fd000 (designer=00e:NXP part=88c) [rom_table]
0001761 I [0]<e00fe000:ROM class=1 designer=43b:Arm part=4c8> [rom_table]
0001761 I   AHB-AP#0 Class 0x1 ROM table #1 @ 0xe00fe000 (designer=43b:Arm part=4c8) [rom_table]
0001792 I   [0]<e00ff000:ROM class=1 designer=43b:Arm part=4c7> [rom_table]
0001792 I     AHB-AP#0 Class 0x1 ROM table #2 @ 0xe00ff000 (designer=43b:Arm part=4c7) [rom_table]
0001822 I     [0]<e000e000:SCS v7-M class=14 designer=43b:Arm part=00c> [rom_table]
0001838 I     [1]<e0001000:DWT v7-M class=14 designer=43b:Arm part=002> [rom_table]
0001853 I     [2]<e0002000:FPB v7-M class=14 designer=43b:Arm part=00e> [rom_table]
0001869 I     [3]<e0000000:ITM v7-M class=14 designer=43b:Arm part=001> [rom_table]
0001901 I   [1]<e0041000:ETM M7 class=9 designer=43b:Arm part=975 devtype=13 archid=4a13 devid=0:0:0> [rom_table]
0001933 I   [2]<e0042000:CTI class=9 designer=43b:Arm part=906 devtype=14 archid=0000 devid=40800:0:0> [rom_table]
0001965 I [1]<e0040000:TPIU M7 class=9 designer=43b:Arm part=9a9 devtype=11 archid=0000 devid=ca1:0:0> [rom_table]
0001981 I [2]<e0043000:TSGEN class=15 designer=43b:Arm part=101> [rom_table]
0001997 I IMXRT Boot Mode: Internal Boot [target_imxrt]
0002029 I CPU core #0 is Cortex-M7 r1p1 [cortex_m]
0002061 I FPU present: FPv5-D16-M [cortex_m]
0002093 I 4 hardware watchpoints [dwt]
0002108 I 8 hardware breakpoints, 1 literal comparators [fpb]
0002222 I Semihost server started on port 4444 (core 0) [server]
0002260 I GDB server started on port 3333 (core 0) [gdbserver]
0026417 I Client connected to port 3333! [gdbserver]
0027031 E Error while executing remote command 'reset init': unexpected value for reset_type option ('init') [gdbserver]
Traceback (most recent call last):
  File "c:\users\jesse\appdata\local\programs\python\python39\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 1051, in handle_remote_command
    self._command_context.process_command_line(cmd)
  File "c:\users\jesse\appdata\local\programs\python\python39\lib\site-packages\pyocd\commands\execution_context.py", line 316, in process_command_line
    invoc.handler(invoc)
  File "c:\users\jesse\appdata\local\programs\python\python39\lib\site-packages\pyocd\commands\execution_context.py", line 412, in execute_command
    cmd_object.parse(invocation.args)
  File "c:\users\jesse\appdata\local\programs\python\python39\lib\site-packages\pyocd\commands\commands.py", line 374, in parse
    self.reset_type = convert_reset_type(args[0])
  File "c:\users\jesse\appdata\local\programs\python\python39\lib\site-packages\pyocd\utility\cmdline.py", line 240, in convert_reset_type
    raise ValueError("unexpected value for reset_type option ('%s')" % value)
ValueError: unexpected value for reset_type option ('init')
0027063 I Semihosting enabled [gdbserver]
0027071 I Attempting to load RTOS plugins [gdbserver]
0030653 I IMXRT Boot Mode: Internal Boot [target_imxrt]
0030669 I IMXRT Boot Device: 0 [target_imxrt]
0031016 I IMXRT Boot Mode: Internal Boot [target_imxrt]
0031032 I IMXRT Boot Device: 0 [target_imxrt]
[==================================================] 100%
0149880 I IMXRT Boot Mode: Internal Boot [target_imxrt]
0149896 I IMXRT Boot Device: 0 [target_imxrt]
0150130 I Erased 131072 bytes (2 sectors), programmed 117760 bytes (460 pages), skipped 0 bytes (0 pages) at 0.97 kB/s [loader]

it is stepping through the code! now to get the linuxcnc side working!!!

scottalford75 commented 1 year ago

Well done! I need to get this working to. Any special configs needed?

scottalford75 commented 1 year ago

Wow, this was to easy.

Two commands and the board is flashed with pyOCD!! Thanks Jesse!!!

python -m pip install -U pyocd pyocd flash .\remora-rt1052.axf --target mimxrt1050_quadspi

0001147 I Loading D:\Local Repositories NXP\Remora-RT1052\remora-rt1052\Debug\remora-rt1052.axf [load_cmd] [==================================================] 100% 0026928 I Erased 65536 bytes (1 sector), programmed 52224 bytes (204 pages), skipped 65536 bytes (256 pages) at 4.47 kB/s [loader]

jschoch commented 1 year ago

what dhcpd server are you using, i see no /etc/dhcpd.conf

wow, why did they make setting up a static ip a nightmare....

scottalford75 commented 1 year ago

I'm running a raspberry pi so I set a static IP on the Ethernet and use wifi for normal internet.

jschoch commented 1 year ago

ya, my rpi install doesn't have that file, but i did the static ip config and after running some obscure flush command it took and i can take linuxcnc out of estop!!!!!! Wow this was hard. i think i flashed about 20 things... ended up using free dap on a pi pico but the real trick was using pyocd. more to come.

scottalford75 commented 1 year ago

What's in your pyocd_config.yaml file? So you were able to debug in MCUXpresso using pyOCD?

jschoch commented 1 year ago

yes, i could debug in MCUXpresso!

the config is just this

probes:
  137B10A1: # Probe's unique ID.
    #target_override:  mimxrt1052cvl5b
    target_override: mimxrt1050_quadspi
    test_binary:      remora-rt1052.axf

# Global options
auto_unlock: false

I am seeing joint 0 follow errors randomly but the x is putting out pulses.

jschoch commented 1 year ago

How do you get serial ouput/uart off of this? Have you setup any pins? Is there a way to get it from swd?

scottalford75 commented 1 year ago

Serial comms is setup on the DB connector. 115200 baud 8N1.

Haven't tried serial over swd.

https://www.nxp.com/docs/en/application-note/AN13234.pdf

jschoch commented 1 year ago

my board seems dead... i noticed it was running current limited at .3A and voltage sagged to ~9v. i upped the current and now i can't connect and the 3.3v line is reading like 0.8v. also tried to power direct to 3.3v line but it is pulling too much current, it was running ~0.06A prior to flashing.

I didn't think undervolting could hurt it that much but i'm not sure what to do and i'm getting pretty sick of this board at this point.

scottalford75 commented 1 year ago

Doesn't sound good. Sorry to hear.

jschoch commented 1 year ago

if you could trace the source of the 3.3v that would be helpful. it appears there are 3 DC-DC IC's a MP4462 right off the 24v connection, a 1F8NY chip with 6 pins and a DE=G12 with 5 pins. Since ground is shorted to 3.3 somewhere it would help to know which IC to try to pull to get rid of the short and so I can order a new one. I guess it could also be other things but I"m guessing the low voltage stressed the DC-DC bus somewhere

scottalford75 commented 1 year ago

The 3.3v is connected to the 1F8NY chip. Pin at the base (bottom) of the letter Y.

scottalford75 commented 1 year ago

I think I found the data sheet.

MP2359 1.2A, 24V, 1.4MHz Step-Down Converter in a TSOT23-6

The datasheet has a great big "not recommended for new designs refer to MP2331H"

jschoch commented 1 year ago

no luck, even pulled the voltage supervisor off the pro_b pin and the mysterious "IC" chip as well as Q2. tried to pump some current into it to see what heated up but nothing got above 104F from what my crappy IR temp thing says.

jschoch commented 1 year ago

I'm mapping out the power pins.

24V to U3 MP4462, this 5v out powers a bunch stuff including U7 and U5 U7 marked DE=G12 is a RT9193 can't figure out where this output goes U5 marked 1F8NY this seems to be the main 3.3v supply Eth Phy is LAN8720 both power pins seem to go to U5 U2 MAX3239 also seems to be on the main U5 3.3v rail.

the rt1052 L2 ball is mapped through an inductor to 3.3v, i need to read how this works i've been wondering what that inductor is for, some notion of a dc-dc converter from the data sheet but I just scanned it.

U4 is the winbond flash is on the U5 3.3v bus U11: there is what appears to be a 16k fram module marked RC16 E12128 that I think maybe is MB85RC16 but it isn't clear what it does, maybe backup rom?

big question remains: where is the short, it is 0.8 ohms... and what does U7 power? Going to dig into the datasheet's power section to try to understand this fancy chip's bootup

Geramy commented 1 year ago

Hey, you guys where able to flash the EC500 with the raspberry pi?

Gubby1 commented 1 year ago

Hi Scott, when I type pyocd flash .\remora-rt1052.axf --target mimxrt1050_quadspi it asks me for a debug probe to be connected, what did you use for that?

scottalford75 commented 1 year ago

You will need a CMSIS-DAP probe. You can convert an ST-Link V2 by flashing the CMSIS-DAP firmware available in the repo.

Gubby1 commented 1 year ago

I see, also I would like to know how did you setup your Pi, I'm using a Pi 4 model B with debian 10 and LinuxCNC 2.8 but when I installed PyOCD, LinuxCNC stopped working, do you think I should flash the EC500 first and then set the Pi again for LinuxCNC?

scottalford75 commented 1 year ago

Hi, not sure why LinuxCNC stopped working. I flash my NVEM / EC300 / EC500's using a Windows machine.

You will need to install the dev version of LinuxCNC to enable the installation of the Remora component.

Geramy commented 1 year ago

Hi I got the NodeMCU ESP8266 and usb/ip working. But how do I actually program the card via openocd? I am going to load usb/ip on the windows computer and give that a run. Also do I need to power the 24v on the board to program the chip or is there a way around it by providing 3v to the pin? I really would rather just provide 3v then having to run 24v and no 3v because otherwise I have to bring a 24v power supply with me wherever I decide to try to get this working haha

scottalford75 commented 1 year ago

Further up in this thread is the commands used to install pyOCD and to flash the board.

https://github.com/scottalford75/Remora-RT1052/issues/3#issuecomment-1411214880

You could try to power the board using the CMSIS-DAP probe, but I've found that it's not reliable and always have had the 24v supply to the board.

Geramy commented 1 year ago

Is it possible to use the esp8266 with pyocd?

Geramy commented 1 year ago

So we eventually got it working sorry about the spam, what ports are missing or if the list is shorter what ports are implemented?

Geramy commented 1 year ago

Hi I was wondering if any of you by chance had the NVCM V2 backup firmware file by chance I know it’s off topic but no one else has it and the Chinese don’t respond.

scottalford75 commented 1 year ago

So we eventually got it working sorry about the spam, what ports are missing or if the list is shorter what ports are implemented?

Hi, I'm getting closer with the EC500. But the current published firmware has the IO available shown in this post. https://www.forum.linuxcnc.org/18-computer/44828-remora-ethernet-nvem-cnc-board?start=670#264193

Geramy commented 1 year ago

Any idea on how to get this controller to work again haha, what i mean is that it was working with linuxcnc and i had ethernet in and moving the axis i connected via debug got the firmware updated again, disconnected from debug it was working and then i restarted it and started trying to get the dap link to work again with it to do another update and i got the two RED LED lights lit up but i got no ethernet and no ack on the dap link. can't get pyocd to even reset the device or ethernet lights to come up, any idea?