The problem of joint data detection and channel estimation for a code division multiple access system adopting aperiodic spreading codes is considered. Assuming that each transmitted data frame contains a short preamble of known symbols, a detection strategy is proposed that relies on an iterative exchange of information between the data detector and the channel estimator. This strategy, which is termed "multipass," is shown to be capable of alleviating, at the price of some attendant increase in the computational complexity (or, equivalently, in the detection delay), the performance degradation induced by the lack of prior knowledge about the channel state and the users' timing offsets. Both the mobile-to-base (uplink) and base-to-mobile (downlink) communication hauls are considered, and algorithms suited for each of these scenarios are proposed. Analytical findings and extensive computer simulations confirm that the proposed strategy achieves excellent results.