The advent of humanoid robots has posed new challenges and opportunities to control complex movements; their bodies have an high number of degrees of freedom, and methods used up to now to control them are no longer efficient. The purpose of this work is to create a system that could approach these challenges. We present a bioinspired model of the cortex-basal ganglia circuit for movement generation. Our model is able to learn and control movements starting from a set of motor primitives. Experiments on the NAO robot show that the system can be a good starting point for a more complex motor system to be integrated in a bioinspired cognitive architecture.