Why sometimes I can set framerate sometimes I can't?
Note that camera has many different pixel_formats supported and they have different framerates specification. Check the pixel_format you used, it is likely that the default pixel_format does not support the framerate you want.