If using dried beans, soak them overnight in water, then drain and rinse before cooking.
Heat olive oil in a large pot over medium heat.
Add diced onion, sliced carrots, and chopped celery, cooking for 5 minutes until softened.
Add minced garlic and cook for an additional 30 seconds.
Add beans, diced ham or ham bone, chicken broth, bay leaf, thyme, and black pepper to the pot and stir well.
Bring the soup to a boil, then reduce heat to low and cover.
Simmer for 1½ to 2 hours if using dried beans, or 30 minutes if using canned beans, until beans are tender.
Remove the bay leaf and season with salt to taste.
To thicken the soup, mash a small portion of the beans directly in the pot.
Serve the soup hot with bread or crackers.