STM32F407VG Disc board won't connect anymore - arm

Context
I have accidentally uploaded some ARM Cortex M0-cmis files (core-cmFunc.h and core_cmInstr.h) to the STM32F407VG discovery board. After I noticed my mistake, I tried to undo it by changing my code and upload it again... but it said it couldn't make connection.
What I already tried
I've tried to get passed the USART interface of the discovery board by uploading the code directly on the ARM Coretex M4 chip via the bootloader. I connected BOOT0 to VDD and PB2(=BOOT1) to GND so the chip starts up in the Pattern1-mode. Then I connected PA9(=Tx) and PA10(=Rx) to an USB to TTL cable (by the use of a RS-232 chip in the cable) and reset the device. I started the "Flash Loader Demonstrator" from ST to make connection with the board (I've done this before and it worked). But that didn't made connection either.
Extra information
The Windows filemanager "sees" the ARM Cortex M4 file when it gets connected to the PC;
Led LD7 emits green light when the board is powered;
Led LD1 emits red light;
Does someone knows how I can factory-reset the flashmemmory of the STM32F4 so it acts at it should again?

After some trial and error I've come to the conclusion that I accidentally activated the OTG_VBUS with my code. I couldn't upload another code because that bus was active on PA9(TX of USART2). It seems that the VBUS was held active, even in bootloader mode.
PA9 connected to VBUS
The solution to this problem was the use of another bootloader interface, I used USART3 on PB10/11, but you could also use PC10/11. After I uploaded a dummy code in that manner, I
was able to upload codes with the Coocox-IDE again.
Other Bootloader interfaces

Related

Beaglebone Black won't show-up as /dev/ttyUSB

I am trying to learn Linux by following instructions in "Mastering Embedded Linux Programming" by Chris Simmonds. By following the book and with some help from Stack_Overflow_1, i was able to build the MLO and u-boot.img.
However, when i connect USB cable to my PC and execute the ls /dev/tty* command, i cannot find any device with /dev/ttyUSB. All i can see are devices with /dev/tty0-63, /dev/ttyS0-31 and one /dev/ttyprintk.
Also, when i press down the S2 button and connect the USB cable, i can only see the power led glowing and nothing else.
I have properly built the u-boot (three attempts to get it right).
Also, as per the instructions in the book, i am only testing the u-boot stuff and yet to reach the kernal part.
If i remove the sd card and connect the USB, im an able to talk to my BBB over ssh (192.168.7.2).
How to i get the u-boot to work? Thank you!
If you don't have one yet, I'd recommend to get a USB-to-serial device (3.3V Vref). You connect it to the debug UART (J1) which is located next to the P9 side. Nowadays those are very cheap and can cost below 1$. Ones that feature a genuine FTDI part will be 5-10$ at least.
The serial port you are referencing is only available once the device has passed through U-Boot, booted the kernel and finally userspace has set up the communications.
Especially when working with U-Boot and the Kernel, low level UART access is crucial.
As a further note, could it be that the Book refers to the (white) original Beaglebone? That has a FTDI USB-to-UART chip on board and will allow you even U-Boot access. You can do the same things if you have the above mentioned USB device.
https://groups.google.com/g/beagleboard/c/eNDjK05spY8/m/GPvhcP52BAAJ shows that one needs to hold the space key to enter u-boot.
Also, the info. here might be more up to date compared to the book.
https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black
There is no way to copy and paste everything from the eewiki. I just left you the link. Enjoy!

STM32F407 Disc E31 Error message in debugging

I will ask a question about my STM32F407 Discovery board. I want to learn about external interrupts and I was making a small circuit. I connected PH0 to my button and PH1 to the LED. But these pins are connected to the mcu's crystal pins. But I didn't know it at that time. I was press button that is connectet to 5V. And my IDE won't connect to my board for debugging debugging. I can connecting to my board via ST Link Utility and I can do a full chip erase with no errors. Then I turn back to code in Atollic, press the debugging button and I get this error messages:
Error in executing 'cont' command ...
CM4 Failed to read all registers
FAILED to REGISTER Values from the target
Target is not responding, retrying...
*some messages in between*
warning: Remote failure reply: E31
Remote failure reply: E31
Remote connection closed
Quit
And then I turned off the debug screen to try again but I can't because Atollic can't find any ST Link devices. This is the error message:
Target no device found
Error in initializing ST-LINK device.
Reason: No device found on target.
Note: My PC recognize my board in Device Manager.
How can I solve this problem. ST Link Utility connects to my board succesfully, My PC connects to my board. I tried St link firmware upgrade but I got more errors. Like this.
Failure at line: 13 in "Target Software Startup Scripts"
You probably have ST Utility still connected to your MCU. This results in Atollic not beeing able to connet to the MCU. Either close ST Utillity or press the disconnet button.
Since you can erase it your MCU should be ok and you chose one of the few 5V tolerant pins but it would be better practice to use 3V.
Another reason might be the option bytes if the read out protection got set to level 1 or 2 the debugger is sometimes not able to reset those and is therefore not able to read out the register.
I was solve a lot of problem. Firstly I found a problem. This is a my DCMI_Config function. In this function I have a lot of pin definition. GPIOA caused my problem.
GPIOA-> MODER = 0x00002200; //GPIOA 4,6 Set Alternate Function for DCMI
This line has my problem. I was search Discovery schematic and I found something. PA4 pin connected to Discovery's voice uc as I2S3_WS. Is this cause any problem?

parallella fpga : how to give an interrupt from pl to arm ps

I successfully implemented an "[accelerator in 15 minutes]"1 on parallella board. Now I need to send an interrupt from pl to ps. So I connected it to IRQ_F2P of Zynq processing system.
Now, how can I get this interrupt in arm processor?
Usual interrupt example using "XILINX SDK" tool which uses a JTAG. But in parallella , I don't have a JTAG. (I am coping the program to SD card and execute it from SD card using Ubuntu). So any suggestions are most welcome.
So for parallella, I tried to use the Xilinx SDK, but the header files are creating an error..
My one more doubt is "Is it possible to create a bsp using sdk tool and copy it into sd card and then make it run on parallella board. Will it work ?
If not, how do we get this interrupt in arm processor, because all example uses Xilinx header files like "xparameters.h, xil_printf.h, xcugic.h, etc" and these are connected to many other Xilinx functions.

C UART not working all the time

I'm having an issue connecting a serial device to an embedded device I'm writing code for.
The device I am writing has two serial ports, an incoming from my laptop, and an outgoing to an external device.
When I connect both terminals to my laptop and view the data, I get exactly the data I am expecting.
When I connect my laptop to the external device directly, I am getting exactly what I expect, and a response.
When I connect the laptop and the external device to the embedded device I am working on, the laptop sends data to it, it receives it, it passes it on to the external device. This works as expected.
However, the external device doesn't send back the response.
If I send data to the external device from the embedded device, each new message I send allows it to send the original reply.
I know the first message got through correctly because the external device whirrs to live, and I know when it is sending the response by running and logic analyser on the tx/rx comms and viewing the traffic.
I considered that the embedded device is holding the rx line and preventing its transmission, but I don't see how that possible in the code. Also if that is the case it shouldn't work when I plug both lines into my laptop.
I also considered the DTR was not set high, but checked this and it appears to be set high.
Does anyone know a reason which would prevent a device from responding?
Note: When I say Serial Ports I am referring to the UART when referring to the embedded device. All device use a DB9 connector running RS232.
Edit: Operating System on laptop is Windows 10. Embedded device is a Atmega324p.
Edit 2: Did some more testing. It appears that it sometimes work and sometimes doesn't.
I have added an image which show a almost perfect signal of the response.
The blue section is a gap in the signal that shouldn't be there.
Ended up finding a solution.
The RTS line was held via the embedded device at 1.2v, while the Pc was holding it at 5.2v.
Pulling the RTS line up to 5v fixed the issue.

ATSAM4s8b, how to wait until a usb device has been connected

I am very new to C and embedded programming.
I simply want to have my main thread wait until a usb device has been plugged in to my embedded device.
However, no matter how hard I look, I cant find documentation or examples about how to check if the usb has been plugged in.
I am using a ATSAM4S8B.
EDIT:
Actually I think the usb capabilities are built into the chip, I can use Atmel ASF libraries.
I am hoping that there is just a library function I can call to see if the usb has been connected too but I can't find anything like it.
There are two ways of detecting USB connection:
waiting for usb events occure and special USB flags to fire in hardware registers, which will signal if initiating process started. This solution depends on a particular chip you use and firmware burnt into MCU.
use sense IO pin. Attach USB 5V through 1k resistor to a pin of the MCU. High level on the pin will indicate, that USB was connected. Dont forget to use high value (>10k) pull-down resistor, which will pull the input low when USB disconnected.

Resources