Rinse and sort beans, soak overnight in a large pot of water. Next morning, drain soak water and rinse beans. Add six cups of fresh water, the chopped onion, garlic, pepper, and ham or ham hock.
Simmer beans with lid tilted on pot for about 3 hours until tender, then add salt. (I always salt dried beans after they are done. They take longer to cook if you salt them during the cooking process.)
If using a ham hock, remove it from pot and take the ham from the bone and add back to the beans. Serve over rice. These beans can be cooked in the crock pot as well. Cook on high for 4 hours or low about seven hours until tender.