I'm setting up i2c for an Application written in C, but I've not been able to find any how-to's for it. I'm running a model-b Raspberry Pi on Debian 6 with LXDE. Can anybody show me how to set up i2c so I can use it in a C Application?
Thanks for any help in advance
I've been looking for similar information and I found a couple of i2c tutorials, one in adafruit tutorials and the other in Guy Carpenter's Gaugette blog. I'm not yet at the stage of actually using it so I can't vouch for their completeness but they seem to be a good start.
Configuring Your Pi for I2C
Analog Gauges Using I²C on the Raspberry Pi
I2C Installation for Raspberry Pi. I think this is only necessary if not using AdaFruit's Occidentalis release which has it included.
try this :
C GPIO Interface library for the Raspberry Pi
It offers API for handling GPIO port on Raspberry, including dedicated functions for I2C interface. I've been using this to read measurements from temperature sensor and it works perfect (STCN75 connected to RPi rev. B).
You can find examples and instructions on author's website. Project is maintained and updated frequently on public Git repo.
Related
I want to reprogram the external flash of a raspberry Pico via SWD line.
This feature must be implemented in a different microcontroller, not from a Linux computer so the OpenOCD library cannot be used.
I already wrote a C library that is able to read and write in RAM and in core registers via SWD and I'm able to put the Cortex-M0+ into halt state.
I read many tutorials and documentation and those that are useful are:
http://markding.github.io/swd_programing_sram/
https://www.silabs.com/documents/public/application-notes/an0062.pdf
https://community.silabs.com/s/article/how-to-program-internal-sram-over-swd?language=en_US
but unfortunately they aren't clear enough.
Can you explain the sequence of commands that I should send to RP2040 to correctly upload the new firmware?
Thanks for your help!
Is there anyone who has worked on STM32L1 series. I'm working on STM32L1xx series and wanted to write USB driver for it. Is there any example for USB driver for STM32L series or anyone worked on STM32L1xx series? Any help will be appreciated.
Thanks in advance.
You need these works to do:
1.USB client driver on STM32. There are lots of available codes in github or other website;
2.SDcard driver. Normally SDCard has two modes, include SPI mode and SD mode, the operation will be simplified a lot in SPI mode, however, in SD mode the speed will more faster than SPI mode. you can refer to datasheet for more information.
Download STM32CubeMX
Download STM32CubeL1
Start new project for your device, choose peripheral, choose device class for MSC
Setup clock for USB
Export project
Configure SPI for your SDCARD (SDIO is not available) for interface between USB device stack and SDCARD sector read on PC demand.
This are key steps to do, as I don't know what you know so far (looks like nothing) and what you have learn yourself so far (looks like nothing) I'm unable to give you comprehensive answer.
I have got Arduino MEGA 2560. What I would like to do is to send a signal to Arduino via serial port to light specified LED up. However, I cannot find any documentation about this. What steps should I follow?
I think first, I need to compile the driver of Arduino and add it to Linux kernel. Second, I have to find some header files to use them in module. Then, I have to find functions to start serial communication and to light LEDs up. However, these are just my thoughts.
Any advice will be appreciated.
The arduino-mega (the one with ATmega2560) documentation is here:
https://www.arduino.cc/en/Main/ArduinoBoardMega2560#documentation
The serial communication via UART:
https://www.arduino.cc/en/Reference/SoftwareSerial
Since there are other ways for serial communication with the ATmega please read the documentation [above] and compare that to your exercise sheet.
I think such a kernel module is already available - and used by the arduino-ide.
I am taking Arduino Prototype code used for a DS3231 RTC and taking it to an embedded platform that does not directly support Arduino code (right now that is the Atmel Xplained Mini). Is there a way for me to create an equivalent program without writing an entire I2C protocol and the entire data communication from scratch? There must be an overlapping library/header/code block that I can adapt to my purpose.
As an example I am looking to make the code here work on the Atmel Xplained Board. The code should be pretty simple, what I need is for the DS3231 to tell the MCU the time when it asks for it. I can do the manipulation of the date/time myself, it is getting that information on a non-Arduino platform that is the road block for me.
Arduino has an existing wiring library that facilitates I2C communication, most professional development frameworks aren't quite so simple but are also more full-featured. I'm assuming you are using Atmel Studio, you'll want to look at the TWI (two-wire interface) documentation for doing I2C communication.
AVR315: Using the TWI Module as I2C Master
You can copy TWI_Master.c and TWI_Master.h to your project and use these for I2C communication. That is what I've typically done in the past.
The demo code that goes with this app note can be found here, main.c has an example of the usage of this I2C driver:
AVR315 Demo Code
I am a begineer in learning Device Driver.I am practising with simple example to learn device driver. Can anyone suggest me how to start writing uart ,GPIO device driver for raspberry pi,because i started practising with raspberry pi only.
Thanks in advance
Regards,
pradeep
If this is your very first driver, start with something simple. I would take the following steps:
Write a simple character device driver that implements read/write/open/close file ops. That means they can be used with 'cat' and 'echo'.
Based on the initial work from 1, you can write a GPIO driver. This should be simple because all you need to do is write or read a 0 or 1 from a specific memory address.
Now that you have some experience with device drivers you can write a tty driver for your uart. There are lots of examples of tty drivers in linux already.