How to ensure bootloader is started - embedded-linux

I am working with openmote-cc2538 for the project: https://github.com/cetic/6lbr/wiki
Here when I was trying to flash openmote with this command
sudo make TARGET=cc2538dk BOARD=openmote-CC2538 bootload0/dev/ttyUSB0 slip-radio.upload
This error message is displayed
ERROR:Cant CONNECT TO TARGET:Ensure bootloader is started(no answer on sync sequence)
cc2538 bsl.py script is available for uploading binary to openmote. But I don't have much experience about this. Can anybody give me some suggestions regarding how to proceed??

Grab a scope and probe different digital I/O pins on the CC2538. Typically a bootloader will initialize all the ports on the chip and you will see them change state, which is an indication that the bootloader is indeed running. I would guess one of the LEDs would change state as well (which doesn't require a scope).

Related

Uploading to replica Arduino Mega2560 fails

everyone
I could really need some help. I built an ArduinoMega2560, see schematic. I tested the PCB.
I loaded the driver for the Mega16u2 on it. I loaded the Bootloader for the atmega2560-Chip per SCK/MOSI/MISO-Pins successfully. But uploading sketches with the arduino-IDE fails with the error message "timeout". I also ran the loopback test successfully.
I guess i have some wiring problem or forgotten something important.
Maybe one of you knows this very well and can give me a hint. I do not know how to continue.
loopback test
multiple bootloader flashing and 16u2-flashing

How to pass user setting to Driver Extension (MacOS)?

I am writing a driverkit extension whose goal is to block some categories of USB devices, such as flash drives. The driver should block (match to) any device of the relevant device classes, except those, which are whitelisted (based on their vendor and product ID). The whitelist can be set dynamically by user of the application.
The question is, how to pass these data to the driver as reading from a file or something like Windows registry is not available in the DriverKit. The tricky part is that the driver requires the whitelist data before the device is matched.
From what I understood, rejection of device is possible by returning an error from Start() method and returning from it prematurely. I got an idea to send the data while the driver is running this function, however this is not possible as the communication via IOUserClass is not available until the Start method returns.
Is this somehow doable?
As far as I'm aware, communicating with user space apps from the initial Start() method is not possible from DriverKit extensions. As you say, IOUserClients are the mechanism to use for user space communication, and those aren't available until the service is started and registered. You can have your driver match IOResources/IOUserResources so it is always loaded, but each matched service starts up an independed process of your dext, and I'm not aware of a way to directly communicate between these instances.
If I understand you correctly, you're trying to block other drivers from acquiring the device. I don't think the solution you have in mind will help you with this. If you return success from Start(), your dext will drive the device. If you return failure, no driver is loaded for the device, because matching has already concluded. So other drivers would never get a chance anyway, regardless of whether the device is on your allow-list or deny-list.
It's new in DriverKit 21 (i.e. macOS Monterey), and I've not had a chance to try it yet, but there is an API for reading files, OSMappedFile. I would imagine that the DriverKit sandbox will have something to say about which files a dext can open, but this seems like an avenue worth exploring whether you can open configuration files this way.
Note that none of this will help you during early boot, as your dext will never be considered for matching at that time. And you may not be able to get required entitlements from Apple to build a dext which matches USB device classes rather than specific product/vendor ID patterns. (Apologies for repeating myself, but other users may come across this answer and not be aware of this issue.)

How to Lock bootloader in source code- U-boot

I want to make my development board's bootloader (which is u-boot) be locked so no one can stop autoboot process at all. (In this way I will be sure that no one can alter the firmware of the board!)
So please guide me in order to locking the firmware and block any "root" attempts. I am using amlogic s905x SoC.
Another question:
Is this process relates to verified boot and signing kernel images?
If your SoC chip supports secure boot, then it is a way to make its firmware, secure of jail breaking. consult the datasheet. Otherwise you can not 'lock' the firmware.
You can use CONFIG_AUTOBOOT_KEYED=Password to require a password for stopping autoboot.
You can use CONFIG_BOOTDELAY=-2 to autoboot with no delay and not check for abort.
This will not stop users with physical access from altering the firmware. They could simply insert there own SD-card or USB stick or reprogram the eMMC.
CONFIG_AUTOBOOT_KEYED will make you live easier if you need to reflash a returned device.

MCP25625 doesnt send CAN messages

Im using MCP25625 which is MCP2515+integrated MCP2551 and trying to send messages in a loop.
For some reson I dont see any signal at all on CANH, CANL lines.
SPI communication works correctly
I use software reset procedure
There is clear 20Mhz sinewave from Crystal
There is TXCAN signal
At the moment there is nothing at all connected to CANL,CANH, just the probe.
I also tried to run in LOOPBACK mode and it works, but in the NORMAL modethere is nothing coming out.
Seems like transciever is broken? I changed 2 chips already, so it shouldnt be the problem.
Any suggestion guys?
Schematics
have you considered the modes of operation of the CAN transceiver?
In your schematic, the pins value is not clear.
If you have connected it to the MCU, Please pull it to LOW to select the normal operation mode for the transceiver (it is different configuration then the CAN controller settings, hence might cause some confusion!).
Controlling it by MCU is a good choice as it gives more control to prevent network communication from being blocked, due to a CAN controller which is out of control.
Else, connect it to ground to ensure normal operation mode specifically for the build in transceiver.
I have referred the data-sheet's of MCP25625, MCP2515 and TJA1050 to bring out this conclusion.
TJA1050 has pin-S for selecting high-speed mode and silent mode. Both modes are similar to normal mode and standby mode respectively of the transceiver of MCP25625.
Also, pin-S configuration in TJA1050 is similar to pin-STBY configuration in MCP25625.
0(LOW) for high-speed/normal mode of TJA1050/MCP25625-Transceiver
1(HIGH) for silent/standby mode of TJA1050/MCP25625-Transceiver
Hope this helps.
At the moment there is nothing at all connected to CANL,CANH, just the probe.
Hope you have connected the termination resistor? It is on the schematic, but ...

Accessing/monitoring battery status through SMBus

I am currenlty trying to monitor my battery status through SMBus.
I have a battery along with a control board that constantly outputs the battery status.
This control board is then connected to my mother board through a I2C-USB module.
I need to write a program to recognize the SMBus connection and transmit the battery status to the user.
I'm a beginner when it comes to dealing with smart batteries and I2C/SMBus, and I'm somewhat lost with how to approach this problem.
Any help of suggestions would be appreciated. Thanks.
Your question is a bit lacking. What kind of I2C-USB module? Or rather does it come with a Linux driver? If it does you probably won't need to write one. An application will do. You can read more about I2C and SMBus here.
Basically what you need is the I2C address of the control board (a single byte). When you have the address you (as the master) issue read commands over the I2C bus to the control board using its address and reads the response. If there's a driver for the I2C-USB module this should be straightforward enough. Plug in the device and open() the device (/dev/[i2c-usb-name] where [i2c-usb-name] is the name of the device). Then follow the driver implementer's guide how to setup and send data over that device (typically using read()/write() or ioctl()). Here are some additional information on working with I2C from user space: http://www.mjmwired.net/kernel/Documentation/i2c (select topics in the menu on the left hand side).
If you must write the driver yourself, the first stop for a Linux device driver beginner is the LDD3. Read it, it's quite a pleasant read.

Resources