Skip to content

Instantly share code, notes, and snippets.

View lategoodbye's full-sized avatar

Stefan Wahren lategoodbye

  • chargebyte GmbH
  • Germany
View GitHub Profile
@lategoodbye
lategoodbye / mx28_dcdc_clock.txt
Last active August 29, 2015 14:19
Logical diagram of i.MX28 DC-DC clock domain
ref_xtal |\
------------------------------------------------------------->| \
| \ +----------+
| \ | |
ref_pll |\ | +--------------------> CLK_DCDC |
--------------->| \ +---------+ | / | |
| \ | | | / +----------+
| +------------------> DIV INT |----------->| /
ref_gpmi | / | | |/
--------------->| / +---------+ HW_POWER_MISC_SEL_PLLCLK
@lategoodbye
lategoodbye / mx23_dcdc_clock.txt
Last active August 29, 2015 14:19
Logical diagram of i.MX23 DC-DC clock domain
ref_xtal |\
------------------------------------------------------------->| \
| \ +----------+
| \ | |
ref_pll |\ | +--------------------> CLK_DCDC |
--------------->| \ +---------+ | / | |
| \ | | | / +----------+
| +------------------> DIV INT |----------->| /
ref_gpmi | / | | |/
--------------->| / +---------+ HW_POWER_MISC_SEL_PLLCLK
@lategoodbye
lategoodbye / anybaud.c
Last active November 4, 2022 19:54 — forked from peterhurley/anybaud.c
/*
* Allows to set arbitrary speed for the serial device on Linux.
* stty allows to set only predefined values: 9600, 19200, 38400, 57600, 115200, 230400, 460800.
*/
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@lategoodbye
lategoodbye / mx23_lcdif_clock.txt
Created October 3, 2015 10:43
logical diagram of i.MX23 lcdif clock domain
lcdif_sel
ref_pix |\ lcdif_div
--------------->| \ +---------+
| \ | |
| +------------------> |-----------> lcdif
ref_xtal | / | |
--------------->| / +---------+
|/
@lategoodbye
lategoodbye / dmesg.log
Created January 17, 2016 02:36
Errors after disconnecting external USB Hub from Raspberry Pi B
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.4.0-rc7-next-20160104+ (user@Raspberry) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #16 Sun Jan 17 01:56:28 UTC 2016
[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] Machine model: Raspberry Pi Model B
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 49152
[ 0.000000] free_area_init_node: node 0, pgdat c07e3cf8, node_mem_map cbe79000
[ 0.000000] Normal zone: 384 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
diff --git a/bin/mbus-tcp-request-data-multi-reply.c b/bin/mbus-tcp-request-data-multi-reply.c
index 8cc1d2e..3d850d3 100755
--- a/bin/mbus-tcp-request-data-multi-reply.c
+++ b/bin/mbus-tcp-request-data-multi-reply.c
@@ -31,6 +31,8 @@ init_slaves(mbus_handle *handle)
return 0;
}
+ sleep(1);
+
diff --git a/mbus/mbus-protocol.c b/mbus/mbus-protocol.c
index 107e73a..0deca63 100755
--- a/mbus/mbus-protocol.c
+++ b/mbus/mbus-protocol.c
@@ -691,7 +691,6 @@ mbus_data_float_decode(unsigned char *float_data)
float f;
} data;
memcpy(&(data.u32), float_data, sizeof(uint32_t));
- data.u32 = ntohl(data.u32);
return data.f;
//usb_test.c
//compile: gcc usb_test.c -o usb_test
#include <fcntl.h> /* O_RDWR */
#include <stdio.h>
#include <unistd.h>
#include <string.h>
void open_port(char * portname) {
@lategoodbye
lategoodbye / 0001-i2c-bcm2835-NULL-ptr.patch
Created February 15, 2017 13:50
Avoid possible NULL pointer dereference in i2c-bcm2835
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index c3436f6..561090a 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -195,7 +195,9 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data)
}
if (val & BCM2835_I2C_S_DONE) {
- if (i2c_dev->curr_msg->flags & I2C_M_RD) {
+ if (!i2c_dev->curr_msg) {
@lategoodbye
lategoodbye / rpi-fw-pin-usage.txt
Last active April 7, 2017 09:00
Pin usage of the Raspberry Pi firmware
RPi 1 RPi 1 RPi 1 RPi 1 RPi 1 RPi RPi RPi 2 RPi 3 RPi 3
A+ B r1 B r2 B+ CM 0 0 W B B CM
0 | | | X | | | | | | |
1 | | | X | | | | | | |
2 | | X | | | | | | | |
3 | | X | | | | | | | |
4 | | | | | | | | | |
5 | | X | X | | | | | | |
6 | | | | | | | | | |
7 | | | | | | | | | |