Git Product home page Git Product logo

Comments (8)

mvwieringen avatar mvwieringen commented on August 25, 2024

Is this still a problem in the fbuf branch version ?

I'm trying to set the pwm for the POE hat.

That is register 0x00030049 for the GET and 0x00030050 for the set.
The buffer seems to be 3 bytes according to the Linux kernel driver. The GET somewhat works
but the SET is barking that the mailbox send failed.

I'm doing the following in python:

+            ioctlData = bytearray(struct.pack('<IIIIIII',
+                                              RPIQ_SHORT_BUFFER_LEN,
+                                              RPIQ_SET_REQ,
+                                              RPIQ_MBOX_TAG_SET_POE_HAT,
+                                              RPIQ_MBOX_SET_POE_HAT_LEN,
+                                              reg, value, 0))

the RPIQ_SHORT_BUFFER_LEN is set to 24

from thpimon.

thebel1 avatar thebel1 commented on August 25, 2024

The fbuf branch in fact does support variable-sized buffers, since I needed them to implement the framebuffer mailbox interface. The buffer is allocated based on the number of bytes supplied in the buffer len field (as you have done): https://github.com/thebel1/thpimon/blob/fbuf/pimon_charDev.c#L447

Having said that, the mailbox interface is not for interacting with memory-mapped registers, but rather with the VideoCore GPU via a mailbox interface. The struct you're building in Python is the mailbox buffer you're sending to the VideoCore. See the following for a list of supported mailbox properties: https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface . Currently, only channel 8 is supported.

I hope that helps.

from thpimon.

mvwieringen avatar mvwieringen commented on August 25, 2024

I said register but essentially those are the mailbox properties but it seems the wiki doesn't mention these higher ones e.g. it ends at 0x00030020 and then goes on with 0x00040001

from thpimon.

thebel1 avatar thebel1 commented on August 25, 2024

In that case, it should work. Can you paste the code around the snippet you sent earlier and the tail of the /var/log/vmkernel.log after running your script please. I'll need to have a look at the logging.

from thpimon.

mvwieringen avatar mvwieringen commented on August 25, 2024

0001-Add-test-version-of-setting-pwm-for-POE-hat.txt

attached the current quick hack. The log looks like the following:

2020-12-01T12:01:36.118Z cpu3:133881)thpimon: pimon_charDevOpen:351: opened file; priv 0x4304d9001340 lock 0x4304d90013c0
2020-12-01T12:01:36.118Z cpu3:133881)WARNING: thpimon: pimon_charDevIoctl:455: failed to allocate memory for ioctl data: Out of memory
2020-12-01T12:01:36.118Z cpu3:133881)thpimon: pimon_charDevIoctl:462: copying ioctl data from 0x36509f31f70 (UW) to 0x4304d9001370 (vmk)
2020-12-01T12:01:36.118Z cpu3:133881)thpimon: pimon_charDevIoctl:480: executing ioctl cmd 8 with data 0x36509f31f70
2020-12-01T12:01:36.118Z cpu3:133881)WARNING: thpimon: rpiq_mboxSend:359: transaction error: 0x80000001
2020-12-01T12:01:36.118Z cpu3:133881)thpimon: pimon_charDevIoctl:462: copying ioctl data from 0x36509f31f70 (UW) to 0x4304d9001370 (vmk)
2020-12-01T12:01:36.118Z cpu3:133881)thpimon: pimon_charDevIoctl:480: executing ioctl cmd 8 with data 0x36509f31f70
2020-12-01T12:01:36.118Z cpu3:133881)WARNING: thpimon: rpiq_mboxSend:359: transaction error: 0x80000001
2020-12-01T12:01:36.119Z cpu3:133881)thpimon: pimon_charDevFileDestroy:726: destroying file 0x4304d9001340

e.g. that was running the pimon_setpwm.py script. So it seems that it gets send but the mailbox responds with an error.

For now I soldered some wires to the 5v and GND pin and plugged the POE HAT fan onto that and then it runs and keeps
things cool but eventually it would be nice to be able to write some python scripting that reads out the temp and sets the pwm.

from thpimon.

thebel1 avatar thebel1 commented on August 25, 2024

Yeah, we're going to need some additional data here, to get the contents of the buffer before it gets sent. If dynamic VProbes were available on Arm this would be easy. Hopefully, they'll be supported soon.

Can you send me the entirety of your script plus the pimon library's init.py file? I'd like to repro this on my Pi.

from thpimon.

mvwieringen avatar mvwieringen commented on August 25, 2024

I already attached the patch to my previous message which you can just apply and that will give you the extra code and the two scripts. I can also attach that again if that helps.

from thpimon.

mvwieringen avatar mvwieringen commented on August 25, 2024

init.txt
pimon_getpwm.txt
pimon_setpwm.txt

The python files renamed to .txt extension instead of .py

from thpimon.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.