There are specially designed lenses for doing such a thing and they usually have the word "macro" somewhere in their name. The word macro generally means that the thing you are photographing will be the same size on the film or digital sensor as it is in real life. While anything can be photographed using a macro lens the lovely thing about a raspberry is that the whole thing is small enough to fit on a 35mm full frame sensor.
However there is a small problem with macro photography which is depth of field. It's a limitation based on the laws of physics. Depth of field is the same thing as depth of focus, and the law is that for any given lens the depth of focus gets smaller the closer you are to your subject. When you get close enough to a raspberry to photograph it at a macro scale the depth of focus is tiny. I mean really tiny. In the order of a millimetre. My raspberry was about 20mm across the top, so twenty times too big for a nice sharp photograph in one go.
Lenses do have a mechanism to increase the depth of focus called a diaphragm which changes the side of the hole letting the light through. The hole has a name which most people know as the aperture. The smaller the aperture the greater the depth of focus. "Ah ha!" I hear you say "Problem solved". But it's not quite the answer. Beyond a certain point the aperture starts to cause other problems as it gets smaller. Although depth of focus gets greater, the overall sharpness drops due to diffraction. Also, with less light getting through the smaller aperture the shutter also has to open for longer for a correct exposure so there is a risk of camera shake influencing the image. It's quite a fight to get the balance.
Thankfully there is an answer, and the answer is computers. Specifically, computers and image processing software. And it goes something like this.
I ended up with 20 photographs of my raspberry the first and last of which can be seen below.
The next steps took the 20 images and blended the sharpest parts of each one into a single final image using photoshop. There are automated blending methods in photoshop called focus stacking which made a great looking image. However when I zoomed in it became apparent the blending was a little blocky and missed some fine details when they were very close to other parts of the out of focus raspberry. The only way to fix it was spending a couple of hours manually blending the layers together. The results were worth it as you can see below. Keep scrolling down to see a 100% crop of the final image which shows just how hairy raspberries when getting really close.