In the linux GPIO subsystem:
static int gpio_request(unsigned gpio, const char *label)
GPIO number is taken from hardware schematics right?? How exactly this number is mapped to dts (or any header file in linux kernel)? Can I use GPIO number from schematics directly or do I need to add some offset?
I am using CN8300 cavium arm soc. And trying to convert a GPIO pin into interrupt pin.
Related
I have 32-bit MCU. The port uses 32 digital IO functionality.STM32F469/479 Series.
I am looking for a sample code to Latch a particular bit/particular pin in PORTA
Set/RESET function particular bit In port A.
Can some one guide me on how it can be done using AND/OR/XOR operation?
I am doing a university project in which i have to build a I2C which have only one slave and will have to transmit a data with 5 bits, 4 bits for the number which is in the range of 0 to 9 and 1 bit to read or write, i'm using a DE10-LITE with VHDL for this project, which has a 50 Mhz default clock, i was looking into the "ALTPLL" inside quartus prime but i can't find the option to set my clock to 100kbps, i did find in the in some forums that the "Set up PLL in LVDS mode" enables that, but for some reason quartus won't let me activate it. My SDA will be 100kbps, and the SCL 50mhz.
As the Other people have said: You don't need a PLL for that. If you already have a default clock of 50MHz then you just need to divide that by 500, using a counter, and then you have your 100kHz clock.
Anyways, you would want to start the counter only when there is a request on the bus. So user16145658 is correct: The generated clock should be the output of your state machine.
You don't need to change the clock of the FPGA, since you are using an FPGA, you only need to implement an i2c core to communicate with the i2c device.
And the i2c specification specifies the rate of i2c
Standard mode (Sm) 100 kbit/s
Fast mode (Fm) 400 kbit/s
When I initialise two PWM pins on ESP32 using micropython I found the two pins are always on the same PWM frequency.
motorPin1 = machine.PWM(Pin(21, mode=Pin.OUT))
motorPin1.duty(512)
motorPin1.freq(10)
motorPin2 = machine.PWM(Pin(22, mode=Pin.OUT))
motorPin2.duty(300)
motorPin2.freq(200)
In the above example, both motorPin1 & motorPin2 end up on the same frequency. Also if the frequency on one pin is updated, it will also update the frequency on the other (to the same frequency). Duty cycle can be controlled separately but not frequency.
I eventually found ESP32 has pwm 'channels' which are driven/timed in pairs. So for example, if you have two PWM pins assigned to channels 0 & 1, they will always run at the same frequency.
The micropython PWM interface doesn't expose the PWM channel assigned to a pin.
How do people setup PWM pins in micropython with the appropriate PWM channels to allow separate control of the frequency?
Unfortunately this hardware functionality is not currently available in MicroPython - there is an open PR to add this: https://github.com/micropython/micropython/pull/3608
You could look into bit-banging or utilising timers if your needs are more basic, otherwise you could provide support for getting the PR merged!
I want to use hdmi monitor with cyclone V GX board, but I don't get an acknowledgement from adv7513 on i2c bus.
I think there is a problem with the address that I am sending at the beginning of the i2c transaction (I get no acknowledgement of address) I couldn't find information on whether PD/AD is low or high. Also I am not sure if i should use 7 or 8 bit address, so I would like some explanation.
I used i2c controller that i found online:
https://www.digikey.com/eewiki/pages/viewpage.action?pageId=10125324
signaltap result
I assume you haven't read the ADV7513 Programming Guide
The ADV7513 uses four I2C register maps. The SDA/SCL programming
address for the Main Register Map is 0x72 or 0x7A, based on whether
PD/AD is pulled high (10KΩ resistor to power supply = 0x7A) or pulled
low (10KΩ resistor to GND = 0x72) when power is applied to the
supplies. The user should wait 200ms for the address to be decided,
after the power supplies are high, before attempting to communicate
with the ADV7513 using I2C
I2C addresses are 7-bit or 10-bit not 8-bit. In this case it is 7-bit.
See I2C Specification. So if PD/AD is high, 7-bit address is 0x7A. In binary your 7 bits will be: 1111010. The R/W bit is the last bit of the first I2C 'address' byte but the vhd code you posted doesn't need that as part of the address, that's done separately.
addr : IN STD_LOGIC_VECTOR(6 DOWNTO 0); --address of target slave
rw : IN STD_LOGIC; --'0' is write, '1' is read
If you are still having problems, check your pull-ups, I2C SCL clock rate, ensure the master allows clock stretching. The VHDL code you posted has quite a lot of information about how to use so re-read that.
Alternatively take to question to Electrical Engineering Stack Exchange and take some oscilloscope readings of SDA/SCL.
I would like use battery backup SRAM in STM32F4 MCU. Is there some way how detect disconnected/removed battery after connecting VDD voltage (after reset)?
Yes, I can save CRC of backup SRAM in RTC backup registers, but I would like get information from some MCU register.
Thank you for your answer
Vbat is connected internally to the channel 18 of the ADC. You just need to enable the bit VBATE in the CCR ADC register and convert. This channel has internal divider and the read value is 1/4 of the actual one.