Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does changing RP2040 clock speed change file read/write times? #91

Closed
nateinaction opened this issue Jan 10, 2025 · 7 comments
Closed
Labels
good first issue Good for newcomers

Comments

@nateinaction
Copy link
Member

Summary

It takes about 170 seconds to load the flight software onto the board with make install. Can it be done faster? We reduce the CPU clock speed on the satellite as a power saving feature, let's see what kind of impact it has on development speed.

Suggested testing methodology

  1. Delete all files from the board
  2. Use screen to drop into the repl on the board:
screen /dev/tty.usbmodem101
  1. Set the clock speed high
machine.set_clock(125000000)  # 125Mhz
  1. From your computer, test read/write speed
# cd to the board mount
cd /Volumes/PYSQUARED
# Test board write speed
dd if=/dev/zero of=./test bs=5k count=10 oflag=direct
  1. Set clock speed low
machine.set_clock(62500000)  # 62.5Mhz
  1. From your computer, test read/write speed
# cd to the board mount
cd /Volumes/PYSQUARED
# Test board write speed
dd if=./test of=/dev/zero bs=5k count=10 oflag=direct
  1. Post the results in the issue

Board mount location may differ. You can find out how to find the volume in the README.md.

@nateinaction nateinaction added the good first issue Good for newcomers label Jan 10, 2025
@yudataguy
Copy link
Collaborator

Based on my tesst:

samyu@MP3 PYSQUARED % dd if=/dev/zero of=./test bs=5k count=10 oflag=direct
10+0 records in
10+0 records out
51200 bytes transferred in 7.449752 secs (6873 bytes/sec)
samyu@MP3 PYSQUARED % dd if=/dev/zero of=./test bs=5k count=10 oflag=direct
10+0 records in
10+0 records out
51200 bytes transferred in 7.902248 secs (6479 bytes/sec)
>>> import microcontroller
>>> microcontroller.cpu.frequency = 125000000
>>> print(microcontroller.cpu.frequency)
125000000
>>> microcontroller.cpu.frequency = 62500000

Looks like there's no difference in read/write speed based on cpu clock speed

@Mikefly123
Copy link
Member

@yudataguy I think based on my read of that console output there is a very minor reduction in read/write speeds when we drop the clock speed? Only a difference of 349 bytes/s which isn't too much, but maybe you'd still feel it as a couple seconds over the course of a few megabytes?

@yudataguy
Copy link
Collaborator

Only a difference of 349 bytes/s which isn't too much, but maybe you'd still feel it as a couple seconds over the course of a few megabytes?

Depends on how you reading it. By the number itself, the decrease is minimum. If you 7.90 7.44 7.90 0.06  or  6 %, which represent a rather significant reduction. Of course we are not considering the power consumption in regard to clock speed.

We need more tests

@Mikefly123
Copy link
Member

I think that power consumption is not really a big concern when we are just copying files over on the ground. I figure a good amendment to the code would be to default the clock speed to the standard 125Mhz when it is on the ground and only change it down to the 62.5Mhz when we are going for flight and looking to save power.

Perhaps an amendment to pysquared.py along the lines of this:

if seld.debug:
    self.turbo=True
else:
    self.turbo=False

@yudataguy
Copy link
Collaborator

@Mikefly123 got another idea. Using altimeter and temperature sensor (if available on board), under certain condition, the lower clock speed is automatically activated.

@Mikefly123
Copy link
Member

Hey @nateinaction do you think we should just update pysquared.py to just use the default clock speed of 125Mhz? It seems like there is a marginal improvement in the file copy times if we do this.

Trying to close some of the stale issues haha

@nateinaction
Copy link
Member Author

If it's only a marginal improvement, let's keep it in "flight mode." Going to close. Feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants