Abstract-Most previous work on code division multiple access (CDMA) considers the bit error ratio (BER) at the physical layer and the frame drop ratio (FDR) at the medium access control layer separately. However, a better system performance, e.g., in terms of a lower overall frame loss ratio (FLR), can be achieved if BER and FDR are jointly optimized. In this paper, we propose a cross-layer optimization scheme called traffic-adaptive scheme for multicode CDMA operating over a time division multiple access (TDMA) channel. Based on the traffic condition and buffer status, this scheme employs a Markov Decision Process (MDP) to determine the optimal value of the maximum number of simultaneous data frames that can be transmitted in each time slot of a TDMA frame so as to minimize the overall FLR of the system. To facilitate implementation, we also propose an approximation scheme named the rateadaptive scheme to reduce the computation cost. Simulation and analytical results show that both the traffic-adaptive scheme and rate-adaptive scheme can significantly reduce FLR, increase the system throughput, and optimize the packet access delay of the system. Furthermore, the rate-adaptive scheme can achieve a performance close to the traffic-adaptive scheme when the traffic load in the system is high.