UPDATE
I were able successfully to flash a program the only lights up a LED, to do so I had to clear the .c file flashed from every possible thing that could’ve cause an error.
Right now I have the following problems:
1- This problem is the most annoying one, basically, when I connect to the CW, the program doesn’t run, it only runs when I run the following function that I got from here
Programming the FE310 through OpenOCD
:
def reconnect():
scope = cw.scope()
scope.default_setup()
target = cw.target(scope)
scope.io.nrst = "low"
time.sleep(0.7)
scope.io.nrst = "high_z"
return scope, target
The problem is that it causes the CW to disconnect, I can’t connect again because I get the LIBUSB busy error -6, and disconnecting and reconnecting the CW from thr PC is the only way yo reconnect again but it closes the program run by the target so no more LEDs
2- Assuming I succeed in falshing a program and keeping it running while the CW is also running, I still have no idea on how I’ll be able to communicate with the target since the UART is no initialized in the fe310_hal.c file in the hal folder. Isn’t necessary to inizilize it before using it in the getch and putch functions that are used in the communication with the target ? I would like to know so if the answer is yes I’ll try to code the initialization myself
3- Despite the fact that flashing a programmed worked, it still take a lot of time (almost an hour just for lighting up an LED), any idea on how to increase the speed of programming in openOCD? Will the usage of a programmer (like ST-link) work and be faster ?
EDIT
4- Using the scope.enable_MPSSE() causes the LED1 (the green one) on the CW308 to light up (even though it isn’t even configured in the code to do so) and gdb debugger can not debug the target since it can’t talk with openOCD on the localhost 3333, this happens when LED1 is on because of enable_MPSSE() , any ideas ?
Thanks in advance for any help or advice.