{"id":30835507,"url":"https://github.com/ams-osram/tmf8829_driver_linux","last_synced_at":"2026-02-12T02:40:15.384Z","repository":{"id":310863789,"uuid":"1039942465","full_name":"ams-OSRAM/tmf8829_driver_linux","owner":"ams-OSRAM","description":"TMF8829 Linux driver","archived":false,"fork":false,"pushed_at":"2025-11-17T11:38:47.000Z","size":539,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-17T12:07:23.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ams-OSRAM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-18T08:11:00.000Z","updated_at":"2025-11-17T10:03:45.000Z","dependencies_parsed_at":"2025-08-20T18:42:16.566Z","dependency_job_id":"ec5479d6-ed41-4bc4-bbf9-7201ae6314c6","html_url":"https://github.com/ams-OSRAM/tmf8829_driver_linux","commit_stats":null,"previous_names":["ams-osram/tmf8829_driver_linux"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ams-OSRAM/tmf8829_driver_linux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ams-OSRAM%2Ftmf8829_driver_linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ams-OSRAM%2Ftmf8829_driver_linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ams-OSRAM%2Ftmf8829_driver_linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ams-OSRAM%2Ftmf8829_driver_linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ams-OSRAM","download_url":"https://codeload.github.com/ams-OSRAM/tmf8829_driver_linux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ams-OSRAM%2Ftmf8829_driver_linux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29355259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-06T17:10:11.867Z","updated_at":"2026-02-12T02:40:15.379Z","avatar_url":"https://github.com/ams-OSRAM.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TMF8829 Linux Reference Driver README.md\r\n\r\n## Description\r\n\r\nThis file describes the installation of the tmf8829 linux reference driver, and how to use it.\r\n\r\n### Compilation\r\n\r\nThe compilation was done with the ams-Osram provided image bookworm_4v0.\r\nLinux version 6.1.73-ams #1 Mon Apr 22 19:32:02 BST 2024 2024 armv6l\r\n\r\n## Files\r\n    \r\nOverlay Files\r\nThe device tree overlay files for the tmf8829 prototyped on the Raspberry Pi zero.\r\n    - tmf8829-overlay-fpc.dts\r\n        evm configuration with flex printed circuit, EN gpio and INT gpio, I2C\r\n    - tmf8829-overlay-fpc-polled.dts\r\n        evm configuration with flex printed circuit, EN gpio and INT register polled, I2C\r\n    - tmf8829-overlay-fpc-spi.dts\r\n        evm configuration with flex printed circuit, EN gpio and INT gpio, SPI\r\n    - tmf8829-overlay-fpc-spi-polled.dts\r\n        evm configuration with flex printed circuit, EN gpio and INT register polled, SPI\r\n\r\nModule File\r\n    - tmf8829.ko\r\n\r\nams Raspberry USB Sensorbridge\r\n    - ams-usb-sensorbridge.service\r\n\r\nTMF8829 Application Hex file\r\n    if an application patch file is required\r\n    - tmf8829_application.hex\r\n\r\n## Installation \r\n\r\nConfiguration of Raspberry Pi zero:\r\n1. Use the right image\r\n\r\n   bookworm_4v0 (provided by ams-Osram)\r\n\r\n2. connect to Raspberry Pi\r\n\r\n   (e.g. using a windows powershell)\r\n\r\n    ssh ams@169.254.0.2\r\n    Pw: ams\r\n\t\r\n3. copy the right files on the Raspberry Pi /home/ams directory\r\n\r\n   (this could be done with WinScp or with a shell and scp)\r\n   \r\n   - Module tmf8829.ko\r\n   \r\n   - Install script\r\n     - tmf8829_install_i2c.sh for i2c communication\r\n     \u003cbr\u003eor\r\n     - tmf8829_install_spi.sh for spi communication\r\n     \u003cbr\u003efor the polling int version\r\n     - tmf8829_install_i2c_polled_int.sh for i2c communication\r\n     \u003cbr\u003eor\r\n     - tmf8829_install_spi_polled_int.sh for spi communication\r\n     \r\n   - Overlay file\r\n     - tmf8829-overlay-fpc.dtbo for i2c communication \r\n     - tmf8829-overlay-fpc-spi.dtbo for spi communication\r\n     - tmf8829-overlay-fpc-polled.dtbo for i2c communication and int register polling\r\n     - tmf8829-overlay-fpc-spi-polled.dtbo for spi communication and int register polling\r\n\r\n   - Hex File ( if required )\r\n\r\n   - ams-usb-sensorbridge.service\r\n\r\n   - tmf8829_zmq_server.service\r\n   \r\n4. - chmod 777 tmf8829_install_i2c.sh\r\n   \u003cbr\u003eor\r\n   - chmod 777 tmf8829_install_spi.sh\r\n   \u003cbr\u003efor the polling int version\r\n   - chmod 777 tmf8829_install_i2c_polled_int.sh\r\n   \u003cbr\u003eor\r\n   -chmod 777 tmf8829_install_spi_polled_int.sh\r\n   \r\n5. sudo su (Super User mode)\r\n   \r\n6. - ./tmf8829_install_i2c.sh\r\n   \u003cbr\u003eor\r\n   - ./tmf8829_install_spi.sh\r\n   \u003cbr\u003efor the polling int version\r\n   - ./tmf8829_install_i2c_polled_int.sh\r\n   \u003cbr\u003eor\r\n   - ./tmf8829_install_spi_polled_int.sh\r\n\r\n7. Optional:\u003cbr\u003e If the python zmq server sources will be installed\r\n   and the server should be started at boot time, enable the zmq service.\r\n      \r\n   - systemctl enable tmf8829_zmq_server.service\r\n\r\n8. sync\r\n\r\n9. reboot (reboot system)\r\n\r\n## General commands on the Raspberry Pi\r\n\r\n1. Connect to Raspberry Pi\r\n\r\n    - ssh ams@169.254.0.2\r\n    - Pw: ams\r\n\r\n2. See pinout on Raspberry Pi\r\n\r\n    - pinout\r\n\r\n3. CPU information\r\n\r\n    - cat /proc/cpuinfo\r\n    \r\n    Additional information\r\n    - lscpu\r\n\r\n    Number of cores\r\n\r\n    - cat /proc/cpuinfo | grep processor | wc -l\r\n\r\n4. Debug messages\r\n\r\n    - list: dmesg\r\n    - list and clear: sudo dmesg -c\r\n   \r\n5. Change Raspberry I2C frequency\r\n\r\n    - in file: /boot/firmware/config.txt\r\n    - reboot\r\n\r\n6. Module Functions\r\n\r\n    - list all modules: lsmod\r\n    - insert module:    sudo insmod tmf8829.ko\r\n    - remove module:    sudo rmmod tmf8829.ko\r\n    - module info :     modinfo tmf8829.ko\r\n\r\n7. See running tmf8829 thread for interrupt handling\r\n\r\n    - ps -ef\r\n\r\n8. Makefile command for TMF8829\r\n\r\n    - make CONFIG_SENSORS_TMF8829=m\r\n\r\n9. The overlay file could be changed\r\n\r\n    - copy overlay file to boot directory\r\n    \r\n    - if overlay files are generated\r\n\r\n        - cp /home/ams/arch/arm/boot/dts/tmf8829-overlay-fpc.dtbo /boot/overlays\r\n        - cp /home/ams/arch/arm/boot/dts/tmf8829-overlay-fpc_polled.dtbo /boot/overlays\r\n        - cp /home/ams/arch/arm/boot/dts/tmf8829-overlay-fpc-spi.dtbo /boot/overlays\r\n        - cp /home/ams/arch/arm/boot/dts/tmf8829-overlay-fpc-spi-polled.dtbo /boot/overlays\r\n\r\n    - in /boot/config.txt add the desired overlay file:\r\n\r\n        - dtoverlay=tmf8829-overlay-fpc\r\n        - dtoverlay=tmf8829-overlay-fpc-polled\r\n        - dtoverlay=tmf8829-overlay-fpc-spi\r\n        - dtoverlay=tmf8829-overlay-fpc-spi-polled\r\n\r\n    - echo \"dtoverlay=tmf8829-overlay\" \u003e\u003e /boot/firmware/config.txt\r\n   \r\n10. Change and see log level\r\n     \r\n    - echo \u003clevel\u003e \u003e /proc/sys/kernel/printk\r\n    - cat /proc/sys/kernel/printk\r\n\r\n11. See temperature and cpu frequency\r\n\r\n    - vcgencmd measure_temp\r\n    - vcgencmd measure_clock arm\r\n\r\n12. Change raspberry configuration\r\n\r\n    - sudo raspi-config\r\n\r\n13. see the running services\r\n\r\n    - systemctl\r\n14. start / stop the running tmf8829 zmq service\r\n\r\n    - systemctl start tmf8829_zmq_server.service\r\n    - systemctl stop tmf8829_zmq_server.service\r\n\r\n## General Raspberry Information\r\n\r\nInformation for Broadcom BCM2835 GPIO (and pinmux) controller\r\n\r\nhttps://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt\r\n\r\nRaspberry pi Documentation\r\n\r\nhttps://www.raspberrypi.com/documentation/computers/raspberry-pi.html\r\n\r\n\r\n## System File System\r\n\r\n- I2C Bus 0 (fpc): /sys/class/i2c-adapter/i2c-0/0-0041/\r\n\r\n### Common Attributes (tmf8829_common)\r\n\r\nThis section describes the common attributes with examples.\r\n\r\n1. chip_enable (R/W)\r\n    \r\n    - See chip enabled status: cat chip_enable\r\n    - Enable the device with the application including patch download: echo 0x01 \u003e chip_enable\r\n    - Disable the device:                       echo 0x00 \u003e chip_enable\r\n    - Enable the device in bootloader mode   :  echo 0x80 \u003e chip_enable\r\n    - Enable the device with ROM application :  echo 0x02 \u003e chip_enable\r\n\r\n2. driver_debug (R/W)\r\n      \r\n    - Debugging statement for driver\r\n        - 0x00 ... no logging\r\n        - 0x01 ... only error logging\r\n        - 0x08 ... this is a bit-mask check for clock correction logging\r\n        - 0x10 ... some information\r\n        - 0x20 ... very chatty firmware\r\n        - 0x80 ... this is a bit-mask check for i2c logging\r\n        - 0xFF ... dump everything\r\n\r\n    - Show debug state:  cat driver_debug (default 0x1)\r\n\r\n    - Enable debugging:  echo 0x10 \u003e driver_debug\r\n    - Disable debugging: echo 0x00 \u003e driver_debug\r\n\r\n3. program (R)\r\n    - Version: \r\n        - 0x80 ... Bootloader\r\n        - 0x01 ... Application\r\n\r\n    - See running program: cat program\r\n    \r\n4. program_version (R)\r\n    \r\n    - See program, major/minor/patch version, chip id and chip revision:\r\n    cat program_version\r\n      \r\n5. registers (R)\r\n    \r\n    - Dump Registers 0x00-0xFF: cat registers\r\n       \r\n6. register_write (W)\r\n    \r\n    - example stop measurement:  echo \"0x08:0xFF\" \u003e register_write\r\n    - example irq enabling:      echo \"0xe2:0x01\" \u003e register_write\r\n                  \r\n7. request_ram_patch (W)\r\n\r\n    The firmware tmf8829_application.hex located in /usr/lib/firmware will be downloaded.\r\n    Only possible if the device is in bootloader mode.\r\n\r\n    - Download Firmware patch: echo 1 \u003e request_ram_patch\r\n\r\n8. serial_number (R)\r\n\r\n    - Show serial number cat serial_number\r\n\r\n### Application Attributes (tmf8829_app)\r\n\r\nThis section describes the application attributes with examples.\r\nThe configuration parameters are described in the Config Page tmf8829_config_page.\r\nThe application registers are described in tmf8829_application registers.\r\nSee also Datasheet.\r\n\r\nAttributes:\r\n\r\n1. start_measurement (R/W)\r\n\r\n    - Show cyclic measurement is running:  cat start_measurement\r\n         0 ... not running\r\n         1 ... cyclic measurement running\r\n         Note: not for single shoot measurements (period = 0)\r\n    - Stop measurement:  echo 0 \u003e start_measurement\r\n    - Start measurement: echo 1 \u003e start_measurement\r\n\r\n2. config_custom (R/W)\r\n    \r\n    Do not use !!!\r\n    Read/Write all configuration parameters from/to the device as bytestream (hex).\r\n\r\n    - Show configuration (hex): cat config_custom\r\n    - Set configuration (hex): echo ... \u003e config_custom\r\n\r\n3. period (R/W)\r\n        \r\n    - Show measurement period in ms (dec):  cat period\r\n    - Set measurement period in ms(dec):    echo 33 \u003e period\r\n\r\n4. iterations (R/W)\r\n  \r\n    - Show measurement kilo iterations (dec): cat iterations\r\n    - Set measurement kilo iterations (dec):  echo 500 \u003e iterations\r\n    \r\n5. fp_mode (R/W)\r\n    \r\n    Should not be used !!!\r\n    The config_mode attribute should be used!!!\r\n\r\n    - Show the focal plane mode (dec): cat fp_mode\r\n    - Set the focal plane mode (dec):  echo 2 \u003e fp_mode\r\n\r\n6. result_format (R/W)\r\n\r\n    See description of register 0x2A TMF8829_CFG_RESULT_FORMAT.\r\n\r\n    - Show the value of the register TMF8829_CFG_RESULT_FORMAT (dec): cat result_format\r\n    - Set the value of the register TMF8829_CFG_RESULT_FORMAT (dec):  echo 1 \u003e result_format\r\n\r\n7. histograms (R/W)\r\n\r\n    See description of register 0x2B TMF8829_CFG_DUMP_HISTOGRAMS.\r\n\r\n    - Show histograms setting of the device (dec): cat histograms\r\n    - Set histograms to 1 for dumping of histogram frames (dec): echo 1 \u003e histograms\r\n    - Set histograms to 0 for disabling the dumping of histogram frames(dec): echo 0 \u003e histograms\r\n\r\n8. config_mode (W)\r\n\r\n    Command to pre-configure the device.\r\n\r\n    - Set the configuration mode (hex):  echo 0x40 \u003e config_mode\r\n    \r\n    - Options:\r\n        - 0x40 ... CMD_LOAD_CFG_8X8\r\n        - 0x41 ... CMD_LOAD_CFG_8X8_LONG_RANGE\r\n        - 0x42 ... CMD_LOAD_CFG_8X8_HIGH_ACCURACY\r\n        - 0x43 ... CMD_LOAD_CFG_16X16\r\n        - 0x44 ... CMD_LOAD_CFG_16X16_HIGH_ACCURACY\r\n        - 0x45 ... CMD_LOAD_CFG_32X32\r\n        - 0x46 ... CMD_LOAD_CFG_32X32_HIGH_ACCURACY\r\n        - 0x47 ... CMD_LOAD_CFG_48X32\r\n        - 0x48 ... CMD_LOAD_CFG_48X32_HIGH_ACCURACY\r\n\r\n9. clk_correction (W)\r\n\r\n    Command to activate / deactivate the clock correction for distance data. (default activated)\r\n\r\n    - Activate (dec):    echo 1 \u003e clk_correction\r\n    - Deactivate (dec):  echo 0 \u003e clk_correction\r\n\r\n10. app_tof_output (R)\r\n\r\n    Reading of frames with a size greater then 4096 (PAGE SIZE of linux driver) like histogram frames are not supported.\r\n    The misc driver needs to be used.\r\n    Note: The output buffer is a fifo buffer with 64k (PAGE_SIZE * 16).\r\n\r\n    Every data frame has 4 four byte header.\r\n      Byte[0] = FrameID\r\n      Byte[1] = frameNumber (free-running number, increments with each frame)\r\n      Byte[2] = clk_corr_LSB\r\n      Byte[3] = clk_corr_MSB\r\n      Byte[4] = reserved_0 (0x77)\r\n      Byte[5] = reserved_1 (0x77)\r\n      Byte[6] = payload_size_LSB\r\n      Byte[7] = payload_size_MSB\r\n\r\n    - FrameID:\r\n        - TMF8829_COM_RESULT__measurement_res_frame  0xAA /**\u003c measurement result frame */\r\n        - TMF8829_COM_RESULT__measurement_hist_frame 0xBB /**\u003c measurement histogram frame */\r\n        - TMF8829_COM_RESULT__measurement_header      0xFD /**\u003c measurement frame header only; for debug only should never occur in result frame */\r\n        - TMF8829_COM_RESULT__error_frame            0xFE /**\u003c error frame */\r\n        - TMF8829_COM_RESULT__no_frame               0xFF /**\u003c no frame / unhandled interrupt */\r\n    -  The clock correction factor is only available for result frames in Q1.15 numbering format.\r\n       \r\n       d = ( driver-\u003eclkCorrRatioUQ * d + (1\u003c\u003c14) ) \u003e\u003e 15;\r\n       \r\n    Result Data from I2C readout starting from register 0xFA. For content see datasheet.\r\n        \r\n    - Output data (binary) could be read: cat app_tof_output\r\n\r\n## Misc Device Driver\r\n\r\nThe Misc device driver which is a simple character driver is used to read the measurement frames.\r\nSee ***Application Attributes app_tof_output*** .\r\n    \r\n- Get the measurement data: cat /dev/tof_tmf8829\r\n\r\n## Python File \r\n\r\nAfter installation, the python folder /home/ams/tmf8829_zeromq_server_linux contains the python files for interacting with the driver.\r\n\r\nAll TMF8829 EVMs provide python sources with example files and zmq based scripts. \r\nThe zmq-server interacts with the driver and over tcp-ports with the zmq-client.\r\n\r\n### File Description \r\n\r\nSee readme.md in /home/ams/tmf8829_zeromq_server_linux which has a file description for released python sources Linux driver EVM and Shield Board EVM. \r\n\r\n### Installation\r\n\r\n1. Copy tmf8829_zeromq_server_linux.zip  on the Raspberry Pi /home/ams directory.\r\n2. Unpack the tmf8829_zeromq_server_linux.zip file.\r\n   - unzip tmf8829_zeromq_server_linux.zip -d tmf8829_zeromq_server_linux\r\n\r\n### Example Files\r\n\r\nThe example file measurement.py could be used for a normal measurement.\r\nModifications could be done in the area \"User Settings\".\r\n\r\n ```bash\r\n python ./tmf8829_zeromq_server_linux/measurement.py\r\n ```\r\n\r\n### zeromq Server\r\n\r\nThe zeromq Server is used to connect to the linux driver over tcp ports.\r\n\r\n ```bash\r\n python ./tmf8829_zeromq_server_linux.py\r\n ```\r\n\r\n\r\n- See Raspberry connected with powershell:\r\n\r\n    - Command ipconfig shows the IP\r\n\r\n    - Command ss -tulw shows tcp ports\r\n\r\n        | Netid | State | Recv-Q | Send-Q | Local Address:Port | Peer Address:Port | Process |\r\n        ------- | ----- | -------| -------| -------------------| ------------------| --------|\r\n         tcp    |LISTEN |  0     |    100 |  169.254.0.2:5557  |         0.0.0.0:* |         | \r\n         tcp    |LISTEN |  0     |    100 |  169.254.0.2:5558  |         0.0.0.0:* |         | \r\n         tcp    |LISTEN |  0     |    128 |      0.0.0.0:ssh   |         0.0.0.0:* |         | \r\n\r\n### zeromq Client\r\n\r\nThe logger description README.md in the folder /home/ams/tmf8829_zeromq_server_linux/client_info describes the usage of the logger and the output format. The zeromq client script could be used directly on the raspberry pi instead of the windows pc exe.\r\n\r\n ```bash\r\n python ./tmf8829_zeromq_client.py\r\n ```\r\n\r\n\r\n### GUI\r\n\r\nThe TMF8829 EVM GUI could be used to see the results on a pc.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fams-osram%2Ftmf8829_driver_linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fams-osram%2Ftmf8829_driver_linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fams-osram%2Ftmf8829_driver_linux/lists"}