Howto measure BUS rise time + variable pullup resistor

  1. Avoid the voltage divider entirely, use the microcontroller's Vcc as the test voltage. Simpler, better. I'd also worry that 9V might damage devices on the bus. If all the devices are not connected to the bus, their input capacitance is not being measured, and this might be a source of significant error.

  2. You are measuring the capacitance of the bus, and there are several ways to do this, specifically you don't need a variable resistor to do this - its a complication that's not needed (its also a problem in that you have to measure its value somehow).

You might use charge injection and measure the voltage step produced - this can be done with a fixed resistor (or a small set of selectable fixed resistors) and variable pulse time - the pulse time is something the code has control of and won't need to measure separately. The simple equation is delta-V = Q/C, where Q is the charge injected