ADF4372 & rpi-5.10y analog devices kernel build - raspberry-pi3

I am trying to rebuild the kernel for ADF4372 driver : below
https://github.com/analogdevicesinc/linux/tree/rpi-5.10.y
Now it don't work well.
Kernel version:
Linux raspberrypi 5.10.631235984-v7 #4 SMP Sat Jul 16 17:41:54 JST 2022 armv7l GNU/Linux << My rebuild extension 1235984
Kernel log:
dmesg | grep spi : error messages
[ 9.641473] spi-bcm2835 3f204000.spi: registered master spi0
[ 9.661432] spi spi0.0: setup: forcing CS_HIGH (use_gpio_descriptors)
[ 9.661476] spi spi0.0: setup mode 0, cs_high, 8 bits/w, 1000000 Hz max --> 0
[ 9.662253] adf4371 spi0.0: Using the default clk names
[ 9.672797] spi-bcm2835 3f204000.spi: registered child spi0.0
[ 9.672889] spi-bcm2835 3f204000.spi: chipselect 0 already in use
[ 9.672926] spi_master spi0: spi_device register error /soc/spi#7e204000/spidev#0
[ 9.672957] spi_master spi0: Failed to create SPI device for /soc/spi#7e204000/spidev#0
[ 9.673013] spi spi0.1: setup: forcing CS_HIGH (use_gpio_descriptors)
[ 9.673042] spi spi0.1: setup mode 0, cs_high, 8 bits/w, 125000000 Hz max --> 0
[ 9.673445] spi-bcm2835 3f204000.spi: registered child spi0.1
File rpi-adf4371-overlay.dts:
/dts-v1/;
/plugin/;
/ {
fragment#0 {
target-path = "/";
__overlay__ {
clocks {
adf4372_clkin: clock#0 {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <10000000>; // 10MHz
};
};
};
};
fragment#1 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
adf4372#0 {
compatible = "adi,adf4372";
reg = <0>;
spi-max-frequency = <1000000>;
clocks = <&adf4372_clkin>;
clock-names = "clkin";
};
};
};
};

Related

canĀ“t emit via ethernet to my server on javascript?

hello, good day, I am making an example with a 5500 chip in esp32 with the socketioclient library, but when I want to send the json to my server, they are only left on the waiting list and I don't know what is happening to me, before all this an error message about invalid mbox appeared and I added the following line of code esp_netif_init(); and it was fixed, but once entering the loop the following happens:
serial monitor:
Starting WebServer on ESP32 with W5x00 using Ethernet_Generic Library with Large Buffer
Ethernet_Generic v2.4.0
[ETG] Default SPI pinout:
[ETG] MOSI: 23
[ETG] MISO: 19
[ETG] SCK: 18
[ETG] SS: 5
[ETG] =========================
[ETG] ESP32 setCsPin: 5
[ETG] W5100 init, using SS_PIN_DEFAULT = 22 , new ss_pin = 10 , W5100Class::ss_pin = 5
[ETG] Chip is W5500
[ETG] W5100::init: W5500, SSIZE = 8192
[ETG] Currently Used SPI pinout:
[ETG] MOSI: 23
[ETG] MISO: 19
[ETG] SCK: 18
[ETG] SS: 5
[ETG] =========================
Using mac index = 1
Connected! IP address: 192.168.10.147
Speed: 100 MB, Duplex: FULL DUPLEX, Link status: LINK
LLego a la parte de initwebsocket y task
termino inits
[SIoC] add packet 42["setRele",{"Dato":"hola"}]
[SIoC] add packet 42["getPrueba",{"name":"hola ese","SERVIDOR":"HOLA MUNDO"}]
[SIoC] Disconnected!
[SIoC] add packet 42["setRele",{"Dato":"hola"}]
[SIoC] add packet 42["getPrueba",{"name":"hola ese","SERVIDOR":"HOLA MUNDO"}]
[SIoC] Disconnected!
[SIoC] add packet 42["setRele",{"Dato":"hola"}]
[SIoC] add packet 42["getPrueba",{"name":"hola ese","SERVIDOR":"HOLA MUNDO"}]
[SIoC] Disconnected!
then the loop remains without emitting it just remains as shown above
sketch:
/****************************************************************************************************************************
WebServer.ino
Ethernet_Generic is a library for the W5x00 Ethernet shields trying to merge the good features of
previous Ethernet libraries
Built by Khoi Hoang https://github.com/khoih-prog/Ethernet_Generic
*****************************************************************************************************************************/
/*
The Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno
and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53,
is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work.
*/
#include "defines.h"
#include <SocketIoClient.h>
#include <Arduino_JSON.h>
#include <tcpip_adapter.h>
//TaskHandle_t Task1;
SocketIoClient socketIO;
//void Task1code( void * parameter ){
// Serial.print("Task1 is running on core ");
// Serial.println(xPortGetCoreID());
// while(1){
// socketIO.loop();
// delay(100);
// }
//}
//
//
void initWebSocket()
{
// server address, port and URL
socketIO.begin("192.168.10.59",8000);
// event handler for the event message
socketIO.on("asignacion",getresponse);
//socketIO.on("getPrueba",getresponse);
socketIO.loop();
delay(5000);
}
void getresponse(const char *payload, size_t length){
Serial.printf("response: ",payload);
String data = String(payload);
data.replace("\\","");
JSONVar dato = JSON.parse(data);
Serial.println(dato["litros"]);
}
void setup()
{
Serial.begin(115200);
while (!Serial && millis() < 5000);
Serial.print("\nStarting WebServer on "); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(ETHERNET_GENERIC_VERSION);
#if (USING_SPI2)
#if defined(CUR_PIN_MISO)
ETG_LOGWARN(F("Default SPI pinout:"));
ETG_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
ETG_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
ETG_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
ETG_LOGWARN1(F("SS:"), CUR_PIN_SS);
ETG_LOGWARN(F("========================="));
#endif
#else
ETG_LOGWARN(F("Default SPI pinout:"));
ETG_LOGWARN1(F("MOSI:"), MOSI);
ETG_LOGWARN1(F("MISO:"), MISO);
ETG_LOGWARN1(F("SCK:"), SCK);
ETG_LOGWARN1(F("SS:"), SS);
ETG_LOGWARN(F("========================="));
#endif
#if defined(ESP32)
// You can use Ethernet.init(pin) to configure the CS pin
//Ethernet.init(10); // Most Arduino shields
//Ethernet.init(5); // MKR ETH shield
//Ethernet.init(0); // Teensy 2.0
//Ethernet.init(20); // Teensy++ 2.0
//Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet
//Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet
#endif
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 5 //22 // For ESP32
#endif
ETG_LOGWARN1(F("ESP32 setCsPin:"), USE_THIS_SS_PIN);
// Must use library patch for Ethernet, EthernetLarge libraries
// ESP32 => GPIO2,4,5,13,15,21,22 OK with Ethernet, Ethernet2, EthernetLarge
// ESP32 => GPIO2,4,5,15,21,22 OK with Ethernet3
//Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (USE_THIS_SS_PIN);
// start the ethernet connection and the server:
// Use DHCP dynamic IP and random mac
uint16_t index = millis() % NUMBER_OF_MAC;
// Use Static IP
//Ethernet.begin(mac[index], ip);
Ethernet.begin(mac[index]);
//SPIClass SPI2(HSPI);
//Ethernet.begin(mac[index], &SPI2);
// Just info to know how to connect correctly
// To change for other SPI
#if defined(CUR_PIN_MISO)
ETG_LOGWARN(F("Currently Used SPI pinout:"));
ETG_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
ETG_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
ETG_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
ETG_LOGWARN1(F("SS:"), CUR_PIN_SS);
ETG_LOGWARN(F("========================="));
#else
ETG_LOGWARN(F("Currently Used SPI pinout:"));
ETG_LOGWARN1(F("MOSI:"), MOSI);
ETG_LOGWARN1(F("MISO:"), MISO);
ETG_LOGWARN1(F("SCK:"), SCK);
ETG_LOGWARN1(F("SS:"), SS);
ETG_LOGWARN(F("========================="));
#endif
Serial.print(F("Using mac index = "));
Serial.println(index);
Serial.print(F("Connected! IP address: "));
Serial.println(Ethernet.localIP());
if ( (Ethernet.getChip() == w5500) || (Ethernet.getAltChip() == w5100s) )
{
Serial.print(F("Speed: ")); Serial.print(Ethernet.speedReport());
Serial.print(F(", Duplex: ")); Serial.print(Ethernet.duplexReport());
Serial.print(F(", Link status: ")); Serial.println(Ethernet.linkReport());
}
Serial.println("LLego a la parte de initwebsocket y task");
Serial.println("termino inits");
// tcpip_adapter_init();
// for (int i = TCPIP_ADAPTER_IF_STA; i < TCPIP_ADAPTER_IF_MAX; i++) {
// if (tcpip_adapter_is_netif_up((tcpip_adapter_if_t)i))
// ESP_LOGI(TAG, "interface %i up ", i);
// else
// ESP_LOGI(TAG, "interface %i down ", i);
// }
esp_netif_init();//ojo con esta funcion https://gitter.im/espressif/arduino-esp32?at=607b291f06e2e024e85cdf50
initWebSocket();
// xTaskCreatePinnedToCore(Task1code,"Task1",10000,NULL,1,&Task1,0);
}
void loop()
{
//socketio.loop();
//socketIO.emit("getPrueba","{\"hello world\"}");
//socketIO.emit("plainString", "\"this is a plain string\"");
socketIO.emit("setRele","{\"Dato\":\"hola\"}");
delay(500);
//socketIO.emit("app","{\"name\":\"hola ese\",\"chava\":\"hola chava\"}");//esta libreria solo maneja archivos json
socketIO.emit("getPrueba","{\"name\":\"hola ese\",\"SERVIDOR\":\"HOLA MUNDO\"}");
//socketIO.emit("setData","{\"Dato\":\"hola\",\"Dato2\":\"Andre\"}");
//socketIO.on("get",getresponse);
delay(500);
socketIO.loop();
}
i only use two events to emit to the server they are setRele and getprueba as shown in the loop
server java script:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http,{allowEIO3: true ,cors: {origins: ['http://localhost:4200', 'http://localhost']}});
var port = process.env.PORT || 8080;
app.get('/', (req, res) => {
console.log("app works");
});
io.on('connection', (socket) => {
console.log(socket.id);
/**Catalogos */
// socket.emit("GetConfiguracion","{\"code\":\"ECOA-0179\",\"cambio\":\"0\",\"idRespuesta\":\"1\",\"Pines\":[{},{}]}");
// socket.emit("Reiniciar","{\"CodigoMDC\":\"ECOA-0179\"}");
// socket.emit("SetRelee","{\"code\":\"ECOA-0179\",\"f\":\"2022/04/26 03:51:33\",\"p\":\"26\",\"v\":\"1.00\"}");
socket.on("stateChanged", (params) => {
console.log(params); // x8WIv7-mJelg7on_ALbx
});
socket.on("getPrueba", (params) => {
console.log(params); // x8WIv7-mJelg7on_ALbx
});
socket.on("setRele", (params) => {
console.log(params); // x8WIv7-mJelg7on_ALbx
//socket.emit("SetRelee","{\"code\":\"ECOA-0179\",\"f\":\"2022/04/26 03:51:33\",\"p\":\"26\",\"v\":\"1.00\"}");
});
socket.on("ConfiguracionAplicada", (params) => {
console.log(params); // x8WIv7-mJelg7on_ALbx
});
socket.on('disconnect', () =>
{
console.log("Desconectado id: ",socket.id);
});
});
http.listen(port, () => {
console.log('listening on :' + port);
});
If someone could help me, it would be very helpful. Thank you. I'm new to ethernet connectivity. I hope you understand.

Adding custom LCD to the SAMA5D2 XULT

I`m using the Atmel KMS/DRM LCD driver to make it work a custom LCD (ST5651CB + ST5021CB) that I have at home from another project that I wanted to use. So, in order to speed up the development strategy I have divided the problem into several parts which are detailed below.
I have started by integrating the TSC2007 touchscreen driver with successful results, as voltage fluctuations are detected on the screen when it is touched, according to the normal operation after the inclusion of the relevant node in the corresponding i2c bus.
Subsequently, the node for the backlight has been included, making use of the pwm-backlight kernel driver. Also in this case it is fully functional, being able to activate or deactivate it on demand, as well as change the brightness levels (which have been previously defined with the values that oscillate in the interval [0,255]).
Once this has been done, the timing analysis of the panel in SYNC mode has been undertaken using the ST5651CB specification in which this is detailed, to populate the node that makes use of the simple-panel driver of the kernel (to which the backlight previously discussed has been assigned).
(root node)
....
/* Screen brightness */
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&hlcdc_pwm 0 50000 0>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <7>;
status = "okay";
};
/* ST5651CB + ST5021CB TFT LCD */
panel: panel {
compatible = "simple-panel";
backlight = <&backlight>;
width-mm = <155>; /* Active area (W) 154.21 */
height-mm = <86>; /* Active area (H) 85.92 */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
/* SYNC mode */
panel-timing {
clock-frequency = <65000000>; /* Panel clock (Hz) */
hactive = <1024>; /* Active frame width (px) */
vactive = <768>; /* Active frame height (px) */
hfront-porch = <160>; /* Horizontal front porch timing (px) */
hsync-len = <160>; /* HSD blanking (px) */
hback-porch = <160>; /* Horizontal back porch timing (px) */
vfront-porch = <15>; /* Vertical front porch timing (lines) */
vsync-len = <23>; /* VSD blanking (lines) */
vback-porch = <15>; /* Vertical back porch timing (lines) */
pixelclk-active = <0>; /* Data driving on falling edge */
hsync-active = <0>; /* Horizontal sync pulse (low) */
vsync-active = <0>; /* Vertical sync pulse (low) */
de-active = <0>; /* Data enable (low) */
};
port#0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
panel_input: endpoint#0 {
reg = <0>;
remote-endpoint = <&hlcdc_panel_output>;
};
};
};
...
Also in the kernel argument line (using U-Boot bootargs) I`m specifying the mode by supplying video=Unknown-1:1024x768-16
Finally, and I have conglomerated each of these parts to achieve the final goal, populating the hlcdc node in the device tree and having the LCD functional.
(apb node)
...
hlcdc: hlcdc#f0000000 {
u-boot,dm-pre-reloc;
status = "okay";
hlcdc-display-controller {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_rgb666 &pinctrl_lcd_reset>;
port#0 {
#address-cells = <1>;
#size-cells = <0>;
hlcdc_panel_output: endpoint#0 {
reg = <0>;
remote-endpoint = <&panel_input>;
};
};
};
hlcdc_pwm: hlcdc-pwm {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_pwm>;
#pwm-cells = <3>;
};
};
...
The problem is that this strategy does not seem to work because, as mentioned above, because I only have the backlight and the touchscreen functional, but nothing is displayed on the screen.
The question is basically if this guide to integrate a custom LCD in linux is correct or if it has been wrong somewhere.

How to describe correctly GPIO in dts-file to power it off in the "Suspend-to-RAM" mode?

I have GPIO-expnader tca6424 on my board. Pin 17 supplies another chips. I need to power off this chips in the "suspend-to-RAM" mode. I described it in dts file:
hu_u1740: tca6424_hu_u1740#22 {
compatible = "ti,tca6424";
reg = <0x22>;
gpio-controller;
#gpio-cells = <2>;
regulator#17 {
regulator-min-microvolt = <33000000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-name = "pw_bt";
enable-active-high;
regulator-state-mem {
regulator-off-in-suspend;
};
};
};
I tried pin 17 as regulator but it doesn't work. If is there ready way or i should write own driver?

CC3200 SPI slave issue

I am trying to interface Artix-7 FPGA with CC3200MOD for SPI transfers. CC3200MOD is the slave. I am receiving only '.' on the terminal.
SPI slave program:
void SlaveMain()
{
//
// Initialize the message
//
memcpy(g_ucTxBuff,SLAVE_MSG,sizeof(SLAVE_MSG));
//
// Set Tx buffer index
//
ucTxBuffNdx = 0;
ucRxBuffNdx = 0;
//
// Reset SPI
//
MAP_SPIReset(GSPI_BASE);
//Message("\n\r SPI reset");
// Configure SPI interface
//
MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
SPI_IF_BIT_RATE,SPI_MODE_SLAVE,SPI_SUB_MODE_3,
(SPI_HW_CTRL_CS |
SPI_4PIN_MODE |
SPI_TURBO_ON |
SPI_CS_ACTIVELOW |
SPI_WL_8));
Message("\n\rSPI configured");
//
// Register Interrupt Handler
//
MAP_SPIIntRegister(GSPI_BASE,SlaveIntHandler);
//
// Enable Interrupts
//
MAP_SPIIntEnable(GSPI_BASE,SPI_INT_RX_FULL|SPI_INT_TX_EMPTY);
//
// Enable SPI for communication
//
MAP_SPIEnable(GSPI_BASE);
//Message("\n\rSPI enabled");
/*MAP_SPIReset(GSPI_BASE);
MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
SPI_IF_BIT_RATE,SPI_MODE_SLAVE,SPI_SUB_MODE_0,
(SPI_HW_CTRL_CS |
SPI_4PIN_MODE |
SPI_TURBO_OFF |
SPI_CS_ACTIVELOW |
SPI_WL_8));
MAP_SPIEnable(GSPI_BASE);
//}*/
}
The SlaveMain() function is called once in the main and then the program goes into a while(1) until SPI interrupt is hit. When SPI interrupt is hit, only '255' is received irrespective of what I transmit from the FPGA.
What can be the issue?

How to Enable UART in MT7620 Using Device Tree

I have platform with MT7620 in MIPS arch. On Platform is instaled OpenWRT. I also use Image Builder to create firmware. Now I whant to enable UART interface in my platform. I think that I must add inode to DT in mt7620.dts file but I do not know what must be the correct syntax. My propozition is below. I also need that UART worked as ttyS0 and console I whant to assigned to ttyS1
So, in file mt7620.dts I whant to add this
chosen {
bootargs = "console=ttyS1,15200";
};
uart#500 {
compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
reg = <0x500 0x100>;
interrupt-parent = <&intc>;
interrupts = <5>;
reg-shift = <2>;
pinctrl-names = "default";
pinctrl-0 = <&uartf_pins>;
status = "ok";
};
Please tell me whether above syntax is correct ?
Main library (dtsi) its following inode UART
uart#500 {
compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
reg = <0x500 0x100>;
resets = <&rstctrl 12>;
reset-names = "uart";
interrupt-parent = <&intc>;
interrupts = <5>;
reg-shift = <2>;
status = "disabled";
};
EITD
The answer is simply. It should be add inode to *.dts
uart#500
{
status = "okay"
}
That is all, because all parameters have been define in *.dtsi file.

Resources