how do I boot BeagleBone Black directly over UART? - boot

I want to boot my BeagleBone Black(BBB) over UART without the BBB attempting to boot from USB or the SD before attempting to boot from UART.
in this guide:
http://linuxkernel51.blogspot.co.il/2015/08/booting-beagle-bone-black-over-uart.html
they succeed in booting a BBB over UART. however this is only done after the BBB attempts to boot from the SD and the USB
BBB has different boots modes like boot from eMMC, uSD, serial & usb. To change the boot mode there is a switch S2, holding the boot switch down during boot without a uSD card inserted will force the boot source to be the USB port and if nothing is detected on the USB client port, it will go to the serial port for download.
this guide:
http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide
explains the boot process of the AM335x SoC Evaluation Board (the same SoC as in the BBB) mentions boot pins which make the board boot from UART first
is there a way to set these pins on the BBB to boot from UART first too?

You can change the boot sequence setting the SYS_BOOT[15:0] signals. On BBB these signals are shared with LCD_DATA[15:0]. They are accessable on P8 header.
When S2 button is not pressed, the SYS_BOOT[4:0] on power on is 11100. In this case the boot sequence is MMC1(eMMC), MMC0(SD card), UART0, USB0.
When S2 button pressed, the SYS_BOOT[4:0] on power on is 11000. In this case the boot sequence is SPI0, MMC0(SD card), USB0, UART0.
To make the UART0 the first, without the need of change the pullup/down resistors of boot configuration, you can force to zero only the SYS_BOOT4 and SYS_BOOT3 signals. This boot configuration (SYS_BOOT[4:0]=00100) results in UART0, XIP, MMC0 (eMMC), NAND sequence.
So, you can make a jump to GND on P8.41 (SYS_BOOT4) and P8.44 (SYS_BOOT3).
Use a push-button to do this: remove the power, press and hold this button, apply the power, release the button when LED status start flashing.

Related

USB stack confusion/serial emulator

I am looking at implementing USB communication on a MCU which has a USB engine built into it. Basically you have access to the pipes/endpoints.
I am a little bit confused on the USB stack now. It appears that drivers operate on another level above the pipe/endpoint setup, so the pipe/endpoint is like a middle level layer that drivers are built on. Is this correct?
Secondly, I am interested in simulating serial communication over USB. It appears windows has a premade driver so on the computer side I do not need to program the pipe level.
How do I find out what I need to implement on the MCU to make it behave correctly with the generic serial driver?
This is an answer to your second question regarding the serial communication.
The USB standard defines a communication device class (CDC) for serial communication. The required drivers on the host side are implemented by Windows, macOS, Linux and many more operation systems.
The relevant CDC subclass is PSTN. The relevant documents are found in Class definition for Communication Devices 1.2.
The device basically implements four endpoints:
Control endpoint for configuration requests (baud rate, DTR state etc.). Have a look at SetLineCodeing, GetLineCoding and SetControlLineState.
Bulk endpoint for USB to serial transmission
Bulk endpoint for serial to USB transmission
Interrupt endpoint for notifications (DCD state, errors). See SerialState.
And of course you need to get the device descriptor right.
On top of that, you need to implement all the standard USB requests.
Chances are high that this has already been written for your MCU, both the standard requests and the serial communication. So why not use the existing code?

How to enable USB 2.0 Host on AST2500?

I'm trying to enable USB 2.0 Host on an AST2500 based board. I'm using the latest obmc-phosphor-image from GitHub which contains Linux 5.10.30. EHCI seems to start in QEMU but fails on real HW. I enabled ehci0 (or ehci1) in the device tree, added the necessary drivers to Linux and I get the following error message during boot-up:
ehci-platform 1e6a1000.usb: USB 2.0, controller refused to start: -110
I investigated EHCI registers a bit and found that when ehci_run() function in ehci-hcd.c would start EHCI (by setting CMD_RUN bit) it remains halted, HCHalted bit in USBSTS register remains 1.
I also saw that the frame index register starts to count when CMD_RUN is asserted. Clock and reset bits in SCU registers are set properly by pinctrl and clk drivers.
Contents of the periodic list buffer and the asynchronous QH buffer seem to be OK. But EHCI still doesn't start.
Strangely UHCI (USB 1.1 host) seems to work properly.
Did maybe somebody manage to get EHCI working on real AST2500 or similar hardware?
Thanks for any advice.

Can the NXP PN532 work on UART at a 38400 baud rate?

I am trying to integrate an RFID1356MIFARE, which uses NXP PN532, with an ESP32-EVB using their UART capabilities.
The NXP docs states that the PN532 is able to communicate on High Speed UART.
I am trying to use 38400 because that's the baud rate fixed by the reader that I'm using.
I've found a modified Adafruit PN532 library that added HSU support. This library states that HSU uses 115200 baud rate.
Now, I've modified PN532_HSU.cpp, where we can find:
void PN532_HSU::begin()
{
_serial->begin(115200);
}
into
void PN532_HSU::begin()
{
_serial->begin(38400, SERIAL_8N1, 36, 4);
}
Unfortunately, I haven't been able to establish communication between the reader and the ESP using this method.
I am able to get a readable output using normal Serial.read(), so UART communication works, but that's not how you read MIFARE cards.
I don't know what the problem is.
What do you think ?
[EDIT]
I went through the documentation and here is what i suggest: If you have a USB to serial device use it to directly connect reader module to computer else connect it directly using mini USB port in module. the follow following steps:
Put device in UART/ USB CDC mode depending on how you connected device to computer. Exact method to do this is provided in operation section of documentation
Use picoterm / screen or other serial terminal (if you are using Linux) or just use Arduino serial monitor with correct baud rate to connect device.(115200 for USB and 38400 for UART)
Type in commands listed in COMMAND SET FOR CDC AND UART MODE section in documentation to check if module is working or not.
Place some cards over reader to check what response does module sends when card is detected.
Use this information to develop your own library for reader.
It will not work with regular PN532 libraries. Instead you'll need to use regular Serial read and write to communicate.
[Original]
PN532 datasheet says host interface is selected by pulling up/down I0, I1 pins of device. For HSU both pins must be pulled down. This is implemented in hardware so you need to verify if the mode you want to use is set.
Looking into the link you posted for module, it says that it uses another micro-controller on board to extend communication capabilities, so maybe you need to use driver for that specific controller firmware? The link seems to have document explaining how to setup different communication system in Document section, please have a look there and check if it works.
Link: https://www.olimex.com/wiki/MOD-RFID1356MIFARE

Enabling spi1.x bus in android things raspberry pi 3

As per, rpi3 device tree, it has two spi buses i.e spi0 and spi1. spi0 bus supports 2 chip select [spi0.0, spi0.1] and spi1 bus supports 3 chip select[spi1.0, spi1.1, spi1.2] pins. All these can be configured in config.txt using dtoverlay.
Now my rpi3 uses spi0.1 for touchscreen interface. I dont want to use spi0.0 because it may cause bus contention. So i need to connect my other peripheral on spi1.x bus.
When i am querying rpi3 for spi buses using getSpiBusList(), the ouput is [SPI0.0, SPI0.1]
How do i get around this issue?
Note:- Using android things 0.7-devpreview
According Raspberry Pi I/O pinout there is only SPI0.0 and SPI0.1 SPI buses pins, so you can't use SPI1.? bus even if you configure it in config.txt.

Intel Edison not Booting

I have a new Intel Edison connected to the Arduino breakout board and it is unable to boot. I have never seen it boot ever.
I have tried connecting it with different settings to discard a problem at cable level or power input.
The current setup is:
-Intel Edison mounted on Arduino breakout board.
-Power cable connected to Powered USB Hub or to wall adapter.
-Console cable connected directly to computer USB port.
When monitoring the boot process with a terminal app, the only output is:
PSH KERNEL VERSION: b0182727
..WR: 20104000
SCU IPC: 0x800000d0 0xfffce92c
PSH miaHOB version: TNG..B0..VVBD..0000000c
microkernel. built 23:15:13. Apr 24 2014.
******* PSH loader *******
PCM page cache size = 192 KB
Cache Constraint = 0 Pages
Arming IPC driver ..
Adding page store pool ..
PagestoreAddr(IMR Start Address) = 0x04899000
pageStoreSize(IMR Size) = 0x00080000
**** Ready to receive application ****
After this, the Edison loops every X amount of time. If I disconnect and reconnect power, the exact result is obtained.
I have also tried to boot from OsX / Debian / Linux with no results.
When running the flashall.sh scripts, the device is never found.
I have tried everything I have found online, and have run out of ideas...
I am now sure the Edison has a physical problem. I tried with a new one and was able to boot it up without any trouble. I already talked to the company I bought it from and they will be doing a refund.

Resources